user3320751
user3320751

Reputation: 1

Fill DataGrid according to logged in user

Hi My scenario is like if suppose employee1 had created 3 client and employee2 had created 4 client, What i need is that employee1 logged he must see only those detail of client which he had created. Please guide me out how to proceed , bit confused about how create a table structure and how to get filter criteria.

Thanks

Upvotes: 0

Views: 40

Answers (1)

Win
Win

Reputation: 62260

First of all, you need a Login, so that employees can to login to your site. Otherwise, you do not know which employee created which client.

Then, you need a business logic in which employee can only retrieve his/her client.

In database, you need to create a column to keep track of who created this client record.

Employee Table

EmployeeId | Username | Password
-----------+---------------------
    1      | johndoe  |  hashed
    2      | marrydoe |  hashed 

Role Table

RoleId | Name
-------+--------------
    1  | Administrator
    2  | Employee

EmployeesInRoles Table

EmployeeId | RoleId
-----------+--------
    1      |   2 
    2      |   2

Client Table

ClientId | EmployeeId | Some other data
---------+------------+-----------------
    1    |     1      |  ...
    2    |     1      |  ...

Upvotes: 1

Related Questions