Пример #1
0
 public void execute()
 {
     using (var currentContex = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
     {
         FillTrudoyomkostDB.WhereOperationUseList.Add(_whereOperUse);
         currentContex.WhereOperationUse.InsertOnSubmit(_whereOperUse);
         currentContex.SubmitChanges();
     }
 }
Пример #2
0
        public void execute()
        {
            var result = from currLabItem in FillTrudoyomkostDB.CurrentLabourNormList
                         join whOper in FillTrudoyomkostDB.WhereOperationUseList
                         on currLabItem.ID equals whOper.LabourNormID

                         select new
            {
                LabourId = currLabItem.ID,
                whOper.Id,
                whOper.InfProductsChipher,
                whOper.SeriaFrom,
                whOper.SeriaTo,
            } into res
            group res by res.LabourId
            into groupResult
                select new
            {
                Key   = groupResult.Key,
                Value = groupResult
            };

            using (var currentContex = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
            {
                foreach (var item in result)
                {
                    if (item.Value.Count() < 2)
                    {
                        var tempEl = item.Value.First();
                        if (tempEl.SeriaFrom >= _seriaFrom && tempEl.InfProductsChipher == _productCipher)
                        {
                            var el       = currentContex.WhereOperationUse.First(x => x.Id == tempEl.Id);
                            var memoryEl = FillTrudoyomkostDB.WhereOperationUseList.First(x => x.Id == tempEl.Id);

                            bool Visible = FillTrudoyomkostDB.WhereOperationUseList.Remove(memoryEl);
                            currentContex.WhereOperationUse.DeleteOnSubmit(el);
                        }
                        else if (tempEl.SeriaFrom < _seriaFrom && tempEl.SeriaTo >= _seriaFrom && tempEl.InfProductsChipher == _productCipher)
                        {
                            var el = currentContex.WhereOperationUse.First(x => x.Id == tempEl.Id);
                            el.SeriaTo = _seriaFrom - 1;
                            FillTrudoyomkostDB.WhereOperationUseList.First(x => x.Id == tempEl.Id).SeriaTo = _seriaFrom - 1;
                        }
                        currentContex.SubmitChanges();
                    }
                }
            }
        }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
     {
         foreach (var item in currentContext.LabourNorm)
         {
             if (item.ItemCTN == 0 && item.PreparTimeCTN == 0 && item.ItemPayNorm == 0 && item.PreparTimePayNorm == 0)
             {
                 currentContext.LabourNorm.DeleteOnSubmit(item);
             }
             if (item.KindPay == "C")
             {
                 item.KindPay = "C";
             }
             currentContext.SubmitChanges();
         }
     }
 }
Пример #4
0
        private void dgProducts_RowValidated(object sender, DataGridViewCellEventArgs e)
        {
            short        cipher = 0;
            DataGridView tempDg;

            tempDg = sender as DataGridView;
            if (tempDg != null)
            {
                cipher = (short)tempDg.Rows[e.RowIndex].Cells[0].Value;
            }

            //tempDg.Rows[e.RowIndex].
            using (var currentContext = new TrudoyomkostDBContext(Properties.Settings.Default.TrudoyomkostDBConnectionString))
            {
                var selectEntity = currentContext.InfProducts.Where(item => item.Cipher == cipher).First();

                selectEntity.Product      = tempDg.Rows[e.RowIndex].Cells[1].Value.ToString();
                selectEntity.Mask         = (byte)tempDg.Rows[e.RowIndex].Cells[3].Value;
                selectEntity.ProductTotal = tempDg.Rows[e.RowIndex].Cells[2].Value.ToString();
                currentContext.SubmitChanges();
            }
        }