Пример #1
0
 private void InsertDb(ReturnItemObj itemObj)
 {
     if (itemObj != null)
     {
         using (var oc = _container.Resolve <OrderDataContext>())
         {
             oc.DataBaseContext.sp_ins_ReturnItem(itemObj.Id, itemObj.ReturnHeaderId, itemObj.InvoiceDataId,
                                                  itemObj.ReturnReasonId, itemObj.QuantityRet);
         }
     }
 }
Пример #2
0
 public void EditItem(Guid id, ReturnItemObj itemObj)
 {
     if (_returnItems != null)
     {
         var item = _returnItems.Where(x => x.Id == id).SingleOrDefault();
         if (item != null)
         {
             item.CopyFrom(itemObj);
             EditDb(id, item);
         }
     }
 }
Пример #3
0
 public void CopyFrom(ReturnItemObj itemObj)
 {
     Group         = itemObj.Group;
     InvoiceDataId = itemObj.InvoiceDataId;
     InvoiceDate   = itemObj.InvoiceDate;
     LotNumber     = itemObj.LotNumber;
     Name          = itemObj.Name;
     Price         = itemObj.Price;
     Quantity      = itemObj.Quantity;
     QuantityRet   = itemObj.QuantityRet;
     //_returnHeaderId = itemObj.ReturnHeaderId;
     //_returnReasonObjs = itemObj.ReturnReasonObjs;
     Supplier              = itemObj.Supplier;
     ReturnReasonId        = itemObj.ReturnReasonId;
     Id                    = itemObj.Id;
     ReturnPositionStateId = itemObj.ReturnPositionStateId;
     Barcode               = itemObj.Barcode;
     Code                  = itemObj.Code;
 }
Пример #4
0
        public void AddNewItem(ReturnItemObj itemObj)
        {
            ReturnItemObj item = null;

            if (_returnItems != null)
            {
                try
                {
                    item = _returnItems.CreateNew();
                    item.CopyFrom(itemObj);

                    InsertDb(item);
                }
                catch (Exception e)
                {
                    _returnItems.Remove(item);
                    throw;
                }
            }
        }
Пример #5
0
 public void CopyFrom(ReturnItemObj itemObj)
 {
     Group = itemObj.Group;
     InvoiceDataId = itemObj.InvoiceDataId;
     InvoiceDate = itemObj.InvoiceDate;
     LotNumber = itemObj.LotNumber;
     Name = itemObj.Name;
     Price = itemObj.Price;
     Quantity = itemObj.Quantity;
     QuantityRet = itemObj.QuantityRet;
     //_returnHeaderId = itemObj.ReturnHeaderId;
     //_returnReasonObjs = itemObj.ReturnReasonObjs;
     Supplier = itemObj.Supplier;
     ReturnReasonId = itemObj.ReturnReasonId;
     Id = itemObj.Id;
     ReturnPositionStateId = itemObj.ReturnPositionStateId;
     Barcode = itemObj.Barcode;
     Code = itemObj.Code;
 }
Пример #6
0
 public void EditReturnItem(ReturnItemObj item)
 {
     if ((CurrentReturnHeader != null) && (item != null))
     {
         _goodsReturnAddModel.EditReturnItemObj(item);
         using (var dlg = new GoodsReturnAddDlg(_goodsReturnAddModel))
         {
             if (dlg.ShowDialog() == DialogResult.OK)
             {
                 CurrentReturnHeader.EditItem(item.Id, _goodsReturnAddModel.GetReturnItemObj());
                 _goodsReturnAddModel.GetInvoiceData().Refresh(_goodsReturnAddModel.GetReturnItemObj().InvoiceDataId);
                 _goodsReturnAddModel.EdititItem = null;
             }
         }
     }
 }
Пример #7
0
 public void DelReturnItem(ReturnItemObj items)
 {
     if (CurrentReturnHeader != null)
     {
         if(XtraMessageBox.Show("Вы действительно хотите удалить позицию?", "Удаление позиции возврата", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             using (var oc = UnityContainer.Resolve<OrderDataContext>())
             {
                 //WindowsIdentity wi = WindowsIdentity.GetCurrent();
                 oc.DataBaseContext.sp_del_ReturnItem(items.Id);
             }
             CurrentReturnHeader.ReturnItems.Remove(items);
             _goodsReturnAddModel.RemoveReturnItem(items);
         }
     }
 }
Пример #8
0
 private void InsertDb(ReturnItemObj itemObj)
 {
     if (itemObj != null)
     {
         using (var oc = _container.Resolve<OrderDataContext>())
         {
             oc.DataBaseContext.sp_ins_ReturnItem(itemObj.Id, itemObj.ReturnHeaderId, itemObj.InvoiceDataId,
                                                  itemObj.ReturnReasonId, itemObj.QuantityRet);
         }
     }
 }
Пример #9
0
        public void AddNewItem(ReturnItemObj itemObj)
        {
            ReturnItemObj item = null;
            if (_returnItems != null)
            {
                try
                {
                    item = _returnItems.CreateNew();
                    item.CopyFrom(itemObj);

                    InsertDb(item);
                }
                catch (Exception e)
                {
                    _returnItems.Remove(item);
                    throw;
                }
            }
        }
Пример #10
0
 public void EditItem(Guid id, ReturnItemObj itemObj)
 {
     if (_returnItems != null)
     {
         var item = _returnItems.Where(x => x.Id == id).SingleOrDefault();
         if (item != null)
         {
             item.CopyFrom(itemObj);
             EditDb(id, item);
         }
     }
 }
Пример #11
0
        public void EditReturnItemObj(ReturnItemObj item)
        {
            IsEdit = true;
            var inv = invoiceData.Where(x => x.id_Invoice == item.InvoiceDataId).SingleOrDefault();
            if(inv != null)
            {
                inv.Quantity += item.QuantityRet;
                inv.QuantityRet = item.QuantityRet;
                inv.ReturnReasonId = item.ReturnReasonId;
                EdititItem = inv;
            }

            else
            {
                EdititItem = new sp_sel_InvoiceDataForReturnResult()
                                 {
                                     Group = item.Group,
                                     InvoiceDate = item.InvoiceDate,
                                     Supplier = item.Supplier,
                                     Name = item.Name,
                                     Price = item.Price,
                                     Quantity = item.QuantityRet,
                                     Number = item.LotNumber,
                                     Seria = item.LotNumber,
                                     id_Invoice = item.InvoiceDataId,
                                     QuantityRet = item.QuantityRet,
                                     ReturnReasonId = item.ReturnReasonId,
                                     Barcode = item.Barcode,
                                     Code = item.Code
                                 };
                invoiceData.Add(EdititItem);
            }
        }
Пример #12
0
 public bool EditItem(ReturnItemObj itemObj)
 {
     return true;
 }
Пример #13
0
        public void SetSelReturn(sp_sel_InvoiceDataForReturnResult ret, sp_sel_ReturnReasonsResult reason, decimal value)
        {
            ret.Quantity -= double.Parse(value.ToString());

            ReturnItemObj = new ReturnItemObj()
                          {
                              Group = ret.Group,
                              InvoiceDate = ret.InvoiceDate,
                              Name = ret.Name,
                              LotNumber = string.Format("{0} {1}", ret.Seria, ret.Number),
                              InvoiceDataId = ret.id_Invoice,
                              Price = ret.Price,
                              Quantity = ret.Quantity,
                              QuantityRet = double.Parse(value.ToString()),
                              Supplier = ret.Supplier,
                              ReturnReasonId = reason.id,
                              Barcode = ret.Barcode,
                              ReturnPositionStateId = 1,
                              Code = ret.Code
                          };
        }
Пример #14
0
 public void RemoveReturnItem(ReturnItemObj itemObj)
 {
     invoiceData.Refresh(itemObj.InvoiceDataId);
 }
Пример #15
0
 private void DelReturnItem(ReturnItemObj items)
 {
     Model.DelReturnItem(items);
 }