Exemplo n.º 1
0
        public bool Insert(List <WAMS_RETURN_LIST> entityDetails, int login)
        {
            var srvNew = SRVLastest("R");

            foreach (var detail in entityDetails)
            {
                if (detail.bReturnListID != 0 && detail.iModified == 1)
                {
                    var detailEntity = GetByKey(detail.bReturnListID);
                    //detailEntity.vPOID = detail.vPOID;
                    //detailEntity.vStockID = detail.vStockID;
                    //detailEntity.dQuantity = detail.dQuantity;
                    //detailEntity.dReceivedQuantity = detail.dReceivedQuantity;
                    //detailEntity.dPendingQuantity = detail.dPendingQuantity;
                    //detailEntity.dDateDelivery = detail.dDateDelivery;
                    //detailEntity.iShipID = detail.iShipID;
                    //detailEntity.tDescription = detail.tDescription;
                    //detailEntity.vMRF = detail.vMRF;
                    // detailEntity.dCurrenQuantity = detail.dCurrenQuantity;
                    //detailEntity.dInvoiceDate = detail.dInvoiceDate;
                    //detailEntity.vInvoiceNo = detail.vInvoiceNo;
                    //detailEntity.dImportTax = detail.dImportTax;
                    //detailEntity.iEnable = true;
                    //detailEntity.dDateAssign = detail.dDateAssign;
                    //detailEntity.SRV = detail.SRV;
                    //detailEntity.iStore = detail.iStore;
                    //detailEntity.dCreated = createdDate;
                    //detailEntity.iCreated = login;
                    detailEntity.dModified = DateTime.Now;
                    detailEntity.iModified = login;
                    _repository.Update(detailEntity);
                }
                else if (detail.bReturnListID != 0)
                {
                    var detailEntity = new WAMS_RETURN_LIST
                    {
                        //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,
                        //iEnable = true,
                        //dDateAssign = DateTime.Now,
                        SRV = srvNew,
                        //iStore = detail.iStore,
                        dCreated = DateTime.Now,
                        iCreated = login
                    };
                    _repository.Add(detailEntity);
                }
                else
                {
                    var detailEntity = new WAMS_RETURN_LIST
                    {
                        vStockID   = detail.vStockID,
                        vProjectID = detail.vProjectID,
                        bQuantity  = detail.bQuantity,
                        ToStore    = detail.ToStore,
                        SRV        = srvNew,
                        vCondition = detail.vCondition,
                        iCreated   = login,
                        FlagFile   = false
                    };
                    _customRepository.Add(detailEntity);
                }
            }
            _unitOfWork.CommitChanges();
            return(true);
        }