Esempio n. 1
0
        public void PositionUp(long pLonId)
        {
            IList <Module> lLstObjModules = mObjModuleDAO.GetEntitiesList()
                                            .OrderBy(a => a.Position)
                                            .ThenBy(b => b.Name)
                                            .AsEnumerable()
                                            .Select((c, i) => { c.Position = i + 1; return(c); })
                                            .ToList();

            Module lObjModule = lLstObjModules.FirstOrDefault(x => x.Id == pLonId);
            int    lIntIndex  = lLstObjModules.IndexOf(lObjModule);

            if (lIntIndex > 0)
            {
                int LIntIndexTemp = lLstObjModules[lIntIndex - 1].Position;
                lLstObjModules[lIntIndex - 1].Position = lLstObjModules[lIntIndex].Position;
                lLstObjModules[lIntIndex].Position     = LIntIndexTemp;

                mObjModuleDAO.SaveOrUpdateEntity(lLstObjModules[lIntIndex - 1]);
                mObjModuleDAO.SaveOrUpdateEntity(lLstObjModules[lIntIndex]);
            }
            else
            {
                throw new Exception("El registro ya tiene la primera posición.");
            }
        }
Esempio n. 2
0
 public void SaveOrUpdate(User pObjUser)
 {
     if (!ExistsUser(pObjUser.UserName, pObjUser.Id))
     {
         pObjUser.Password = pObjUser.Password.Encode();
         mObjUserDAO.SaveOrUpdateEntity(pObjUser);
     }
     else
     {
         throw new Exception("El usuario ingresado ya existe.");
     }
 }
Esempio n. 3
0
 public void SaveOrUpdate(Item pObjItem)
 {
     if (!Exists(pObjItem))
     {
         mObjItemDAO.SaveOrUpdateEntity(pObjItem);
     }
     else
     {
         throw new Exception("El artículo ingresado ya existe.");
     }
 }
Esempio n. 4
0
 public void SaveOrUpdate(ItemTypeDefinition pObjItemDefinition)
 {
     if (!Exists(pObjItemDefinition))
     {
         mObjItemTypeDefinitionDAO.SaveOrUpdateEntity(pObjItemDefinition);
     }
     else
     {
         throw new Exception("La definición ingresada ya existe.");
     }
 }
Esempio n. 5
0
 public void SaveOrUpdate(Auction pObjAuction)
 {
     if (!Exists(pObjAuction))
     {
         mObjAuctionDAO.SaveOrUpdateEntity(pObjAuction);
     }
     else
     {
         throw new Exception("La subasta ingresada ya existe.");
     }
 }
Esempio n. 6
0
 public void SaveOrUpdate(PartnerMapping pObjPartnerMapping)
 {
     if (!Exists(pObjPartnerMapping))
     {
         mObjPartnerMappingDAO.SaveOrUpdateEntity(pObjPartnerMapping);
     }
     else
     {
         throw new Exception("El mapeo del socio de negocio temporal ingresado ya se encuentra registrado.");
     }
 }
Esempio n. 7
0
 public void SaveOrUpdate(UserType pObjUserType)
 {
     if (!Exists(pObjUserType))
     {
         mObjUserTypeDAO.SaveOrUpdateEntity(pObjUserType);
     }
     else
     {
         throw new Exception("El tipo de usuario ingresado ya existe.");
     }
 }
Esempio n. 8
0
 public void SaveOrUpdate(Configuration pObjConfiguration)
 {
     if (!Exists(pObjConfiguration))
     {
         mObjConfigurationDAO.SaveOrUpdateEntity(pObjConfiguration);
     }
     else
     {
         throw new Exception("Registro existente.");
     }
 }
Esempio n. 9
0
 public void SaveOrUpdate(BatchLine pObjBatchLine)
 {
     if (!Exists(pObjBatchLine))
     {
         mObjBatchLineDAO.SaveOrUpdateEntity(pObjBatchLine);
     }
     else
     {
         throw new Exception("La linea de lote ingresada ya existe.");
     }
 }
Esempio n. 10
0
 public void SaveOrUpdate(Partner pObjPartner)
 {
     if (!Exists(pObjPartner))
     {
         mObjPartnerDAO.SaveOrUpdateEntity(pObjPartner);
     }
     else
     {
         throw new Exception("El cliente ingresado ya existe.");
     }
 }
Esempio n. 11
0
 public void SaveOrUpdate(FoodDelivery pObjFoodDelivery)
 {
     if (!Exists(pObjFoodDelivery))
     {
         mObjFoodDeliveryDAO.SaveOrUpdateEntity(pObjFoodDelivery);
     }
     else
     {
         throw new Exception("La entrega de mercancía ya se encuentra registrada.");
     }
 }
Esempio n. 12
0
 public void SaveOrUpdate(Batch pObjBatch)
 {
     if (!Exists(pObjBatch))
     {
         mObjBatchDAO.SaveOrUpdateEntity(pObjBatch);
     }
     else
     {
         throw new Exception("El lote ingresado ya existe.");
     }
 }
Esempio n. 13
0
 public void SaveOrUpdate(ItemType pObjItemType)
 {
     if (!Exists(pObjItemType))
     {
         mObjItemTypeDAO.SaveOrUpdateEntity(pObjItemType);
     }
     else
     {
         throw new Exception("El tipo de artículo ingresado ya existe.");
     }
 }
Esempio n. 14
0
 public void SaveOrUpdate(PartnerClassification pObjPartnerClassification)
 {
     if (!Exists(pObjPartnerClassification))
     {
         mObjPartnerClassificationDAO.SaveOrUpdateEntity(pObjPartnerClassification);
     }
     else
     {
         throw new Exception("La clasificación ingresada ya existe.");
     }
 }
Esempio n. 15
0
        //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));
            }
        }
Esempio n. 16
0
        public void SaveOrUpdate(FoodCharge pObjFoodCharge)
        {
            if (!Exists(pObjFoodCharge))
            {
                IList <FoodChargeLine> lLstObjLines = pObjFoodCharge.Lines;
                pObjFoodCharge.Lines = null;

                mObjFoodChargeDAO.SaveOrUpdateEntity(pObjFoodCharge);

                if (lLstObjLines != null && lLstObjLines.Count > 0)
                {
                    mObjFoodChargeLineDAO.SaveOrUpdateEntitiesList(lLstObjLines.Select(x => { x.FoodChargeId = pObjFoodCharge.Id; return(x); }).ToList());
                }
            }
            else
            {
                throw new Exception("El cobro de alimento capturado ya se encuentra registrado.");
            }
        }
Esempio n. 17
0
        public void SaveOrUpdate(JournalEntry pObjJournalEntry)
        {
            if (!Exists(pObjJournalEntry))
            {
                IList <JournalEntryLine> lLstObjLines = pObjJournalEntry.Lines;
                pObjJournalEntry.Lines = null;

                mObjJournalEntryDAO.SaveOrUpdateEntity(pObjJournalEntry);

                if (lLstObjLines != null && lLstObjLines.Count > 0)
                {
                    mObjJournalEntryLineDAO.SaveOrUpdateEntitiesList(lLstObjLines.Select(x => { x.JournalEntryId = pObjJournalEntry.Id; return(x); }).ToList());
                }
            }
            else
            {
                throw new Exception("La factura capturada ya se encuentra registrada.");
            }
        }
Esempio n. 18
0
        public void SaveOrUpdate(Invoice pObjInvoice)
        {
            if (!Exists(pObjInvoice))
            {
                IList <InvoiceLine> lLstObjLines = pObjInvoice.Lines;
                pObjInvoice.Lines = null;

                mObjInvoiceDAO.SaveOrUpdateEntity(pObjInvoice);

                if (lLstObjLines != null && lLstObjLines.Count > 0)
                {
                    mObjInvoiceLineDAO.SaveOrUpdateEntitiesList(lLstObjLines.Select(x => { x.InvoiceId = pObjInvoice.Id; return(x); }).ToList());
                }
            }
            else
            {
                throw new Exception("La factura capturada ya se encuentra registrada.");
            }
        }
Esempio n. 19
0
 public void SaveOrUpdate(FoodCharge pObjFoodCharge)
 {
     mObjFoodChargeDAO.SaveOrUpdateEntity(pObjFoodCharge);
     //if(!Exist)
 }
Esempio n. 20
0
 public void Save(FoodChargeCheck pObjFoodChargeCheck)
 {
     mObjFoodChargeCheckListDAO.SaveOrUpdateEntity(pObjFoodChargeCheck);
 }
Esempio n. 21
0
 public void SaveOrUpdate(GoodsReceipt pObjGoodsReceipt)
 {
     mObjGoodsReceiptDAO.SaveOrUpdateEntity(pObjGoodsReceipt);
 }
Esempio n. 22
0
 public void SaveOrUpdate(GoodsReturn pObjGoodsReturn)
 {
     mObjGoodsReturnDAO.SaveOrUpdateEntity(pObjGoodsReturn);
 }
Esempio n. 23
0
 public void SaveOrUpdate(Stock pObjItemType)
 {
     mObjStockDAO.SaveOrUpdateEntity(pObjItemType);
 }
Esempio n. 24
0
 public void SaveOrUpdate(InvoiceLine pObjInvoiceLine)
 {
     mObjInvoiceLineDAO.SaveOrUpdateEntity(pObjInvoiceLine);
 }
Esempio n. 25
0
 public void SaveOrUpdate(FoodChargeLine pObjFoodChargeLine)
 {
     mObjFoodChargeLineDAO.SaveOrUpdateEntity(pObjFoodChargeLine);
 }
Esempio n. 26
0
 public void SaveOrUpdate(JournalEntryLine pObjJournalEntryLine)
 {
     mObjJournalEntryLineDAO.SaveOrUpdateEntity(pObjJournalEntryLine);
 }
Esempio n. 27
0
 public void SaveOrUpdate(GoodsIssue pObjGoodsIssue)
 {
     mObjGoodsIssueDAO.SaveOrUpdateEntity(pObjGoodsIssue);
 }