예제 #1
0
        public ActionResult Edit([Bind(Include = "GrdID,GradeName,OGradeID,NormalOTAmount,RestOTAmount,GZOTAmount")] HR_Grade hr_grade)
        {
            if (ModelState.IsValid)
            {
                ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp;
                using (var ctx = new HRMEntities())
                {
                    HR_Grade        OldGrade     = ctx.HR_Grade.First(aa => aa.GrdID == hr_grade.GrdID);
                    HR_GradeHistory GradeHistory = new HR_GradeHistory();
                    GradeHistory.CDateTime      = DateTime.Now;
                    GradeHistory.GradeName      = OldGrade.GradeName;
                    GradeHistory.GrdID          = OldGrade.GrdID;
                    GradeHistory.GZOTAmount     = OldGrade.GZOTAmount;
                    GradeHistory.IP             = AuditManager.GetIPAddress();
                    GradeHistory.NormalOTAmount = OldGrade.NormalOTAmount;
                    GradeHistory.OGradeID       = OldGrade.OGradeID;
                    GradeHistory.OGradeID       = OldGrade.OGradeID;
                    GradeHistory.RestOTAmount   = OldGrade.RestOTAmount;
                    GradeHistory.UserID         = loggedUser.UserID;
                    ctx.HR_GradeHistory.Add(GradeHistory);
                    ctx.SaveChanges();
                    hr_grade.OGradeID = OldGrade.OGradeID;
                }
                db.Entry(hr_grade).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Grade), Convert.ToInt16(AuditManager.AuditOperation.Edit), DateTime.Now, (int)hr_grade.GrdID);
                return(RedirectToAction("Index"));
            }
            return(View(hr_grade));
        }
 private void BindGridViewQualification(string search)
 {
     using (var db = new HRMEntities())
     {
         GridViewEmployee.DataSource = db.HR_Emp_Qualification.ToList();
         GridViewEmployee.DataBind();
     }
 }
예제 #3
0
        private void BindGridViewSection(string search)
        {
            using (var db = new HRMEntities())
            {
                FiltersModel         fm           = Session["FiltersModel"] as FiltersModel;
                List <ViewHRSection> _View        = new List <ViewHRSection>();
                List <ViewHRSection> _TempView    = new List <ViewHRSection>();
                ViewUserEmp          LoggedInUser = HttpContext.Current.Session["LoggedUser"] as ViewUserEmp;
                List <ViewHRSection> secList      = new List <ViewHRSection>();
                secList = db.ViewHRSections.Where(aa => aa.Status == true).ToList();
                if (LoggedInUser.UserType == "A" || LoggedInUser.UserType == "H" || LoggedInUser.UserType == "E" || LoggedInUser.HRModule == true)
                {
                    _View = secList.ToList();
                }
                else
                {
                    List <EmpView> emps = new List <EmpView>();
                    emps = OTHelperManager.GetEmployees(db.EmpViews.Where(aa => aa.Status == "Active").ToList(), LoggedInUser);
                    List <short?>        secids   = emps.Select(aa => aa.SectionID).Distinct().ToList();
                    List <ViewHRSection> tempSecs = new List <ViewHRSection>();
                    foreach (var secid in secids)
                    {
                        tempSecs.AddRange(secList.Where(aa => aa.SecID == secid).ToList());
                    }
                    _View = tempSecs.ToList();
                }

                if (fm.DepartmentFilter.Count > 0)
                {
                    _TempView.Clear();
                    foreach (var dept in fm.DepartmentFilter)
                    {
                        short _deptID = Convert.ToInt16(dept.ID);
                        _TempView.AddRange(_View.Where(aa => aa.DeptID == _deptID).ToList());
                    }
                    _View = _TempView.ToList();
                }
                if (fm.LocationFilter.Count > 0)
                {
                    _TempView.Clear();
                    foreach (var dept in fm.LocationFilter)
                    {
                        short _deptID = Convert.ToInt16(dept.ID);
                        _TempView.AddRange(_View.Where(aa => aa.LocID == _deptID).ToList());
                    }
                    _View = _TempView.ToList();
                }
                GridViewSection.DataSource = _View.Where(aa => aa.SectionName.ToUpper().Contains(search.ToUpper())).OrderBy(aa => aa.SectionName).ToList();
                GridViewSection.DataBind();
            }
        }
예제 #4
0
 public static void SaveAuditLog(int _userID, short _form, short _operation, DateTime _date, int PID)
 {
     try
     {
         using (var ctx = new HRMEntities())
         {
             Audit_Log auditEntry = new Audit_Log();
             auditEntry.AuditUserID   = _userID;
             auditEntry.FormID        = _form;
             auditEntry.OperationID   = _operation;
             auditEntry.AuditDateTime = _date;
             auditEntry.IPAddress     = GetIPAddress();
             auditEntry.PID           = PID;
             ctx.Audit_Log.Add(auditEntry);
             ctx.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }
예제 #5
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();
            }
        }