コード例 #1
0
ファイル: Sys_UserController.cs プロジェクト: dtafe/vnr
        public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Sys_UserModel user)
        {
            var isAccess = CheckPermission(UserId, PrivilegeType.Modify, ConstantPermission.Sys_User);
            if (!isAccess)
            {
                return PartialView("AccessDenied");
            }

            //if (ModelState.IsValid)
            //{
                var service = new RestServiceClient<Sys_UserModel>();
                service.SetCookies(this.Request.Cookies, _hrm_Sys_Service);
                var result = service.Put(_hrm_Sys_Service, "api/Sys_User/", user);
                //return Json(result);
                //ViewBag.MsgUpdate = "Update success";
            //}
                return Json(result);
        }
コード例 #2
0
ファイル: Sys_UserController.cs プロジェクト: dtafe/vnr
        // GET api/<controller>/5
        public Sys_UserModel Get(Guid id)
        {
            var profileName = string.Empty;
            var service = new Sys_UserServices();
            // var result = service.GetById<Sys_UserInfoEntity>(id, ref status);

            ActionService actionService = new ActionService(UserLogin);
            var result = actionService.GetByIdUseStore<Sys_UserInfoEntity>(id, ConstantSql.hrm_sys_sp_get_UserbyId, ref status);

          

            if (result == null)
            {
                return new Sys_UserModel();
            }

            #region Get ProfileName
            var userService = new Sys_UserServices();
            var profile = userService.GetProfileName(result.ProfileID ?? Guid.Empty);
            var profileID = Guid.Empty;
            if (profile != null)
            {
                profileName = profile.ProfileName;
                profileID = profile.ID;
            }
            #endregion

            var Sys_UserEntity = new Sys_UserModel
            {
                ID = result.ID,
                Code = result.Code,
                UserType = result.UserType,
                UserInfoName = result.UserInfoName,
                UserInfoName1 = result.UserInfoName,
                UserLogin = result.UserLogin,
                FullName = result.FullName,
                Password = result.Password,
                Email = result.Email,
                EffectedDate = result.DateEnd,
                ProfileName = profileName,
                ProfileID = profileID,
                IsActivate = result.IsActivate,
                IsCheckLDAP = result.IsCheckLDAP,
                Description = result.Description,
                LDAPDatasource = result.LDAPDatasource,
            };

            #region Tự động load ds các dự án vào multiSelect control
            var sysUserService = new Sys_UserServices();
            var masterDataGroup = sysUserService.GetMultiCatTableForDashBoard(id);
            var dic = new Dictionary<Guid, string>();
            foreach (var item in masterDataGroup)
            {
                dic.Add(item.ID, item.MasterDataGroupName);
            }
            Sys_UserEntity.MasterDataGroups = dic; 
            #endregion

            return Sys_UserEntity;

        }
コード例 #3
0
ファイル: Sys_UserController.cs プロジェクト: dtafe/vnr
        public ActionResult Edit([DataSourceRequest] DataSourceRequest request, Sys_UserModel user)
        {

            //if (ModelState.IsValid)
            //{
            var service = new RestServiceClient<Sys_UserModel>(UserLogin);
                service.SetCookies(this.Request.Cookies, _hrm_Sys_Service);
                var result = service.Put(_hrm_Sys_Service, "api/Sys_User/", user);
                //return Json(result);
                //ViewBag.MsgUpdate = "Update success";
            //}
                return Json(result);
        }
コード例 #4
0
ファイル: Sys_UserController.cs プロジェクト: dtafe/vnr
        public Sys_UserModel Put(Sys_UserModel model)
        {
            var Sys_UserEntity = new Sys_UserInfoEntity
            {
                ID = model.ID,
                Code = model.Code,
                UserType = model.UserType,
                UserInfoName = model.UserInfoName,
                UserLogin = model.UserLogin,
                Password = model.Password,
                IsActivate = model.IsActivate,
                IsCheckLDAP = model.IsCheckLDAP,
                LDAPDatasource = model.LDAPDatasource,
            };
            var service = new Sys_UserServices();
            if (model.ID != Guid.Empty)
            {
                Sys_UserEntity.ID = model.ID;
                service.Edit<Sys_UserInfoEntity>(Sys_UserEntity);
            }
            else
            {
                service.Add<Sys_UserInfoEntity>(Sys_UserEntity);
            }

            return model;
        }