Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
 /*internal abstract bool BlackList(User ToRedlist, string Reason);*/
 internal abstract bool DeBlacklist(User ToRedlist);
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
 //user
 internal abstract User updateUser(User ToUpdate);
Exemplo n.º 9
0
 protected virtual bool seuntjie_SendRain(object sender, User RainOn, double Amount)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 10
0
 internal abstract string GetRedReasonForUser(User GetFor);
Exemplo n.º 11
0
 internal abstract int GetUserStatus(User GetFor);
Exemplo n.º 12
0
 internal abstract LateMessage[] GetMessagesForUser(User ToGet);
Exemplo n.º 13
0
 internal abstract string GetBlackReasonForUser(User GetFor);
Exemplo n.º 14
0
 internal abstract bool DeRedlist(User Itm);
Exemplo n.º 15
0
 void seuntjie_ActiveUsersChanged(User[] ActiveUsers)
 {
     if (InvokeRequired)
     {
         User[] Users = ActiveUsers;
         Invoke(new ActiveChanged(seuntjie_ActiveUsersChanged), Users.ToList<User>());
         return;
     }
 }
Exemplo n.º 16
0
 public static User updateuser(User user)
 {
     return SQLBASE.Instance().updateUser(user);
 }
Exemplo n.º 17
0
        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;
            }
        }
Exemplo n.º 18
0
 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;
     }
 }