Ejemplo n.º 1
0
        private void Insert()
        {
            if (id != -1)
            {
                string       queryz   = $"DELETE FROM OrderData WHERE idOrderBuy = {id}";
                OleDbCommand commandz = new OleDbCommand(queryz, Form5.myConnection);
                commandz.ExecuteNonQuery();
            }
            int idOrderBuy = DBmanager.GetId("OrderBuy", "idOrderBuy");

            string       query   = $"INSERT INTO OrderData (idOrderBuy,data) VALUES ({idOrderBuy},'{DateTime.Now}') ";
            OleDbCommand command = new OleDbCommand(query, Form5.myConnection);

            command.ExecuteNonQuery();

            for (int i = 0; i < orders.Count; i++)
            {
                if (orders[i].count != 0)
                {
                    query = $"INSERT INTO OrderBuy (idOrderBuy,idStock,colech) VALUES ({idOrderBuy},{orders[i].idStoock},{orders[i].count}) ";

                    command = new OleDbCommand(query, Form5.myConnection);

                    command.ExecuteNonQuery();
                }
            }

            Export();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Form5.famClient != "")
            {
                int          idOdrer = DBmanager.GetId("Orders", "idOrder");
                string       data    = DateTime.Now.ToString();
                string       query   = $"INSERT INTO Orders (idClient,data,idOrder,skidka) VALUES ({Form5.idClient},'{DateTime.Now}',{idOdrer},{Form5.skidka})";
                OleDbCommand command = new OleDbCommand(query, Form5.myConnection);
                command.ExecuteNonQuery();


                for (int i = 0; i < Form5.bascet.Count; i++)
                {
                    query   = $"SELECT idColor FROM Colors WHERE color = '{Form5.bascet[i].color}'";
                    command = new OleDbCommand(query, Form5.myConnection);
                    int idColor = int.Parse(command.ExecuteScalar().ToString());

                    query   = $"SELECT idStock FROM Stock WHERE idPhone = {Form5.bascet[i].idPhone} AND idFleshMem = {Form5.bascet[i].idFleshMem} AND idColor = {idColor}";
                    command = new OleDbCommand(query, Form5.myConnection);
                    int idStock = int.Parse(command.ExecuteScalar().ToString());
                    //int idStock =
                    query   = $"INSERT INTO Histori (idOrder,idStock,colech,price) VALUES ({idOdrer},{idStock},{Form5.bascet[i].count},{summa})";
                    command = new OleDbCommand(query, Form5.myConnection);
                    command.ExecuteNonQuery();
                }

                if (checkBox1.Checked)
                {
                    Export(idOdrer, data);
                    Messege mes = new Messege(Messege.messegeType.done, "Готово");
                    mes.ShowDialog();
                    DeleteBas();
                    if (System.Windows.Forms.Application.OpenForms["Form5"] != null)
                    {
                        (System.Windows.Forms.Application.OpenForms["Form5"] as Form5).OpenPhones();
                    }
                    Form5.famClient = null;
                    Form5.skidka    = 0;
                }
                else
                {
                    DeleteBas();
                    if (System.Windows.Forms.Application.OpenForms["Form5"] != null)
                    {
                        (System.Windows.Forms.Application.OpenForms["Form5"] as Form5).OpenPhones();
                    }
                    Form5.famClient = null;

                    Form5.skidka = 0;
                    Messege mes = new Messege(Messege.messegeType.done, "Готово");
                    mes.ShowDialog();
                }
            }
            else
            {
                Messege mes = new Messege(Messege.messegeType.error, "Для оформления заказа необходимо выбрать покупателя");
                mes.ShowDialog();
            }
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            //LoadData();

            //comboBox4.SelectedIndex= CombSetValue(comboBox4,"8");
            //form6 = new Form6(222);
            //form6.ShowDialog();

            DBmanager.SetImage(textBox20.Text, 504);
        }
Ejemplo n.º 4
0
        private void LoadDataUpdate()
        {
            ImageList imageList = new ImageList();

            imageList.ImageSize = new Size(80, 100);
            listView1.Items.Clear();

            string query = $"SELECT a.model, d.color, f.FleshMamari,a.idPhone,c.colech,a.componi,c.idStock,i.colech FROM Phons a ,Stock c , Colors d, FleshMem f,OrderBuy i WHERE" +    ////(SELECT a.FleshMamari FROM FleshMem a1,Stock b1 WHERE b1.idFleshMem = a1.idFleshMam)
                           $" a.сharged = FALSE AND c.idPhone = a.idPhone AND c.idColor = d.idColor AND f.idFleshMam = c.idFleshMem AND c.idStock = i.idStock AND i.idOrderBuy = {id}"; //AND a.idPhone=b.idPhone

            OleDbCommand command = new OleDbCommand(query, Form5.myConnection);

            OleDbDataReader reader = command.ExecuteReader();

            int i = 0;

            idStock.Clear();
            List <int> coleches = new List <int>();

            while (reader.Read())
            {
                idStock.Add(int.Parse(reader[6].ToString()));
                ListViewItem listViewItem;
                Order        order = orders.Find(item => item.idStoock == int.Parse(reader[6].ToString()));
                if (order == null)
                {
                    orders.Add(new Order(int.Parse(reader[6].ToString()), reader[5].ToString() + " " + reader[0].ToString() + " " + reader[2].ToString(), reader[1].ToString()));
                    orders[orders.Count - 1].count = int.Parse(reader[7].ToString());

                    listViewItem = new ListViewItem(new string[] { $"{i + 1}", reader[5].ToString() + " " + reader[0].ToString() + " " + reader[2].ToString() + " ГБ", reader[1].ToString(), reader[4].ToString(), $"{orders[orders.Count - 1].count}" });
                    System.Drawing.Color color = System.Drawing.Color.FromArgb(29, 31, 35);
                    listViewItem.UseItemStyleForSubItems = false;
                    listViewItem.SubItems[4].BackColor   = color;
                }
                else
                {
                    listViewItem = new ListViewItem(new string[] { $"{i + 1}", reader[5].ToString() + " " + reader[0].ToString() + " " + reader[2].ToString() + " ГБ", reader[1].ToString(), reader[4].ToString(), order.count.ToString() });
                    if (order.count != 0)
                    {
                        System.Drawing.Color color = System.Drawing.Color.FromArgb(54, 54, 54);

                        listViewItem.UseItemStyleForSubItems = false;
                        listViewItem.SubItems[4].BackColor   = color;
                    }
                }
                coleches.Add(int.Parse(reader[4].ToString()));
                listView1.Items.Add(listViewItem);
                imageList.Images.Add(DBmanager.GetImage(int.Parse(reader[3].ToString())));
                listView1.SmallImageList = imageList;
                listViewItem.ImageIndex  = i;
                i++;
            }
            max = coleches.Max();
            numericUpDown1.Value = max;
        }
Ejemplo n.º 5
0
        void LoadInfo(int id)
        {
            comboBox2.SelectedIndex = 0;
            string query = $"SELECT  model, data, os, ram, sizeSc, fsim,Csim, hDesign, mDesign, scrin, sizeBat," +
                           $" componi, idProc, texScren, soatnoshStor, cam FROM Phons WHERE idPhone={id}";

            OleDbCommand command = new OleDbCommand(query, Form5.myConnection);

            OleDbDataReader reader = command.ExecuteReader();

            reader.Read();

            textBox2.Text            = reader[0].ToString();                                             //Модель
            comboBox14.SelectedIndex = CombSetValue(comboBox14, reader[1].ToString());                   //Data
            comboBox1.SelectedIndex  = CombSetValue(comboBox1, reader[2].ToString());                    //Os
            comboBox4.SelectedIndex  = CombSetValue(comboBox4, reader[3].ToString());                    //Ram
            textBox8.Text            = reader[4].ToString();
            comboBox6.SelectedIndex  = CombSetValue(comboBox6, reader[5].ToString());                    //Fsim
            comboBox7.SelectedIndex  = CombSetValue(comboBox7, reader[6].ToString());                    //Fsim
            comboBox10.SelectedIndex = CombSetValue(comboBox10, reader[7].ToString());                   //Hdis
            comboBox11.SelectedIndex = CombSetValue(comboBox11, reader[8].ToString().Replace(".", ",")); //mDis
            //textBox3.Text = reader[9].ToString();//DrazScrin
            comboBox16.Text = reader[9].ToString();                                                      //DrazScrin
            textBox19.Text  = reader[10].ToString();                                                     //batari
            //comboBox13.SelectedIndex = CombSetValue(comboBox13, reader[11].ToString());//compani
            comboBox13.Text          = reader[11].ToString();                                            //compani
            idProcInPhone            = int.Parse(reader[12].ToString());                                 //idProcInPhone
            comboBox12.SelectedIndex = CombSetValue(comboBox12, reader[13].ToString());                  //texScren
            comboBox3.SelectedIndex  = CombSetValue(comboBox3, reader[14].ToString());                   // soatnoshStor
            textBox1.Text            = reader[15].ToString();                                            // Cam
            for (int i = 0; i < idProc.Count; i++)
            {
                if (idProc[i] == idProcInPhone)
                {
                    comboBox2.SelectedIndex = i + 1;
                    break;
                }
            }
            pictureBox1.Image = DBmanager.GetImage(id);
            pictureBox2.Image = pictureBox1.Image;
            textBox20.Text    = "Добавлено";
            textBox5.Text     = "Добавлено";
            label2.Text       = "Изменение";
            //mamori = int.Parse(comboBox5.Text);
        }
Ejemplo n.º 6
0
        private void LoadData()
        {
            textBox1.Enabled = false;
            ImageList imageList = new ImageList();

            imageList.ImageSize = new Size(80, 100);
            listView1.Items.Clear();

            string query = $"SELECT a.model, d.color, f.FleshMamari,a.idPhone,c.colech,a.componi,c.idStock,i.colech,c.prise,c.idFleshMem,c.idColor  FROM Phons a ,Stock c , Colors d, FleshMem f,OrderBuy i WHERE" + ////(SELECT a.FleshMamari FROM FleshMem a1,Stock b1 WHERE b1.idFleshMem = a1.idFleshMam)
                           $" a.сharged = FALSE AND c.idPhone = a.idPhone AND c.idColor = d.idColor AND f.idFleshMam = c.idFleshMem AND c.idStock = i.idStock AND i.idOrderBuy = {id}";                              //AND a.idPhone=b.idPhone

            OleDbCommand command = new OleDbCommand(query, Form5.myConnection);

            OleDbDataReader reader = command.ExecuteReader();

            int i = 0;

            idPhone.Clear();
            coleches.Clear();
            prices.Clear();
            colors.Clear();
            idFlehs.Clear();
            idStock.Clear();
            while (reader.Read())
            {
                idPhone.Add(int.Parse(reader[3].ToString()));
                idStock.Add(int.Parse(reader[6].ToString()));
                prices.Add(int.Parse(reader[8].ToString()));
                idFlehs.Add(int.Parse(reader[9].ToString()));
                colors.Add(reader[9].ToString());
                ListViewItem listViewItem;
                listViewItem = new ListViewItem(new string[] { $"{i + 1}", reader[5].ToString() + " " + reader[0].ToString() + " " + reader[2].ToString() + " ГБ", reader[1].ToString(), reader[7].ToString(), $"0" });


                listView1.Items.Add(listViewItem);
                coleches.Add(int.Parse(reader[4].ToString()));
                imageList.Images.Add(DBmanager.GetImage(int.Parse(reader[3].ToString())));
                listView1.SmallImageList = imageList;
                listViewItem.ImageIndex  = i;
                i++;
            }
        }
Ejemplo n.º 7
0
        public void LoadData()
        {
            listView1.Items.Clear();

            ImageList imageList = new ImageList();

            imageList.ImageSize = new Size(120, 150);
            //if (query == "")
            query = $"SELECT a.idPhone, a.model, c.price ,d.FleshMamari , c.colech FROM Phons a,Stock b,Histori c, FleshMem d WHERE" +
                    $" c.idOrder = {id} AND c.idStock = b.idStock AND a.idPhone = b.idPhone AND d.idFleshMam = b.idFleshMem";

            OleDbCommand command = new OleDbCommand(query, Form5.myConnection);

            OleDbDataReader reader = command.ExecuteReader();

            int    i   = 0;
            double sum = 0;

            while (reader.Read())
            {
                ListViewItem listViewItem = new ListViewItem(new string[] { "", reader[1].ToString() + " " + reader[3].ToString() + " ГБ", reader[4].ToString(), reader[2].ToString() });
                sum += double.Parse(reader[2].ToString()) * double.Parse(reader[4].ToString());
                listView1.Items.Add(listViewItem);
                imageList.Images.Add(DBmanager.GetImage(int.Parse(reader[0].ToString())));
                listView1.SmallImageList = imageList;
                listViewItem.ImageIndex  = i;
                i++;
            }

            double result = Math.Round(sum - itogSkid, 2);

            double skidka = Math.Round(result / sum * 100);

            label5.Text = $"ИТОГО (BYN) = {sum}";
            label6.Text = $"СКИДКА ({skidka}%) = {result}";
            label7.Text = $"ИТОГО СО СКИДКОЙ (BYN) = {sum - result}";
            reader.Close();
        }
Ejemplo n.º 8
0
        public void LoadData(List <int> id = null)
        {
            modals.Clear();
            listView1.Items.Clear();
            this.id = id;
            if (id.Count == 0)
            {
                return;
            }
            string where = $"and ( a.idPhone = {id[0]}";
            for (int c = 1; c < id.Count; c++)
            {
                where += $" OR a.idPhone = {id[c]}";
            }
            where += " )";

            string query = $"SELECT  model, data, os, ram, sizeSc, fsim,Csim, hDesign, mDesign, scrin, sizeBat," +
                           $"texScren, soatnoshStor,  cam, Min(b.prise) ,a.idPhone,idProc FROM Phons a,Stock b WHERE a.idPhone = b.idPhone  {where} GROUP BY model, data, os, ram, sizeSc, fsim,Csim, hDesign, mDesign, scrin, sizeBat,texScren, soatnoshStor,  cam ,a.idPhone,idProc";

            OleDbCommand command = new OleDbCommand(query, Form5.myConnection);

            OleDbDataReader reader = command.ExecuteReader();


            ImageList imageList = new ImageList();

            imageList.ImageSize = new Size(90, 120);
            int i = 0;

            while (reader.Read())
            {
                ListViewItem listViewItem = new ListViewItem(new string[] { "", reader[0].ToString(), reader[1].ToString(), reader[2].ToString(),
                                                                            reader[3].ToString(), reader[4].ToString(), reader[5].ToString(), reader[6].ToString(), reader[7].ToString(), reader[8].ToString(),
                                                                            reader[9].ToString(), reader[10].ToString(), reader[11].ToString(), reader[12].ToString(), reader[13].ToString(), reader[14].ToString() });

                modals.Add(reader[0].ToString());
                listView1.Items.Add(listViewItem);
                imageList.Images.Add(DBmanager.GetImage(int.Parse(reader[15].ToString())));
                listView1.SmallImageList = imageList;
                listViewItem.ImageIndex  = i;
                listView1.Items[i].UseItemStyleForSubItems = false;
                i++;
            }
            listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            foreach (ColumnHeader item in listView1.Columns)
            {
                item.Width += 20;
                //item. += 20;
            }
            Color color = Color.FromArgb(54, 54, 54);
            //listView1.Items[1].SubItems[4].BackColor = color;

            int count    = 0;
            int indexMax = 0;

            int[] massColons = { 4, 5, 7, 11, 14, 15 };

            while (count < massColons.Length)
            {
                List <int> maxValus = new List <int>();
                for (int ii = 0; ii < i; ii++)
                {
                    if (massColons[count] != 15)
                    {
                        if (double.Parse(listView1.Items[ii].SubItems[massColons[count]].Text) >=
                            double.Parse(listView1.Items[indexMax].SubItems[massColons[count]].Text))
                        {
                            indexMax = ii;
                        }
                    }
                    else
                    {
                        if (double.Parse(listView1.Items[ii].SubItems[massColons[count]].Text) <=
                            double.Parse(listView1.Items[indexMax].SubItems[massColons[count]].Text))
                        {
                            indexMax = ii;
                        }
                    }

                    //listView1.Items[ii].SubItems[4].BackColor = Color.Red;
                }
                for (int k = 0; k < i; k++)
                {
                    if (double.Parse(listView1.Items[k].SubItems[massColons[count]].Text) == double.Parse(listView1.Items[indexMax].SubItems[massColons[count]].Text))
                    {
                        listView1.Items[k].SubItems[massColons[count]].BackColor = Color.Green;
                    }
                }

                count++;
                button4.Enabled = false;
            }
        }
Ejemplo n.º 9
0
        public void LoadData(int id = 0)
        {
            idPhone = id;
            counts.Clear();
            counts = new List <List <string> >();
            idFleshMems.Clear();
            idFleshMems = new List <List <int> >();
            for (int i = 0; i < Buttons.Count; i++)
            {
                RemoveAll();
            }
            Buttons.Clear();
            ColorComboBoxes.Clear();
            LabelsCount.Clear();
            LabelsPrise.Clear();
            Numers.Clear();
            addFirst();
            string query = $"SELECT c.FleshMamari,a.colech,a.prise,b.color,c.idFleshMam FROM Stock a, Colors b,FleshMem c WHERE" +
                           $" a.idPhone={id} AND c.idFleshMam = a.idFleshMem AND b.idColor=a.idColor AND a.chatged = FALSE ORDER BY c.FleshMamari";
            //string query = $"SELECT a.FleshMamari,b.colech,a.prise,b.color,a.idFleshMam FROM FleshMem a,Colors b  WHERE a.idPhone={id} AND b.idFleshMem = a.idFleshMam";

            OleDbCommand command = new OleDbCommand(query, Form5.myConnection);

            OleDbDataReader reader = command.ExecuteReader();

            if (reader.Read())
            {
                button2.Text = reader[0].ToString() + " ГБ";
                comboBox1.Items.Add(reader[3].ToString());
                label49.Text           = reader[1].ToString();
                label23.Text           = reader[2].ToString();
                numericUpDown1.Maximum = int.Parse(reader[1].ToString());
                counts.Add(new List <string>());
                counts[count].Add(reader[1].ToString());

                idFleshMems.Add(new List <int>());
                idFleshMems[count].Add(int.Parse(reader[4].ToString()));

                comboBox1.SelectedIndex = 0;
            }

            while (reader.Read())
            {
                if (Buttons[count].Text != reader[0].ToString() + " ГБ")
                {
                    count++;
                    CreateButton(reader[0].ToString() + " ГБ");
                    CreateComboBoxColor(reader[3].ToString());
                    CreateLableCount(reader[1].ToString());
                    CreateLablePrise(reader[2].ToString());
                    CreateNumber(int.Parse(reader[1].ToString()));

                    counts.Add(new List <string>());
                    counts[count].Add(reader[1].ToString());

                    idFleshMems.Add(new List <int>());
                    idFleshMems[count].Add(int.Parse(reader[4].ToString()));
                }
                else
                {
                    ColorComboBoxes[count].Items.Add(reader[3].ToString());
                    counts[count].Add(reader[1].ToString());

                    idFleshMems[count].Add(int.Parse(reader[4].ToString()));
                }
            }

            query = $"SELECT  model, data, os, ram, sizeSc, fsim,Csim, hDesign, mDesign, scrin, sizeBat," +
                    $" componi, idProc, texScren, soatnoshStor,cam FROM Phons WHERE idPhone={id}";

            command = new OleDbCommand(query, Form5.myConnection);

            reader = command.ExecuteReader();
            //reader.Read();
            if (reader.Read())
            {
                label2.Text   = reader[11].ToString() + " " + reader[0].ToString(); //Модель
                label20.Text  = reader[1].ToString();                               //Data
                label31.Text  = reader[2].ToString();                               //Os
                label33.Text  = reader[3].ToString();                               //Ram
                label26.Text  = reader[4].ToString();
                label35.Text  = reader[5].ToString();                               //Fsim
                label36.Text  = reader[6].ToString();                               //Fsim
                label39.Text  = reader[7].ToString();                               //Hdis
                label40.Text  = reader[8].ToString().Replace(".", ",");             //mDis
                label32.Text  = reader[9].ToString();                               //razScrin
                label37.Text  = reader[10].ToString();                              //batari
                label38.Text  = reader[11].ToString();                              //compani
                idProcInPhone = int.Parse(reader[12].ToString());                   //idProcInPhone
                label41.Text  = reader[13].ToString();                              //texScren
                label42.Text  = reader[14].ToString();                              // soatnoshStor
                label25.Text  = reader[15].ToString();                              // cam
            }


            pictureBox1.Image = DBmanager.GetImage(id);
            if (idProcInPhone != 1)
            {
                query = $"SELECT model,speed,nCors,razProc,sGPU,GAccelModl FROM Cors WHERE idProc={idProcInPhone}";

                command = new OleDbCommand(query, Form5.myConnection);

                reader = command.ExecuteReader();
                reader.Read();
                label43.Text        = reader[0].ToString();
                label44.Text        = reader[1].ToString();
                label45.Text        = reader[2].ToString();
                label46.Text        = reader[3].ToString();
                label47.Text        = reader[4].ToString();
                label48.Text        = reader[5].ToString();
                pictureBox2.Visible = false;
                reader.Close();
            }
            else
            {
                label43.Text        = "Пусто";
                label44.Text        = "Пусто";
                label45.Text        = "Пусто";
                label46.Text        = "Пусто";
                label47.Text        = "Пусто";
                label48.Text        = "Пусто";
                pictureBox2.Visible = true;
            }
        }
Ejemplo n.º 10
0
        public void SelectData(string query = "")
        {
            listView1.Items.Clear();
            modals.Clear();
            idPhone.Clear();
            ImageList imageList = new ImageList();

            imageList.ImageSize = new Size(120, 150);
            if (query == "")
            {
                query = "SELECT a.model,Min(b.prise),a.idPhone,a.сharged,a.componi FROM Phons a, Stock b WHERE сharged = FALSE AND a.idPhone = b.idPhone GROUP BY a.model,a.idPhone,a.сharged,a.componi,b.prise";
            }

            OleDbCommand command = new OleDbCommand(query, Form5.myConnection);

            OleDbDataReader reader = command.ExecuteReader();

            int i = 0;

            //idPhone.Add(0);


            while (reader.Read())
            {
                if (i == 0)
                {
                    ListViewItem listViewItem = new ListViewItem(new string[] { "", "        " + reader[4].ToString() + " " + reader[0].ToString(), reader[1].ToString() + "    ", 3 + "", 4 + "", 5 + "" });

                    //MessageBox.Show(reader[2].ToString());
                    idPhone.Add(int.Parse(reader[2].ToString()));
                    modals.Add(reader[4].ToString() + " " + reader[0].ToString());

                    listView1.Items.Add(listViewItem);
                    imageList.Images.Add(DBmanager.GetImage(int.Parse(reader[2].ToString())));

                    listView1.SmallImageList = imageList;
                    listViewItem.ImageIndex  = i;
                    i++;
                }
                else
                if (!FindID(idPhone, int.Parse(reader[2].ToString())))
                {
                    ListViewItem listViewItem = new ListViewItem(new string[] { "", "        " + reader[4].ToString() + " " + reader[0].ToString(), reader[1].ToString() + "    ", 3 + "", 4 + "", 5 + "" });

                    //MessageBox.Show(reader[2].ToString());
                    idPhone.Add(int.Parse(reader[2].ToString()));
                    modals.Add(reader[4].ToString() + " " + reader[0].ToString());

                    listView1.Items.Add(listViewItem);


                    imageList.Images.Add(DBmanager.GetImage(int.Parse(reader[2].ToString())));
                    listView1.SmallImageList = imageList;
                    listViewItem.ImageIndex  = i;
                    i++;
                }
            }

            reader.Close();
            //ClearFiltrs();
        }
Ejemplo n.º 11
0
        private void button5_Click(object sender, EventArgs e)
        {
            string       query;
            OleDbCommand command;
            //if (Operation.update == oper)
            //{
            //    query = $"DELETE FROM Stock WHERE idPhone={idPhone}";
            //    command = new OleDbCommand(query, Form5.myConnection);

            //    command.ExecuteNonQuery();
            //}

            bool filledTextBox  = this.Controls.OfType <TextBox>().All(textBox => textBox.Text != "");
            bool filledComboBox = this.Controls.OfType <ComboBox>().All(comboBox => comboBox.Text != "");

            //Task.Run(() => { while (true) CheckErrors(); });


            //DestroiAllErPoints();

            if (!filledComboBox || !filledTextBox)
            {
                Messege mes = new Messege(Messege.messegeType.error, $"Не все поля заполнены");
                mes.ShowDialog();
                timer1.Enabled = true;
            }
            else
            if (!CheckModel("Phons", textBox2.Text) && oper == Operation.insert)
            {
                CreatErrorPoint(textBox2);
                error = true;
                Messege mes = new Messege(Messege.messegeType.error, $"Телефон с моделью {textBox2.Text} уже зарегистрирован");
                mes.ShowDialog();
            }
            else
            {
                data  = comboBox14.Text;
                model = textBox2.Text;
                os    = comboBox1.Text;
                //scrinSize = double.Parse(textBox8.Text);
                razScrin = comboBox16.Text;
                ram      = int.Parse(comboBox4.Text);
                //mamori = int.Parse(comboBox5.Text);
                fSim    = comboBox6.Text;
                cSim    = int.Parse(comboBox7.Text);
                batari  = int.Parse(textBox19.Text);
                compani = comboBox13.Text;

                if (comboBox2.Text == "Новый")
                {
                    proc       = textBox12.Text;
                    speed      = int.Parse(textBox11.Text);
                    countCors  = int.Parse(comboBox8.Text);
                    razProс    = int.Parse(comboBox9.Text);
                    sGPU       = int.Parse(textBox16.Text);
                    GAccelModl = comboBox15.Text;

                    idCors  = DBmanager.GetId("Cors", "idProc");
                    query   = $"INSERT INTO Cors (idProc,model,speed,nCors,razProc,sGPU,GAccelModl) VALUES ({idCors},'{proc}',{speed},{countCors},{razProс},{sGPU},'{GAccelModl}')";
                    command = new OleDbCommand(query, Form5.myConnection);

                    command.ExecuteNonQuery();
                }
                if (oper == Operation.insert)
                {
                    idPhone = DBmanager.GetId("Phons", "idPhone");
                }


                idProcInPhone = idCors;
                hDis          = comboBox10.Text;
                mDis          = comboBox11.Text.Replace(",", ".");
                List <int> idFlethMam = new List <int>();

                texScren = comboBox12.Text;

                soatnoshStor = comboBox3.Text;


                //inStock =int.Parse(textBox4.Text);

                image = pictureBox1.Image;


                if (oper == Operation.insert)
                {
                    query = $"INSERT INTO Phons (idPhone, model, data, os, ram, sizeSc, fsim,Csim, hDesign, mDesign, scrin, sizeBat," +
                            $" componi, idProc, texScren, soatnoshStor, cam) VALUES ({idPhone}, '{model}', {data}, '{os}', {ram}, {textBox8.Text.Replace(",",".")}," +
                            $" '{fSim}', {cSim}, '{hDis}', '{mDis}', '{razScrin}', {batari}, '{compani}', {idCors}, '{texScren}', '{soatnoshStor}',  {textBox1.Text})";
                }
                else
                {
                    query = $"UPDATE Phons SET idPhone={idPhone}, model='{model}', data={data}, os='{os}', ram={ram}, sizeSc={textBox8.Text.Replace(",", ".")}, fsim='{fSim}',Csim={cSim}, hDesign='{hDis}', mDesign='{mDis}', scrin='{razScrin}', sizeBat={batari}," +
                            $" componi='{compani}', idProc={idCors}, texScren='{texScren}', soatnoshStor='{soatnoshStor}',  cam={textBox1.Text} WHERE idPhone={idPhone}";
                }
                //else
                //    query = $"UPDATE Phons SET idPhone={idPhone}, model={model}, data={data}, os={os}, ram={ram}, sizeSc={textBox8.Text}, fsim={fSim},Csim={cSim}, hDesign={hDis}, mDesign={mDis}, scrin={razScrin}, sizeBat={batari}, componi={compani}, idProc={idCors}, texScren={texScren}, soatnoshStor={soatnoshStor}, minPrise={strMinPrise}";
                command = new OleDbCommand(query, Form5.myConnection);

                command.ExecuteNonQuery();

                DBmanager.SetImage(image, idPhone);
                int        idFleshMam = 0;
                int        idColor    = 0;
                List <int> idStocs    = new List <int>();
                for (int i = 0; i < MemComboBoxes.Count; i++)
                {
                    while (true)
                    {
                        query   = $"SELECT idFleshMam FROM FleshMem WHERE FleshMamari = {MemComboBoxes[i].Text}";
                        command = new OleDbCommand(query, Form5.myConnection);
                        try
                        {
                            idFleshMam = int.Parse(command.ExecuteScalar().ToString());
                            break;
                        }
                        catch (Exception)
                        {
                            query   = $"INSERT INTO FleshMem (FleshMamari) VALUES ({MemComboBoxes[i].Text})";
                            command = new OleDbCommand(query, Form5.myConnection);

                            command.ExecuteNonQuery();
                        }
                    }
                    while (true)
                    {
                        query   = $"SELECT idColor FROM Colors WHERE color = '{ColorComboBoxes[i].Text}'";
                        command = new OleDbCommand(query, Form5.myConnection);
                        try
                        {
                            idColor = int.Parse(command.ExecuteScalar().ToString());
                            break;
                        }
                        catch (Exception)
                        {
                            //query = $"INSERT INTO FleshMem (FleshMamari) VALUES ({MemComboBoxes[i].Text})";
                            query   = $"INSERT INTO Colors (color) VALUES ('{ColorComboBoxes[i].Text}')";
                            command = new OleDbCommand(query, Form5.myConnection);

                            command.ExecuteNonQuery();
                        }
                    }
                    if (oper == Operation.insert)
                    {
                        int idStoock = DBmanager.GetId("Stock", "idStock");
                        query   = $"INSERT INTO Stock (idStock,idPhone,idFleshMem,idColor,colech,prise) VALUES ({idStoock},{idPhone},{idFleshMam},{idColor},{NumericUpDowns[i].Value},{TextBoxes[i].Text.Replace(",",".")})";
                        command = new OleDbCommand(query, Form5.myConnection);
                        command.ExecuteNonQuery();
                    }
                    else
                    {
                        try
                        {
                            query   = $"UPDATE Stock SET idPhone = {idPhone},idFleshMem = {idFleshMam},idColor = {idColor},colech = {NumericUpDowns[i].Value}, prise = {TextBoxes[i].Text.Replace(",", ".")} WHERE idStock = {Form6.idStocks[i]}";
                            command = new OleDbCommand(query, Form5.myConnection);
                            command.ExecuteNonQuery();
                        }
                        catch (Exception)
                        {
                            int idStock = -1;
                            idStock = DBmanager.GetId("Stock", "idStock");
                            query   = $"INSERT INTO Stock (idStock,idPhone,idFleshMem,idColor,colech,prise) VALUES ({idStock},{idPhone},{idFleshMam},{idColor},{NumericUpDowns[i].Value},{TextBoxes[i].Text.Replace(",", ".")})";
                            command = new OleDbCommand(query, Form5.myConnection);
                            command.ExecuteNonQuery();
                            //idStocs.Add(idStock);
                        }
                    }
                    for (int t = 0; t < Form6.idDeleteStocks.Count; t++)
                    {
                        query   = $"UPDATE Stock SET chatged = TRUE WHERE idStock = {Form6.idDeleteStocks[t]}";
                        command = new OleDbCommand(query, Form5.myConnection);
                        command.ExecuteNonQuery();
                    }
                }

                if (oper == Operation.update)
                {
                    Messege mes = new Messege(Messege.messegeType.done, $"Характеристики {textBox2.Text} успешно изменены.");
                    mes.ShowDialog();

                    if (System.Windows.Forms.Application.OpenForms["Form5"] != null)
                    {
                        (System.Windows.Forms.Application.OpenForms["Form5"] as Form5).OpenPhones();
                    }
                }
                else
                {
                    Messege mes = new Messege(Messege.messegeType.done, $"Телефон {textBox2.Text} успешно добавлен.");
                    mes.ShowDialog();

                    if (System.Windows.Forms.Application.OpenForms["Form5"] != null)
                    {
                        (System.Windows.Forms.Application.OpenForms["Form5"] as Form5).OpenPhones();
                    }
                }
            }
        }