Beispiel #1
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool AddUser(User_I user)
        {
            using (var factory = new BaseAccess(base._DBConfigPath))
            {
                try
                {
                    //user.UserPassword = (user.UserLoginName + Define._PASSWORDSPLIT + appConfig.DefaultPassword).ToMD5();
                    user.UserPassword = appConfig.DefaultPassword.ToMD5();
                    user.ID           = Guid.NewGuid().ToString();
                    var userDep = new UserOrganizationEntity()
                    {
                        ID             = Guid.NewGuid().ToString(),
                        UserID         = user.ID,
                        OrganizationID = user.UserDeptID,
                        IsDefault      = 1
                    };
                    var model = user.Adapter <UserEntity>(new UserEntity());
                    factory.Insert <UserEntity>(model, false);
                    factory.Insert <UserOrganizationEntity>(userDep, false);
                    factory.Commit();

                    return(true);
                }
                catch (Exception ex)
                {
                    factory.Rollback();
                    return(false);
                }
            }
        }
Beispiel #2
0
 public JsonResult _Add(User_I user)
 {
     try
     {
         if (_UserFacade.Value.AddUser(user))
         {
             return(Json(AjaxResult.Success("用户新增成功,默认密码为:" + appConfig.DefaultPassword)));
         }
         else
         {
             return(Json(AjaxResult.Error("用户新增失败!")));
         }
     }
     catch (Exception ex)
     {
         return(Json(AjaxResult.Error(ex.Message)));
     }
 }
Beispiel #3
0
 /// <summary>
 /// 添加用户
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public bool AddUser(User_I user)
 {
     //不实现
     return(false);
 }