public ActionResult Index() { ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; var att_jobcardapp = db.ViewJobCards.Where(aa => aa.SupervisorID == LoggedInUser.EmpID && aa.StatusID == "Pending").OrderByDescending(aa => aa.DateCreated); return(View(att_jobcardapp)); }
public ActionResult Cancel(int?id) { Att_JobCardApp job = new Att_JobCardApp(); job = db.Att_JobCardApp.First(aa => aa.JobCardAppID == id); job.StatusID = "Rejected"; job.ApprovedDate = DateTime.Now; db.SaveChanges(); if (job.StatusID == "Rejected") { var EName = db.EmpViews.First(aa => aa.EmployeeID == job.EmpID).FullName; string Toadd = "*****@*****.**"; string subject = "Job Card Approval/Rejection" + EName; string body = "Dear Sir/Madam, <br/> job card request was Rejected < br /> Date : " + job.DateCreated + "+ < br /> , kindly review it. <br/> Employee Name: " + EName + "<br/> Employee No: " + job.EmpID + "<br/> Date Time: " + job.DateCreated.Value.ToShortDateString() + "<br/> Please Click on below link to procced further <a href='http://192.168.0.21/wms'>http://192.168.0.21/ESSP</a>"; EmailManager.SendEmail(Toadd, subject, body); } ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Job_Cards), Convert.ToInt16(AuditManager.AuditOperation.Reject), DateTime.Now, (int)id); int RecordID = job.JobCardAppID; // Below Code is for Notification ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; int TypeID = Convert.ToInt16(Utilities.NotificationType.Job_Card); string TypeName = Utilities.NotificationType.Job_Card.ToString().Replace("_", " "); int EmployeeID = LoggedInUser.EmpID ?? 0; Utilities.DeleteNotification(job.JobCardAppID, Convert.ToInt16(Utilities.NotificationType.Pending_Job_Card)); Utilities.InsertEMPNotification(TypeID, TypeName, EmployeeID, id ?? 0, job.EmpID ?? 0, BaseURL + "Attendance/JobCard/Index"); return(RedirectToAction("Index")); }
public ActionResult EmployeeJCList() { ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; var att_jobcardapp = db.ViewJobCards.Where(aa => aa.StatusID == "Approved"); return(View(att_jobcardapp.ToList())); }
public ActionResult Create([Bind(Include = "RdrID,RdrName,ReaderDutyCode,IpAdd,IpPort,RdrTypeID,Status,LocID")] Att_Reader att_reader) { //att_shift.GZDays = (bool)ValueProvider.GetValue("GZDays").ConvertTo(typeof(bool)); ViewBag.Location = new SelectList(db.HR_Location, "LocID", "LocationName"); ViewBag.DutyCode = new SelectList(db.Att_ReaderDutyCode, "RdrDuty", "DutyName"); ViewBag.ReaderType = new SelectList(db.Att_ReaderType, "RdrTypeID", "RdrTypeName"); try { if (string.IsNullOrEmpty(att_reader.IpAdd)) { ModelState.AddModelError("IpAdd", "Ip Address is required!"); } else { att_reader.ClearRecords = true; if (ModelState.IsValid) { db.Att_Reader.Add(att_reader); db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Device), Convert.ToInt16(AuditManager.AuditOperation.Add), DateTime.Now, (int)att_reader.RdrID); return(RedirectToAction("Index")); } return(View(att_reader)); } } catch (Exception) { throw; } return(View()); }
// GET: /HumanResource/Designation/ public ActionResult Index() { //return View(db.HR_Designation.OrderBy(aa => aa.DesignationName).ToList()); List <HR_Designation> _View = new List <HR_Designation>(); List <HR_Designation> _TempView = new List <HR_Designation>(); ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; QueryBuilder qb = new QueryBuilder(); string query = qb.QueryForReportsDepartment(LoggedInUser); DataTable dt = new DataTable(); if (query != "where") { dt = qb.GetValuesfromDB("select * from HR_Designation" + query + " DesignationName"); } _View = dt.ToList <HR_Designation>(); List <HR_Employee> emps = db.HR_Employee.Where(aa => aa.Status == "Active").ToList(); List <DesignationList> desigtList = new List <DesignationList>(); foreach (var item in _View.ToList()) { DesignationList sl = new DesignationList(); sl.DesignationID = item.DesgID; sl.DesignationName = item.DesignationName; sl.CommonName = item.OCommonName; sl.NoOfEmps = emps.Where(aa => aa.HR_Designation.DesgID == item.DesgID).Count(); desigtList.Add(sl); } return(View(desigtList.OrderBy(aa => aa.DesignationName).ToList())); }
public ActionResult Edit([Bind(Include = "DeptID,DepartmentName,DivsionID,Status")] HR_Department hr_department) { if (hr_department.DepartmentName == null || hr_department.DepartmentName == "") { ViewBag.error = "Empty Feild"; } else { try { if (ModelState.IsValid) { db.Entry(hr_department).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Department), Convert.ToInt16(AuditManager.AuditOperation.Edit), DateTime.Now, (int)hr_department.DeptID); return(RedirectToAction("Index")); } } catch (Exception) { throw; } } //ViewBag.DivsionID = new SelectList(db.HR_Division, "DivID", "DivisionName", hr_department.DivsionID); return(View(hr_department)); }
public ActionResult Rejected(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VMS_SVisitor vms_svisitor = db.VMS_SVisitor.Find(id); if (vms_svisitor != null) { vms_svisitor.Status = "Rejected"; db.SaveChanges(); if (vms_svisitor.Status == "Rejected") { var EName = db.EmpViews.First(aa => aa.EmployeeID == vms_svisitor.EmpID).FullName; string Toadd = "*****@*****.**"; string subject = "Pending Visitor's Vehicle Access for Employee" + EName; string body = "Dear Concerned, <br/> your request is Rejected. <br/> Employee Name: " + EName + "<br/> Visitor Name: " + vms_svisitor.VisitorName + "<br/> Vehicle No: " + vms_svisitor.VehicleNo + "<br/> Date Time: " + vms_svisitor.Arrival_Date.Value.ToShortDateString() + vms_svisitor.ArrivalTime + "<br/> Please Click on below link to procced further <a href='http://192.168.0.21/wms'>http://192.168.0.21/ESSP</a>"; EmailManager.SendEmail(Toadd, subject, body); } ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; int TypeID = Convert.ToInt16(Utilities.NotificationType.PendingVisitorEntry); string TypeName = Utilities.NotificationType.PendingVisitorEntry.ToString().Replace("_", " "); int EmployeeID = LoggedInUser.EmpID ?? 0; Utilities.DeleteNotification(vms_svisitor.ID, Convert.ToInt16(Utilities.NotificationType.PendingVisitorEntry)); Utilities.InsertEMPNotification(TypeID, TypeName, EmployeeID, id ?? 0, vms_svisitor.EmpID ?? 0, BaseURL + "Attendance/ScheduleVisitor/Index"); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Visitor_Entry), Convert.ToInt16(AuditManager.AuditOperation.Reject), DateTime.Now, (int)id); return(RedirectToAction("ListOfPendingVisitor")); } return(RedirectToAction("ListOfPendingVisitor")); }
// GET: /Attendance/ScheduleVisitor/ public ActionResult Index() { ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; Utilities.DeleteNotificationByType(LoggedInUser.EmpID ?? 0, Convert.ToInt16(Utilities.NotificationType.PendingVisitorEntry)); return(View(db.VMS_SVisitor.Where(aa => aa.EmpID == LoggedInUser.EmpID).OrderByDescending(aa => aa.ID).ToList())); }
public ActionResult FocalUsers([Bind(Include = "PID,FocalUID,UserID,StartDate,EndDate")] int?id, FocalUser focaluser) { ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; if (focaluser.StartDate == null) { ViewBag.error = "required field must have a value"; } else { if (db.FocalUsers.Where(aa => aa.FocalUID == focaluser.FocalUID && aa.EndDate == null).Count() > 0) { FocalUser OldEntry = db.FocalUsers.Where(aa => aa.FocalUID == focaluser.FocalUID && aa.EndDate == null).OrderByDescending(aa => aa.PID).First(); OldEntry.EndDate = DateTime.Now.AddDays(-1); } focaluser.UserID = id; focaluser.FocalUName = db.ViewUserEmps.First(aa => aa.UserID == focaluser.FocalUID).FullName; ViewBag.FocalUID = new SelectList(db.ViewUserEmps.Where(aa => aa.Status == true).ToList(), "UserID", "FullName"); db.FocalUsers.Add(focaluser); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FocalUID = new SelectList(db.ViewUserEmps.Where(aa => aa.Status == true).ToList(), "UserID", "FullName"); return(View()); }
public ActionResult HAOTDeptList(int?PayrollPeriodID) { ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; List <short?> deptIds = new List <short?>(); List <short?> divIds = new List <short?>(); List <int?> empIds = new List <int?>(); List <EmpView> totalEmps = new List <EmpView>(); List <EmpView> emps = new List <EmpView>(); List <PR_PayrollPeriod> activePeriods = new List <PR_PayrollPeriod>(); List <int?> activePeriodIds = new List <int?>(); int SelectedPeriodID = 0; List <ViewDailyOTEntry> otList = new List <ViewDailyOTEntry>(); PR_PayrollPeriod prp = new PR_PayrollPeriod(); ModelRDeptPending vm = new ModelRDeptPending(); totalEmps = db.EmpViews.Where(aa => aa.Status == "Active").ToList(); if (LoggedInUser.UserType != "H" && LoggedInUser.UserType != "A") { totalEmps = OTHelperManager.GetEmployees(totalEmps, LoggedInUser); } SelectedPeriodID = Convert.ToInt32(Session["PRID"].ToString()); if (PayrollPeriodID == null) { PayrollPeriodID = SelectedPeriodID; } else { Session["PRID"] = PayrollPeriodID.ToString(); } //activePeriodIds = db.ViewDailyOTEntries.Where(aa => ((aa.SupervisorID == LoggedInUser.EmployeeID && aa.StatusID == "P") || (aa.StatusID == "F" && aa.ForwardToID == LoggedInUser.EmployeeID))).Select(aa => aa.PeriodID).Distinct().ToList(); //activePeriods = OTHelperManager.GetActivePeriods(db.PR_PayrollPeriod.ToList(), activePeriodIds); prp = OTHelperManager.GetPayrollPeriod(db.PR_PayrollPeriod.ToList(), (int)PayrollPeriodID); empIds = db.ViewDailyOTEntries.Where(aa => aa.OTProcessingPeriodID == prp.PID && aa.StatusID == "A").Select(aa => aa.EmployeeID).Distinct().ToList(); emps = OTHelperManager.GetEmployeeConvertedFromIds(empIds, totalEmps); deptIds = OTHelperManager.GetDeptIDs(emps); divIds = OTHelperManager.GetDivisionIDs(deptIds, db.HR_Section.ToList()); if (deptIds.Count == 1) { return(RedirectToAction("HAOTEmpList", new { DeptID = deptIds.First(), PayrollPeriodID = prp.PID })); } else { otList = db.ViewDailyOTEntries.Where(aa => aa.OTProcessingPeriodID == prp.PID && aa.StatusID == "A").ToList(); vm.List = OTHelperRecommended.GetConvertedOTListDepts(otList, emps, deptIds); vm.Count = vm.List.Count; vm.PayrollPeriodID = (int)PayrollPeriodID; if (prp.FinYearID != null) { vm.DivRemainingBudget = OTHelperManager.GetDivRemainingBudget(divIds, db.BG_OTDivision.ToList(), (int)prp.FinYearID); } vm.TotalOTAmount = OTHelperManager.GetTotalOTAmount(vm.List); ViewBag.PayrollPeriodID = new SelectList(activePeriods, "PID", "PName", PayrollPeriodID); ViewBag.DecisionID = new SelectList(OTHelperManager.GetOTStatusForSupervisor(db.Att_OTStatus.ToList()), "PSID", "StatusName", "F"); //ViewBag.RecommendID = new SelectList(OTHelperManager.GetUsersForSupervisor(db.ViewUserEmps.Where(aa => aa.EmpStatus == "Active" && aa.UserType == "R" && aa.sec).ToList()), "UserID", "FullName"); vm.Message = new List <string>(); return(View(vm)); } }
public ModelSOTEmpList GetEmpPending(ViewUserEmp LoggedInUser, int?PayrollPeriodID, int DeptID) { // Varibale Initilization ModelSOTEmpList vm = new ModelSOTEmpList(); List <short?> deptIds = new List <short?>(); List <short?> divIds = new List <short?>(); List <int?> empIds = new List <int?>(); List <EmpView> totalEmps = new List <EmpView>(); List <EmpView> emps = new List <EmpView>(); List <PR_PayrollPeriod> activePeriods = new List <PR_PayrollPeriod>(); List <int?> activePeriodIds = new List <int?>(); PR_PayrollPeriod prp = new PR_PayrollPeriod(); int SelectedPeriodID = 0; List <ViewDailyOTEntry> otList = new List <ViewDailyOTEntry>(); deptIds.Add((short)DeptID); divIds = OTHelperManager.GetDivisionIDs(deptIds, db.HR_Section.ToList()); totalEmps = db.EmpViews.Where(aa => aa.Status == "Active").ToList(); // Get Payroll Period SelectedPeriodID = Convert.ToInt32(Session["PRID"].ToString()); if (PayrollPeriodID == null) { PayrollPeriodID = SelectedPeriodID; } else { Session["PRID"] = PayrollPeriodID.ToString(); } activePeriodIds = db.ViewDailyOTEntries.Where(aa => (aa.SupervisorID == LoggedInUser.EmployeeID && aa.StatusID == "P") || (aa.StatusID == "F" && aa.ForwardToID == LoggedInUser.EmployeeID)).Select(aa => aa.PeriodID).Distinct().ToList(); activePeriods = OTHelperManager.GetActivePeriods(db.PR_PayrollPeriod.ToList(), activePeriodIds); prp = OTHelperManager.GetPayrollPeriod(activePeriods, (int)PayrollPeriodID); empIds = db.ViewDailyOTEntries.Where(aa => aa.OTDate >= prp.PStartDate && aa.OTDate <= prp.PEndDate && aa.SecID == DeptID && ((aa.SupervisorID == LoggedInUser.EmployeeID && aa.StatusID == "P") || (aa.StatusID == "F" && aa.ForwardToID == LoggedInUser.EmployeeID))).Select(aa => aa.EmployeeID).Distinct().ToList(); emps = OTHelperManager.GetEmployeeConvertedFromIds(empIds, totalEmps); otList = db.ViewDailyOTEntries.Where(aa => aa.OTDate >= prp.PStartDate && aa.OTDate <= prp.PEndDate && aa.SecID == DeptID && ((aa.SupervisorID == LoggedInUser.EmployeeID && aa.StatusID == "P") || (aa.StatusID == "F" && aa.ForwardToID == LoggedInUser.EmployeeID))).ToList(); vm.DeptID = (int)DeptID; if (prp.FinYearID != null) { vm.DivRemainingBudget = OTHelperManager.GetDivRemainingBudget(divIds, db.BG_OTDivision.ToList(), (int)prp.FinYearID); } vm.List = OTHelperRecommended.GetConvertedOTListEmp(otList, emps); //if (DateTime.Today > prp.SupervisorCutOffDate) // vm.IsLate = true; //else vm.IsLate = false; if (vm.List.Count() > 1) { vm.TotalOTAmount = vm.List.Sum(aa => aa.OTAmount); vm.SystemOT = OTHelperManager.ConverMinIntoHours(vm.List.Sum(aa => aa.SystemOTMins)); vm.ClaimedOT = OTHelperManager.ConverMinIntoHours(vm.List.Sum(aa => aa.ClaimedOTMins)); vm.TotalEmps = vm.List.Count().ToString(); } vm.Count = vm.List.Count; ViewBag.DecisionID = new SelectList(OTHelperManager.GetOTStatusForApprover(db.Att_OTStatus.ToList()), "PSID", "StatusName", "F"); ViewBag.RecommendID = new SelectList(OTHelperManager.GetUsersForRecommender(db.ViewUserEmps.Where(aa => aa.EmpStatus == "Active").ToList()), "UserID", "FullName"); ViewBag.PayrollPeriodID = new SelectList(activePeriods, "PID", "PName", PayrollPeriodID); return(vm); }
public ActionResult Edit([Bind(Include = "HolidayID,HolidayDate,HolidayName")] Att_Holiday att_holiday) { if (att_holiday.HolidayDate == null) { ViewBag.date = "required field!"; } else { if (att_holiday.HolidayName == null || att_holiday.HolidayName == "") { ViewBag.name = "required field!"; } else { if (ModelState.IsValid) { db.Entry(att_holiday).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Holiday), Convert.ToInt16(AuditManager.AuditOperation.Edit), DateTime.Now, (int)att_holiday.HolidayID); return(RedirectToAction("Index")); } } } return(View(att_holiday)); }
// GET: /HumanResource/EmpType/ public ActionResult Index() { try { List <HR_EmpType> _View = new List <HR_EmpType>(); List <HR_EmpType> _TempView = new List <HR_EmpType>(); ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; QueryBuilder qb = new QueryBuilder(); string query = qb.QueryForReportsDepartment(LoggedInUser); DataTable dt = new DataTable(); if (query != "where") { dt = qb.GetValuesfromDB("select * from HR_EmpType" + query + " TypeName"); } _View = dt.ToList <HR_EmpType>(); List <HR_Employee> emps = db.HR_Employee.Where(aa => aa.Status == "Active").ToList(); List <EmpTypeList> typelist = new List <EmpTypeList>(); foreach (var item in _View.ToList()) { EmpTypeList sl = new EmpTypeList(); sl.TypeID = item.TypID; sl.TypeName = item.TypeName; sl.NoOfEmps = emps.Where(aa => aa.EmpTypeID == item.TypID).Count(); typelist.Add(sl); } return(View(typelist.ToList())); } catch (Exception) { throw; } }
public ActionResult Create([Bind(Include = "JobCardAppID,DateCreated,DateStarted,DateEnded,JCTypeID,UserID,JobCardCriteria,CriteriaData,Status,TimeIn,TimeOut,WorkMin,Remarks,OtherValue,SupervisorID,StartTime,EndTime,EmpID,Justification")] Att_JobCardApp att_jobcardapp) { if (att_jobcardapp.EmpID == null) { ViewBag.error = "required field!"; } else { if (ModelState.IsValid) { if (att_jobcardapp.DateEnded != null) { att_jobcardapp.DateCreated = DateTime.Now; att_jobcardapp.StatusID = "Approved"; att_jobcardapp.StartTime = null; att_jobcardapp.EndTime = null; db.Att_JobCardApp.Add(att_jobcardapp); db.SaveChanges(); } else { att_jobcardapp.DateCreated = DateTime.Now; att_jobcardapp.StatusID = "Approved"; db.Att_JobCardApp.Add(att_jobcardapp); db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Job_Cards), Convert.ToInt16(AuditManager.AuditOperation.Add), DateTime.Now, (int)att_jobcardapp.JobCardAppID); } } ViewBag.JCTypeID = new SelectList(db.Att_JobCard, "JCID", "JCName", att_jobcardapp.JCTypeID); return(RedirectToAction("Index")); } return(View(att_jobcardapp)); }
public static List <EmpView> GetEmployees(List <EmpView> emps, ViewUserEmp LoggedInUser) { List <EmpView> nEmps = emps.Where(aa => aa.ReportingToID == LoggedInUser.EmpID).ToList(); // Add LoggedInUser Employee object in list if (nEmps.Where(aa => aa.EmployeeID == LoggedInUser.EmpID).Count() == 0) { nEmps.AddRange(emps.Where(aa => aa.EmployeeID == LoggedInUser.EmpID).ToList()); } List <EmpView> rEmps = GetReportingToEmps(emps, nEmps); if (rEmps.Count > 0) { while (true) { rEmps = GetReportingToEmps(emps, rEmps).ToList(); nEmps.AddRange(rEmps); if (rEmps.Count == 0) { return(nEmps); } if (nEmps.Count() >= emps.Count()) { return(nEmps); } } } else { return(nEmps); } }
public ModelSOTPEmpDetail GetDetailPending(int prid, int EmpID, ViewUserEmp LoggedInUser) { ModelSOTPEmpDetail vm = new ModelSOTPEmpDetail(); PR_PayrollPeriod prp = OTHelperManager.GetPayrollPeriod(db.PR_PayrollPeriod.ToList(), prid); HR_Employee emp = db.HR_Employee.First(aa => aa.EmployeeID == EmpID); //if (DateTime.Today > prp.SupervisorCutOffDate) // vm.IsLate = true; //else vm.IsLate = false; vm.EmpID = (int)EmpID; vm.EmpName = emp.FullName; vm.DeptID = (int)emp.SectionID; vm.List = OTHelperRecommended.GetConvertedDailyOTList(db.ViewDailyOTEntries.Where(aa => aa.EmployeeID == vm.EmpID && aa.OTDate >= prp.PStartDate && aa.OTDate <= prp.PEndDate).ToList()); if (vm.List.Count > 0) { vm.SystemOT = OTHelperManager.ConverMinIntoHours(vm.List.Sum(aa => aa.SystemOTMins)); vm.ClaimedOT = OTHelperManager.ConverMinIntoHours(vm.List.Sum(aa => aa.ClaimedOTMins)); vm.TotalDays = vm.List.Count(); vm.TotalAmount = vm.List.Sum(aa => aa.OTAmount); } vm.DivRemainingBudget = OTHelperManager.GetDivRemainingBudget(OTHelperManager.GetDivisionIDs(OTHelperManager.ConvertDeptIDList(emp.SectionID), db.HR_Section.ToList()), db.BG_OTDivision.ToList(), (int)prp.FinYearID); vm.PeriodName = prp.PName; vm.PeriodID = prp.PID; vm.OTPolicy = "OT Days Forward Policy: Maximum Days in Week = " + emp.Att_OTPolicy.DaysInWeek.ToString() + " , Maximum Days in Month = " + emp.Att_OTPolicy.DaysInMonth.ToString(); vm.OTPolicyDays = "OT Claimed Hours Policy: Normal Day= " + OTHelperManager.ConverMinIntoHours((int)emp.Att_OTPolicy.PerDayOTStartLimitHour) + " to " + OTHelperManager.ConverMinIntoHours((int)emp.Att_OTPolicy.PerDayOTEndLimitHour) + ", Rest & GZ Day= " + OTHelperManager.ConverMinIntoHours((int)emp.Att_OTPolicy.PerDayGOTStartLimitHour) + " to " + OTHelperManager.ConverMinIntoHours((int)emp.Att_OTPolicy.PerDayGOTEndLimitHour); vm.Count = vm.List.Count; ViewBag.DecisionID = new SelectList(OTHelperManager.GetOTStatusForApprover(db.Att_OTStatus.ToList()), "PSID", "StatusName", "F"); ViewBag.RecommendID = new SelectList(OTHelperManager.GetUsersForRecommender(db.ViewUserEmps.Where(aa => aa.EmpStatus == "Active").ToList()), "UserID", "FullName"); return(vm); }
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)); }
internal string QueryForSectionReport(ViewUserEmp LoggedInUser) { string query = ""; HRMEntities db = new HRMEntities(); List <UserRoleData> uAcc = new List <UserRoleData>(); uAcc = db.UserRoleDatas.Where(aa => aa.RoleUserID == LoggedInUser.UserID && aa.UserRoleLegend == "D").ToList(); // List<HR_Division> division = db.HR_Division.ToList(); List <HR_Department> department = db.HR_Department.ToList(); List <HR_Section> section = db.HR_Section.ToList(); List <string> queryList = new List <string>(); foreach (var access in uAcc) { switch (LoggedInUser.UserType) { case "G": //ADmin query = ""; List <HR_Section> locs = new List <HR_Section>(); break; //case "V"://Division // List<HR_Section> locs = new List<HR_Section>(); // locs = db.HR_Section.Where(aa => aa.HR_Department.DivsionID == access.RoleDataValue).ToList(); // foreach (var c in locs) // { // queryList.Add(" SecID =" + c.SecID); // } // break; case "D": //Depts locs = db.HR_Section.Where(aa => aa.DepartmentID == access.RoleDataValue).ToList(); foreach (var c in locs) { queryList.Add(" SecID =" + c.SecID); } break; case "S": //Section string cityIDForLoc = section.Where(aa => aa.SecID == access.RoleDataValue).FirstOrDefault().SecID.ToString(); queryList.Add(" SecID =" + cityIDForLoc); break; } } if (queryList.Count == 1) { query = query + queryList[0]; } else if (queryList.Count > 1) { for (int i = 0; i < queryList.Count - 1; i++) { query = query + queryList[i] + " or "; } query = query + queryList[queryList.Count - 1]; } return(query); }
internal string QueryForLocReport(ViewUserEmp LoggedInUser) { string query = ""; HRMEntities db = new HRMEntities(); List <UserRoleData> uAcc = new List <UserRoleData>(); uAcc = db.UserRoleDatas.Where(aa => aa.RoleUserID == LoggedInUser.UserID && aa.UserRoleLegend == "L").ToList(); List <HR_Location> locss = db.HR_Location.ToList(); List <string> queryList = new List <string>(); foreach (var access in uAcc) { switch (LoggedInUser.UserType) { case "A": //ADmin query = ""; List <HR_Location> locs = new List <HR_Location>(); break; //case "R"://REgion // List<HR_Location> locs = new List<HR_Location>(); // locs = db.HR_Location.Where(aa => aa.HR_City.CityID == access.RoleDataValue).ToList(); // foreach (var c in locs) // { // queryList.Add(" LocID =" + c.LocID); // } // break; //case "C"://City // locs = db.HR_Location.Where(aa => aa.CityID == access.RoleDataValue).ToList(); // foreach (var c in locs) // { // queryList.Add(" LocID =" + c.LocID); // } // break; case "L": //Location if (locss.Where(aa => aa.LocID == access.RoleDataValue).Count() > 0) { string cityIDForLoc = locss.Where(aa => aa.LocID == access.RoleDataValue).FirstOrDefault().LocID.ToString(); queryList.Add(" LocID =" + cityIDForLoc); } break; } } if (queryList.Count == 1) { query = query + queryList[0]; } else if (queryList.Count > 1) { for (int i = 0; i < queryList.Count - 1; i++) { query = query + queryList[i] + " or "; } query = query + queryList[queryList.Count - 1]; } return(query); }
public ActionResult AOTEmpList(int?DeptID, int?PayrollPeriodID) { ModelSOTEmpList vm = new ModelSOTEmpList(); ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; vm = GetEmpPending(LoggedInUser, (int)PayrollPeriodID, (int)DeptID); vm.Message = new List <string>(); return(View(vm)); }
// GET: /Attendance/JobCard/ public ActionResult Index() { Session["SelectedMenu"] = "JobCardHistory"; ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; var att_jobcardapp = db.ViewJobCards.Where(aa => aa.EmployeeID == LoggedInUser.EmpID).OrderByDescending(aa => aa.DateCreated); Utilities.DeleteNotificationByType(LoggedInUser.EmpID ?? 0, Convert.ToInt16(Utilities.NotificationType.Job_Card)); return(View(att_jobcardapp.ToList())); }
public ActionResult SOTDetailList(int?EmpID, int?PayrollPeriodID) { ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; ModelSOTPEmpDetail vm = new ModelSOTPEmpDetail(); int prid = Convert.ToInt32(Session["PRID"].ToString()); vm = GetDetailPending(prid, (int)EmpID, LoggedInUser); vm.Message = new List <string>(); return(View(vm)); }
private bool CheckCreateActionPermission(ViewUserEmp _User) { if (_User.CanAdd == true) { return(true); } else { return(false); } }
private bool CheckEditActionPermission(ViewUserEmp _User) { if (_User.CanEdit == true) { return(true); } else { return(false); } }
public ActionResult DeleteConfirmed(byte id) { Att_Holiday att_holiday = db.Att_Holiday.Find(id); db.Att_Holiday.Remove(att_holiday); db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Holiday), Convert.ToInt16(AuditManager.AuditOperation.Delete), DateTime.Now, (int)att_holiday.HolidayID); return(RedirectToAction("Index")); }
private bool CheckDetailActionPermission(ViewUserEmp _User) { if (_User.CanView == true) { return(true); } else { return(false); } }
public ActionResult Edit([Bind(Include = "ID,SupervisorCutOffDate,RecommendCutOffDate,ApprovedCutOffDate")] Att_Setting att_setting) { if (ModelState.IsValid) { db.Entry(att_setting).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Att_Setting), Convert.ToInt16(AuditManager.AuditOperation.Edit), DateTime.Now, (int)att_setting.ID); return(RedirectToAction("Index")); } return(View(att_setting)); }
public ActionResult Edit([Bind(Include = "PFinYearID,FinYearName,StartDate,EndDate,Status")] PR_FinYear pr_finyear) { if (ModelState.IsValid) { db.Entry(pr_finyear).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.FinYear), Convert.ToInt16(AuditManager.AuditOperation.Edit), DateTime.Now, (int)pr_finyear.PFinYearID); return(RedirectToAction("Index")); } return(View(pr_finyear)); }
public ActionResult DeleteConfirmed(int id) { PR_FinYear pr_finyear = db.PR_FinYear.Find(id); db.PR_FinYear.Remove(pr_finyear); db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.FinYear), Convert.ToInt16(AuditManager.AuditOperation.Delete), DateTime.Now, (int)pr_finyear.PFinYearID); return(RedirectToAction("Index")); }
// GET: /Attendance/EmployeeJobCard/Delete/5 public ActionResult Delete(int?id) { Att_JobCardApp att_jobcardapp = db.Att_JobCardApp.Find(id); db.Att_JobCardApp.Remove(att_jobcardapp); db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Job_Cards), Convert.ToInt16(AuditManager.AuditOperation.Delete), DateTime.Now, (int)att_jobcardapp.JobCardAppID); return(RedirectToAction("Index")); }