コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            request_mas_of_base_elements();
            int        start     = Convert.ToInt32(start_Tbox.Text);
            int        stop      = Convert.ToInt32(stop_Tbox.Text);
            List <int> del_index = new List <int>();

            for (int i = start; i < stop; i++)
            {
                Compare_Element el      = Compare_Element.get_el_as_xls_el_for_cmp(mcl, i).CloneElement();
                string          serial2 = el.Serial2;
                int             index   = mas.Serial2_base.IndexOf(serial2);
                if (index != -1)
                {
                    Compare_Pare pr = mas.pre_mas[index].CloneComparePare();
                    pr.xls_el = el.CloneElement();
                    pr.check_equalence(Serial1_cm.Checked, Serial2_cm.Checked, Place_cm.Checked, Mark_cm.Checked, Date_cm.Checked, Prise_cm.Checked);
                    mas.dual_mas.Add(pr.CloneComparePare());



                    del_index.Add(index);
                }
                else
                {
                    Compare_Pare pr = new Compare_Pare();
                    pr.xls_el = el.CloneElement();
                    pr.check_equalence(Serial1_cm.Checked, Serial2_cm.Checked, Place_cm.Checked, Mark_cm.Checked, Date_cm.Checked, Prise_cm.Checked);
                    mas.xls_only_mas.Add(pr.CloneComparePare());
                }
            }
            for (int i = 0; i < mas.pre_mas.Count; i++)
            {
                if (!del_index.Contains(i))
                {
                    mas.pre_mas[i].check_equalence(Serial1_cm.Checked, Serial2_cm.Checked, Place_cm.Checked, Mark_cm.Checked, Date_cm.Checked, Prise_cm.Checked);
                    mas.base_only_mas.Add(mas.pre_mas[i]);
                }
            }

            mas.all_mas = new List <Compare_Pare>();
            mas.all_mas.AddRange(mas.dual_mas);
            mas.all_mas.AddRange(mas.xls_only_mas);
            mas.all_mas.AddRange(mas.base_only_mas);


            base_and_xls_dgv.Rows.Clear();
            base_only_dgv.Rows.Clear();
            xls_only_dgv.Rows.Clear();

            fill_dgv_with_list(mas.dual_mas, false, base_and_xls_dgv);
            fill_dgv_with_list(mas.xls_only_mas, true, xls_only_dgv);
            fill_dgv_with_list(mas.base_only_mas, false, base_only_dgv);


            all_lab.Text  += " " + (mas.base_only_mas.Count + mas.dual_mas.Count + mas.xls_only_mas.Count);
            full_lab.Text += " " + mas.dual_mas.Count;
            base_lab.Text += " " + mas.base_only_mas.Count;
            xls_lab.Text  += " " + mas.xls_only_mas.Count;
        }
コード例 #2
0
        public static Compare_Element get_el_as_xls_el(XLS_Class mcl, int i)//++
        {
            Compare_Element el = new Compare_Element();

            el.Mark   = mcl.read_val(i, Properties.Settings.Default.xls_Mark).ToString();
            el.Type   = mcl.read_val(i, Properties.Settings.Default.xls_Type).ToString();
            el.Status = mcl.read_val(i, Properties.Settings.Default.xls_Status).ToString();
            el.Place  = mcl.read_val(i, Properties.Settings.Default.xls_Place).ToString();

            el.Text  = mcl.read_val(i, Properties.Settings.Default.xls_Text).ToString();
            el.Text2 = mcl.read_val(i, Properties.Settings.Default.xls_Text2).ToString();
            el.Text3 = mcl.read_val(i, Properties.Settings.Default.xls_Text3).ToString();
            el.Text4 = mcl.read_val(i, Properties.Settings.Default.xls_Text4).ToString();
            el.Text5 = mcl.read_val(i, Properties.Settings.Default.xls_Text5).ToString();

            el.Serial  = mcl.read_val(i, Properties.Settings.Default.xls_Serial).ToString();
            el.Serial2 = mcl.read_val(i, Properties.Settings.Default.xls_Serial2).ToString();

            el.Prise  = mcl.read_val(i, Properties.Settings.Default.xls_Prise).ToString();
            el.date   = (mcl.read_val(i, Properties.Settings.Default.xls_Date)).ToString();
            el.OS     = mcl.read_val(i, Properties.Settings.Default.xls_OS).ToString();
            el.Place2 = mcl.read_val(i, Properties.Settings.Default.xls_Place2).ToString();


            el.read_other_xls();
            return(el);
        }
コード例 #3
0
        public static bool add_Element(Compare_Element el)
        {
            string zap = "insert into itemtable (itemtable.Serial,itemtable.Serial2," +
                         "itemtable.Mark,itemtable.Type,itemtable.Status,itemtable.Place," +
                         "itemtable.Text,itemtable.Text2,itemtable.Text3,itemtable.Text4,itemtable.Text5,itemtable.Text6 " +
                         ",itemtable.Place2, itemtable.Prise, itemtable.OS, itemtable.Date,itemtable.Owner,itemtable.Status2)";

            zap += " values(" +
                   "'" + el.Serial + "'," +
                   "'" + el.Serial2 + "'," +
                   el.Markid + "," +
                   el.Typeid + "," +
                   el.Statusid + "," +
                   el.Placeid + "," +
                   "'" + el.Text + "'," +
                   "'" + el.Text2 + "'," +
                   "'" + el.Text3 + "'," +
                   "'" + el.Text4 + "'," +
                   "'" + el.Text5 + "'," +
                   "'" + el.Text6 + "'," +
                   el.Place2id + "," +
                   "'" + el.Prise + "'," +
                   el.OSID + "," +
                   "'" + el.date + "'," + el.OwnerID + "," + el.Status2id + ")";

            try
            {
                return(SQL_Class.Execute(zap));
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #4
0
        public static Compare_Element get_el_as_xls_el_for_cmp(XLS_Class mcl, int i) //++11
        {
            Compare_Element el = new Compare_Element();

            el.Mark    = mcl.read_val(i, Properties.Settings.Default.xls_Mark).ToString();
            el.Type    = mcl.read_val(i, Properties.Settings.Default.xls_Type).ToString();
            el.Status  = mcl.read_val(i, Properties.Settings.Default.xls_Status).ToString();
            el.Status2 = "";
            el.Place   = mcl.read_val(i, Properties.Settings.Default.xls_Place).ToString();
            el.Owner   = mcl.read_val(i, Properties.Settings.Default.xls_Owner).ToString();


            el.Serial  = mcl.read_val(i, Properties.Settings.Default.xls_Serial).ToString();
            el.Serial2 = mcl.read_val(i, Properties.Settings.Default.xls_Serial2).ToString();

            el.Prise     = (mcl.read_val(i, Properties.Settings.Default.xls_Prise)).ToString();
            el.date      = FuncClass.get_Date(mcl.read_val(i, Properties.Settings.Default.xls_Date).ToString());
            el.OS        = mcl.read_val(i, Properties.Settings.Default.xls_OS).ToString();
            el.Place2    = mcl.read_val(i, Properties.Settings.Default.xls_Place2).ToString();
            el.Status2id = RandomFull.get_rand_int();



            el.read_other_xls();
            return(el);
        }
コード例 #5
0
        public static Compare_Pare_Mas get_base_elements(int ownerID)//--
        {
            Compare_Pare_Mas rett = new Compare_Pare_Mas();
            string           zap  = "Select itemtable.ID,itemtable.Serial,itemtable.Serial2," +
                                    "itemtable.Mark,itemtable.Type,itemtable.Status,itemtable.Place," +
                                    "itemtable.Text,itemtable.Text2,itemtable.Text3,itemtable.Text4,itemtable.Text5,itemtable.Text6 " +
                                    ",itemtable.Place2, itemtable.Prise, itemtable.OS, itemtable.Date from itemtable where itemtable.Owner=" + ownerID;
            SQL_Class cl = new SQL_Class();

            cl.ReadValues(zap);


            while (cl.SQL_DataReader.Read())
            {
                Compare_Element el = new Compare_Element();

                el.ID = cl.get_int(0);

                el.Serial  = cl.get_string(1);
                el.Serial2 = cl.get_string(2);

                el.Markid   = cl.get_int(3);
                el.Typeid   = cl.get_int(4);
                el.Statusid = cl.get_int(5);
                el.Placeid  = cl.get_int(6);

                el.Place2id = cl.get_int(13);
                el.Prise    = cl.get_string(14);
                el.OSID     = cl.get_int(15);
                el.date     = cl.get_string(16);

                el.Text  = cl.get_string(7);
                el.Text2 = cl.get_string(8);
                el.Text3 = cl.get_string(9);
                el.Text4 = cl.get_string(10);
                el.Text5 = cl.get_string(11);
                el.Text6 = cl.get_string(12);


                el.read_other_names_base();
                Compare_Pare pare = new Compare_Pare();
                pare.base_el = el;
                rett.pre_mas.Add(pare);
                rett.Serial2_base.Add(el.Serial2);
            }
            cl.Manualy_Close_Connection2();


            for (int i = 0; i < rett.pre_mas.Count; i++)
            {
                rett.pre_mas[i].base_el.read_other_names_base();
            }

            return(rett);
        }
コード例 #6
0
 public ElementWorkForm(Compare_Element el)
 {
     //edit
     InitializeComponent();
     prepare_CmBox();
     pr               = new Compare_Pare();
     pr.base_el       = el;
     pr.xls_el        = null;
     pr.full_pair     = false;
     up_panel.Visible = false;
     load_data_from_pair();
 }
コード例 #7
0
        } // for string

        public void reload_base_el()
        {
            changed = true;
            int             id = pr.base_el.ID;
            Compare_Element el = FuncClass.get_Element(id);

            if (el != null)
            {
                pr.base_el = el;
                load_data_from_pair();
            }
        }
コード例 #8
0
        public static Compare_Element get_Element(int id)
        {
            string zap = "Select itemtable.ID,itemtable.Serial,itemtable.Serial2," +
                         "itemtable.Mark,itemtable.Type,itemtable.Status,itemtable.Place," +
                         "itemtable.Text,itemtable.Text2,itemtable.Text3,itemtable.Text4,itemtable.Text5,itemtable.Text6 " +
                         ",itemtable.Place2, itemtable.Prise, itemtable.OS, itemtable.Date, itemtable.Owner,itemtable.Status2 from itemtable where itemtable.ID=" + id;
            SQL_Class cl = new SQL_Class();

            cl.ReadValues(zap);

            Compare_Element el = null;

            while (cl.SQL_DataReader.Read())
            {
                el = new Compare_Element();

                el.ID = cl.get_int(0);

                el.Serial  = cl.get_string(1);
                el.Serial2 = cl.get_string(2);

                el.Markid   = cl.get_int(3);
                el.Typeid   = cl.get_int(4);
                el.Statusid = cl.get_int(5);
                el.Placeid  = cl.get_int(6);

                el.Place2id  = cl.get_int(13);
                el.Prise     = cl.get_string(14);
                el.OSID      = cl.get_int(15);
                el.date      = cl.SQL_DataReader.GetDateTime(16);
                el.Status2id = cl.get_int(18);
                el.OwnerID   = cl.get_int(17);
                el.Text      = cl.get_string(7);
                el.Text2     = cl.get_string(8);
                el.Text3     = cl.get_string(9);
                el.Text4     = cl.get_string(10);
                el.Text5     = cl.get_string(11);
                el.Text6     = cl.get_string(12);


                el.read_other_names_base();
            }
            cl.Manualy_Close_Connection2();
            return(el);
        }
コード例 #9
0
        private void FillBase_Click(object sender, EventArgs e) //--------
        {
            int start = Convert.ToInt32(start_Tbox.Text);
            int stop  = Convert.ToInt32(stop_Tbox.Text);

            for (int i = start; i < stop; i++)
            {
                Compare_Element el = Compare_Element.get_el_as_base_el(mcl, i);


                string zap = "insert into itemtable (itemtable.Serial,itemtable.Serial2, itemtable.Mark, itemtable.Type, itemtable.Status,itemtable.Place,             itemtable.Text,itemtable.Text2,itemtable.Text3,itemtable.Text4,itemtable.Text5,itemtable.Text6,itemtable.Owner," +
                             "itemtable.Place2,itemtable.OS,itemtable.Date,itemtable.Prise,itemtable.Status2" +
                             ") Values ('" + el.Serial + "','" + el.Serial2 + "'," + el.Markid +
                             "," + el.Typeid + "," + el.Statusid + "," + el.Placeid +
                             ",'" + el.Text + "','" + el.Text2 + "','" + el.Text3 + "','" + el.Text4 + "','" + el.Text5 + "',''," + el.OwnerID + "," + el.Place2id + "," + el.OSID + ",'" + el.date.ToString("yyyy-MM-dd") + "','" + el.Prise + "'," + el.Status2id + ")";
                SQL_Class.Execute(zap);
            }
        }
コード例 #10
0
        private void Add_But_Click(object sender, EventArgs e)
        {
            Compare_Element el = new Compare_Element();

            el.Serial  = ser1.Text;
            el.Serial2 = ser21.Text;

            el.Text  = t1.Text;
            el.Text2 = t2.Text;
            el.Text3 = t3.Text;
            el.Text4 = t4.Text;
            el.Text5 = t5.Text;
            el.Text6 = t6.Text;

            el.Prise     = prise1.Text;
            el.date      = date1.Value;
            el.Status2id = SQL_Class.ReadValueInt32("select ID from status2table where Status2 ='" + status21.SelectedItem + "'");
            el.Typeid    = SQL_Class.ReadValueInt32("select ID from typetable where Type ='" + type1.SelectedItem + "'");
            el.Markid    = SQL_Class.ReadValueInt32("select ID from marktable where Mark ='" + mark1.SelectedItem + "'");
            el.Statusid  =
                SQL_Class.ReadValueInt32("select ID from statustable where  Status ='" + status1.SelectedItem + "'");
            el.Placeid  = SQL_Class.ReadValueInt32("select ID from placetable where Place ='" + place1.SelectedItem + "'");
            el.Place2id =
                SQL_Class.ReadValueInt32("select ID from place2table where PLace2  ='" + place21.SelectedItem + "'");
            el.OSID    = SQL_Class.ReadValueInt32("select ID from ostable where  OS ='" + os1.SelectedItem + "'");
            el.OwnerID = SQL_Class.ReadValueInt32("select ID from ownertable where Owner ='" + owner1.SelectedItem + "'");

            if (FuncClass.add_Element(el))
            {
                Close();
            }
            else
            {
                MessageBox.Show("Элемент не добавлен");
            }
        }