예제 #1
0
        private void BindGridViewDesignation(string search)
        {
            using (var db = new HRMEntities())
            {
                FiltersModel fm = Session["FiltersModel"] as FiltersModel;

                ViewUserEmp           LoggedInUser = HttpContext.Current.Session["LoggedUser"] as ViewUserEmp;
                List <HR_Designation> desigList    = new List <HR_Designation>();
                desigList = db.HR_Designation.ToList();
                List <HR_Designation> tempList = new List <HR_Designation>();
                if (LoggedInUser.UserType == "A" || LoggedInUser.UserType == "H" || LoggedInUser.UserType == "E" || LoggedInUser.HRModule == true)
                {
                    tempList = desigList.ToList();
                }
                else
                {
                    List <EmpView> emps = new List <EmpView>();
                    emps = OTHelperManager.GetEmployees(db.EmpViews.Where(aa => aa.Status == "Active").ToList(), LoggedInUser);
                    List <short?> desigIds = emps.Select(aa => aa.DesgID).Distinct().ToList();
                    foreach (var secid in desigIds)
                    {
                        tempList.AddRange(desigList.Where(aa => aa.DesgID == secid).ToList());
                    }
                }
                List <DesignationCommonModel> desigCommonList = new List <DesignationCommonModel>();

                foreach (var desig in tempList.Select(aa => aa.OCommonName).Distinct().ToList())
                {
                    if (desig != null && desig != "")
                    {
                        DesignationCommonModel dc = new DesignationCommonModel();
                        dc.DesigID   = desig;
                        dc.DesigName = desig;
                        desigCommonList.Add(dc);
                    }
                }
                GridViewDesignation.DataSource = desigCommonList.Where(aa => aa.DesigName.ToUpper().Contains(search.ToUpper())).OrderBy(aa => aa.DesigName).ToList();
                GridViewDesignation.DataBind();
            }
        }
예제 #2
0
 void DataGvProperties()
 {
     GridViewDesignation.DataSource = DesignationServices.GetAll();
     GridViewDesignation.DataBind();
 }