public ActionResult TrackingDetails(string scheduledId = "", string startDate = "", string endDate = "", string userId = "") { string url = Request.RawUrl; string query = Request.Url.Query; scheduledId = Request.QueryString["scheduledId"]; List <DateTime> listDate = new List <DateTime>(); List <TB_USERS> listUser = new List <TB_USERS>(); List <TB_SCHEDULES> listSchedule = new List <TB_SCHEDULES>(); List <V_TRACKING_USER_CLASS> list = new List <V_TRACKING_USER_CLASS>(); try { listDate = GetDateTimeToMonth(startDate, endDate); listSchedule = Schedules_Service.GetAll(); list = Trackings_Service.GetTrackingUser(userId, scheduledId, startDate, endDate); listUser = User_Service.GetAllStudies(); } catch (Exception e) { ViewBag.Error = e.ToString(); } ViewBag.ListDate = listDate.OrderByDescending(x => x).ToList(); ViewBag.Schedule = listSchedule; ViewBag.User = listUser; ViewBag.Url = url; return(View(list)); }
// delete schedule public JsonResult DeleteSchedule(string scheduleId) { AjaxResultModel Result = new AjaxResultModel(); try { if (Schedules_Service.Delete(Int32.Parse(scheduleId))) { Result.Code = 0; Result.Result = "Thao tác thành công"; } else { Result.Code = 1; Result.Result = "Lớp học đang được sử dụng. Vui lòng kiểm tra lại"; } } catch (Exception Ex) { Result.Code = 1; Result.Result = "Lớp học đang được sử dụng. Vui lòng kiểm tra lại"; IOHelper.WriteLog(StartUpPath, IpAddress, "InsertOrUpdateUser:", Ex.Message, Ex.ToString()); } return(Json(new JsonResult() { Data = Result })); }
public PartialViewResult _Index(string keyText = "", string boxId = "", string subjectId = "", string timeIn = "", string timeEnd = "", string status = "", int pageNumber = 1, int pageSize = 10) { ViewBag.pageNumber = pageNumber; ViewBag.pageSize = pageSize; ViewBag.maxNumber = 0; List <V_CLASS_DETAILS> cl = new List <V_CLASS_DETAILS>(); var classes = new List <V_CLASS>(); List <V_NUMBER_STUDIES> listCount = new List <V_NUMBER_STUDIES>(); int count = 0; try { cl = Classes_Service.GetInfoClass(keyText, boxId, subjectId, timeIn, timeEnd, status, pageNumber, pageSize, out count); listCount = Schedules_Service.GetCountStudieInClass(""); //classes = Classes_Service.GetClassBy(keyText, boxId, subjectId, timeIn, timeEnd, status, pageNumber, pageSize, out count); ViewBag.maxNumber = Math.Ceiling((double)count / pageSize); ViewBag.users = User_Service.GetAll(); int count1 = 0; ViewBag.boxSubjects = Subjects_Boxes_Service.GetAllBy("", 1, short.MaxValue, out count1); } catch (Exception ex) { CORE.Helpers.IOHelper.WriteLog(StartUpPath, "ClassController :", ex.Message, ex.ToString()); } ViewBag.Count = listCount; return(PartialView(cl)); }
public PartialViewResult _Tracking(string scheduleId = "", string startDate = "", string endDate = "", int pageNumber = 1, int pageSize = 10) { int count = 0; ViewBag.pageNumber = pageNumber; ViewBag.pageSize = pageSize; ViewBag.maxNumber = 0; List <V_TRACKING_USER_CLASS> list = new List <V_TRACKING_USER_CLASS>(); List <TB_USERS> listUser = new List <TB_USERS>(); List <TB_SCHEDULES> listSchedules = new List <TB_SCHEDULES>(); List <DateTime> listDate = new List <DateTime>(); List <V_TRACKING_SCHEDULE> a = new List <V_TRACKING_SCHEDULE>(); try { a = Trackings_Service.GetTotalTrackingBy(scheduleId, startDate, endDate); listDate = GetDateTimeToMonth(startDate, endDate); listUser = User_Service.GetAllStudies(); listSchedules = Schedules_Service.GetAll(); } catch (Exception e) { ViewBag.Error = e.ToString(); } ViewBag.ListDate = listDate; ViewBag.maxNumber = Math.Ceiling((double)count / pageSize); ViewBag.User = listUser; ViewBag.Schedule = listSchedules; return(PartialView(a)); }
public PartialViewResult _Schedules(string userId) { List <V_SCHEDULE_DETAILS> list = new List <V_SCHEDULE_DETAILS>(); int count = 0; try { if (!string.IsNullOrEmpty(userId)) { list = Schedules_Service.GetInfoClassBy(userId, "TEACHER", 1, short.MaxValue, out count); } }catch (Exception e) { ViewBag.Error = e.ToString(); } return(PartialView(list)); }
public ActionResult Tracking() { List <TB_SCHEDULES> list = new List <TB_SCHEDULES>(); List <TB_USERS> listUser = new List <TB_USERS>(); try { list = Schedules_Service.GetAll(); listUser = User_Service.GetAllTeacher(); } catch (Exception e) { ViewBag.Error = e.ToString(); } ViewBag.Schedule = list; ViewBag.User = listUser; return(View()); }
public PartialViewResult _ReportSalary(string userId = "", string scheduleId = "", string startDate = "", string endDate = "", int pageNumber = 1, int pageSize = 10) { int count = 0; ViewBag.pageNumber = pageNumber; ViewBag.pageSize = pageSize; ViewBag.maxNumber = 0; List <V_SALARY_TEACHER> list = new List <V_SALARY_TEACHER>(); List <TB_SCHEDULES> listSche = new List <TB_SCHEDULES>(); List <TB_SUBJECTS> listSuject = new List <TB_SUBJECTS>(); List <TB_BOX_SUBJECTS> listBoxSubject = new List <TB_BOX_SUBJECTS>(); List <TB_TRANSACTION> listTran = new List <TB_TRANSACTION>(); List <TB_USERS> listUser = new List <TB_USERS>(); int total = 0; try { listUser = User_Service.GetAllTeacher(); listTran = Transaction_Service.GetAllBy(userId, startDate, endDate, "TEACHER"); listSuject = Subjects_Service.GetAll(); listBoxSubject = Subjects_Boxes_Service.GetAll(); listSche = Schedules_Service.GetAll(); list = User_Service.GetSalaryTeacher(userId, scheduleId, startDate, endDate, pageNumber, pageSize, out count); total = count + listTran.Count; } catch (Exception e) { ViewBag.Error = e.ToString(); } ViewBag.maxNumber = Math.Ceiling((double)total / pageSize); ViewBag.Salary = list; ViewBag.Subject = listSuject; ViewBag.SubjectBox = listBoxSubject; ViewBag.Schedule = listSche; ViewBag.Transaction = listTran; ViewBag.User = listUser; return(PartialView()); }
public PartialViewResult _TrackingDetails(string scheduledId = "", string startDate = "", string endDate = "", string userId = "") { List <DateTime> listDate = new List <DateTime>(); List <TB_SCHEDULES> details = new List <TB_SCHEDULES>(); List <TB_USERS> listUser = new List <TB_USERS>(); List <V_TRACKING_USER_CLASS> list = new List <V_TRACKING_USER_CLASS>(); List <TB_SCHEDULE_DETAILS> listDetails = new List <TB_SCHEDULE_DETAILS>(); try { listDetails = Schedule_Detail_Service.GetByScheduleId(scheduledId); foreach (var item in listDetails) { List <DateTime> listDateTemp = new List <DateTime>(); listDateTemp = DateTimeHelper.DaysOfMonth(DateTime.Now.Year, DateTime.Now.Month, ConvertDataWithView.Convert_DayOfWeek_ToTypeDayOfWeek(item.ScheduleDetailDayOfWeek)); foreach (var date in listDateTemp) { if (listDate.Where(x => x.ToString("ddMMyyyy").Equals(date.ToString("ddMMyyyy"))).ToList().Count == 0) { listDate.Add(date); } } } //listDate = GetDateTimeToMonth(startDate, endDate); listUser = User_Service.GetAllStudies(); details = Schedules_Service.GetAll(); list = Trackings_Service.GetTrackingUser(userId, scheduledId, String.Join("", startDate.Split('/')), String.Join("", endDate.Split('/'))); } catch (Exception e) { ViewBag.Error = e.ToString(); } ViewBag.Id = scheduledId; ViewBag.User = listUser; ViewBag.Schedule = details; ViewBag.ListDate = listDate; return(PartialView(list)); }
public ActionResult Class_Detail(int id) { List <TB_SUBJECTS> subjects = new List <TB_SUBJECTS>(); List <TB_BOXES> boxes = new List <TB_BOXES>(); List <TB_USERS> users = new List <TB_USERS>(); List <TB_USERS> teachers = new List <TB_USERS>(); List <TB_USERS> studies = new List <TB_USERS>(); List <TB_USERS> students = new List <TB_USERS>(); List <TB_REGISTERS> register = new List <TB_REGISTERS>(); var detail = new V_CLASS(); var classes = new TB_SCHEDULES(); var details = new List <V_CLASS>(); try { subjects = Subjects_Service.GetAll(); boxes = Boxes_Service.GetAll(); users = User_Service.GetUserRegister(id.ToString()); int count = 0; details = Classes_Service.GetClassBy("", "", "", "", "", "", 1, Int16.MaxValue, out count); register = Registers_Service.GetAll(); studies = User_Service.GetStudiesBySchedule(id.ToString(), 1, Int16.MaxValue, out count); foreach (var tmp in details) { if (id.Equals(tmp.ScheduleId)) { detail = tmp; } } foreach (var user in users) { if (user.UserType.Equals("TEACHER")) { teachers.Add(user); } } foreach (var user in users) { if (user.UserType.Equals("STUDIES")) { students.Add(user); } } classes = Schedules_Service.GetById(id); } catch (Exception e) { Console.WriteLine(e); throw; } List <TB_USERS> lst = new List <TB_USERS>(); foreach (var item in students) { if (studies.Where(x => x.UserId == item.UserId).ToList().Count == 0) { lst.Add(item); } } ViewBag.Register = register; ViewBag.subjects = subjects; ViewBag.boxes = boxes; ViewBag.teachers = teachers; ViewBag.detail = detail; ViewBag.studies = studies; ViewBag.students = lst; ViewBag.id = id; return(PartialView(classes)); }