public static void Update(int id) { string sql = @"update Users set [Status]=[Status]%2+1 where Id=@id"; SqlParam p = new SqlParam(); p.AddParam("@id", id, SqlDbType.Int, 0); ProjectDB.SqlExecute(sql, p); UnicornCache.Remove(CacheKey.User); }
public static void Update(int id, string username, string password) { string sql = @"update Users set Password=@Password where Id=@id"; SqlParam p = new SqlParam(); p.AddParam("@id", id, SqlDbType.Int, 0); p.AddParam("@Password", St.GetMd5(username + password), SqlDbType.VarChar, 100); ProjectDB.SqlExecute(sql, p); UnicornCache.Remove(CacheKey.User); }
public static void Add(string code, string name, int type, string remark) { string sql = @"insert into Dics(Code,Name,Type,Remark) values(@Code,@Name,@Type,@Remark)"; SqlParam p = new SqlParam(); p.AddParam("@Code", code, SqlDbType.VarChar, 50); p.AddParam("@Name", name, SqlDbType.VarChar, 50); p.AddParam("@Type", type, SqlDbType.Int, 0); p.AddParam("@Remark", remark, SqlDbType.VarChar, 50); ProjectDB.SqlExecute(sql, p); UnicornCache.Remove(CacheKey.Dic); }
public static void Update(int id, string code, string name, int type, string remark) { string sql = @"update Dics set Code=@Code,Name=@Name,Type=@Type,Remark=@Remark where Id=@id"; SqlParam p = new SqlParam(); p.AddParam("@id", id, SqlDbType.Int, 0); p.AddParam("@Code", code, SqlDbType.VarChar, 50); p.AddParam("@Name", name, SqlDbType.VarChar, 50); p.AddParam("@Type", type, SqlDbType.Int, 0); p.AddParam("@Remark", remark, SqlDbType.VarChar, 50); ProjectDB.SqlExecute(sql, p); UnicornCache.Remove(CacheKey.Dic); }
public static void Add(string username, string realname, int userrole, DateTime leavetime, int bugzillaid) { string sql = @" if exists(select Id from Users where UserName=@UserName) update Users set RealName=@RealName,RoleType=@RoleType,LeaveTime=@LeaveTime,bugzillaid=@bugzillaid where UserName=@UserName else insert into Users(UserName,Password,RealName,RoleType,Status,LeaveTime,bugzillaid) values(@UserName,@Password,@RealName,@RoleType,1,@LeaveTime,@bugzillaid)" ; SqlParam p = new SqlParam(); p.AddParam("@UserName", username, SqlDbType.VarChar, 100); p.AddParam("@RealName", realname, SqlDbType.VarChar, 500); p.AddParam("@RoleType", userrole, SqlDbType.Int, 0); p.AddParam("@Password", St.GetMd5(username + "123456"), SqlDbType.VarChar, 100); p.AddParam("@LeaveTime", leavetime, SqlDbType.DateTime, 0); p.AddParam("@bugzillaid", bugzillaid, SqlDbType.Int, 0); ProjectDB.SqlExecute(sql, p); UnicornCache.Remove(CacheKey.User); }