Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
 public void ChangeLanguage(Sys_UserSettingModel model)
 {
     if (string.IsNullOrEmpty(model.LanguageValue))
     {
         model.LanguageValue = Constant.VN;
     }
     VnResource.Helper.Utility.LanguageHelper.LanguageCode = model.LanguageValue;
 }
Ejemplo n.º 3
0
 public Sys_UserSettingModel Getbyid(Guid id)
 {
     var service = new Sys_AttOvertimePermitConfigServices();
     var language = service.GetConfigValue<string>(AppConfig.HRM_SYS_USERSETTING_LANGUAGE.ToString()+"_"+id.ToString());
     var theme = service.GetConfigValue<string>(AppConfig.HRM_SYS_USERSETTING_THEME + "_" + id.ToString());
     var userSetting = new Sys_UserSettingModel()
     {
         LanguageName = language,
         ThemeName = theme,
         UserCreateID = id
     };
     return userSetting;
 }
Ejemplo n.º 4
0
        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");
        }