public bool Add(out string message) { try { if (UserInfoDA.FindAll(string.Format("where [LoginName]='{0}'", LoginName)).Count > 0) { message = "登陆帐号已经存在!"; return(false); } m_UserInfoDA.Edition = CurrentUser.Instance.User.Edition; m_UserInfoDA.Insert(); m_UserInfoDA.Save(); message = "添加用户成功!"; return(true); } catch (Exception exception) { Loger.Instance.WriteErrorLog(exception.Message); message = "添加用户失败!"; return(false); } }
public bool Add() { try { //版本 m_EditionDA.Insert(); m_EditionDA.Save(); //版本功能 m_EditionDA.ID = m_EditionDA.GetInsertID(); InsertEditionModule(); //角色 Role role = new Role(); role.Name = "系统管理员角色"; role.IsDefault = true; role.Modules = Modules; role.Add(ID); //用户 UserInfoDA userInfo = new UserInfoDA(); userInfo.UserName = "******"; userInfo.LoginName = string.Format("admin_{0}_{1}", ID, role.ID); userInfo.Password = "******"; userInfo.Role = role.ID; userInfo.Edition = ID; userInfo.IsDefault = true; userInfo.Description = Name; userInfo.Insert(); userInfo.Save(); return(true); } catch (Exception exception) { Loger.Instance.WriteErrorLog(exception.Message); return(false); } }