public void SetOnDepartmentSelected() { Mediator.GetInstance().CBoxDepartmentChanged += (department) => { if (department != null) { ScheduleProxy scheduleProxy = new ScheduleProxy(); try { Clear(); Schedule = scheduleProxy.GetScheduleByDepartmentIdAndDate(department.Id, DateBoxes[0].Date); Shifts = Schedule.Shifts; LoadShiftsIntoCalendar(); } catch (Exception) { Shifts.Clear(); Schedule = null; Clear(); AddTxtNoSchedule(); } } DepartmentId = department.Id; return(Schedule); }; }
public ActionResult GetEvents() { ScheduleProxy scheduleProxy = new ScheduleProxy(); Employee employee = (Employee)Session["employee"]; try { List <ScheduleShift> shifts = scheduleProxy.GetScheduleByDepartmentIdAndDate(employee.DepartmentId, DateTime.Now).Shifts; return(new JsonResult { Data = shifts, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } catch (Exception e) { } return(null); }
public ActionResult GetShiftsByEmployee() { List <ScheduleShift> res = new List <ScheduleShift>(); Employee employee = (Employee)Session["employee"]; try { List <ScheduleShift> shifts = _scheduleProxy.GetScheduleByDepartmentIdAndDate(employee.DepartmentId, DateTime.Now).Shifts; res = shifts.Where(x => x.Employee.Name == employee.Name).ToList(); return(new JsonResult { Data = res, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } catch (Exception e) { } return(null); }