public JsonResult UpdateRegister(int reg_id, string reg_status) { AjaxResultModel Result = new AjaxResultModel(); try { TB_REGISTERS t = Registers_Service.GetById(reg_id); t.RegisterStatus = reg_status; if (Registers_Service.UpdateStatus(t.RegisterId, reg_status)) { Result.Code = 000; Result.Result = "Thành công"; } else { Result.Code = 001; Result.Result = "Không thành công"; } } catch (Exception Ex) { Result.Code = 2000; Result.Result = "Có lỗi xảy ra. Vui lòng thử lại sau hoặc liên hệ với người quản trị."; CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString()); } return(Json(Result)); }
public PartialViewResult _ChiTiet(int registerId = 0) { int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85); TB_REGISTERS r = Registers_Service.GetById(registerId); ViewBag.Register = r; return(PartialView(height)); }
public PartialViewResult _MenuListDetail(int registerId = 0) { TB_REGISTERS regis = Registers_Service.GetById(registerId); int serviceId = regis.RegisterServiceId; int menuId = regis.RegisterMenuId; int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85); TB_MENUS menu = Menus_Service.GetById(menuId); if (menu == null) { menu = new TB_MENUS(); } menu.MenuServiceId = serviceId; ViewBag.Menu = menu; List <V_Group_Menu> details = Menus_Service.GetAllDetails(menuId); List <TB_REGISTER_DETAILS> regisDetail = Registers_Service.GetByRegisterId(registerId); List <V_Group_Menu> list = new List <V_Group_Menu>(); foreach (var item in details) { V_Group_Menu v = new V_Group_Menu(); v = item; foreach (var data in item.MgroupDetail) { if (regisDetail.Where(x => x.RdetailMdetailId == data.MdetailId).ToList().Count > 0) { v.MgroupDetail = new List <V_Details_Menu>(); v.MgroupDetail.Add(data); list.Add(v); break; } } } ViewBag.Details = list; return(PartialView(height)); }
public bool Update(TB_REGISTERS register) { return(new TB_REGISTERSSql().Update(register)); }
public bool Insert(TB_REGISTERS register) { return(new TB_REGISTERSSql().Insert(register)); }
public string Insert(TB_REGISTERS register) { string result = ""; List <V_NUMBER_STUDIES> list = new List <V_NUMBER_STUDIES>(); list = new TB_SCHEDULESFactory().GetCountStudieInClass(register.RegisterScheduleId.ToString()); // lay ra danh sach lich hoc cua hoc sinh List <V_TKBStudies> listTKB = new List <V_TKBStudies>(); listTKB = new TB_USERSFactory().GetThoiKhoaBieu(register.RegisterUserId.ToString()); // lay ra danh sach thu trong tuan List <TB_SCHEDULE_DETAILS> listDetails = new List <TB_SCHEDULE_DETAILS>(); listDetails = new TB_SCHEDULE_DETAILSFactory().GetByScheduleId(register.RegisterScheduleId.ToString()); // lay danh sach da dang ky nhung chua duoc xac nhan List <TB_REGISTERS> listRegisTem = new List <TB_REGISTERS>(); listRegisTem = new TB_REGISTERSSql().FilterByField("RegisterUserId", register.RegisterUserId); bool check = true; foreach (var tkb in listRegisTem) { List <TB_SCHEDULE_DETAILS> listTemp = new List <TB_SCHEDULE_DETAILS>(); listTemp = new TB_SCHEDULE_DETAILSFactory().GetByScheduleId(tkb.RegisterScheduleId.ToString()); foreach (var a in listTemp) { if (listDetails.Where(x => x.ScheduleDetailId == a.ScheduleDetailId).ToList().Count == 0) { if (listDetails.Where(x => x.ScheduleDetailDayOfWeek.Equals(a.ScheduleDetailDayOfWeek) && x.ScheduleDetailTimeFrom.Hours == a.ScheduleDetailTimeFrom.Hours).ToList().Count > 0) { check = false; } } } } if (check) { bool check2 = true; foreach (var tkb in listTKB) { if (listDetails.Where(x => x.ScheduleDetailDayOfWeek.Equals(tkb.ScheduleDetailDayOfWeek) && x.ScheduleDetailTimeFrom.Hours == tkb.ScheduleDetailTimeFrom.Hours).ToList().Count > 0) { check2 = false; } } if (check2) { if (list.Count > 0) { if (list[0].CountStudie >= 20) { result = "150"; } else { List <TB_REGISTERS> listRegis = new List <TB_REGISTERS>(); listRegis = new TB_REGISTERSSql().FilterByField("RegisterUserId", register.RegisterUserId).Where(x => x.RegisterScheduleId == register.RegisterScheduleId).ToList(); if (listRegis.Count == 0) { if (new TB_REGISTERSSql().Insert(register)) { result = "00"; } else { result = "200"; } } else { result = "300"; } } } } else { result = "400"; } } else { result = "400"; } return(result); }