public string AddUser(UserEntity userEntity, string Pwd) { UserBll userBll = new UserBll(); userEntity.Photo = "/Content/img/photo/photo16.jpg" ; int result = userBll.AddUser(userEntity, Pwd); return result.ToString(); }
public UserSingleEntitiy(UserEntity user) { Rights = new List<string>(); foreach (FieldInfo fi in typeof(UserEntity).GetFields()) { FieldInfo appNameInfo = typeof(UserSingleEntitiy).GetField(fi.Name); appNameInfo.SetValue(this, fi.GetValue(user)); } }
/// <summary>添加用户 /// </summary> /// <param name="userEntity"></param> /// <returns>1:成功 -1:失败 -2:已存在相同用户</returns> public int AddUser(UserEntity userEntity, string pwd) { UserDal userDal = new UserDal(); if (!userDal.ExistUId(userEntity.Uid)) { return userDal.AddUser(userEntity, pwd) ? 1 : -1; } return -2; }
private UserEntity Conver2Entity(DataRow dataRow) { UserEntity userEntity = new UserEntity(); userEntity.Name = dataRow["Name"].ToString(); userEntity.Photo = dataRow["Photo"] == DBNull.Value ? "/Content/Img/Photo/photo16.jpg" : dataRow["Photo"].ToString(); userEntity.RolesIds = dataRow["RolesIds"].ToString(); userEntity.Uid = dataRow["Uid"].ToString(); userEntity.Status = Int32.Parse(dataRow["Status"].ToString()); return userEntity; }
public void InitDb() { UserEntity user = new UserEntity(); user.Name = "超级管理员"; user.Photo = ""; user.RolesIds = ""; user.Status = 1; user.Uid = UserBll.SuperAdminID;// "sys_root"; new DbCheckDal().InitDb(user); }
public bool AddUser(UserEntity userEntity, string pwd) { string sql = "Insert into t_users (Uid,Name,Photo,Status,PassWord ) values (@uId,@Name,@Photo,@status,@passWord)"; SQLiteParameter[] para = new SQLiteParameter[] { new SQLiteParameter("@status", userEntity.Status), new SQLiteParameter("@Name", userEntity.Name), new SQLiteParameter("@Photo", userEntity.Photo), new SQLiteParameter("@uId", userEntity.Uid), new SQLiteParameter("@passWord", pwd), }; int result = new SqlLiteHelper().RunSQL(sql, para); return result > 0; }
/// <summary>初始化数据库 /// </summary> public void InitDb(UserEntity user) { SqlLiteHelper herpler = new SqlLiteHelper(); if (herpler.InitDb()) { new LoginDal().creatTable(herpler); new PluginDal().creatTable(herpler); new RightDal().creatTable(herpler); new RoleDal().creatTable(herpler); new UserDal().creatTable(herpler); new UserDal().AddUser(user, EncryptionFunc.MD5Encrypt(user.Uid+"\f123456")); } }