示例#1
0
        //POPULATE SERVICES
        public static void populateServices(Customer_info customer)
        {
            foreach (Request req in customer.Requests)
            {
                var db = DBConnection.Instance();
                db.DatabaseName = "sql9235287";

                if (db.IsConnect())
                {
                    string query = string.Format("SELECT * FROM Service WHERE VID='{0}'", req.VID);
                    var    cmd   = new MySqlCommand(query, db.Connection);
                    cmd.CommandType = System.Data.CommandType.Text;
                    var reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        req.ManageServices.Add(new Service(reader.GetString(0), reader.GetString(1),
                                                           reader.GetString(2), reader.GetString(3),
                                                           reader.GetFloat(4), reader.GetBoolean(5)));
                    }

                    db.Close();
                }
            }
        }
示例#2
0
        //normal login
        public static void customerLogin(string Login, string Password, Customer_info customer)
        {
            var db = DBConnection.Instance();

            db.DatabaseName = "sql9235287";
            if (db.IsConnect())
            {
                string query = string.Format("SELECT * FROM Customer_info WHERE Login='******' AND Password='******'", Login, Password);
                var    cmd   = new MySqlCommand(query, db.Connection);
                cmd.CommandType = System.Data.CommandType.Text;
                var reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    customer.FName    = reader.GetString(0);
                    customer.LName    = reader.GetString(1);
                    customer.Address  = reader.GetString(2);
                    customer.Number   = reader.GetString(3);
                    customer.ID       = reader.GetString(4);
                    customer.Login    = reader.GetString(5);
                    customer.Password = reader.GetString(6);
                }

                db.Close();
            }
        }
示例#3
0
        //POPULATE REQUESTS
        public static void populateRequests(Customer_info customer)
        {
            var db = DBConnection.Instance();

            db.DatabaseName = "sql9235287";
            if (db.IsConnect())
            {
                string query = string.Format("SELECT * FROM Request WHERE CustomerID='{0}'", customer.ID);
                var    cmd   = new MySqlCommand(query, db.Connection);
                cmd.CommandType = System.Data.CommandType.Text;
                var reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    customer.Requests.Add(new Request(reader.GetString(0), reader.GetString(1),
                                                      reader.GetString(2), reader.GetString(3),
                                                      reader.GetString(4), reader.GetString(5),
                                                      reader.GetString(6), reader.GetString(7)));
                }

                db.Close();
            }
        }