public ListItem ListItemParser(IDataReader Reader) { ListItem tmp = null; { try { ListItem tmp2 = new ListItem(); tmp2.active = (bool)Reader["active"]; tmp2.reason = (string)Reader["[reason]"]; tmp2.mutingid = (int)Reader["[user_id]"]; tmp2.uid = (int)Reader["[uid]"]; tmp2.time = (DateTime)Reader["[time]"]; tmp2.until = (DateTime)Reader["[until]"]; tmp2.oid = (int)Reader["[oid]"]; tmp2.redlist = (bool)Reader["[redlist]"]; tmp = tmp2; } catch { } } return tmp; }
internal override bool Redlist(ListItem Itm) { SqlConnection sqcon = GetCon(); bool success = false; SqlCommand com = new SqlCommand("UpdateRedlist", sqcon); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.AddWithValue("uid", Itm.uid); com.Parameters.AddWithValue("reason", Itm.reason); com.Parameters.AddWithValue("user_id", Itm.mutingid); com.Parameters.AddWithValue("active", Itm.active); com.Parameters.AddWithValue("time", Itm.time); com.Parameters.AddWithValue("until", Itm.until>Itm.time?Itm.until:Itm.time.AddYears(1)); com.Parameters.AddWithValue("redlist", Itm.redlist); com.Parameters.AddWithValue("oid", Itm.oid); try { sqcon.Open(); com.ExecuteNonQuery(); success = true; } catch (Exception e) { success = false; } sqcon.Close(); return success; }
internal abstract bool Redlist(ListItem Itm);