Пример #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "" && textBox3.Text != "")
     {
         using (WWWEntities dbConteiner = new WWWEntities())
         {
             if (textBox2.Lines[0].Contains("Поставка"))
             {
                 List <Know> list = dbConteiner.Know.ToList();
                 foreach (Know item in list)
                 {
                     if (item.Knowledge == textBox3.Lines[0])
                     {
                         item.confidence = 1;
                         dbConteiner.know2.Add(new know2
                         {
                             Id        = dbConteiner.know2.ToList().Count + 1,
                             condition = textBox2.Lines[0],
                             rule      = textBox3.Lines[0],
                             time      = int.Parse(textBox4.Lines[0])
                         });
                         dbConteiner.SaveChanges();
                         textBox2.Clear();
                         textBox3.Clear();
                         textBox4.Clear();
                         break;
                     }
                 }
             }
             else
             {
                 dbConteiner.know2.Add(new know2
                 {
                     Id        = dbConteiner.know2.ToList().Count + 1,
                     condition = textBox2.Lines[0],
                     rule      = textBox3.Lines[0],
                     time      = int.Parse(textBox4.Lines[0])
                 });
                 dbConteiner.SaveChanges();
                 textBox2.Clear();
                 textBox3.Clear();
                 textBox4.Clear();
             }
         }
     }
     else
     {
         MessageBox.Show("Поле не заполнено для данного действия");
     }
 }
Пример #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && richTextBox1.Text != "")
     {
         try
         {
             cost = int.Parse(textBox1.Text);
         }
         catch
         {
             MessageBox.Show("Неверный формат данных в поле Индекс!");
             return;
         }
         int         y = Convert.ToInt32(textBox1.Text);
         WWWEntities contextEntities = new WWWEntities();
         List <Know> list            = contextEntities.Know.ToList();
         foreach (Know item in list)
         {
             if (Convert.ToInt32(item.Id) == y)
             {
                 item.Knowledge = richTextBox1.Lines[0];
                 contextEntities.SaveChanges();
             }
         }
         richTextBox1.Clear();
         textBox1.Clear();
     }
 }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && richTextBox1.Text != "" && richTextBox2.Text != "")
     {
         try
         {
             cost = int.Parse(textBox1.Text);
         }
         catch
         {
             MessageBox.Show("Неверный формат данных в поле Стоимость!");
             return;
         }
         int          y = Convert.ToInt32(textBox1.Text);
         WWWEntities  contextEntities = new WWWEntities();
         List <know2> list            = contextEntities.know2.ToList();
         foreach (know2 item in list)
         {
             if (Convert.ToInt32(item.Id) == y)
             {
                 item.condition = richTextBox1.Lines[0];
                 item.rule      = richTextBox2.Lines[0];
                 contextEntities.SaveChanges();
             }
         }
         richTextBox1.Clear();
         richTextBox2.Clear();
         textBox1.Clear();
     }
 }
Пример #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "")
     {
         using (WWWEntities dbConteiner = new WWWEntities())
         {
             dbConteiner.Know.Add(new Know
             {
                 Id        = dbConteiner.Know.ToList().Count + 1,
                 Knowledge = textBox1.Lines[0]
             });
             dbConteiner.SaveChanges();
             textBox1.Clear();
         }
     }
     else
     {
         MessageBox.Show("Поле не заполнено для данного действия");
     }
 }
Пример #5
0
        void diff4()
        {
            WWWEntities  contextEntities = new WWWEntities();
            List <know2> lip             = contextEntities.know2.ToList();
            List <Know>  list            = contextEntities.Know.ToList();

            for (int i = 0; i < 200; ++i)
            {
                if (a[i, 0].time != 0)
                {
                    list[Convert.ToInt32(i)].time = Convert.ToInt32(a[i, 0].time);
                    contextEntities.SaveChanges();
                }
                a[i, 0].time  = 0;
                a[i, 0].gotov = 0;
                a[i, 0].znach = 0;
                a[i, 0].pos   = 0;
                for (int j = 0; j < 11; ++j)
                {
                    a[i, j].sled = 0;
                }
            }
        }
Пример #6
0
        void diff3(object obj)
        {
            WWWEntities contextEntities = new WWWEntities();
            List <Know> list            = contextEntities.Know.ToList();
            Counter     c  = (Counter)obj;
            Counter     z1 = new Counter();
            DateTime    t2 = DateTime.Now;

            //if(list[Convert.ToInt32(c.y)].confidence==1)
            if (a[c.y, 0].gotov == 1)
            {
                a[c.y, 0].gotov = 3;
                //list[Convert.ToInt32(c.y)].confidence = 3;
                Thread.Sleep(a[c.y, 0].znach);
                a[c.y, 0].gotov = 2;
                list[Convert.ToInt32(c.y)].confidence = 2;
                int ort = a[c.y, 0].znach;
                a[c.y, 0].time = DateTime.Now.Second * 1000 + DateTime.Now.Millisecond - t1.Second * 1000 - t1.Millisecond;
                list[Convert.ToInt32(c.y)].time = Convert.ToInt32(a[c.y, 0].time);
                contextEntities.SaveChanges();
                //richTextBox1.Text += "Доствавка - " + Convert.ToString(list[Convert.ToInt32(c.y)].Knowledge) + ",  " + Convert.ToString(a[c.y, 0].time) + "\n";
            }
            else
            {
                int kol = 0;
                while (a[c.y, 0].sled != kol)
                {
                    for (int i = 1; i <= a[c.y, 0].sled; ++i)
                    {
                        //z1.x = c.x;
                        long y = a[c.y, i].sled;
                        int  o1 = a[y, 0].gotov; long o2 = a[y, 0].pos;
                        a[c.y, 0].pos = 0;
                        //if (list[Convert.ToInt32(y)].confidence != 2 && a[y, 0].pos == 0)
                        if (a[y, 0].gotov != 2 && a[y, 0].pos == 0)
                        {
                            z1.x        = c.x;
                            z1.y        = y;
                            a[y, 0].pos = 1;
                            diff3(z1);
                        }
                    }
                    kol = 0;
                    for (int i = 1; i <= a[c.y, 0].sled; ++i)
                    {
                        long y = a[c.y, i].sled;
                        //if (list[Convert.ToInt32(y)].confidence == 2)
                        if (a[y, 0].gotov == 2)
                        {
                            kol = kol + 1;
                        }
                    }
                }
                //if(list[Convert.ToInt32(c.y)].confidence==0)
                if (a[c.y, 0].gotov == 0)
                {
                    a[c.y, 0].gotov = 3;
                    //list[Convert.ToInt32(c.y)].confidence = 3;
                    Thread.Sleep(a[c.y, 0].znach);
                    a[c.y, 0].gotov = 2;
                    list[Convert.ToInt32(c.y)].confidence = 2;
                    if (a[c.y, 0].time == 0)
                    {
                        a[c.y, 0].time = DateTime.Now.Second * 1000 + DateTime.Now.Millisecond - t1.Second * 1000 - t1.Millisecond;
                        //List<Know> list = contextEntities.Know.ToList();
                        list[Convert.ToInt32(c.y)].time = Convert.ToInt32(a[c.y, 0].time);
                        contextEntities.SaveChanges();
                        richTextBox1.Text += "Сборка - " + Convert.ToString(list[Convert.ToInt32(c.y)].Knowledge)
                                             + ",  " + Convert.ToString(Convert.ToInt32(a[c.y, 0].time / 5)) + "\n";
                    }
                }
            }
        }