public void SaveOrUpdateTrade(Trade pObjTrade) { if (pObjTrade.Id == 0) { mObjTradeDAO.AddEntity(pObjTrade); } else { mObjTradeDAO.UpdateEntity(pObjTrade, pObjTrade.Id); } }
public void SaveOrUpdate(Section pObjSection) { // mObjSectionDAO.SaveOrUpdateEntity(pObjSection); if (!Exists(pObjSection)) { if (pObjSection.Id == 0) { pObjSection.Position = GetNextPosition(pObjSection.ModuleId); mObjSectionDAO.AddEntity(pObjSection); } else { pObjSection.Position = GetCurrentPosition(pObjSection.Id); mObjSectionDAO.UpdateEntity(pObjSection, pObjSection.Id); } } else { throw new Exception("Registro existente."); } }
//public void CreateGoodsReturn(IList<DetailedBatchDTO> pLstObjDetailedBatches) //{ // foreach (var lObjDetailedBatch in pLstObjDetailedBatches) // { // CreateGoodsReturn(lObjDetailedBatch); // } //} //public void CreateGoodsReturn(DetailedBatchDTO pObjDetailedBatch) //{ // //Valid availability // if (pObjDetailedBatch.QuantityToPick > 0 && GetAvailableQuantity(pObjDetailedBatch) >= pObjDetailedBatch.QuantityToPick) // { // //Get item batches from lines // foreach (var lObjLine in pObjDetailedBatch.Lines.Where(x => GetAvailableQuantity(pObjDetailedBatch, x) > 0)) // { // if (pObjDetailedBatch.QuantityToPick > 0 && GetAvailableQuantity(pObjDetailedBatch) >= pObjDetailedBatch.QuantityToPick) // { // //Get quantity to apply // int lIntQuantityToApply = pObjDetailedBatch.QuantityToPick > GetAvailableQuantity(pObjDetailedBatch, lObjLine) ? GetAvailableQuantity(pObjDetailedBatch, lObjLine) : pObjDetailedBatch.QuantityToPick; // //Create Goods Return // GoodsReturn lObjGoodsReturn = new GoodsReturn() // { // BatchId = pObjDetailedBatch.Id, // Quantity = lIntQuantityToApply, // //BatchNumber = lObjLine.BatchNumber, // //BatchDate = lObjLine.BatchDate, // //ItemId = lObjLine.ItemId, // Delivered = pObjDetailedBatch.Delivered, // Exported = false // }; // //Add Goods Return // mObjGoodsReturnDAO.AddEntity(lObjGoodsReturn); // //Update quantities // pObjDetailedBatch.ReturnedQuantity += lIntQuantityToApply; // lObjLine.ReturnedQuantity += lIntQuantityToApply; // pObjDetailedBatch.QuantityToPick -= lIntQuantityToApply; // if (pObjDetailedBatch.Delivered) // { // pObjDetailedBatch.AvailableQuantityToReturnDelivery -= lIntQuantityToApply; // lObjLine.AvailableQuantityToReturnDelivery -= lIntQuantityToApply; // } // else // { // pObjDetailedBatch.AvailableQuantityToReturn -= lIntQuantityToApply; // lObjLine.AvailableQuantityToReturn -= lIntQuantityToApply; // } // } // } // //Update Batch // mObjBatchDAO.SaveOrUpdateEntity(mObjBatchDAO.GetEntity(pObjDetailedBatch.Id)); // } // } public void CreateGoodsReturn(DetailedBatchDTO pObjDetailedBatch, int pIntQttyToReturn, int pIntDeliveredQtty) { //Valid availability if (pObjDetailedBatch.QuantityToPick > 0 && GetAvailableQuantity(pObjDetailedBatch, pIntQttyToReturn, pIntDeliveredQtty) >= pObjDetailedBatch.QuantityToPick) { //Get quantity to apply int lIntQuantityToApply = pObjDetailedBatch.QuantityToPick > GetAvailableQuantity(pObjDetailedBatch, pIntQttyToReturn, pIntDeliveredQtty) ? GetAvailableQuantity(pObjDetailedBatch, pIntQttyToReturn, pIntDeliveredQtty) : pObjDetailedBatch.QuantityToPick; //Create Goods Return GoodsReturn lObjGoodsReturn = new GoodsReturn() { BatchId = pObjDetailedBatch.Id, Quantity = lIntQuantityToApply, Weight = pObjDetailedBatch.Weight, Delivered = pObjDetailedBatch.Delivered, Exported = false, ReturnMotive = pObjDetailedBatch.ReturnMotive }; //Add Goods Return mObjGoodsReturnDAO.AddEntity(lObjGoodsReturn); //Update quantities pObjDetailedBatch.ReturnedQuantity += lIntQuantityToApply; //lObjLine.ReturnedQuantity += lIntQuantityToApply; pObjDetailedBatch.QuantityToPick -= lIntQuantityToApply; if (pObjDetailedBatch.Delivered) { pObjDetailedBatch.AvailableQuantityToReturnDelivery -= lIntQuantityToApply; //lObjLine.AvailableQuantityToReturnDelivery -= lIntQuantityToApply; } else { pObjDetailedBatch.AvailableQuantityToReturn -= lIntQuantityToApply; //lObjLine.AvailableQuantityToReturn -= lIntQuantityToApply; } ////Update Batch mObjBatchDAO.SaveOrUpdateEntity(mObjBatchDAO.GetEntity(pObjDetailedBatch.Id)); } }
public void SaveOrUpdate(Module pObjModule) { if (!Exists(pObjModule)) { if (pObjModule.Id == 0) { pObjModule.Position = GetNextPosition(); mObjModuleDAO.AddEntity(pObjModule); } else { pObjModule.Position = GetCurrentPosition(pObjModule.Position); mObjModuleDAO.UpdateEntity(pObjModule, pObjModule.Id); } } else { throw new Exception("Registro existente."); } }
public void Save(Authorization pObjAuthorization) { mObjAuthorizationDAO.AddEntity(pObjAuthorization); }