Exemple #1
0
        public void execute()
        {
            WhereOperationUse tempItem = FillTrudoyomkostDB.WhereOperationUseList.Find(item => item.LabourNormID == _whereOperUse.LabourNormID && item.InfProductsChipher == _whereOperUse.InfProductsChipher);

            FillTrudoyomkostDB.WhereOperationUseList.Remove(tempItem);
            FillTrudoyomkostDB.WhereOperationUseTableAdapter.DeleteSelectProduct(_whereOperUse.LabourNormID, _whereOperUse.InfProductsChipher);
        }
Exemple #2
0
        public static WhereOperationUse FillItemWhereOperationUse(ODLDB210410DataSet.TN158Row anrow)
        {
            int seriaFrom = 0;

            if (!anrow.IsN_IZD_CNull() && anrow.N_IZD_C.Trim() != "")
            {
                int.TryParse(anrow.N_IZD_C.Trim(), out seriaFrom);
                if (seriaFrom < 0)
                {
                    seriaFrom = 0;
                }
            }
            int seriaTo = 99999999;

            if (!anrow.IsN_IZD_PONull() && anrow.N_IZD_PO.Trim() != "")
            {
                int.TryParse(anrow.N_IZD_PO.Trim(), out seriaTo);
                if (seriaTo < 0)
                {
                    seriaTo = 99999999;
                }
            }
            var whereUseItem = new WhereOperationUse();

            whereUseItem.SeriaFrom          = seriaFrom;
            whereUseItem.SeriaTo            = seriaTo;
            whereUseItem.InfProductsChipher = 17;

            return(whereUseItem);
        }
Exemple #3
0
 public UpdateAndCreateNewLabourCard(List <int> infdetIdList, WhereOperationUse inputObj)
 {
     _infDetIdList      = infdetIdList;
     _applyWhereOpers   = inputObj;
     _oldAndNewLabourId = new Dictionary <int, int>();
     LinqQueryForTrudoyomkost.GetInfTariff(ref _inftariff);
 }
Exemple #4
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();
        }
Exemple #5
0
        public static void FilltmpWhereOperUseRow(WhereOperationUse itemWhereOperUse)
        {
            DataRow rowTempWhereOperUse = WhereOperationUseDataTable.NewRow();

            rowTempWhereOperUse[0] = itemWhereOperUse.LabourNormID;
            rowTempWhereOperUse[1] = itemWhereOperUse.SeriaFrom;
            rowTempWhereOperUse[2] = itemWhereOperUse.SeriaTo;
            rowTempWhereOperUse[3] = itemWhereOperUse.InfProductsChipher;
            WhereOperationUseDataTable.Rows.Add(rowTempWhereOperUse);
        }
Exemple #6
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);
                }
            }
        }
Exemple #7
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);
        }
Exemple #8
0
 private void btApplyDel_Click(object sender, EventArgs e)
 {
     if (_operNumlst.Count > 0)
     {
         foreach (var item in _operNumlst)
         {
             _whereOperationUseItem = new WhereOperationUse(item, 1, 1, _selectProductChiper);
             _delWhereOperUseCmd    = new DeleteWhereOperUseCommand(_whereOperationUseItem);
             _delWhereOperUseCmd.execute();
         }
         this.UpdateDataGrids();
         _operNumlst.Clear();
     }
     else
     {
         _delWhereOperUseCmd = new DeleteWhereOperUseCommand(_whereOperationUseItem);
         _delWhereOperUseCmd.execute();
         this.UpdateApplyDataGrid();
     }
 }
 partial void DeleteWhereOperationUse(WhereOperationUse instance);
 partial void UpdateWhereOperationUse(WhereOperationUse instance);
 partial void InsertWhereOperationUse(WhereOperationUse instance);
Exemple #12
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();
        }
        private void btSaveAndLimit_Click(object sender, EventArgs e)
        {
            CheckValidateForm(gbOperItems);
            if (!IsValidForm)
            {
                MessageBox.Show(_isValidateGbNotific);
                IsValidForm = true;
                return;
            }
            using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
            {
                foreach (var item in _oldAndNewApplyDict)
                {
                    WhereOperationUse tempItem = new WhereOperationUse();
                    tempItem = FillTrudoyomkostDB.WhereOperationUseList.ToList().Find(currItem => (currItem.SeriaFrom == item.Key.SeriaFrom && currItem.SeriaTo == item.Key.SeriaTo && currItem.InfProductsChipher == item.Key.ProductChipher && currItem.LabourNormID == templabour.ID));
                    tempItem.SeriaTo = item.Value.SeriaFrom - 1;
                    FillTrudoyomkostDB.WhereOperationUseTableAdapter.UpdateSeriaTo(tempItem.SeriaTo, item.Key.ProductChipher, item.Key.SeriaFrom, templabour.ID);

                    FillTrudoyomkostDB.WhereOperationUseList.Add(item.Value);
                    currentContext.WhereOperationUse.InsertOnSubmit(item.Value);
                    currentContext.SubmitChanges();
                }

                templabour.ID = _newID;

                btSaveAndLimit.Enabled = false;
                UpdateLabourNorm(ref templabour, _timeInHour);

                FillTrudoyomkostDB.LabourNormTableAdapter.InsertQuery(templabour.InfDetID, templabour.OperNum, templabour.DepRegion, templabour.ProfCode, templabour.NameKindWork,
                    templabour.TariffNetNum, templabour.KindPay, templabour.WorkerRate, templabour.ItemCTN, templabour.PreparTimeCTN,
                    templabour.ItemPayNorm, templabour.PreparTimePayNorm, templabour.Valuation, templabour.ValPreparTime, templabour.CoeffCTN, templabour.DocNum, templabour.Date, templabour.TaskNumber);

                FillTrudoyomkostDB.LabourNormList.Add(templabour);
                templabour = new LabourNorm();

            }

            _parentForm.UpdateDataGrids();
            _newID++;
            btSaveAndLimit.Enabled = true;
        }
        public static WhereOperationUse FillItemWhereOperationUse(ODLDB210410DataSet.TN158Row anrow)
        {
            int seriaFrom = 0;
            if (!anrow.IsN_IZD_CNull() && anrow.N_IZD_C.Trim() != "")
            {

                int.TryParse(anrow.N_IZD_C.Trim(), out seriaFrom);
                if (seriaFrom < 0)
                {
                    seriaFrom = 0;
                }
            }
            int seriaTo = 99999999;
            if (!anrow.IsN_IZD_PONull() && anrow.N_IZD_PO.Trim() != "")
            {
                int.TryParse(anrow.N_IZD_PO.Trim(), out seriaTo);
                if (seriaTo < 0)
                {
                    seriaTo = 99999999;
                }
            }
            var whereUseItem = new WhereOperationUse();
            whereUseItem.SeriaFrom = seriaFrom;
            whereUseItem.SeriaTo = seriaTo;
            whereUseItem.InfProductsChipher = 17;

            return whereUseItem;
        }
Exemple #15
0
 public UpdateAndCreateNewLabourCard(List<int> infdetIdList, WhereOperationUse inputObj)
 {
     _infDetIdList = infdetIdList;
      _applyWhereOpers = inputObj;
      _oldAndNewLabourId = new Dictionary<int, int>();
     LinqQueryForTrudoyomkost.GetInfTariff(ref _inftariff);
 }
Exemple #16
0
 public UpdateLabourCard(List <int> infdetIdList, WhereOperationUse inputObj)
 {
     _infDetIdList    = infdetIdList;
     _applyWhereOpers = inputObj;
 }
Exemple #17
0
 private void btApplyDel_Click(object sender, EventArgs e)
 {
     if (_operNumlst.Count > 0)
     {
         foreach (var item in _operNumlst)
         {
             _whereOperationUseItem = new WhereOperationUse(item, 1, 1, _selectProductChiper);
             _delWhereOperUseCmd = new DeleteWhereOperUseCommand(_whereOperationUseItem);
             _delWhereOperUseCmd.execute();
         }
         this.UpdateDataGrids();
         _operNumlst.Clear();
     }
     else
     {
         _delWhereOperUseCmd = new DeleteWhereOperUseCommand(_whereOperationUseItem);
         _delWhereOperUseCmd.execute();
         this.UpdateApplyDataGrid();
     }
 }
Exemple #18
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);
                }
            }
        }
Exemple #19
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();
        }
Exemple #20
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();
                }
        }
Exemple #21
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();
            }
        }
Exemple #22
0
 public AddWhereOperUseCommand(WhereOperationUse whereOperationUse)
 {
     _whereOperUse = whereOperationUse;
 }
        private void btLimitedOper_MouseClick(object sender, MouseEventArgs e)
        {
            if (!vtbProdName.IsValid || !vtbSeriaFrom.IsValid || !vtbSeriaTo.IsValid)
                return;
            if (MathFunctionForSeries.GetIntSeriaNumber(vtbSeriaFrom.ValueTxt) > MathFunctionForSeries.GetIntSeriaNumber(vtbSeriaTo.ValueTxt))
                return;

            foreach (DataRow itemRow in _dtOperApply.Rows)
            {
                if ((MathFunctionForSeries.GetIntSeriaNumber(itemRow[1].ToString()) >= MathFunctionForSeries.GetIntSeriaNumber(vtbSeriaFrom.ValueTxt)) && itemRow[0].ToString().Equals(vtbProdName.ValueTxt))
                    return;
            }

            int seriaTo = MathFunctionForSeries.GetIntSeriaNumber(vtbSeriaTo.ValueTxt);
            int seriaFrom = MathFunctionForSeries.GetIntSeriaNumber(vtbSeriaFrom.ValueTxt);
            short prodChiper = _dcInfProducts[vtbProdName.ValueTxt];
            WhereOperationUse tempOperUse = new WhereOperationUse(_newID, seriaFrom, seriaTo, prodChiper);
            WhereOperationUse exsititem = _oldAndNewApplyDict.Values.ToList().Find(item => item.InfProductsChipher == prodChiper);

            if (exsititem == null)
            {
                _oldAndNewApplyDict.Add(_oldWhereOperUse, tempOperUse);
                _dtOperApply.Rows.RemoveAt(_currentDgApplyIndex);
                _dtOperApply.Rows.Add(vtbProdName.ValueTxt, vtbSeriaFrom.ValueTxt, vtbSeriaTo.ValueTxt);
            }

            btSaveFrom.Enabled = false;
            btUpdateForm.Enabled = false;
            btSaveAndLimit.Enabled = true;
        }
Exemple #24
0
 public DeleteWhereOperUseCommand(WhereOperationUse whereOperationUse)
 {
     _whereOperUse = whereOperationUse;
 }
Exemple #25
0
 public AddWhereOperUseCommand(WhereOperationUse whereOperationUse)
 {
     _whereOperUse = whereOperationUse;
 }
Exemple #26
0
 public UpdateLabourCard(List<int> infdetIdList, WhereOperationUse inputObj)
 {
     _infDetIdList = infdetIdList;
      _applyWhereOpers = inputObj;
 }
Exemple #27
0
 public DeleteWhereOperUseCommand(WhereOperationUse whereOperationUse)
 {
     _whereOperUse = whereOperationUse;
 }
 public static void FilltmpWhereOperUseRow(WhereOperationUse itemWhereOperUse)
 {
     DataRow rowTempWhereOperUse = WhereOperationUseDataTable.NewRow();
     rowTempWhereOperUse[0] = itemWhereOperUse.LabourNormID;
     rowTempWhereOperUse[1] = itemWhereOperUse.SeriaFrom;
     rowTempWhereOperUse[2] = itemWhereOperUse.SeriaTo;
     rowTempWhereOperUse[3] = itemWhereOperUse.InfProductsChipher;
     WhereOperationUseDataTable.Rows.Add(rowTempWhereOperUse);
 }
        private void btnSaveForm_Click(object sender, EventArgs e)
        {
            CheckValidateForm(gbOperItems);
            if (!IsValidForm)
            {
                MessageBox.Show(_isValidateGbNotific);
                IsValidForm = true;
            }
            else
            {
                using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
                {
                    btSaveFrom.Enabled = false;

                    int Id = currentContext.LabourNorm.ToList().Max().ID;

                    Id++;
                    templabour.ID = Id;

                    UpdateLabourNorm(ref templabour, _timeInHour);
                    InitializeGbOperItem();

                    FillTrudoyomkostDB.LabourNormList.Add(templabour);
                    FillTrudoyomkostDB.LabourNormTableAdapter.InsertQuery(templabour.InfDetID, templabour.OperNum, templabour.DepRegion, templabour.ProfCode, templabour.NameKindWork,
                        templabour.TariffNetNum, templabour.KindPay, templabour.WorkerRate, templabour.ItemCTN, templabour.PreparTimeCTN,
                        templabour.ItemPayNorm, templabour.PreparTimePayNorm, templabour.Valuation, templabour.ValPreparTime, templabour.CoeffCTN, templabour.DocNum, templabour.Date, templabour.TaskNumber);

                    int WhereUseId = currentContext.WhereOperationUse.ToList().Last().Id;

                    foreach (DataRow row in _dtOperApply.Rows)
                    {
                        WhereUseId++;
                        int seriaFrom = MathFunctionForSeries.GetIntSeriaNumber(row[1].ToString());
                        int seriaTo = MathFunctionForSeries.GetIntSeriaNumber(row[2].ToString());
                        short prodChipher = _dcInfProducts[row[0].ToString()];
                        WhereOperationUse _whereOperUseitem = new WhereOperationUse(templabour.ID, seriaFrom, seriaTo, prodChipher, WhereUseId);

                        FillTrudoyomkostDB.WhereOperationUseList.Add(_whereOperUseitem);
                        FillTrudoyomkostDB.WhereOperationUseTableAdapter.InsertQuery(templabour.ID, seriaFrom, seriaTo, prodChipher);
                    }

                    _parentForm.UpdateDataGrids();

                    ClearForm();
                    btSaveFrom.Enabled = true;

                }
            }
        }