public ActionResult Index(UpdateAttendanceSearchModel adt, int id) { adt.SearchStartdate = NepEngDate.NepToEng(adt.SearchStartdateNP); adt.SeacrchEnddate = NepEngDate.NepToEng(adt.SeacrchEnddateNP); ViewBag.sdate = adt.SearchStartdateNP; ViewBag.edate = adt.SeacrchEnddateNP; try { var list = _employeeServices.GetEmployeeDetails(id); ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id); UpdateAttendanceSearchModel uds = new UpdateAttendanceSearchModel(); DateTime sadte, enddate; sadte = Convert.ToDateTime(adt.SearchStartdate); enddate = Convert.ToDateTime(adt.SeacrchEnddate); uds.AttendanceList = _attendanceDailyServices.GetAttendanceByRangeAndID(id, sadte, enddate); uds.Name = list.Name; uds.Empcode = list.Code; uds.Branch = list.OfficeName; uds.Department = list.Department; uds.Designation = list.Designation; uds.Shift = list.Shift; uds.Group = list.Group; uds.Level = list.Level; uds.SearchStartdate = adt.SearchStartdate; uds.SeacrchEnddate = adt.SeacrchEnddate; return(View(uds)); } catch (Exception Ex) { return(View(Ex.Message)); } }
public ActionResult Index(int id, string Sdate, string Enddate) { if (!ViewBag.AllowView) { ViewBag.Error = "You are not Authorize to view or update attendance details"; return(PartialView("_partialviewNotFound")); } try { if (String.IsNullOrEmpty(Sdate) && String.IsNullOrEmpty(Enddate)) { var list = _employeeServices.GetEmployeeDetails(id); UpdateAttendanceSearchModel uds = new UpdateAttendanceSearchModel(); uds.AttendanceList = _attendanceDailyServices.GetAttendanceByRangeAndID(id, null, null); uds.Name = list.Name; uds.Empcode = list.Code; uds.Branch = list.OfficeName; uds.Department = list.Department; uds.Designation = list.Designation; uds.Shift = list.Shift; uds.Group = list.Group; uds.Level = list.Level; ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id); return(View(uds)); } else { var list = _employeeServices.GetEmployeeDetails(id); UpdateAttendanceSearchModel uds = new UpdateAttendanceSearchModel(); DateTime Stsrtdate, Edate; Stsrtdate = Convert.ToDateTime(Sdate); Edate = Convert.ToDateTime(Enddate); uds.AttendanceList = _attendanceDailyServices.GetAttendanceByRangeAndID(id, Stsrtdate, Edate); uds.Name = list.Name; uds.SearchStartdate = Sdate; uds.SeacrchEnddate = Enddate; uds.Empcode = list.Code; uds.Branch = list.OfficeName; uds.Department = list.Department; uds.Designation = list.Designation; uds.Shift = list.Shift; uds.Group = list.Group; uds.Level = list.Level; ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id); return(View(uds)); } } catch (Exception Ex) { ViewBag.Error = "No Data found or No employee found with this employeeCode"; return(View()); } }