Example #1
0
        public ActionResult systemuser()
        {
            List <Employee> li_users = new List <Employee>();

            try
            {
                DataSet ds = dblayer.EmployeeSummary();

                ViewBag.SYSTEM_USER = ds.Tables[0];
                ViewBag.role        = ds.Tables[1];
                ViewBag.mng         = ds.Tables[2];
                ViewBag.dept        = ds.Tables[3];

                List <SelectListItem> mnglist = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "Select", Value = "0"
                    },
                };

                foreach (DataRow dr in ViewBag.mng.Rows)
                {
                    mnglist.Add(new SelectListItem {
                        Text = dr["EMP_NAME"].ToString(), Value = dr["EMP_ID"].ToString()
                    });
                }
                ViewBag.MNG_List = mnglist;

                List <SelectListItem> li_role = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "Select", Value = "0"
                    },
                };

                foreach (DataRow dr in ViewBag.role.Rows)
                {
                    li_role.Add(new SelectListItem {
                        Text = @dr["ROLE_NAME"].ToString(), Value = @dr["ROLE_ID"].ToString()
                    });
                }
                ViewBag.ROLE_List = li_role;

                List <SelectListItem> li_dept = new List <SelectListItem>()
                {
                    new SelectListItem {
                        Text = "Select", Value = "0"
                    },
                };

                foreach (DataRow dr in ViewBag.dept.Rows)
                {
                    li_dept.Add(new SelectListItem {
                        Text = @dr["DEPARTMENT_NAME"].ToString(), Value = @dr["DEPARTMENT_ID"].ToString()
                    });
                }
                ViewBag.DEPT_List = li_dept;

                foreach (DataRow dr in ViewBag.SYSTEM_USER.Rows)
                {
                    Employee su = new Employee();
                    su.Sr_No            = Convert.ToInt32(dr["SR_NO"].ToString());
                    su.Emp_id           = Convert.ToInt32(dr["EMP_ID"].ToString());
                    su.Emp_Name         = dr["EMP_NAME"].ToString();
                    su.Letter           = dr["LETTER"].ToString();
                    su.Email            = dr["EMAIL"].ToString();
                    su.Department_Name  = dr["DEPARTMENT_NAME"].ToString();
                    su.Designation_Name = dr["DESIGNATION"].ToString();
                    su.Created_Date     = dr["CREATED_DATE"].ToString();
                    su.ROLE_NAME        = dr["ROLE_NAME"].ToString();
                    su.ROLE_ID          = Convert.ToInt32(dr["ROLE_ID"].ToString());
                    li_users.Add(su);
                }
            }
            catch (Exception ex)
            {
            }
            return(View(li_users));
        }