/// <summary> /// 更新一条数据 /// </summary> public bool Update(MenuButton model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Auth_MenuButton set "); strSql.Append("MenuId=@MenuId,"); strSql.Append("ButtonId=@ButtonId"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@MenuId", SqlDbType.Int, 4), new SqlParameter("@ButtonId", SqlDbType.Int, 4), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.MenuId; parameters[1].Value = model.ButtonId; parameters[2].Value = model.Id; int rows = MssqlHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Icon model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Auth_Icon set "); strSql.Append("Name=@Name,"); strSql.Append("CreateTime=@CreateTime,"); strSql.Append("Creater=@Creater"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.VarChar, 50), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Creater", SqlDbType.VarChar, 50), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.Name; parameters[1].Value = model.CreateTime; parameters[2].Value = model.Creater; parameters[3].Value = model.Id; int rows = MssqlHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(UserRole model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Auth_UserRole set "); strSql.Append("UserId=@UserId,"); strSql.Append("RoleId=@RoleId"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@RoleId", SqlDbType.Int, 4), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.UserId; parameters[1].Value = model.RoleId; parameters[2].Value = model.Id; int rows = MssqlHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Menu model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Auth_Menu set "); strSql.Append("Name=@Name,"); strSql.Append("Code=@Code,"); strSql.Append("Icon=@Icon,"); strSql.Append("ParentId=@ParentId,"); strSql.Append("Link=@Link,"); strSql.Append("SortIndex=@SortIndex,"); strSql.Append("CreateTime=@CreateTime,"); strSql.Append("Creater=@Creater,"); strSql.Append("Remark=@Remark"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@Code", SqlDbType.VarChar, 50), new SqlParameter("@Icon", SqlDbType.VarChar, 50), new SqlParameter("@ParentId", SqlDbType.Int, 4), new SqlParameter("@Link", SqlDbType.VarChar, 255), new SqlParameter("@SortIndex", SqlDbType.Int, 4), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Creater", SqlDbType.VarChar, 50), new SqlParameter("@Remark", SqlDbType.VarChar, 255), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.Name; parameters[1].Value = model.Code; parameters[2].Value = model.Icon; parameters[3].Value = model.ParentId; parameters[4].Value = model.Link; parameters[5].Value = model.SortIndex; parameters[6].Value = model.CreateTime; parameters[7].Value = model.Creater; parameters[8].Value = model.Remark; parameters[9].Value = model.Id; int rows = MssqlHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(User model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Auth_User set "); strSql.Append("UserName=@UserName,"); strSql.Append("UserPass=@UserPass,"); strSql.Append("NickName=@NickName,"); strSql.Append("Enable=@Enable,"); strSql.Append("Phone=@Phone,"); strSql.Append("Email=@Email,"); strSql.Append("CreateTime=@CreateTime,"); strSql.Append("Creater=@Creater,"); strSql.Append("Remark=@Remark"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@UserName", SqlDbType.VarChar, 50), new SqlParameter("@UserPass", SqlDbType.Char, 32), new SqlParameter("@NickName", SqlDbType.NVarChar, 50), new SqlParameter("@Enable", SqlDbType.Bit, 1), new SqlParameter("@Phone", SqlDbType.Char, 11), new SqlParameter("@Email", SqlDbType.VarChar, 255), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Creater", SqlDbType.VarChar, 50), new SqlParameter("@Remark", SqlDbType.VarChar, 255), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.UserName; parameters[1].Value = model.UserPass; parameters[2].Value = model.NickName; parameters[3].Value = model.Enable; parameters[4].Value = model.Phone; parameters[5].Value = model.Email; parameters[6].Value = model.CreateTime; parameters[7].Value = model.Creater; parameters[8].Value = model.Remark; parameters[9].Value = model.Id; int rows = MssqlHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 批量删除数据 /// </summary> public bool DeleteList(string Idlist) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from Auth_Menu "); strSql.Append(" where Id in (" + Idlist + ") "); int rows = MssqlHelper.ExecuteSql(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 删除一条数据 /// </summary> public bool Delete(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("delete from Auth_Menu "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; int rows = MssqlHelper.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }