Example #1
0
        public int Insert(List <WAMS_FULFILLMENT_DETAIL> entityDetails, int login)
        {
            var srvNew = SRVLastest("F");

            foreach (var detail in entityDetails)
            {
                if (detail.ID != 0 && detail.iModified == 1)
                {
                    // Update quantity
                    var detailEntity = new WAMS_FULFILLMENT_DETAIL
                    {
                        ID                = detail.ID,
                        vPOID             = detail.vPOID,
                        vStockID          = detail.vStockID,
                        dQuantity         = detail.dQuantity,
                        dReceivedQuantity = detail.dReceivedQuantity,
                        dPendingQuantity  = detail.dPendingQuantity,
                        dDateDelivery     = detail.dDateDelivery,
                        //iShipID = detail.iShipID,
                        tDescription = detail.tDescription,
                        vMRF         = detail.vMRF,
                        // dCurrenQuantity = detail.dCurrenQuantity,
                        dInvoiceDate = detail.dInvoiceDate,
                        vInvoiceNo   = detail.vInvoiceNo,
                        dImportTax   = detail.dImportTax,
                        SRV          = srvNew,
                        iStore       = detail.iStore,
                        dCreated     = DateTime.Now,
                        iCreated     = login,
                        FlagFile     = false
                    };
                    _customRepository.Update(detailEntity);
                }
                else if (detail.ID != 0)
                {
                    var detailEntity = GetByKey(detail.ID);
                    detailEntity.tDescription = detail.tDescription;
                    detailEntity.dInvoiceDate = detail.dInvoiceDate;
                    detailEntity.vInvoiceNo   = detail.vInvoiceNo;
                    detailEntity.dImportTax   = detail.dImportTax;
                    detailEntity.dModified    = DateTime.Now;
                    detailEntity.iModified    = login;
                    _repository.Update(detailEntity);
                }
                else
                {
                    var detailEntity = new WAMS_FULFILLMENT_DETAIL
                    {
                        vPOID             = detail.vPOID,
                        vStockID          = detail.vStockID,
                        dQuantity         = detail.dQuantity,
                        dReceivedQuantity = detail.dReceivedQuantity,
                        dPendingQuantity  = detail.dPendingQuantity,
                        dDateDelivery     = detail.dDateDelivery,
                        //iShipID = detail.iShipID,
                        tDescription = detail.tDescription,
                        vMRF         = detail.vMRF,
                        // dCurrenQuantity = detail.dCurrenQuantity,
                        dInvoiceDate = detail.dInvoiceDate,
                        vInvoiceNo   = detail.vInvoiceNo,
                        dImportTax   = detail.dImportTax,
                        SRV          = srvNew,
                        iStore       = detail.iStore,
                        dCreated     = DateTime.Now,
                        iCreated     = login,
                        FlagFile     = false
                    };
                    _customRepository.Add(detailEntity);
                }
            }
            //_unitOfWork.CommitChanges();
            return(1);
        }