public choresDone getChoresDone(int id)
        {
            choresDone CD = new choresDone();

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

                using (SQLiteDataReader sqlite_datareader = sqlite_cmd.ExecuteReader())
                {
                    while (sqlite_datareader.Read())
                    {
                        CD.changeOil     = Boolean.Parse(sqlite_datareader.GetString(0));
                        CD.changeTyres   = Boolean.Parse(sqlite_datareader.GetString(1));
                        CD.washCar       = Boolean.Parse(sqlite_datareader.GetString(2));
                        CD.engineService = Boolean.Parse(sqlite_datareader.GetString(3));
                        CD.orderComplete = Boolean.Parse(sqlite_datareader.GetString(4));

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

            return(CD);
        }
        //CREATE TABLE doneClientOrder (clientID INT, changeOil INT, changeTyres INT, washCar INT, engineService INT, orderComplete INT)";

        public void updateChoresDone(int rowid, choresDone CD)
        {
            using (SQLiteCommand sqlite_cmd = SQLITE_CONNECTION.CreateCommand())
            {
                sqlite_cmd.CommandText = String.Format("UPDATE doneClientOrder SET changeOil='{0}', changeTyres='{1}', washCar='{2}', engineService='{3}', orderComplete='{4}' WHERE rowid='{5}'", CD.changeOil, CD.changeTyres, CD.washCar, CD.engineService, CD.orderComplete, rowid);
                sqlite_cmd.ExecuteNonQuery();
            }
        }
 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;
 }
Beispiel #4
0
        private void Button2_Click(object sender, EventArgs e)
        {
            if (checkBox5.Checked && !checkBox5.Enabled)
            {
                MessageBox.Show("Užsakymas jau yra įvygdytas ir jo būsenos keisti nebegalima.");
            }
            else
            {
                choresDone _CD = new choresDone();

                if (checkBox7.Checked)
                {
                    _CD.changeOil = true;
                }

                if (checkBox6.Checked)
                {
                    _CD.changeTyres = true;
                }

                if (checkBox8.Checked)
                {
                    _CD.washCar = true;
                }

                if (checkBox9.Checked)
                {
                    _CD.engineService = true;
                }

                if (checkBox5.Checked)
                {
                    _CD.orderComplete = true;
                    checkBox5.Enabled = false;
                    checkBox6.Enabled = false;
                    checkBox7.Enabled = false;
                    checkBox8.Enabled = false;
                    checkBox9.Enabled = false;
                }


                O[listBox1.SelectedIndex].setChoresDone(_CD);
                _SQL.updateChoresDone(listBox1.SelectedIndex + 1, _CD);
            }
        }
Beispiel #5
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);
        }
 public void setChoresPending(choresDone x)
 {
     CP = x;
 }
 public void setChoresDone(choresDone x)
 {
     CD = x;
     //MessageBox.Show(x.changeOil.ToString() + x.changeTyres + x.engineService + x.washCar + x.orderComplete);
 }
Beispiel #8
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());
            }
        }