Example #1
0
        private void tabFullReport_Enter(object sender, EventArgs e)
        {
            dtTotralForSeria = new DataTable("OperationApplyTable");
            DataColumn ProfCode                = new DataColumn("ProfCode", typeof(int));
            DataColumn NameKindWork            = new DataColumn("NameKindWork", typeof(string));
            DataColumn KindPayColumn           = new DataColumn("KindPay", typeof(string));
            DataColumn WorkerRateColumn        = new DataColumn("WorkerRate", typeof(double));
            DataColumn ItemCTNColumn           = new DataColumn("ItemCTN", typeof(decimal));
            DataColumn PreparTimeCTNColumn     = new DataColumn("PreparTimeCTN", typeof(decimal));
            DataColumn ItemPayNormColumn       = new DataColumn("ItemPayNorm", typeof(decimal));
            DataColumn PreparTimePayNormColumn = new DataColumn("PreparTimePayNorm", typeof(decimal));
            DataColumn ValuationColumn         = new DataColumn("Valuation", typeof(double));
            DataColumn ValPreparTimeColumn     = new DataColumn("ValPreparTime", typeof(double));

            dtTotralForSeria.Columns.AddRange(new DataColumn[] {
                ProfCode, NameKindWork, KindPayColumn, WorkerRateColumn, ItemCTNColumn,
                PreparTimeCTNColumn, ItemPayNormColumn, PreparTimePayNormColumn, ValuationColumn, ValPreparTimeColumn
            });

            LinqQueryForTrudoyomkost.GetTotalCalculNormReport(_seriaFrom, _selectProdCipher, ref dtTotralForSeria);
            dgTotalNormCalc.DataSource = dtTotralForSeria;
            UserDataTables.SetDgColumns(dgTotalNormCalc);
            label31.Text = lbProduct.Text;
            label30.Text = vtbSeriaFrom.ValueTxt;
        }
Example #2
0
        //нажатие мышкой на один из номеров ктс в главном меню
        private void listBox1_Click(object sender, EventArgs e)
        {
            chbWithoutNorm.Enabled = true;
            _detNumID           = dcIDDetNum[lboxDetNum.SelectedItem.ToString()];
            tbSearchDetNum.Text = lboxDetNum.SelectedItem.ToString();

            LinqQueryForTrudoyomkost.FillLabourListForSelectDet(_detNumID, ref FillTrudoyomkostDB.CurrentLabourNormList);

            LinqQueryForTrudoyomkost.SetWhereUseDt(_dtWhereUse, _depList, _infProductsDc, _detNumID);

            _taskNumbers = LinqQueryForTrudoyomkost.SelectAllTaskNum();
            cboxChangeTaskNum.DataSource = _taskNumbers;

            var tempResult2 = from infdet in _infDetList
                              join depList in _depList
                              on infdet.DepProducer equals depList.ID
                              where infdet.ID == _detNumID
                              select new
            {
                depList.Code
            };

            _depProducer = tempResult2.First().Code.ToString();

            lbDepProducer.Text   = _depProducer;
            lbDetNum.Text        = lboxDetNum.SelectedItem.ToString();
            lbNormMapNumber.Text = _detNumID.ToString();

            FillTrudoyomkostDB.NormMapNumber = lbNormMapNumber.Text;

            CreateMaxApplyDc(new List <string>()
            {
                "158", "148", "70"
            });
        }
Example #3
0
        private void FillFormData()
        {
            using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
            {
                LinqQueryForTrudoyomkost.FillInfProductsList(currentContext, ref FillTrudoyomkostDB.infProductList);
                LinqQueryForTrudoyomkost.FillLabourNormList(currentContext, ref FillTrudoyomkostDB.LabourNormList);
                LinqQueryForTrudoyomkost.FillWhereOperationUseList(currentContext, ref FillTrudoyomkostDB.WhereOperationUseList);

                _whereUseList = LinqQueryForTrudoyomkost.FillWhereUselst(currentContext);
                _depList      = LinqQueryForTrudoyomkost.FillinfDeplst(currentContext);
                _infDetList   = LinqQueryForTrudoyomkost.FillinfDetList(currentContext);

                FillTrudoyomkostDB.whereUseList = _whereUseList;
                FillTrudoyomkostDB.infDetList   = _infDetList;

                LinqQueryForTrudoyomkost.FilldcInfProducts(currentContext, ref FillTrudoyomkostDB.DcInfProducts);

                _infProductsDc = FillTrudoyomkostDB.DcInfProducts;

                LinqQueryForTrudoyomkost.FilldcDetNumForProduct(ref dcIDDetNum, _infProductsDc.Values.First());
                LinqQueryForTrudoyomkost.FilldtInfProf(currentContext, ref _dtInfProf);
                LinqQueryForTrudoyomkost.GetInfTariffList(currentContext, ref FillTrudoyomkostDB.tariffList);
                LinqQueryForTrudoyomkost.FillDictDepIDCode(currentContext, ref FillTrudoyomkostDB.DicDepCodeAndId);

                _detNumList.Clear();
                foreach (var item in dcIDDetNum)
                {
                    _detNumList.Add(item.Key);
                }
            }//
        }
Example #4
0
 public UpdateAndCreateNewLabourCard(List <int> infdetIdList, WhereOperationUse inputObj)
 {
     _infDetIdList      = infdetIdList;
     _applyWhereOpers   = inputObj;
     _oldAndNewLabourId = new Dictionary <int, int>();
     LinqQueryForTrudoyomkost.GetInfTariff(ref _inftariff);
 }
Example #5
0
        private void tabTotal_Enter(object sender, EventArgs e)
        {
            label26.Text = lbProduct.Text;
            label27.Text = vtbSeriaFrom.ValueTxt;
            TotalForSeria currentTotalSeria = new TotalForSeria();

            currentTotalSeria.DetCount          = LinqQueryForTrudoyomkost.GetAmountDetForSeria(_seriaFrom, _seriaTo, _selectProdCipher, "Д ");
            currentTotalSeria.AssembNormalCount = LinqQueryForTrudoyomkost.GetAmountDetForSeria(_seriaFrom, _seriaTo, _selectProdCipher, "CH");
            currentTotalSeria.AssemblyCount     = LinqQueryForTrudoyomkost.GetAmountDetForSeria(_seriaFrom, _seriaTo, _selectProdCipher, "C ");
            currentTotalSeria.NormalCount       = LinqQueryForTrudoyomkost.GetAmountDetForSeria(_seriaFrom, _seriaTo, _selectProdCipher, "H ");


            currentTotalSeria.TotalDetCount          = LinqQueryForTrudoyomkost.GetTotalDetForSeria(_seriaFrom, _seriaTo, _selectProdCipher, "Д ");
            currentTotalSeria.TotalAssembNormalCount = LinqQueryForTrudoyomkost.GetTotalDetForSeria(_seriaFrom, _seriaTo, _selectProdCipher, "CH");
            currentTotalSeria.TotalAssemblyCount     = LinqQueryForTrudoyomkost.GetTotalDetForSeria(_seriaFrom, _seriaTo, _selectProdCipher, "C ");
            currentTotalSeria.TotalNormalCount       = LinqQueryForTrudoyomkost.GetTotalDetForSeria(_seriaFrom, _seriaTo, _selectProdCipher, "H ");


            //  currentTotalSeria.PayNormAmount = LinqQueryForTrudoyomkost.VozvratKolvaItemPayNorm(_seriaFrom, _seriaTo, _selectProdCipher);
            currentTotalSeria.CTNormAmount  = (int)LinqQueryForTrudoyomkost.GetTotalDetForSeria2(_seriaFrom, _seriaTo, _selectProdCipher);
            currentTotalSeria.PayNormAmount = (int)LinqQueryForTrudoyomkost.GetTotalDetForSeria3(_seriaFrom, _seriaTo, _selectProdCipher);

            Type t = currentTotalSeria.GetType();

            FieldInfo[] finfo = t.GetFields();

            dgTotalTypeDet.Rows.Clear();
            foreach (var p in finfo)
            {
                dgTotalTypeDet.Rows.Add(_totalRowsNames[p.Name], "шт", p.GetValue(currentTotalSeria));
            }
        }
Example #6
0
 private void chBoxNotFill_CheckedChanged(object sender, EventArgs e)
 {
     if (chBoxNotFill.Checked)
     {
         LinqQueryForTrudoyomkost.GetEmptyDetNum(ref _detNumList, _seriaFrom, _infProductsDc[cbSelectProduct.SelectedItem.ToString()]);
         SetlboxDetNum();
     }
 }
Example #7
0
 private void tabProducts_Enter(object sender, EventArgs e)
 {
     using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
     {
         dgProducts.DataSource          = LinqQueryForTrudoyomkost.GetAllProducts(currentContext);
         dgProducts.Columns[0].ReadOnly = true;
     }
 }
Example #8
0
        private void vtbSeriaTo_Validated(object sender, EventArgs e)
        {
            ValidatingTextBox tempVtb = sender as ValidatingTextBox;

            _seriaTo = MathFunctionForSeries.GetIntSeriaNumber(tempVtb.ValueTxt);
            LinqQueryForTrudoyomkost.FillOperNumlbox(_detNumID, _seriaFrom, _seriaTo, _selectProdCipher,
                                                     ref lBoxOperNum);
        }
Example #9
0
        private void cbSelectProduct_SelectedIndexChanged(object sender, EventArgs e)           //выбор изделия
        {
            _selectProdCipher = _infProductsDc[cbSelectProduct.SelectedItem.ToString()];        //шифр изделия, например 17 у 158го изделия
            LinqQueryForTrudoyomkost.FilldcDetNumForProduct(ref dcIDDetNum, _selectProdCipher); //что за dcIDDetNum???
            _detNumList.Clear();
            _detNumList = dcIDDetNum.Keys.ToList();                                             // это будет выведенно

            SetlboxDetNum();
        }
Example #10
0
        private void tabNormView_Enter(object sender, EventArgs e)
        {
            _allLabourNormForSeries = LinqQueryForTrudoyomkost.GetAllLabourNormForSeria(_seriaFrom, _seriaTo, _selectProdCipher);


            dgLabourViewer.DataSource = _allLabourNormForSeries;
            if (dgLabourViewer.Columns.Count != 0)
            {
                UserDataTables.SetDgColumns(dgLabourViewer);
            }
        }
Example #11
0
        public static void InsertFromANTables(DataSet tableList)
        {
            using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
            {
                LinqQueryForTrudoyomkost.FilldcInfProducts(currentContext, ref DcInfProducts);
                LinqQueryForTrudoyomkost.FillDictDetNumID(currentContext, ref DicDetNumAndId);
                LinqQueryForTrudoyomkost.FillDictDepIDCode(currentContext, ref DicDepCodeAndId);

                Properties.Settings.Default.DetID = currentContext.InfDet.ToList().Count == 0 ? 0 : ++currentContext.InfDet.ToList().Last().ID;
            }

            if (int.Parse((tableList.Tables[0].Rows[0].Field <string>("CEH").Trim())) != Properties.Settings.Default.DepNum)
            {
                return;
            }

            _whereUseTableAdapter.DeleteAllQuery();
            foreach (DataTable itemTable in tableList.Tables)
            {
                foreach (DataRow itemRow in itemTable.Rows)
                {
                    string NDET = (string)itemRow["NDET"];
                    if (!DicDetNumAndId.ContainsKey(NDET))
                    {
                        var infDetItem = FillItemInfDet(itemRow);
                        FilltmpInfDetRow(ref infDetItem);

                        DicDetNumAndId.Add(NDET, Properties.Settings.Default.DetID);
                        Properties.Settings.Default.DetID++;
                    }
                    var itemWhereuse = FillItemWhereUse(itemRow);
                    FilltmpWhereUseRow(itemWhereuse);
                }
            }
            Properties.Settings.Default.Save();
            SqlCeBulkCopy bulkInsert    = new SqlCeBulkCopy(connString);
            DataTable     tmptbInfDet   = InfDetDataTable;
            DataTable     tmptbWhereUse = WhereUseDataTable;

            if (tmptbInfDet.Rows.Count > 0)
            {
                bulkInsert.DestinationTableName = "infDet";
                bulkInsert.WriteToServer(tmptbInfDet);
            }
            if (tmptbWhereUse.Rows.Count > 0)
            {
                bulkInsert.DestinationTableName = "whereUse";
                bulkInsert.WriteToServer(tmptbWhereUse);
            }

            WhereUseDataTable.Clear();
            InfDetDataTable.Clear();
            bulkInsert.Close();
        }
Example #12
0
 public fmAuthentication(mainForm fm)
 {
     this.fm = fm;
     InitializeComponent();
     //tbLogin.Text = "admin";
     //tbPass.Text = "admin";
     using (var newLocalDb = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
     {
         _usersList = LinqQueryForTrudoyomkost.FillUsersList(newLocalDb);
     }
 }
Example #13
0
        public void UpdateApplyDataGrid()
        {
            LinqQueryForTrudoyomkost.FillLabourListForSelectDet(_infDetID, ref FillTrudoyomkostDB.CurrentLabourNormList);
            if (TrudoyomkostSettings.IsAggregateDep && _taskNum != "")
            {
                LinqQueryForTrudoyomkost.SelectLabourNormTaskNum(_taskNum);
            }

            LinqQueryForTrudoyomkost.FilldcOperApply(ref _dcApplyOper);
            UpdateDgTotal();
            dgOperViewer_RowEnter(this.dgOperViewer, new DataGridViewCellEventArgs(0, 0));
        }
Example #14
0
        public void UpdateDataGrids()
        {
            LinqQueryForTrudoyomkost.FillLabourListForSelectDet(_infDetID, ref FillTrudoyomkostDB.CurrentLabourNormList);
            if (TrudoyomkostSettings.IsAggregateDep && _taskNum != "")
            {
                LinqQueryForTrudoyomkost.SelectLabourNormTaskNum(_taskNum);
            }

            LinqQueryForTrudoyomkost.FilldcOperApply(ref _dcApplyOper);
            LinqQueryForTrudoyomkost.FilldtNormViewer(_seriaFrom, _seriaTo, _infProdChipher, ref _dtLabourNorm, rbHours.Checked, ref _normTotalbyTheJob, ref _normTotalByTheTime);
            UpdateDgTotal();
            dgOperViewer_RowEnter(this.dgOperViewer, new DataGridViewCellEventArgs(0, 0));
        }
Example #15
0
 private void btDelProf_Click(object sender, EventArgs e)
 {
     if (
         MessageBox.Show("Вы уверены, что хотите удалить запись?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         FillTrudoyomkostDB.InfProfessionTableAdapter.DeleteRow(_currentProfCode);
         using (
             var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
         {
             LinqQueryForTrudoyomkost.FilldtInfProf(currentContext, ref _dtInfProf);
         }
     }
 }
Example #16
0
        private void cboxChangeTaskNum_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox input = sender as ComboBox;

            if (input != null)
            {
                if (cboxChangeTaskNum.Visible == true)
                {
                    LinqQueryForTrudoyomkost.FillLabourListForSelectDet(_detNumID, ref FillTrudoyomkostDB.CurrentLabourNormList);
                    _selectTaskNumber = input.SelectedValue.ToString();
                    LinqQueryForTrudoyomkost.SelectLabourNormTaskNum(_selectTaskNumber);
                }
            }
        }
Example #17
0
        public void InitializeFormElemets()
        {
            Type t = _normTotalbyTheJob.GetType();

            PropertyInfo[] pinfo = t.GetProperties();
            int            i     = 0;

            foreach (var p in pinfo)
            {
                dgTotal.Columns.Add(p.Name, "");
                dgTotal.Columns[i].Width = 60;
                i++;
            }

            foreach (var item in FillTrudoyomkostDB.DcMaxApply)
            {
                _lboxMaxSeriaInfo.Items.Add(item.Key + "   Серия С " +
                                            MathFunctionForSeries.GetStringSeriaNumber(item.Value.SeriaFrom)
                                            + "   Серия По " +
                                            MathFunctionForSeries.GetStringSeriaNumber(item.Value.SeriaTo));
            }


            LinqQueryForTrudoyomkost.FilldtNormViewer(_seriaFrom, _seriaTo, _infProdChipher,
                                                      ref _dtLabourNorm, rbHours.Checked, ref _normTotalbyTheJob, ref _normTotalByTheTime);

            LinqQueryForTrudoyomkost.FilldcOperApply(ref _dcApplyOper);
            UpdateDgTotal();

            cboxTariff.DataSource            = FillTrudoyomkostDB.tariffList;
            cboxTariff.SelectedIndex         = cboxTariff.Items.IndexOf(TrudoyomkostSettings.TariffNetNum);
            cboxTariff.SelectedValueChanged += new System.EventHandler(cboxTariff_SelectedValueChanged);

            //Filing _dcApplyOper during Form loading...

            dgOperViewer.DataSource = _dtLabourNorm;
            dgOperApply.DataSource  = _dtOperApply;
            lbDetNum.Text           = _detNum;

            labelVsDetName.Text = _detName;
            //  labelVsDetName.Text = _detName;

            vtbSeriaFrom.StringAutoCorrectionMethod = VtboxMethods.correctForInt;
            vtbSeriaFrom.ValidateValue            = VtboxMethods.CheckSeria;
            vtbSeriaTo.StringAutoCorrectionMethod = VtboxMethods.correctForInt;
            vtbSeriaTo.ValidateValue  = VtboxMethods.CheckSeria;
            vtbProdName.ValidateValue = CheckProdNume;
            vtbProdName.StringAutoCorrectionMethod = VtboxMethods.correctForInt;
        }
Example #18
0
        private void btDe_Click(object sender, EventArgs e)
        {
            var tempresult = from laboritem in FillTrudoyomkostDB.CurrentLabourNormList
                             join whereOperitem in FillTrudoyomkostDB.WhereOperationUseList
                             on laboritem.ID equals whereOperitem.LabourNormID
                             where laboritem.OperNum == lBoxOperNum.SelectedItem.ToString()
                             select whereOperitem;

            WhereOperationUse firstittem = tempresult.First();

            FillTrudoyomkostDB.WhereOperationUseList.Remove(firstittem);
            FillTrudoyomkostDB.WhereOperationUseTableAdapter.DeleteQuery(firstittem.LabourNormID);

            LinqQueryForTrudoyomkost.FillOperNumlbox(_detNumID, _seriaFrom, _seriaTo, _selectProdCipher,
                                                     ref lBoxOperNum);
        }
Example #19
0
        private void exportBackGround_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            MDBProvider        mdbProvider = new MDBProvider();
            DataTable          resultdt    = new DataTable();
            ODLDB210410DataSet dataset     = new ODLDB210410DataSet();

            resultdt = dataset.AN148;

            mdbProvider.CreateDB();
            mdbProvider.CreateTNTable("TN148", dataset.TN148);
            mdbProvider.CreateTNTable("TN158", dataset.TN148);
            mdbProvider.CreateTNTable("TN178", dataset.TN148);
            mdbProvider.CreateTNTable("TN70", dataset.TN148);


            resultdt = LinqQueryForTrudoyomkost.FillTNTable(31);
            DataTable testDt = new DataTable();

            mdbProvider.simpleInsert(resultdt);
            resultdt = LinqQueryForTrudoyomkost.FillTNTable(17);
            mdbProvider.simpleInsert(resultdt);
        }
Example #20
0
 private void btProfAdd_Click_1(object sender, EventArgs e)
 {
     foreach (DataRow row in _dtInfProf.Rows)
     {
         if ((int)row[0] == int.Parse(vtbProfCode.ValueTxt))
         {
             return;
         }
     }
     if (checkValidateProfRow(gpEditProff))
     {
         using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
         {
             FillTrudoyomkostDB.InfProfessionTableAdapter.InsertQuery(int.Parse(vtbProfCode.ValueTxt),
                                                                      tbProfName.Text, tbProfKindWork.Text, 1049);
             LinqQueryForTrudoyomkost.FilldtInfProf(currentContext, ref _dtInfProf);
         }
         errorProv.SetError(gpEditProff, String.Empty);
     }
     else
     {
         errorProv.SetError(gpEditProff, "Заполните поля");
     }
 }
Example #21
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;
        }
Example #22
0
        private void InitializeFormElement()
        {
            this.Location = new Point(_parentForm.Location.X, _parentForm.Location.Y);


            vtbOperNum.ValidateValue  = VtboxMethods.checkForNonEmpty;
            vtbTaskNum.ValidateValue  = VtboxMethods.checkForNonEmpty;
            vtbWorkRate.ValidateValue = VtboxMethods.checkWorkRate;
            vtbWorkRate.StringAutoCorrectionMethod = VtboxMethods.correctForDouble;

            vtbItemCTN.ValidateValue = VtboxMethods.checkForDouble;
            vtbItemCTN.StringAutoCorrectionMethod       = VtboxMethods.correctForDouble;
            vtbPreparTimeCTN.ValidateValue              = VtboxMethods.checkForDouble;
            vtbPreparTimeCTN.StringAutoCorrectionMethod = VtboxMethods.correctForDouble;
            vtbCoeffCTN.ValidateValue = VtboxMethods.checkForDouble;
            vtbCoeffCTN.StringAutoCorrectionMethod = VtboxMethods.correctForDouble;

            vtbItemPayNorm.ValidateValue = VtboxMethods.checkForDouble;
            vtbItemPayNorm.StringAutoCorrectionMethod       = VtboxMethods.correctForDouble;
            vtbPreparTimePayNorm.ValidateValue              = VtboxMethods.checkForDouble;
            vtbPreparTimePayNorm.StringAutoCorrectionMethod = VtboxMethods.correctForDouble;

            vtbLoverCoeff.ValidateValue = VtboxMethods.checkForDouble;
            vtbLoverCoeff.StringAutoCorrectionMethod = VtboxMethods.correctForDouble;
            vtbDepRegion.ValidateValue = VtboxMethods.checkForDouble;
            vtbPreparTimePayNorm.StringAutoCorrectionMethod = VtboxMethods.correctForDouble;


            vtbSeriaFrom.StringAutoCorrectionMethod = VtboxMethods.correctForInt;
            vtbSeriaFrom.ValidateValue            = VtboxMethods.CheckSeria;
            vtbSeriaTo.StringAutoCorrectionMethod = VtboxMethods.correctForInt;
            vtbSeriaTo.ValidateValue  = VtboxMethods.CheckSeria;
            vtbProdName.ValidateValue = VtboxMethods.CheckProdNume;
            vtbProdName.StringAutoCorrectionMethod = VtboxMethods.correctForInt;

            using (var newLocalDb = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
            {
                LinqQueryForTrudoyomkost.FilldcInfProfession(newLocalDb, ref _dcShortInfProf, ref vcbProfCode);
                LinqQueryForTrudoyomkost.FilldcInfTariffInfo(newLocalDb, ref _dcInfTariffInfo);
            }
            vcbProfCode.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            vcbProfCode.AutoCompleteSource = AutoCompleteSource.ListItems;
            _autoComSourceForDocNum        = LinqQueryForTrudoyomkost.FillDocNumlst();
            foreach (var item in _autoComSourceForDocNum)
            {
                cbDocNum.Items.Add(item);
            }

            cbDocNum.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            cbDocNum.AutoCompleteSource       = AutoCompleteSource.ListItems;
            cbDocNum.AutoCompleteCustomSource = _autoComSourceForDocNum;

            dgOperApply.Columns[1].Width = 120;
            dgOperApply.Columns[2].Width = 120;
            vtbSeriaTo.ValueTxt          = " ";
            vtbLoverCoeff.ValueTxt       = "1";
            vtbCoeffCTN.ValueTxt         = "0";
            if (TrudoyomkostSettings.IsAggregateDep)
            {
                vtbTaskNum.Enabled = true;
            }
        }
Example #23
0
        public static void InsertFromTNTables()
        {
            InfDetDataTable.Clear();
            using (var newLocalDb = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
            {
                LinqQueryForTrudoyomkost.FillDictDetNumID(newLocalDb, ref DicDetNumAndId);
                LinqQueryForTrudoyomkost.FillDictDepIDCode(newLocalDb, ref DicDepCodeAndId);
                LinqQueryForTrudoyomkost.FillDictInfProfession(newLocalDb, ref DictInfProfession);
            }


            int whereOperUseId = 1;

            foreach (var item in Tn148DataTable)
            {
                if (DicDetNumAndId.ContainsKey(item.NDET))
                {
                    LabourNorm itemlabourNorm = FillItemLabourNorm(item);
                    itemlabourNorm.ID = whereOperUseId;
                    FilltmpLabourNormRow(itemlabourNorm);

                    WhereOperationUse itemWhereOperUse = FillItemWhereOperationUse(item);
                    itemWhereOperUse.LabourNormID = whereOperUseId;
                    FilltmpWhereOperUseRow(itemWhereOperUse);

                    ListAllLabourNorm.Add(item.NDET);
                    whereOperUseId++;
                }
            }

            using (var newLocalDb = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
            {
                LinqQueryForTrudoyomkost.FillDictDetNumID(newLocalDb, ref DicDetNumAndId);
            }
            DicCheckRepeatTN.Clear();
            foreach (var item in Tn158DataTable)
            {
                if (DicDetNumAndId.ContainsKey(item.NDET))
                {
                    LabourNorm itemlabourNorm = FillItemLabourNorm(item);
                    itemlabourNorm.ID = whereOperUseId;
                    FilltmpLabourNormRow(itemlabourNorm);

                    WhereOperationUse itemWhereOperUse = FillItemWhereOperationUse(item);
                    itemWhereOperUse.LabourNormID = whereOperUseId;
                    FilltmpWhereOperUseRow(itemWhereOperUse);

                    ListAllLabourNorm.Add(item.NDET);
                    whereOperUseId++;
                }
            }
            Properties.Settings.Default.Save();
            SqlCeBulkCopy bulkInsert      = new SqlCeBulkCopy(connString);
            DataTable     tmptbLabourNorm = LabourNormDataTable;
            DataTable     tmpWhereOperUse = WhereOperationUseDataTable;

            if (tmptbLabourNorm.Rows.Count > 0)
            {
                bulkInsert.DestinationTableName = "LabourNorm";
                bulkInsert.WriteToServer(tmptbLabourNorm);
            }
            if (tmpWhereOperUse.Rows.Count > 0)
            {
                bulkInsert.DestinationTableName = "whereOperationUse";
                bulkInsert.WriteToServer(tmpWhereOperUse);
            }
            LabourNormDataTable.Clear();
            WhereOperationUseDataTable.Clear();
            bulkInsert.Close();
        }
Example #24
0
 private void dgWhereUse_RowEnter(object sender, DataGridViewCellEventArgs e)
 {
     FillgbShortInfoNormMap(e, ref dgWhereUse);
     LinqQueryForTrudoyomkost.FillOperNumlbox(_detNumID, _seriaFrom, _seriaTo, _selectProdCipher,
                                              ref lBoxOperNum);
 }