Ejemplo n.º 1
0
        public void setUsers(string sql_query)
        {
            SqlConnModel.setData(sql_query);
            MySqlDataReader reader = SqlConnModel.getData();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    int id = reader.GetInt32(reader.GetOrdinal("id"));
                    String name = reader.GetString(reader.GetOrdinal("name"));
                    String email = reader.GetString(reader.GetOrdinal("email"));
                    String cellnumber = reader.GetString(reader.GetOrdinal("cellnumber"));
                    String profile_pic = reader.GetString(reader.GetOrdinal("profile_pic"));
                    String type = reader.GetString(reader.GetOrdinal("type"));

                    var columns = new JObject();
                    columns["id"] = id.ToString();
                    columns["name"] = name;
                    columns["email"] = email;
                    columns["cellnumber"] = cellnumber;
                    columns["profile_pic"] = profile_pic;
                    columns["type"] = type;

                    this.rows.Add(columns);
                }
            }
        }
Ejemplo n.º 2
0
        public void setStyles(string sql_query)
        {
            SqlConnModel.setData(sql_query);
            MySqlDataReader reader = SqlConnModel.getData();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    int    id    = reader.GetInt32(reader.GetOrdinal("id"));
                    String name  = reader.GetString(reader.GetOrdinal("name"));
                    String email = reader.GetString(reader.GetOrdinal("details"));
                    int    price = reader.GetInt32(reader.GetOrdinal("price"));
                    String image = reader.GetString(reader.GetOrdinal("image"));

                    var columns = new JObject();
                    columns["id"]    = id.ToString();
                    columns["name"]  = name;
                    columns["email"] = email;
                    columns["price"] = price;
                    columns["image"] = image;

                    this.rows.Add(columns);
                }
            }
        }
Ejemplo n.º 3
0
        internal void setBooking(string sql_query)
        {
            //execute sql query
            SqlConnModel.setData(sql_query);
            MySqlDataReader reader = SqlConnModel.getData();

            if (reader.HasRows)
            {
                int n = 1;

                //if query results are returned... build a Json array for the results
                while (reader.Read())
                {
                    int    id       = reader.GetInt32(reader.GetOrdinal("id"));
                    int    _styleid = reader.GetInt32(reader.GetOrdinal("style_id"));
                    string start    = reader.GetDateTime(reader.GetOrdinal("start")).ToString("yyyy-MM-dd HH:mm:ss");
                    String end      = reader.GetDateTime(reader.GetOrdinal("end")).ToString("yyyy-MM-dd HH:mm:ss");

                    //get style name by id

                    dynamic responseListObj = this.stylesArray.OfType <JObject>().ToList();
                    int     styleID         = _styleid - 1;
                    string  styleName       = responseListObj[styleID]["name"];

                    //"[{\"id\":\"5\",\"text\":\"Germen Cut\",\"start\":\"2019-10-18T10:30:00\",\"end\":\"2019-10-18T11:30:00\"}]"
                    var columns = new JObject();
                    columns["id"]    = n;
                    columns["text"]  = styleName;
                    columns["start"] = start.Replace(" ", "T");
                    columns["end"]   = end.Replace(" ", "T");

                    this.rows.Add(columns);
                    n++;
                }
            }
        }