Reputation: 1905
Hi i have application where i have to export grid data on a page to another grid on other page..
my logic is i have grid with check boxes.........and i have an admin and 3 users...i have one page for "admin" and one page for other "3 users" when they login they are taken to thier own page.....when admin logins he has the grid filled with data with check boxes.......
1)now the "admin" logins and visits his page his page looks like this
he has a button called assign work and a dropdownlist binded with three users names.
2)The admin selects some data using checkbox and selects the username from the dop down list ,and clicks on assign work button.
3)In the same way he does for other two users....
4)Here all the users have same page when user 1 logins he should be seeing only the work assigned to him by admin,when user two logins his work should be shown.
can any 1 tell me how to start this...how should i prepare the database and use that.... and can any provide me the required code...will be helpfull to me...
thanks in advance guys...
Upvotes: 1
Views: 524
Reputation: 460340
That depends on your database and your schema.
You should create an Work
table that contains
Then i would use 1-n relation-table WorkAssignment
that stores the user-assignement and the data that was chosen by the admin(what should be done)
Work
)Upvotes: 0
Reputation: 3448
For your reference, please check the following. It is not perfect solution, need to modify some referential integrity, etc. Just provide you some idea for your requirements.
-- DB design
-- user information
create table USERS (USER_ID INT IDENTITY PRIMARY KEY, USER_NM NVARCHAR(100) NOT NULL)
insert into USERS values ('Admin');
insert into USERS values ('User 1');
insert into USERS values ('User 2');
insert into USERS values ('User 3');
-- role description
create table ROLES_DESC (ID INT IDENTITY PRIMARY KEY, ROLE_ID INT NOT NULL, ROLE_DESC NVARCHAR(50) NOT NULL)
INSERT INTO ROLES_DESC VALUES (1,'Admin');
INSERT INTO ROLES_DESC VALUES (2,'User');
-- assing each user to at least one role
create table ROLES (ID INT IDENTITY PRIMARY KEY, USER_ID INT NOT NULL, ROLE_ID INT NOT NULL)
insert into ROLES (1,1) -- admin
insert into ROLES (2,2) -- User 1
insert into ROLES (3,2) -- User 2
insert into ROLES (4,2) -- User 3
-- task infomration
create table TASKS (ID INT IDENTITY PRIMARY KEY, TASK_DESC VARCHAR(100))
insert into TASKS values ('C# Programming');
insert into TASKS values ('Database Programming');
insert into TASKS values ('Match Homework');
-- admin can assing task to each user.. save here
create table ASSINGMENTS (ID INT IDENTITY PRIMARY KEY, USER_ID INT NOT NULL, TASK_ID INT NOT NULL, ASSING_DT DATETIME DEFAULT GETDATE())
insert into ASSINGMENTS (USER_ID,TASK_ID) values (2,1);
insert into ASSINGMENTS (USER_ID,TASK_ID) values (2,2);
insert into ASSINGMENTS (USER_ID,TASK_ID) values (3,1);
insert into ASSINGMENTS (USER_ID,TASK_ID) values (4,3);
---------in aspx you have admin page and user page In admin page, use templatefiled columns (user dropdown and task dropdown ) for User dropdown
SELECT USER_ID, USER_NM) FROM USERS WHERE ID <> 1 -- (only select non-admin user)
for task drop down list
SELECT ID, TASK_DESC FROM TASKS
-- when update task to each user event, read data from grid and save into ASSINGMENTS table
For User Page --
Just read data from ASSINGMENTS table join with USERS , TASKS tables as follow and bind to gridview
SELECT A.TASK_ID, T.TASK_DESC, A.ASSING_DT
FROM ASSINGMENTS A
INNER JOIN TASKS T ON (A.TASK_ID = T.ID)
WHERE A.USER_ID = 2
Upvotes: 1