Example #1
0
        private void Double_Click(object sender, EventArgs e)
        {
            vypuskDataSet.ПродукцияRow Donor   = (bindingSource.Current as DataRowView).Row as vypuskDataSet.ПродукцияRow;
            vypuskDataSet.ПродукцияRow NewProd = DataSet.Продукция.NewПродукцияRow();

            NewProd.ID_Продукции        = (int)DataSet.Продукция.Select("", "[ID Продукции] DESC")[0].ItemArray[0] + 1;
            NewProd.Наименование_детали = Donor.Наименование_детали as string;                                /////////////////////////////////
            NewProd.Количество          = 0;                                                                  //   Дублирование
            NewProd.Отметка             = false;                                                              //   выбранной детали
            DataSet.Продукция.AddПродукцияRow(NewProd);                                                       /////////////////////////////////
            BindingSource table = new BindingSource(DataSet, "Узлы");

            table.Filter = "[ID Узловой детали] = " + Donor.ID_Продукции;
            foreach (DataRowView rowView in table)                                                              /////////////////////////////////
            {                                                                                                   //
                vypuskDataSet.УзлыRow NewRow = DataSet.Узлы.NewУзлыRow();                                       //   Копирование
                NewRow.ID_Детали = (rowView.Row as vypuskDataSet.УзлыRow).ID_Детали;                            //   узлов
                NewRow.ПродукцияRowByПродукцияУзлы = NewProd;                                                   //
                NewRow.Количество_деталей          = (rowView.Row as vypuskDataSet.УзлыRow).Количество_деталей; //
                DataSet.Узлы.AddУзлыRow(NewRow);                                                                //
            }                                                                                                   /////////////////////////////////
            table        = new BindingSource(DataSet, "Операции");
            table.Filter = "[ID Продукции] = " + Donor.ID_Продукции;
            foreach (DataRowView rowView in table)                                                            /////////////////////////////////
            {                                                                                                 //
                vypuskDataSet.ОперацииRow NewRow = DataSet.Операции.NewОперацииRow();                         //  Копирование
                if (rowView.Row[1].GetType() != typeof(DBNull))                                               //  операций
                {
                    NewRow.Номер = (int)rowView.Row[1];                                                       //
                }
                if (rowView.Row[2].GetType() != typeof(DBNull))                                               //
                {
                    NewRow.ID_Вида = (int)rowView.Row[2];                                                     //
                }
                NewRow.ПродукцияRow = NewProd;                                                                //
                if (rowView.Row[4].GetType() != typeof(DBNull))                                               //
                {
                    NewRow.ID_Цеха = (int)rowView.Row[4];                                                     //
                }
                if (rowView.Row[5].GetType() != typeof(DBNull))                                               //
                {
                    NewRow.Норма = (double)rowView.Row[5];                                                    //
                }
                if (rowView.Row[6].GetType() != typeof(DBNull))                                               //
                {
                    NewRow.азряд = rowView.Row[6] as string;                                                  //
                }
                if (rowView.Row[7].GetType() != typeof(DBNull))                                               //
                {
                    NewRow.Коэффициент = rowView.Row[7] as string;                                            //
                }
                if (rowView.Row[8].GetType() != typeof(DBNull))                                               //
                {
                    NewRow.Примечание = rowView.Row[8] as string;                                             //
                }
                NewRow.Отметка = false;                                                                       //
                DataSet.Операции.AddОперацииRow(NewRow);                                                      /////////////////////////////////
            }
        }
Example #2
0
        private void DoubleOp_Click(object sender, EventArgs e)
        {
            DataRow row = (операцииBindingSource.Current as DataRowView).Row;

            vypuskDataSet.ОперацииRow newRow = (операцииBindingSource.AddNew() as DataRowView).Row as vypuskDataSet.ОперацииRow;

            if (row.ItemArray[1].GetType() != typeof(DBNull))
            {
                newRow.Номер = (int)row.ItemArray[1];
            }

            if (row.ItemArray[2].GetType() != typeof(DBNull))
            {
                newRow.ID_Вида = (int)row.ItemArray[2];
            }

            if (row.ItemArray[3].GetType() != typeof(DBNull))
            {
                newRow.ID_Продукции = (int)row.ItemArray[3];
            }

            if (row.ItemArray[4].GetType() != typeof(DBNull))
            {
                newRow.ID_Цеха = (int)row.ItemArray[4];
            }

            if (row.ItemArray[5].GetType() != typeof(DBNull))
            {
                newRow.Норма = (double)row.ItemArray[5];
            }

            if (row.ItemArray[6].GetType() != typeof(DBNull))
            {
                newRow.азряд = row.ItemArray[6] as string;
            }

            if (row.ItemArray[7].GetType() != typeof(DBNull))
            {
                newRow.Коэффициент = row.ItemArray[7] as string;
            }

            if (row.ItemArray[8].GetType() != typeof(DBNull))
            {
                newRow.Примечание = row.ItemArray[8] as string;
            }

            if (row.ItemArray[9].GetType() != typeof(DBNull))
            {
                newRow.Отметка = (bool)row.ItemArray[9];
            }

            if (row.ItemArray[10].GetType() != typeof(DBNull))
            {
                newRow.Премия = (double)row.ItemArray[10];
            }
        }