internal override bool DeRedlist(User ToRedlist) { SqlConnection sqcon = GetCon(); bool success = false; SqlCommand com = new SqlCommand("redlist_remove", sqcon); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.AddWithValue("username", ToRedlist.Uid); try { sqcon.Open(); com.ExecuteNonQuery(); success = true; } catch (Exception e) { success = false; } sqcon.Close(); return success; }
internal override int GetUserStatus(User GetFor) { SqlConnection sqcon = GetCon(); int status = 0; SqlCommand com = new SqlCommand("getstatus", sqcon); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.AddWithValue("uid", GetFor.Uid); try { sqcon.Open(); SqlDataReader Reader = com.ExecuteReader(); if (Reader.Read()) { status = (int)Reader["status"]; } } catch (Exception e) { } sqcon.Close(); return status; }
internal override User updateUser(User ToUpdate) { User tmp = null; SqlConnection sqcon = GetCon(); try { SqlCommand com = new SqlCommand("USER_EDIT", sqcon); sqcon.Open(); com.CommandType = System.Data.CommandType.StoredProcedure; com.Parameters.AddWithValue("USERNAME", ToUpdate.Username); com.Parameters.AddWithValue("ADDRESS", ToUpdate.Address); com.Parameters.AddWithValue("TITLE", ToUpdate.Title); com.Parameters.AddWithValue("NOTE", ToUpdate.Note); com.Parameters.AddWithValue("USERTYPE", ToUpdate.UserType); com.Parameters.AddWithValue("lastwarning", ToUpdate.lastwarning); //if (ToUpdate.Uid != -1) { com.Parameters.AddWithValue("UID", ToUpdate.Uid); } SqlDataReader Reader = com.ExecuteReader(); if (Reader.Read()) tmp = UserParser(Reader); } catch { } sqcon.Close(); return tmp; }
internal override LateMessage[] GetMessagesForUser(User ToGet) { List<LateMessage> tmp = new List<LateMessage>(); SqlConnection sqcon = GetCon(); try { sqcon.Open(); SqlCommand Command = new SqlCommand("GetLateMessage", sqcon); Command.CommandType = System.Data.CommandType.StoredProcedure; Command.Parameters.AddWithValue("uid", ToGet.Uid); SqlDataReader Reader = Command.ExecuteReader(); while (Reader.Read()) { tmp.Add(MsgParser(Reader)); } } catch { } sqcon.Close(); return tmp.ToArray(); }
internal override string GetRedReasonForUser(User GetFor) { string tmp = null; SqlConnection sqcon = GetCon(); try { sqcon.Open(); SqlCommand Command = new SqlCommand("redlist_get_reason", sqcon); Command.CommandType = System.Data.CommandType.StoredProcedure; Command.Parameters.AddWithValue("uid", GetFor.Uid); SqlDataReader Reader = Command.ExecuteReader(); if (Reader.Read()) { tmp = (string)Reader["reason"]; } } catch { } sqcon.Close(); return tmp; }
/*internal abstract bool BlackList(User ToRedlist, string Reason);*/ internal abstract bool DeBlacklist(User ToRedlist);
public bool Equals(User other) { try { if (other.Username.ToLower() == Username.ToLower()) return true; } catch { } try { if (other.Uid == Uid && Uid != -1) return true; } catch { } return false; }
//user internal abstract User updateUser(User ToUpdate);
protected virtual bool seuntjie_SendRain(object sender, User RainOn, double Amount) { throw new NotImplementedException(); }
internal abstract string GetRedReasonForUser(User GetFor);
internal abstract int GetUserStatus(User GetFor);
internal abstract LateMessage[] GetMessagesForUser(User ToGet);
internal abstract string GetBlackReasonForUser(User GetFor);
internal abstract bool DeRedlist(User Itm);
void seuntjie_ActiveUsersChanged(User[] ActiveUsers) { if (InvokeRequired) { User[] Users = ActiveUsers; Invoke(new ActiveChanged(seuntjie_ActiveUsersChanged), Users.ToList<User>()); return; } }
public static User updateuser(User user) { return SQLBASE.Instance().updateUser(user); }
bool seuntjie_SendRain(User RainOn, double Amount) { string s1 = Client.GetStringAsync("ajax.php?a=get_csrf").Result; MDCsrf tmp = SeuntjieBot.SeuntjieBot.JsonDeserialize<MDCsrf>(s1); List<KeyValuePair<string, string>> pairs = new List<KeyValuePair<string, string>>(); pairs.Add(new KeyValuePair<string, string>("a", "tip_user")); pairs.Add(new KeyValuePair<string, string>("user_id", RainOn.Uid.ToString())); pairs.Add(new KeyValuePair<string, string>("amount", Amount.ToString(System.Globalization.NumberFormatInfo.InvariantInfo))); pairs.Add(new KeyValuePair<string, string>("csrf", tmp.csrf)); FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs); try { string sEmitResponse = Client.PostAsync("ajax.php", Content).Result.Content.ReadAsStringAsync().Result; return true; } catch (AggregateException e) { return false; } }
internal User UserParser(System.Data.IDataReader Reader) { try { User tmp = new User(); tmp.Username = (string)Reader["username"]; tmp.Title = !(Reader["title"] is DBNull)?(string)Reader["title"]:""; tmp.Note = !(Reader["note"] is DBNull)? (string)Reader["note"] : ""; tmp.UserType = (string)Reader["Usertype"]; tmp.Address = !(Reader["address"] is DBNull)? (string)Reader["address"] : ""; tmp.Uid = (int)Reader["uid"]; tmp.LastSeen = !(Reader["lastactive"] is DBNull)? (DateTime)Reader["lastactive"] : new DateTime(); tmp.LastMessage = !(Reader["lastmessage"] is DBNull)? (string)Reader["lastmessage"] : ""; tmp.rain = !(Reader["rained"] is DBNull)? (double)(decimal)Reader["rained"] : 0; tmp.balance = !(Reader["balance"] is DBNull) ? (double)(decimal)Reader["balance"] : 0; tmp.times = !(Reader["times"] is DBNull) ? (int)Reader["times"] : 0; tmp.Listed = GetUserStatus(tmp); tmp.MessageFor = GetMessagesForUser(tmp); tmp.lastwarning = !(Reader["lastwarning"] is DBNull) ? (DateTime)Reader["lastwarning"] : new DateTime(); return tmp; } catch { return null; } }