Пример #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);
        }
Пример #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();
        }
Пример #3
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);
                }
            }
        }
Пример #4
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();
            }
        }