예제 #1
0
 private void button5_Click(object sender, EventArgs e)
 {
     FillTrudoyomkostDB.TarifTableAdapter = new ODLDB210410DataSetTableAdapters.TARIFTableAdapter();
     FillTrudoyomkostDB.TarifDataTable    = new ODLDB210410DataSet.TARIFDataTable();
     FillTrudoyomkostDB.Tn148TableAdapter = new ODLDB210410DataSetTableAdapters.TN148TableAdapter();
     FillTrudoyomkostDB.Tn158TableAdapter = new ODLDB210410DataSetTableAdapters.TN158TableAdapter();
     FillTrudoyomkostDB.Tn70TableAdapter  = new ODLDB210410DataSetTableAdapters.TN70TableAdapter();
     FillTrudoyomkostDB.Tn148DataTable    = new ODLDB210410DataSet.TN148DataTable();
     FillTrudoyomkostDB.Tn158DataTable    = new ODLDB210410DataSet.TN158DataTable();
     FillTrudoyomkostDB.Tn70DataTable     = new ODLDB210410DataSet.TN70DataTable();
     FillTrudoyomkostDB.Tn148TableAdapter.Fill(FillTrudoyomkostDB.Tn148DataTable);
     FillTrudoyomkostDB.Tn158TableAdapter.Fill(FillTrudoyomkostDB.Tn158DataTable);
     FillTrudoyomkostDB.InsertFromTNTables();
     dataGridView3.DataSource = FillTrudoyomkostDB.LabourNormDataTable;
     dataGridView4.DataSource = FillTrudoyomkostDB.WhereOperationUseDataTable;
 }
예제 #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (openMdbFile.ShowDialog() == DialogResult.OK)
            {
                string connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Persist Security Info=True", openMdbFile.FileName);
                ImportAnTables.conectionString = connectionString;
            }

            DataSet inputSet = ImportAnTables.FillData();

            FillTrudoyomkostDB.InsertFromANTables(inputSet);


            dataGridView1.DataSource = FillTrudoyomkostDB.InfDetDataTable;
            dataGridView2.DataSource = FillTrudoyomkostDB.WhereUseDataTable;
        }
예제 #3
0
        public void AddDoubleItems()
        {
            this.Enabled = false;



            var labourNormlist = LinqQueryForTrudoyomkost.FillLabournNormForDet(_destinationDetID);

            foreach (var item in labourNormlist)
            {
                var whereOperUselstdel = LinqQueryForTrudoyomkost.FillWhereOperationUseList(item.ID);

                if (whereOperUselstdel.Count() > 0)
                {
                    foreach (var applydel in whereOperUselstdel)
                    {
                        FillTrudoyomkostDB.WhereOperationUseList.Remove(applydel);
                    }
                }

                FillTrudoyomkostDB.LabourNormTableAdapter.DeleteQuery(item.ID);
                FillTrudoyomkostDB.WhereOperationUseTableAdapter.DeleteQuery(item.ID);
                FillTrudoyomkostDB.LabourNormList.Remove(item);
            }

            labourNormlist = LinqQueryForTrudoyomkost.FillLabournNormForDet(_sourceDetID);


            using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
            {
                int Id             = 0;
                int whereOperUseId = FillTrudoyomkostDB.WhereOperationUseList.Last().Id;
                Id = currentContext.LabourNorm.ToList().Max().ID;
                foreach (var item in labourNormlist)
                {
                    var whereOperUselst = LinqQueryForTrudoyomkost.FillWhereOperationUseList(item.ID);
                    if (whereOperUselst.Count() > 0)
                    {
                        Id++;
                        //FillTrudoyomkostDB.LabourNormTableAdapter.InsertQuery(_destinationDetID, item.OperNum, item.DepRegion, item.ProfCode, item.NameKindWork,
                        // item.TariffNetNum, item.KindPay, item.WorkerRate, item.ItemCTN, item.PreparTimeCTN,
                        //item.ItemPayNorm, item.PreparTimePayNorm, item.Valuation, item.ValPreparTime, item.CoeffCTN, item.DocNum, item.Date, item.TaskNumber);

                        FillTrudoyomkostDB.FilltmpLabourNormRow(new LabourNorm(Id, _destinationDetID, item.OperNum, item.DepRegion, item.ProfCode,
                                                                               item.NameKindWork, item.TariffNetNum, item.KindPay, item.WorkerRate, item.ItemCTN, item.PreparTimeCTN, item.ItemPayNorm, item.PreparTimePayNorm,
                                                                               item.Valuation, item.ValPreparTime, item.CoeffCTN, item.DocNum, DateTime.Now, item.TaskNumber));

                        FillTrudoyomkostDB.LabourNormList.Add(new LabourNorm(Id, _destinationDetID, item.OperNum, item.DepRegion, item.ProfCode,
                                                                             item.NameKindWork, item.TariffNetNum, item.KindPay, item.WorkerRate, item.ItemCTN, item.PreparTimeCTN, item.ItemPayNorm, item.PreparTimePayNorm,
                                                                             item.Valuation, item.ValPreparTime, item.CoeffCTN, item.DocNum, DateTime.Now, item.TaskNumber));


                        //currentContext.LabourNorm.InsertOnSubmit(new LabourNorm(Id, _destinationDetID, item.OperNum, item.DepRegion, item.ProfCode,
                        //  item.NameKindWork, item.TariffNetNum, item.KindPay, item.WorkerRate, item.ItemCTN, item.PreparTimeCTN, item.ItemPayNorm, item.PreparTimePayNorm,
                        //  item.Valuation, item.ValPreparTime, item.CoeffCTN, item.DocNum, DateTime.Now, item.TaskNumber));



                        foreach (var applyItem in whereOperUselst)
                        {
                            whereOperUseId++;

                            FillTrudoyomkostDB.FilltmpWhereOperUseRow(new WhereOperationUse(Id, applyItem.SeriaFrom, applyItem.SeriaTo, applyItem.InfProductsChipher));
                            FillTrudoyomkostDB.WhereOperationUseList.Add(new WhereOperationUse(Id, applyItem.SeriaFrom, applyItem.SeriaTo, applyItem.InfProductsChipher, whereOperUseId));
                            //currentContext.WhereOperationUse.InsertOnSubmit(new WhereOperationUse(Id, applyItem.SeriaFrom, applyItem.SeriaTo, applyItem.InfProductsChipher,whereOperUseId));

                            //FillTrudoyomkostDB.WhereOperationUseTableAdapter.InsertQuery(Id, applyItem.SeriaFrom, applyItem.SeriaTo, applyItem.InfProductsChipher);
                        }
                    }
                    //currentContext.SubmitChanges();
                }
                DataTable tmpWhereOperUse = FillTrudoyomkostDB.WhereOperationUseDataTable;
                DataTable tmpLabourNorm   = FillTrudoyomkostDB.LabourNormDataTable;

                SqlCeBulkCopy bulkInsert = new SqlCeBulkCopy(Properties.Settings.Default.TrudoyomkostDBConnectionString);
                if (tmpWhereOperUse.Rows.Count > 0)
                {
                    bulkInsert.DestinationTableName = "whereOperationUse";
                    bulkInsert.WriteToServer(tmpWhereOperUse);
                }
                if (tmpLabourNorm.Rows.Count > 0)
                {
                    bulkInsert.DestinationTableName = "LabourNorm";
                    bulkInsert.WriteToServer(tmpLabourNorm);
                }
                FillTrudoyomkostDB.LabourNormDataTable.Clear();
                FillTrudoyomkostDB.WhereOperationUseDataTable.Clear();
                bulkInsert.Close();
            }

            this.Enabled = true;
        }
예제 #4
0
 private void btTarifImport_Click(object sender, EventArgs e)
 {
     FillTrudoyomkostDB.TarifTableAdapter.Fill(FillTrudoyomkostDB.TarifDataTable);
     FillTrudoyomkostDB.InsertFromTARIF();
 }