예제 #1
0
        public choresPending GetChoresPending(int id)
        {
            choresPending CP = new choresPending();

            using (SQLiteCommand sqlite_cmd = SQLITE_CONNECTION.CreateCommand())
            {
                sqlite_cmd.CommandText = string.Format("SELECT changeOil, changeTyres, washCar, engineService FROM pendingClientOrder WHERE rowid='{0}'", id);

                using (SQLiteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader())
                {
                    while (sqlite_datareader.Read())
                    {
                        //KODEL SKAITO PIRMA DUKART?

                        CP.changeOil     = Boolean.Parse(sqlite_datareader.GetString(0));
                        CP.changeTyres   = Boolean.Parse(sqlite_datareader.GetString(1));
                        CP.washCar       = Boolean.Parse(sqlite_datareader.GetString(2));
                        CP.engineService = Boolean.Parse(sqlite_datareader.GetString(3));

                        //MessageBox.Show(id + CP.changeOil.ToString() + CP.changeTyres + CP.washCar + CP.engineService);
                    }
                }
            }

            return(CP);
        }
예제 #2
0
 public Order(string _Name, string _Surname, string _Phone, string _Mail, choresPending _CP, choresDone _CD)
 {
     Name    = _Name;
     Surname = _Surname;
     Phone   = _Phone;
     Mail    = _Mail;
     CP      = _CP;
     CD      = _CD;
 }
예제 #3
0
        public void addNewOrder(string Name, string Surname, string Phone, string Mail, choresPending CP, choresDone CD)
        {
            Order _Order = new Order(Name, Surname, Phone, Mail, CP, CD);

            O.Add(_Order);
            listBox1.Items.Add(string.Format("{0}. {1} | {2} | {3} | {4}", O.Count, Phone, Name, Surname, Mail));

            int lastClientID = -1;

            if (!_SQL.clientExists(_Order))
            {
                _SQL.insertClient(_Order);
                lastClientID = _SQL.getLastInsertID();
            }

            lastClientID = _SQL.readClientID(_Order);

            //MessageBox.Show(Convert.ToInt32(_Order.CP.changeOil) + " " +
            //    Convert.ToInt32(_Order.CP.changeTyres) + " " +
            //    Convert.ToInt32(_Order.CP.washCar) + " " +
            //    Convert.ToInt32(_Order.CP.engineService));


            _SQL.insertDoneOrder(_Order, lastClientID);
            _SQL.insertPendingOrder(_Order, lastClientID);
        }
예제 #4
0
 public void setChoresPending(choresDone x)
 {
     CP = x;
 }
예제 #5
0
        private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text == string.Empty)
                {
                    MessageBox.Show("Neįvestas vartotojo vardas!");
                    return;
                }
                else if (textBox2.Text == string.Empty)
                {
                    MessageBox.Show("Neįvesta vartotojo pavardė!");
                    return;
                }
                else if (!textBox3.Text.All(char.IsDigit))
                {
                    MessageBox.Show("Neįvestas vartotojo telefono numeris!");
                    return;
                }
                else if (!textBox4.Text.Contains("@"))
                {
                    MessageBox.Show("Neįvestas vartotojo el. paštas!");
                    return;
                }
                else if (!checkBox1.Checked && !checkBox2.Checked && !checkBox3.Checked && !checkBox4.Checked)
                {
                    MessageBox.Show("Užsakymas negali būti tuščias!");
                    return;
                }
                else
                {
                    choresPending CP = new choresPending();
                    choresDone    CD = new choresDone();

                    if (checkBox1.Checked)
                    {
                        CP.changeOil = true;
                        CD.changeOil = true;
                    }
                    else
                    {
                        CP.changeOil = false;
                        CD.changeOil = false;
                    }


                    if (checkBox2.Checked)
                    {
                        CP.changeTyres = true;
                        CD.changeTyres = true;
                    }
                    else
                    {
                        CP.changeTyres = false;
                        CD.changeTyres = false;
                    }


                    if (checkBox3.Checked)
                    {
                        CP.washCar = true;
                        CD.washCar = true;
                    }
                    else
                    {
                        CP.washCar = false;
                        CD.washCar = false;
                    }


                    if (checkBox4.Checked)
                    {
                        CP.engineService = true;
                        CD.engineService = true;
                    }
                    else
                    {
                        CP.engineService = false;
                        CD.engineService = false;
                    }

                    CD.orderComplete = false;

                    M.addNewOrder(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, CP, CD);

                    MessageBox.Show("Užsakymas pridėtas!");
                    Hide();
                    M.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("KLAIDA: " + ex.ToString());
            }
        }