Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        private void btAddApply_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow dgrow in dgOperApply.Rows)
            {
                if (dgrow.Cells[0].Value.ToString() == vtbProdName.ValueTxt)
                {
                    return;
                }
            }

            if (!vtbProdName.IsValid || !vtbSeriaFrom.IsValid)
            {
                return;
            }
            if (!FillTrudoyomkostDB.DcMaxApply.ContainsKey(vtbProdName.ValueTxt))
            {
                return;
            }


            int   seriaFrom   = MathFunctionForSeries.GetIntSeriaNumber(vtbSeriaFrom.ValueTxt);
            int   seriaTo     = MathFunctionForSeries.GetIntSeriaNumber(vtbSeriaTo.ValueTxt);
            short prodChipher = _dcInfProducts[vtbProdName.ValueTxt];

            _updateOldLabourCard = new UpdateOldNormCardCommand(seriaFrom, prodChipher);
            _updateOldLabourCard.execute();
            if (_operNumlst.Count == 0 && _dtLabourNorm.Rows.Count > 0)
            {
                foreach (DataRow tRow in _dtLabourNorm.Rows)
                {
                    _operNumlst.Add((int)tRow[0]);
                }
            }

            foreach (var item in _operNumlst)
            {
                bool IsApplyProduct = true;
                foreach (DataRow itemrow in _dcApplyOper[item].Rows)
                {
                    if (vtbProdName.ValueTxt.Equals(itemrow[0]))
                    {
                        IsApplyProduct = false;
                        break;
                    }
                }

                if (IsApplyProduct)
                {
                    _whereOperationUseItem = new WhereOperationUse(item, seriaFrom, seriaTo, prodChipher);
                    _addWhereOperUseCmd    = new AddWhereOperUseCommand(_whereOperationUseItem);
                    _addWhereOperUseCmd.execute();
                }
            }

            UpdateDataGrids();
            CheckDelOper();
            _operNumlst.Clear();
        }
Exemplo n.º 3
0
        private void ReCalcLabourNorm(double applyCoeff, LabourNorm inputLabourNorm)
        {
            double HourCost = _inftariff.Find(item => item.KindPay == inputLabourNorm.KindPay && item.TariffNetNum == inputLabourNorm.TariffNetNum &&
                                              item.WorkerRate == inputLabourNorm.WorkerRate).HourCost;

            inputLabourNorm.ItemPayNorm = MathFunctionForSeries.ReCalcItemPayNorm(applyCoeff, inputLabourNorm.ItemCTN);
            inputLabourNorm.Valuation   = MathFunctionForSeries.CalculateValuation(inputLabourNorm.ItemPayNorm, HourCost);
            inputLabourNorm.CoeffCTN    = MathFunctionForSeries.CalculateCoeffCTN(inputLabourNorm.ItemPayNorm, 0, inputLabourNorm.ItemCTN, 0, 0);
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
        private void dgOperApply_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView tempdg = sender as DataGridView;

            if (tempdg != null)
            {
                if (tempdg.Rows.Count >= 1)
                {
                    int seriaFrom = MathFunctionForSeries.GetIntSeriaNumber(tempdg.Rows[e.RowIndex].Cells[1].Value.ToString());
                    int seriaTo   = MathFunctionForSeries.GetIntSeriaNumber(tempdg.Rows[e.RowIndex].Cells[2].Value.ToString());
                    _selectProductChiper = FillTrudoyomkostDB.DcInfProducts[tempdg.Rows[e.RowIndex].Cells[0].Value.ToString()];

                    _whereOperationUseItem = new WhereOperationUse(_currentLabNormId, seriaFrom, seriaTo, _selectProductChiper);
                }
            }
        }
Exemplo n.º 6
0
        private void btAddOper_Click(object sender, EventArgs e)
        {
            if (!vtbProdName.IsValid || !vtbSeriaFrom.IsValid || !vtbSeriaTo.IsValid)
            {
                return;
            }
            if (!FillTrudoyomkostDB.DcMaxApply.ContainsKey(vtbProdName.ValueTxt))
            {
                return;
            }

            int   SeriaFrom  = MathFunctionForSeries.GetIntSeriaNumber(vtbSeriaFrom.ValueTxt);
            int   SeriaTo    = MathFunctionForSeries.GetIntSeriaNumber(vtbSeriaTo.ValueTxt);
            short prodCipher = FillTrudoyomkostDB.DcInfProducts[vtbProdName.ValueTxt];

            if (SeriaFrom > SeriaTo)
            {
                return;
            }

            bool IsDublProdName = false;

            foreach (DataGridViewRow itemRow in dgOperApply.Rows)
            {
                if (itemRow.Cells[0].Value.ToString().Equals(vtbProdName.ValueTxt))
                {
                    IsDublProdName = true;
                }
            }

            if (!IsDublProdName)
            {
                UserDataTables.AddRowToApplyDt(vtbProdName.ValueTxt, vtbSeriaFrom.ValueTxt, vtbSeriaTo.ValueTxt, _dtOperApply);
                _applyWhereOper                    = new WhereOperationUse();
                _applyWhereOper.SeriaFrom          = SeriaFrom;
                _applyWhereOper.SeriaTo            = SeriaTo;
                _applyWhereOper.InfProductsChipher = prodCipher;
                if (_isUpdate)
                {
                    currentExecutedComand = new UpdateLabourCard(_infDetIdList, _applyWhereOper);
                }
                else
                {
                    UpdateAndCreateNewLabourCard tempComand;
                    if (currentExecutedComand == null)
                    {
                        currentExecutedComand = new UpdateAndCreateNewLabourCard(_infDetIdList, _applyWhereOper);
                        tempComand            = currentExecutedComand as UpdateAndCreateNewLabourCard;
                        if (vtbLowerCoff.IsValid)
                        {
                            tempComand.ApplyCoeff = double.Parse(vtbLowerCoff.ValueTxt);
                        }
                    }
                    else
                    {
                        tempComand = currentExecutedComand as UpdateAndCreateNewLabourCard;
                        if (tempComand != null)
                        {
                            tempComand.ApplyWhereOpers = _applyWhereOper;
                        }
                    }
                }
                currentExecutedComand.execute();
                _fmParent.UpdateDataGrids();
            }
        }