public ActionResult EditorOT(VMOTEntry vmdata) { try { User LoggedInUser = Session["LoggedUser"] as User; List <EmpView> emps = new List <EmpView>(); emps = db.EmpViews.Where(aa => aa.EmpNo == vmdata.EmpNo && aa.Status == true).ToList(); emps = AssistantQuery.GetFilteredEmps(emps, db.UserSections.Where(aa => aa.UserID == LoggedInUser.UserID).ToList()); if (emps.Count() > 0 && vmdata.FromDate != null && vmdata.ToDate != null) { List <ViewAttData> attdata = new List <ViewAttData>(); attdata = db.ViewAttDatas.Where(aa => aa.EmpNo == vmdata.EmpNo && aa.AttDate >= vmdata.FromDate && aa.AttDate <= vmdata.ToDate).ToList(); vmdata.dbViewAttData = attdata; vmdata.Count = attdata.Count; } else { ViewBag.Message = "There is no employee found"; } return(View("Index", vmdata)); } catch (Exception) { throw; } }
public ActionResult UpdateApprovedOT(VMOTEntry vmdata) { if (vmdata.EmpNo != "" && vmdata.FromDate != null && vmdata.ToDate != null) { List <string> empDates = db.ViewAttDatas.Where(aa => aa.EmpNo == vmdata.EmpNo && aa.AttDate >= vmdata.FromDate && aa.AttDate <= vmdata.ToDate).Select(aa => aa.EmpDate).ToList(); foreach (var empDate in empDates) { if (Request.Form["EmpDate-" + empDate].ToString() != null && Request.Form["EmpDate-" + empDate].ToString() != "") { AttData attData = db.AttDatas.First(aa => aa.EmpDate == empDate); attData.ApprovedOT = Convert.ToInt16(Request.Form["EmpDate-" + empDate].ToString()); db.SaveChanges(); } } } vmdata.dbViewAttData = db.ViewAttDatas.Where(aa => aa.EmpNo == vmdata.EmpNo && aa.AttDate >= vmdata.FromDate && aa.AttDate <= vmdata.ToDate).ToList(); return(View("Index", vmdata)); }
public ActionResult GetAttendance(VMOTEntry vmdata) { User LoggedInUser = Session["LoggedUser"] as User; try { if (vmdata.FromDate != null && vmdata.ToDate != null) { List <ViewAttData> attdata = new List <ViewAttData>(); attdata = db.ViewAttDatas.Where(aa => aa.EmpID == LoggedInUser.EmpID && aa.AttDate >= vmdata.FromDate && aa.AttDate <= vmdata.ToDate).ToList(); vmdata.dbViewAttData = attdata; vmdata.Count = attdata.Count; } return(View("Index", vmdata)); } catch (Exception) { throw; } }
// // GET: /EmpAttendance/ public ActionResult Index() { VMOTEntry vm = new VMOTEntry(); User LoggedInUser = Session["LoggedUser"] as User; try { DateTime todate = DateTime.Today; DateTime datefrom = DateTime.Today.AddDays(-10); List <ViewAttData> attdata = new List <ViewAttData>(); attdata = db.ViewAttDatas.Where(aa => aa.EmpID == LoggedInUser.EmpID && aa.AttDate >= datefrom && aa.AttDate <= todate).ToList(); vm.dbViewAttData = attdata; vm.Count = attdata.Count; } catch (Exception) { throw; } return(View(vm)); }
public ActionResult Index() { VMOTEntry vm = new VMOTEntry(); return(View(vm)); }