distributed retail chain

Upload: azeemahmed85

Post on 07-Apr-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Distributed Retail Chain

    1/15

  • 8/6/2019 Distributed Retail Chain

    2/15

    The system basically keeps track of two types of information:

    merchandise and personnel. The stores are spread across

    zones/regions such that during situations where stock is less or

    high in quantity the system can make decision to transfer these

    items across stores. Also it is possible for Managers to add stores,zones and regions depending on their position in the hierarchy.

    Eventually the dynamic and distributed architecture and data

    collection helps in making decision such as adding new stores

    where demand is large .The queries and scope are explained in

    Design specifications.

    Design:

    1. There is a 4 level hierarchical structure where National manager

    lead regional manager, regional managers lead zonal manager and

    finally zonal managers lead store manager. Store managers head

    the store and cashiers report to the store manager

  • 8/6/2019 Distributed Retail Chain

    3/15

    2. The User interfaces are a simple login screen which will direct

    an employee to their role based web pages. We consider that a user

    is a cashier in the store and is the last person in contact with a

    customer and does the transaction on customers behalf. The other

    role is a manager (Store, zone, regional and national).

    3. Following are the list of queries and there scope of execution

    These have been modified and are different from the original

    specification given at

    http://www.cs.odu.edu/~mukka/cs795sum10.net/Project/projspec.p

    df

    Merchandize monitoring

    U1. Change price: Item ID, Price, date effective (sale price being

    changed)

    - When executed at a retail-store, price only at that store ischanged. If executed at higher levels, all retail-stores below

    that node will implement that operation. For example, if R1

    executes this command, then all retail stores under Z1 and Z2

    implement the change in price.

    U2. Add an item: Item ID, description, price. (A new item is to be

    added)

    -Only Store manager can add an item

    U3. Add to Inventory: Item ID, quantity (Items arrived from

    manufacturer)

  • 8/6/2019 Distributed Retail Chain

    4/15

    -We have implemented a logic where a store add from

    inventory only as the last resort when inter store transfer is not

    possible.

    U4. Sales: Item ID, quantity (A customer is purchasing)

    - Sales information is implemented only by store managerU5. Remove item: Item ID (Discontinue the item)

    - A store manager can remove a itemU6. Inter store-transfers: Item ID, quantity, from-store-ID, to-store-ID (Transfer stock from one store to another)

    - Regional manager sets a minimum stock of any item a storemust hold. If the stock is less the region manager can

    generate report identifying stores from where he can transfer

    stock. This check is done for stock available within the same

    region or from another zone within the region.

    - Inter store transfer between regions is not allowed as it doesnot help economically, the region can add from inventory as

    opposed to adding from another region to reduce cost of

    transportation

    U7. Query item: Item ID (Customer service wants to know

    information about the item)

    - A cashier can query for an item to know its availability andgeneral product information.

  • 8/6/2019 Distributed Retail Chain

    5/15

    Employee Monitoring System

    Q1. Add a new employee: Employee ID, SSN, name, sex (male or

    female), job title, and employment begin date, and current salary.

    - A store manager can add an employee, Also when a zonal

    manager adds a store he can add a store manager immediately after

    that, this applies to a regional manager after creating a zone and

    can add a zonal manager.

    Q2. Remove employee: Employee ID (Employee resigned or

    fired)

    - A store manager can remove an employee

    Q3. Display number of employees

    - Can be executed at all levels

    Q4. Total monthly payroll (Sum of monthly salaries of all

    employees)

    - Can be executed at all levelsQ5. Employee information: Employee ID (Given employee ID

    shows all information pertaining to that employee)

    - Can be executed at all levels

    4. There are distributed database servers where each store, zone

    and region keeps track of their sub level databases and also the

    national office acts as the last measure back up in case of failure of

    all servers.

  • 8/6/2019 Distributed Retail Chain

    6/15

    5. There are web services available for client applications at all

    nodes helping in various operations. (More details in

    implementation).

    Features:

    Since the coursework in development in .NET, we have used many

    of the .NET features

    Basic Features Regular Expression, date validation, calendar

    controls and range validation, XML based configuration files

    ADO.NET Datasets, Data Adapters and Data tables

    ASP.NET security Role base security for Forms authentication

    Web services Extensive use of webservices

    .NET Remoting This is a simple application which is not

    integrated into project but used for demo just to show the

    importance of remoting in intranet applications

    Crystal Reports Business objects crystal reports for generating

    reports for various queries pertaining to Employee monitoring and

    few merchandize monitoring such as sales and product information

    Implementation:

    This part of document describes the implementation based 4

    categories Security, Availability, Response time and dynamicnature of the system.

    Firstly we have created database at every node and each database

    has 3 tables mainly store_product_info, sales_table and

    employee_details. The same tables are used at all levels

  • 8/6/2019 Distributed Retail Chain

    7/15

  • 8/6/2019 Distributed Retail Chain

    8/15

    We used the Microsoft Visual Studio 2005 and SQL Server

    Developer Edition with Visual C# as the Language.

    To illustrate the distributed nature of the project over a standalone

    system we used the Enterprise manager as the networking

    monitoring system.

    The analogy is made that over the intranet that the databases would

    be located on their own database servers as opposed to the current

    setup of multiple databases on a single database server.

    However extending the current project to intranet is simple as we

    have used this approach.

    Following is the snapshot of the enterprise manager

  • 8/6/2019 Distributed Retail Chain

    9/15

    Enterprise Manager

    Security

    Role based security for asp.net applications

    We have implemented the .NET provided Role based security with

    an md5 has for encryption of username and passwords.

    Following code snippets shows this.

    // Encrypt the cookie using the machine key for

    secure transport

  • 8/6/2019 Distributed Retail Chain

    10/15

    string hash =

    FormsAuthentication.Encrypt(ticket);

    HttpCookie cookie = newHttpCookie(

    FormsAuthentication.FormsCookieName,

    // Name of auth cookie

    hash); // Hashed ticket

    Then check for the role of the login person from

    the database

    if (role.CompareTo("user") == 0)

    Global.asax file that does the matching

    if (HttpContext.Current.User != null)

    {

    if

    (HttpContext.Current.User.Identity.IsAuthenticated)

    {

    if

    (HttpContext.Current.User.Identity is

    FormsIdentity)

    {

    FormsIdentity id =

    (FormsIdentity)HttpContext.Current.User.Identity;

    FormsAuthenticationTicket

    ticket = id.Ticket;

    // Get the stored user-data, in

    this case, our roles

    string userData =

    ticket.UserData;

    string[] roles =

    userData.Split(',');

    HttpContext.Current.User = new

    GenericPrincipal(id, roles);

    }

    }

  • 8/6/2019 Distributed Retail Chain

    11/15

    Dynamic System:

    To illustrate a Dynamic system we have used multiple database

    servers which interact with each other based on some form of

    event handlers. Creating a new store, zone is doneprogrammatically and at execution creates databases. Also store

    can be reassigned across zones.

    To implement this we used ADO.NET features and made extensive

    use of data tables and datasets for data replication.

    Response time:

    Since this is a stand alone application, the response times are fast

    however timeout mechanisms are implemented, In case a database

    is not responsive the back up database is taken over

    Availability:

    For availability database tables are deleted and restored during this

    system queries are redirected to backup databases (servers).

    Web Services and Web methods: The names are explanatory

    changePrice - web method to change price and alsoupdate respective databases

    getSuperDataBase Used at a level to get upper leveldatabases needed for making updates

    saleProduct Gives each products sales information setStoreProdInfo for every store and a particular

    product this gives the information, this is inventory

    information

  • 8/6/2019 Distributed Retail Chain

    12/15

    getRetailStores For every zone or region get the leafnodes ( stores )

    deleteStoreProdInfo if a product is removed then theupdate is reflected

    getActualDB For every login user get his/her actual dbeven if his/her db has crashed

    getDataBase Get DB of the user from which he haslogged in, this could be upper DB incase of actual DB

    server id down

    getExistingProducts For a particular store get theproduct information

    getLevel The level of node in the hierarchy getProductPrice Get the price of a particular product getProducts Get all the products in the retail store

    Crystal Reports:

    Business objects Crystal reports are made use of in displaying sales

    and employee info.

    The reports are generated even if databases are deleted or down.

  • 8/6/2019 Distributed Retail Chain

    13/15

  • 8/6/2019 Distributed Retail Chain

    14/15

    .NET REMOTING:

    Below are snapshots of .Net remoting used for employee details

    information. Here there are two remoting servers running on two

    different TCP ports. By default the client application fetches datafrom the first remoting server as indicated by first snapshot,

    Snapshot 1

    However when the first remoting is killed or terminated the Client

    jumps to next available server which is Server1, and fetches therequired value. This illustrated how availability is incorporated

    into the project.

  • 8/6/2019 Distributed Retail Chain

    15/15