public Sys_AllSettingModel Put(Sys_AllSettingModel model) { var sysAllSetting = new Sys_AllSettingEntity { ID = model.ID, Name = model.Name + "_" + model.UserID.ToString(), Value1 = model.Value1, Value2 = model.Value2, ModuleName = model.ModuleName, UserID = model.UserID }; //var service = new Sys_AllSettingServices(); //if (model.ID != Guid.Empty) //{ // sysAllSetting.ID = model.ID; // service.Edit<Sys_AllSettingEntity>(sysAllSetting); //} //else //{ // service.Add<Sys_AllSettingEntity>(sysAllSetting); //} var sysAllSettingServices = new Sys_AttOvertimePermitConfigServices(); sysAllSettingServices.CreateOrUpdateSysAllSetting(sysAllSetting.Name, model.Value1); return model; }
public ActionResult ModuleOptionView(string option) { Sys_AllSettingModel model = new Sys_AllSettingModel(); model.Name = Constant.HRM_CONFIG_MODULE_OPTION; model.Value1 = option; return Json(SaveConfig(model)); }
public ActionResult ChangeLanguage(Sys_UserSettingModel model) { LanguageHelper.LanguageCode = model.LanguageValue; Session[SessionObjects.LanguageCode + (Session[SessionObjects.UserInfoName] == null ? string.Empty : Session[SessionObjects.UserInfoName].ToString())] = model.LanguageValue; //TranslateService.LanguageCode = model.LanguageValue; Sys_AllSettingModel modelLang = new Sys_AllSettingModel() { Name = AppConfig.HRM_SYS_USERSETTING_LANGUAGE.ToString(), Value1 = model.LanguageValue, Value2 = null, UserID = model.UserCreateID, ModuleName = "" }; //Sys_AllSettingModel modelTheme = new Sys_AllSettingModel() //{ // Name = AppConfig.HRM_SYS_USERSETTING_THEME.ToString(), // Value1 = string.IsNullOrEmpty(model.ThemeName) ? EnumDropDown.ETheme.VnResourceDefault.ToString() : model.ThemeName, // Value2 = null, // UserID = model.UserCreateID, // ModuleName = "" //}; List<Sys_AllSettingModel> listModel = new List<Sys_AllSettingModel>(); listModel.Add(modelLang); //listModel.Add(modelTheme); var service = new RestServiceClient<List<Sys_AllSettingModel>>(UserLogin); service.SetCookies(this.Request.Cookies, _hrm_Sys_Service); var result = service.Post(_hrm_Sys_Service, "api/Sys_UserSetting/", listModel); return RedirectToAction("Index"); }
public ActionResult MenuOptionView(string parent, string child) { if (string.IsNullOrEmpty(parent) || string.IsNullOrEmpty(child)) { parent = null; child = null; } Sys_AllSettingModel model = new Sys_AllSettingModel(); model.Name = Constant.HRM_CONFIG_MENU_OPTION; model.Value1 = parent; model.Value2 = child; return Json(SaveConfig(model)); }
// GET api/<controller>/5 public Sys_AllSettingModel Get(Guid id) { string status = string.Empty; var service = new Sys_AllSettingServices(); var result = service.GetById<Sys_AllSettingEntity>(id, ref status); var Sys_AllSetting = new Sys_AllSettingModel { ID = result.ID, Name = result.Name, Value1 = result.Value1, Value2 = result.Value2, ModuleName = result.ModuleName }; return Sys_AllSetting; }
public ActionResult ChangeLanguage(Sys_UserSettingModel model) { var isAccess = CheckPermission(UserId, PrivilegeType.Create, ConstantPermission.Sys_UserSetting); if (!isAccess) { return PartialView("AccessDenied"); } TranslateService.LanguageCode = model.LanguageValue; Sys_AllSettingModel modelLang = new Sys_AllSettingModel() { Name = AppConfig.HRM_SYS_USERSETTING_LANGUAGE.ToString(), Value1 = model.LanguageValue, Value2 = null, UserID = model.UserCreateID, ModuleName = "" }; //Sys_AllSettingModel modelTheme = new Sys_AllSettingModel() //{ // Name = AppConfig.HRM_SYS_USERSETTING_THEME.ToString(), // Value1 = string.IsNullOrEmpty(model.ThemeName) ? EnumDropDown.ETheme.VnResourceDefault.ToString() : model.ThemeName, // Value2 = null, // UserID = model.UserCreateID, // ModuleName = "" //}; List<Sys_AllSettingModel> listModel = new List<Sys_AllSettingModel>(); listModel.Add(modelLang); //listModel.Add(modelTheme); var service = new RestServiceClient<List<Sys_AllSettingModel>>(); service.SetCookies(this.Request.Cookies, _hrm_Sys_Service); var result = service.Post(_hrm_Sys_Service, "api/Sys_UserSetting/", listModel); return RedirectToAction("Index"); }
public Sys_AllSettingModel Put(Sys_AllSettingModel model) { var sysAllSetting = new Sys_AllSettingEntity { ID = model.ID, Name = model.Name, Value1 = model.Value1, Value2 = model.Value2, ModuleName = model.ModuleName, UserID = model.UserID }; var service = new Sys_AllSettingServices(); if (model.ID != Guid.Empty) { sysAllSetting.ID = model.ID; service.Edit<Sys_AllSettingEntity>(sysAllSetting); } else { service.Add<Sys_AllSettingEntity>(sysAllSetting); } return model; }
public Sys_AllSettingModel SaveConfig(Sys_AllSettingModel model) { var service = new RestServiceClient<Sys_AllSettingModel>(UserLogin); var dbModel = service.Get(_hrm_Sys_Service, "api/MenuOption/", model.Name); if (dbModel != null) { model.ID = dbModel.ID; } service.SetCookies(this.Request.Cookies, _hrm_Sys_Service); var result = service.Put(_hrm_Sys_Service, "api/Sys_AllSetting/", model); return model; }
public ActionResult DashboardOptionView(string text) { Sys_AllSettingModel model = new Sys_AllSettingModel(); model.Name = Constant.HRM_CONFIG_DASHBOARD_OPTION; model.Value1 = text; return Json(SaveConfig(model)); }
public ActionResult Index(string userLogin) { var userId = Session[SessionObjects.UserId] == null ? Guid.Empty : (Guid)Session[SessionObjects.UserId]; var listPermission = new List<string>(); if (userId != Guid.Empty) { var service = new RestServiceClient<TempPermissionModel>(UserLogin); service.SetCookies(this.Request.Cookies, _hrm_Sys_Service); var result = service.Get(_hrm_Sys_Service, "api/SysPermission/", userId); if (result != null && result.Data.Any()) { if (!string.IsNullOrEmpty(_portal_Permission)) { List<string> listConfigPermission = _portal_Permission.Split(',').ToList(); listPermission = result.Data.Where(listConfigPermission.Contains).ToList(); } else { listPermission = result.Data; } } ViewBag.ListPermission = listPermission; #region Xử lý code để kiểm tra có cấu hình riêng cho khách hàng ko ActionService actionService = new ActionService(UserLogin); Sys_AllSettingModel model = new Sys_AllSettingModel(); string status = string.Empty; var logoPath = "/Content/images/logo/"; var logoFile = "logo-vnr.png"; var defaultLogo = logoPath + logoFile; string clientId = null; string chartDefault = null; var setting = actionService.GetData<Sys_AllSettingEntity>("CLIENT_ID", ConstantSql.hrm_sys_sp_get_AllSettingByKey, ref status); var objOvertime = new List<object>(); objOvertime.AddRange(new object[13]); objOvertime[5] = "E_SUBMIT,E_FIRST_APPROVED"; objOvertime[8] = userId; objOvertime[11] = 1; objOvertime[12] = int.MaxValue - 1; var listOvertime = actionService.GetData<Att_OvertimeEntity>(objOvertime, ConstantSql.hrm_att_sp_get_Overtime, ref status).ToList(); var listOvertimeEntity = listOvertime.Where(s => !(s.Status == LeaveDayStatus.E_FIRST_APPROVED.ToString() && s.UserApproveID == userId)).ToList(); var objLeaveday = new List<object>(); objLeaveday.AddRange(new object[11]); objLeaveday[2] = "E_SUBMIT,E_FIRST_APPROVED"; objLeaveday[7] = userId; objLeaveday[9] = 1; objLeaveday[10] = int.MaxValue - 1; var lstLeaveday = actionService.GetData<Att_LeaveDayEntity>(objLeaveday, ConstantSql.hrm_att_sp_get_Leaveday, ref status).ToList(); var listLeavedayOvertime = lstLeaveday.Where(s => !(s.Status == OverTimeStatus.E_FIRST_APPROVED.ToString() && s.UserApproveID == userId)).ToList(); model.Value3 = listOvertimeEntity.Count().ToString(); model.Value4 = listLeavedayOvertime.Count().ToString(); if (setting != null && setting.Count > 0) { model = setting.FirstOrDefault().CopyData<Sys_AllSettingModel>(); if (string.IsNullOrEmpty(model.Value2)) { model.Value2 = defaultLogo; } else { model.Value2 = logoPath + model.Value2; } defaultLogo = model.Value2; clientId = model.Value1; if (!string.IsNullOrEmpty(model.Value4)) { chartDefault = logoPath + "charts/" + model.Value4; } } Session["Chart"] = chartDefault; Session["CLIENT_ID"] = clientId; Session["LogoPath"] = defaultLogo; #endregion GeneralProfileDetail(userLogin); return GetView(model); } return GetView(); }
public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Sys_AllSettingModel model) { if (ModelState.IsValid) { var service = new RestServiceClient<Sys_AllSettingModel>(UserLogin); service.SetCookies(this.Request.Cookies, _hrm_Sys_Service); var result = service.Put(_hrm_Sys_Service, "api/Sys_AllSetting/", model); //return Json(result); //ViewBag.MsgUpdate = ConstantDisplay.HRM_Category_Position_UpdateSuccess.TranslateString(); } return View(); }
public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Sys_AllSettingModel model) { var isAccess = CheckPermission(UserId, PrivilegeType.Modify, ConstantPermission.Sys_AllSetting); if (!isAccess) { return PartialView("AccessDenied"); } if (ModelState.IsValid) { var service = new RestServiceClient<Sys_AllSettingModel>(); service.SetCookies(this.Request.Cookies, _hrm_Sys_Service); var result = service.Put(_hrm_Sys_Service, "api/Sys_AllSetting/", model); //return Json(result); //ViewBag.MsgUpdate = ConstantDisplay.HRM_Category_Position_UpdateSuccess.TranslateString(); } return View(); }