/// <summary> /// 增加用户 /// </summary> /// <param name="user"></param> /// <param name="msg">返回成功/错误信息</param> /// <returns>是否成功</returns> public static bool Add(User user, out string msg) { UserService service = new UserService(); try { if (service.SearchUserByAccount(user.Account) != null) { msg = EXIST_USER; return(false); } else { if (service.AddUser(user)) { msg = ADD_SUCCESS; return(true); } else { msg = ADD_FAIL; return(false); } } } catch (Exception e) { Console.WriteLine("\n异常信息:\n{0}", e.Message); msg = ADD_FAIL; return(false); } finally { service.CloseConnection(); } }
/// <summary> /// 添加用户 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool AddUser(ref Model.User model, out string errMsg) { return(UserService.AddUser(ref model, out errMsg)); }