Esempio n. 1
0
        public override ModelBase ColumnMapper(DataTable dt)
        {
            HeckUser item = new HeckUser();

            item.ID             = Convert.ToInt32(dt.Rows[0][0]);
            item.GuildID        = Convert.ToInt32(dt.Rows[0][1]);
            item.Snowflake      = Convert.ToString(dt.Rows[0][2]);
            item.UserName       = Convert.ToString(dt.Rows[0][3]);
            item.AvailableHecks = Convert.ToInt32(dt.Rows[0][4]);
            item.CreatedDate    = Convert.ToDateTime(dt.Rows[0][5]);
            return(item);
        }
Esempio n. 2
0
        public ModelBase ColumnMapper(DataRow dr)
        {
            HeckUser item = new HeckUser();

            item.ID             = Convert.ToInt32(dr[0]);
            item.GuildID        = Convert.ToInt32(dr[1]);
            item.Snowflake      = Convert.ToString(dr[2]);
            item.UserName       = Convert.ToString(dr[3]);
            item.AvailableHecks = Convert.ToInt32(dr[4]);
            item.CreatedDate    = Convert.ToDateTime(dr[5]);
            return(item);
        }
Esempio n. 3
0
        public DataResponse GetUserByID(int UserID)
        {
            DataResponse resp = null;
            DataTable    dt   = null;
            //create query
            string query = string.Format("select * from `heckuser` where ID = {0}", UserID.ToString());

            if (RunQuery(query, out dt))
            {
                HeckUser item = ColumnMapper(dt) as HeckUser;
                resp      = new DataResponse("Heck user Found", true);
                resp.Item = item;
            }
            else
            {
                resp = new DataResponse("Heck user not found by ID (" + UserID.ToString() + ").", false);
            }
            return(resp);
        }
Esempio n. 4
0
        public DataResponse GetUserBySnowflakeAndGuildID(string Snowflake, int GuildID)
        {
            DataResponse resp = null;
            DataTable    dt   = null;
            //create query
            string query = string.Format("select * from `heckuser` where DiscordSnowflake = '{0}' AND GuildID = {1}", Snowflake, GuildID.ToString());

            if (RunQuery(query, out dt))
            {
                HeckUser item = ColumnMapper(dt) as HeckUser;
                resp      = new DataResponse("Heck user Found", true);
                resp.Item = item;
            }
            else
            {
                resp = new DataResponse("Heck user not found by snowflake (" + Snowflake + ") and guild id (" + GuildID.ToString() + ").", false);
            }
            return(resp);
        }
Esempio n. 5
0
        public List <HeckUser> GetAllUsersByGuildID(int GuildID)
        {
            List <HeckUser> lst = new List <HeckUser>();
            DataTable       dt  = null;
            //create query
            string query = string.Format("select * from `heckuser` where GuildID = {0}", GuildID.ToString());

            if (RunQuery(query, out dt))
            {
                foreach (DataRow dr in dt.Rows)
                {
                    HeckUser item = ColumnMapper(dr) as HeckUser;
                    lst.Add(item);
                }
            }
            else
            {
                Console.WriteLine("Heck users not found by Guild ID (" + GuildID.ToString() + ").", false);
            }
            return(lst);
        }