public bool DeleteReceiveDetail(ReceiveDetail receiveDetail)
 {
     if (receiveDetail == null) return false;
     _unitOfWork.ReceiveDetailRepository.Delete(receiveDetail);
     _unitOfWork.Save();
     return true;
 }
Esempio n. 2
0
        protected void btnSaveDetail_Click(object sender, EventArgs e)
        {
            try
            {
                ReceiveDetail receiveDetail;
                if (Session["receiveDetailId"] != null)
                {
                    int recDetId = (int)Session["receiveDetailId"];

                    if (recDetId > 0)
                    {
                        receiveDetail = _presenter.CurrentReceive.GetReceiveDetail(recDetId);
                        receiveDetail.PreviousQuantity = receiveDetail.Quantity;
                    }
                    else
                    {
                        receiveDetail = _presenter.CurrentReceive.ReceiveDetails[(int)Session["detailIndex"]];
                    }
                }
                else
                {
                    receiveDetail = new ReceiveDetail();
                }

                receiveDetail.ItemCategory    = _presenter.GetItemCategory(Convert.ToInt32(ddlCategory.SelectedValue));
                receiveDetail.ItemSubCategory = _presenter.GetItemSubCategory(Convert.ToInt32(ddlSubCategory.SelectedValue));
                receiveDetail.Item            = _presenter.GetItem(Convert.ToInt32(ddlItem.SelectedValue));
                receiveDetail.Store           = _presenter.GetStore(Convert.ToInt32(ddlStore.SelectedValue));
                receiveDetail.Section         = _presenter.GetSection(Convert.ToInt32(ddlSection.SelectedValue));
                receiveDetail.Shelf           = _presenter.GetShelf(Convert.ToInt32(ddlShelf.SelectedValue));
                receiveDetail.Quantity        = Convert.ToInt32(txtQuantity.Text);
                receiveDetail.UnitCost        = Convert.ToDecimal(txtUnitCost.Text);
                receiveDetail.TotalQuantity   = receiveDetail.Quantity * receiveDetail.UnitCost;
                receiveDetail.ExpiryDate      = Convert.ToDateTime(txtExpiryDate.Text);
                receiveDetail.Remark          = txtRemark.Text;

                if (Session["receiveDetailId"] == null)
                {
                    _presenter.CurrentReceive.ReceiveDetails.Add(receiveDetail);
                }
                else
                {
                    _presenter.CurrentReceive.ReceiveDetails[(int)Session["detailIndex"]] = receiveDetail;
                }

                BindReceiveDetails();
                Session["receiveDetailId"] = null;
                Session["detailIndex"]     = null;

                Master.ShowMessage(new AppMessage("Item Receive Detail Successfully Added", RMessageType.Info));
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage(ex.Message, RMessageType.Error));
                ExceptionUtility.LogException(ex, ex.Source);
                ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName);
            }
        }
Esempio n. 3
0
        public ActionResult SaveForLocalMarket(string totalAmount, string PONo, int supplierId, string descriptions, int WarehouseId, DateTime dates, List <GoodsReceiveResponse> response, List <AdditionalCost> additionalCost)
        {
            string        ID     = "";
            ReceiveMaster master = new ReceiveMaster();

            master.InvoiceNoPaper = descriptions;
            master.InvoiceDate    = dates;
            master.InvoiceNo      = new GlobalClass().GetMaxIdWithPrfix("InvoiceNo", "8", "00000001", "ReceiveMaster", "GL");
            master.SupplierID     = supplierId;
            master.TotalAmount    = decimal.Parse(totalAmount);
            ID = master.InvoiceNo;
            master.MarketType = "Local";
            foreach (var item in response)
            {
                ReceiveDetail details = new ReceiveDetail();
                //details.Id = item.Id;
                details.ReceiveMasterId = master.Id;
                details.ProductId       = item.ProductId;
                details.WarehouseId     = item.WarehouseId;
                details.Qty             = item.Qty;
                details.Rate            = item.Rate;

                details.SD     = item.SDRate;
                details.Tax    = item.TaxRate;
                details.Amount = item.Amount;

                details.IsActive    = true;
                details.CreatedBy   = CurrentSession.GetCurrentSession().UserName;
                details.CreatedDate = DateTime.Now;
                master.ReceiveDetails.Add(details);
                // total += details.QTY??0 * details.RetailPrice??0;
            }
            master.RecieveFrom = CurrentSession.GetCurrentSession().UserName;
            if (additionalCost != null && additionalCost.Count > 0)
            {
                master.AdditionalCost = additionalCost.Select(a => a.Debit).Sum(a => a.Value);
            }
            else
            {
                master.AdditionalCost = 0;
            }
            master.GrandTotal    = master.TotalAmount + master.AdditionalCost - master.BillDiscount;
            master.IsActive      = true;
            master.SupplierID    = supplierId;
            master.Notes         = descriptions;
            master.MarketType    = "Local";
            master.TransportType = "Truck";
            master.TransportNo   = "1";
            master.CreatedBy     = CurrentSession.GetCurrentSession().UserName;
            master.CreatedDate   = DateTime.Now;

            var result = service.Save(master, WarehouseId, 3);

            //return Json(result.Id, JsonRequestBehavior.AllowGet);
            return(Json(new { result = true, Error = "Saved", ID = ID }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
 public bool DeleteReceiveDetail(ReceiveDetail receiveDetail)
 {
     if (receiveDetail == null)
     {
         return(false);
     }
     _unitOfWork.ReceiveDetailRepository.Delete(receiveDetail);
     _unitOfWork.Save();
     return(true);
 }
Esempio n. 5
0
        public ActionResult Save(string totalAmount, string PONo, int supplierId, string descriptions, int WarehouseId, List <GoodsReceiveResponse> response)
        {
            string        ID     = "";
            ReceiveMaster master = new ReceiveMaster();

            master.InvoiceNoPaper = PONo;
            master.TotalAmount    = decimal.Parse(totalAmount);
            master.InvoiceNo      = new GlobalClass().GetMaxIdWithPrfix("InvoiceNo", "8", "00000001", "ReceiveMaster", "GR");
            master.SupplierID     = supplierId;
            ID = master.InvoiceNo;
            var total = 0.0m;

            foreach (var item in response)
            {
                ReceiveDetail details = new ReceiveDetail();
                //details.Id = item.Id;
                details.ReceiveMasterId = master.Id;
                details.ProductId       = item.ProductId;
                details.WarehouseId     = item.WarehouseId;
                details.TotalBale       = item.TotalBale;
                details.QtyInBale       = item.QtyInBale;

                details.WeightInKG  = item.WeightInKG;
                details.WeightType  = item.WeightType;
                details.WeightInMon = item.WeightInMon;
                details.Amount      = item.Amount;
                details.TotalAmount = item.TotalAmount;


                details.IsActive    = true;
                details.CreatedBy   = CurrentSession.GetCurrentSession().UserName;
                details.CreatedDate = DateTime.Now;
                master.ReceiveDetails.Add(details);
                // total += details.QTY??0 * details.RetailPrice??0;
            }
            master.RecieveFrom    = CurrentSession.GetCurrentSession().UserName;
            master.AdditionalCost = 0.0m;
            master.BillDiscount   = 0.0m;
            //master.TotalAmount = total;
            master.GrandTotal    = master.TotalAmount + master.AdditionalCost - master.BillDiscount;
            master.InvoiceDate   = DateTime.Now;
            master.IsActive      = true;
            master.SupplierID    = supplierId;
            master.Notes         = descriptions;
            master.MarketType    = "Not Local";
            master.TransportType = "Truck";
            master.TransportNo   = "1";
            master.CreatedBy     = CurrentSession.GetCurrentSession().UserName;
            master.CreatedDate   = DateTime.Now;

            var result = service.Save(master, WarehouseId, 1);

            //return Json(result.Id, JsonRequestBehavior.AllowGet);
            return(Json(new { result = true, Error = "Saved", ID = ID }, JsonRequestBehavior.AllowGet));
        }
 public virtual ActionResult Edit(ReceiveDetail ReceiveDetail)
 {
     if (ModelState.IsValid)
     {
         _receiveDetailService.EditReceiveDetail(ReceiveDetail);
         return(RedirectToAction("Index"));
     }
     ViewBag.CommodityID      = new SelectList(_commodityService.GetAllCommodity(), "CommodityID", "Name", ReceiveDetail.CommodityID);
     ViewBag.CommodityGradeID = new SelectList(_commodityGradeService.GetAllCommodityGrade(), "CommodityGradeID", "Name");
     ViewBag.ReceiveID        = new SelectList(_receiveService.GetAllReceive(), "ReceiveID", "SINumber", ReceiveDetail.ReceiveID);
     ViewBag.UnitID           = new SelectList(_unitService.GetAllUnit(), "UnitID", "Name", ReceiveDetail.UnitID);
     ViewBag.UnitID           = new SelectList(_unitService.GetAllUnit().ToList(), "UnitID", "Name", ReceiveDetail.UnitID);
     return(View(ReceiveDetail));
 }
Esempio n. 7
0
        public void Update(List <ReceiveDetail> inserted, List <ReceiveDetail> updated, List <ReceiveDetail> deleted, Receive receive)
        {
            if (receive != null)
            {
                _unitOfWork.ReceiveRepository.Edit(receive);
                _unitOfWork.Save();


                foreach (ReceiveDetail insert in inserted)
                {
                    //TODO THIS should be in transaction
                    insert.ReceiveDetailID = Guid.NewGuid();
                    receive.ReceiveDetails.Add(insert);
                }

                foreach (ReceiveDetail delete in deleted)
                {
                    ReceiveDetail deletedCommodity = _unitOfWork.ReceiveDetailRepository.FindBy(p => p.ReceiveDetailID == delete.ReceiveDetailID).FirstOrDefault();
                    if (deletedCommodity != null)
                    {
                        _unitOfWork.ReceiveDetailRepository.Delete(deletedCommodity);
                    }
                }

                foreach (ReceiveDetail update in updated)
                {
                    ReceiveDetail updatedCommodity = _unitOfWork.ReceiveDetailRepository.FindBy(p => p.ReceiveDetailID == update.ReceiveDetailID).FirstOrDefault();
                    if (updatedCommodity != null)
                    {
                        updatedCommodity.CommodityID      = update.CommodityID;
                        updatedCommodity.Description      = update.Description;
                        updatedCommodity.ReceiveID        = update.ReceiveID;
                        updatedCommodity.SentQuantityInMT = update.SentQuantityInMT;
                        // updatedCommodity.QuantityInMT = updatedCommodity.QuantityInMT;
                        updatedCommodity.SentQuantityInUnit = update.SentQuantityInUnit;
                        updatedCommodity.UnitID             = update.UnitID;
                    }
                }
                _unitOfWork.Save();
            }
        }
Esempio n. 8
0
 public bool EditReceiveDetail(ReceiveDetail receiveDetail)
 {
     _unitOfWork.ReceiveDetailRepository.Edit(receiveDetail);
     _unitOfWork.Save();
     return(true);
 }
Esempio n. 9
0
        public ReceiveNewViewModel ModeltoNewView(Receive receive) //string receiveId, string grn)
        {
            var receiptAllocation = _receiptAllocationService.FindById(receive.ReceiptAllocationID.GetValueOrDefault());

            var user = _userProfileService.GetUser(User.Identity.Name);

            var viewModel = _receiveService.ReceiptAllocationToReceive(receiptAllocation);

            viewModel.CurrentHub    = user.DefaultHub.Value;
            viewModel.UserProfileId = user.UserProfileID;
            var hubOwner = _hub.FindById(user.DefaultHub.Value);

            viewModel.IsTransporterDetailVisible = !hubOwner.HubOwner.Name.Contains("WFP");
            viewModel.AllocationStatusViewModel  = _receiveService.GetAllocationStatus(receive.ReceiptAllocationID.GetValueOrDefault());
            //var commodities = _commodityService.GetAllCommodityViewModelsByParent(receiptAllocation.CommodityID);
            //ViewData["commodities"] = commodities;
            //ViewData["units"] = _unitService.GetAllUnitViewModels();


            viewModel.Grn                 = receive.GRN;
            viewModel.ReceiptDate         = receive.ReceiptDate;
            viewModel.SiNumber            = receiptAllocation.SINumber;
            viewModel.ReceiptDate         = viewModel.ReceiptDate;
            viewModel.ReceiptAllocationId = receive.ReceiptAllocationID.GetValueOrDefault();
            viewModel.ReceiveId           = receive.ReceiveID;

            //viewModel.StackNumber
            viewModel.WayBillNo   = receive.WayBillNo;
            viewModel.SiNumber    = receiptAllocation.SINumber;
            viewModel.ProjectCode = receiptAllocation.ProjectNumber;
            //viewModel.Program = .FindById(receiptAllocation.ProgramID).Name;
            viewModel.ProgramId = receiptAllocation.ProgramID;
            //viewModel.CommodityType = _CommodityTypeRepository.FindById(receiptAllocation.Commodity.CommodityTypeID).Name,
            viewModel.CommodityTypeId       = receiptAllocation.Commodity.CommodityTypeID;
            viewModel.CommoditySourceTypeId = receiptAllocation.CommoditySourceID;


            if (CommoditySource.Constants.LOAN == receiptAllocation.CommoditySourceID ||
                CommoditySource.Constants.SWAP == receiptAllocation.CommoditySourceID ||
                CommoditySource.Constants.TRANSFER == receiptAllocation.CommoditySourceID ||
                CommoditySource.Constants.REPAYMENT == receiptAllocation.CommoditySourceID)
            {
                if (receiptAllocation.SourceHubID.HasValue)
                {
                    viewModel.SourceHub = _hub.FindById(receiptAllocation.SourceHubID.GetValueOrDefault(0)).Name;
                }
            }

            if (CommoditySource.Constants.LOCALPURCHASE == receiptAllocation.CommoditySourceID)
            {
                viewModel.SupplierName  = receiptAllocation.SupplierName;
                viewModel.PurchaseOrder = receiptAllocation.PurchaseOrder;
            }

            viewModel.CommoditySource       = receiptAllocation.CommoditySource.Name;
            viewModel.CommoditySourceTypeId = receiptAllocation.CommoditySourceID;
            viewModel.ReceivedByStoreMan    = receive.ReceivedByStoreMan;
            ReceiveDetail receivedetail = receive.ReceiveDetails.FirstOrDefault();

            viewModel.StoreId     = receive.StoreId.GetValueOrDefault();
            viewModel.StackNumber = receive.StackNumber.GetValueOrDefault();
            viewModel.ReceiveDetailNewViewModel = new ReceiveDetailNewViewModel
            {
                CommodityId          = receivedetail.CommodityID,
                CommodityChildID     = receivedetail.CommodityChildID,
                ReceivedQuantityInMt =
                    receivedetail.QuantityInMT,
                ReceivedQuantityInUnit =
                    receivedetail.QuantityInUnit,
                SentQuantityInMt   = receivedetail.SentQuantityInMT,
                SentQuantityInUnit = receivedetail.SentQuantityInUnit,
                UnitId             = receivedetail.UnitID,
                Description        = receivedetail.Description,
                ReceiveId          = receivedetail.ReceiveID,
                ReceiveDetailId    = receivedetail.ReceiveDetailID,
            };

            viewModel.WeightBridgeTicketNumber = receive.WeightBridgeTicketNumber;
            viewModel.WeightBeforeUnloading    = receive.WeightBeforeUnloading;
            viewModel.WeightAfterUnloading     = receive.WeightAfterUnloading;
            viewModel.TransporterId            = receive.TransporterID;
            viewModel.DriverName     = receive.DriverName;
            viewModel.PlateNoPrime   = receive.PlateNo_Prime;
            viewModel.PlateNoTrailer = receive.PlateNo_Trailer;
            viewModel.PortName       = receive.PortName;
            viewModel.Remark         = receive.Remark;

            return(viewModel);
        }
        /// <summary>
        /// Saves the receipt transaction.
        /// </summary>
        /// <param name="receiveModels">The receive models.</param>
        /// <param name="user">The user.</param>
        public void SaveReceiptTransaction(ReceiveViewModel receiveModels, UserProfile user)
        {
            // Populate more details of the reciept object
            // Save it when you are done.

            Receive receive = receiveModels.GenerateReceive();
            receive.CreatedDate = DateTime.Now;
            receive.HubID = user.DefaultHub.HubID;
            receive.UserProfileID = user.UserProfileID;
            var commType = _unitOfWork.CommodityTypeRepository.FindById(receiveModels.CommodityTypeID);

            // var comms = GenerateReceiveDetail(commodities);

            foreach (ReceiveDetailViewModel c in receiveModels.ReceiveDetails)
            {
                if (commType.CommodityTypeID == 2)//if it's a non food
                {
                    c.ReceivedQuantityInMT = 0;
                    c.SentQuantityInMT = 0;
                }
                TransactionGroup tgroup = new TransactionGroup();

                var receiveDetail = new ReceiveDetail()
                {
                    CommodityID = c.CommodityID,
                    Description = c.Description,
                    SentQuantityInMT = c.SentQuantityInMT.Value,
                    SentQuantityInUnit = c.SentQuantityInUnit.Value,
                    UnitID = c.UnitID,
                    ReceiveID = receive.ReceiveID
                };
                if (c.ReceiveDetailID.HasValue)
                {
                    receiveDetail.ReceiveDetailID = c.ReceiveDetailID.Value;
                }

                // receiveDetail.TransactionGroupID = tgroup.TransactionGroupID;
                receiveDetail.TransactionGroup = tgroup;
                receive.ReceiveDetails.Add(receiveDetail);

                Transaction transaction = new Transaction();
                transaction.TransactionDate = DateTime.Now;
                transaction.ParentCommodityID = _unitOfWork.CommodityRepository.FindById(c.CommodityID).ParentID ?? c.CommodityID;
                transaction.CommodityID = c.CommodityID;
                transaction.LedgerID = Ledger.Constants.GOODS_ON_HAND_UNCOMMITED;
                transaction.HubOwnerID = user.DefaultHub.HubOwnerID;

                transaction.AccountID = _accountService.GetAccountIdWithCreate(Account.Constants.HUB, receive.HubID);
                transaction.ShippingInstructionID = _shippingInstructionService.GetSINumberIdWithCreate(receiveModels.SINumber).ShippingInstructionID;

                //TODO:After Implementing ProjectCodeService Please Return Here
                //transaction.ProjectCodeID = repository.ProjectCode.GetProjectCodeIdWIthCreate(receiveModels.ProjectNumber).ProjectCodeID;
                transaction.HubID = user.DefaultHub.HubID;
                transaction.UnitID = c.UnitID;
                if (c.ReceivedQuantityInMT != null) transaction.QuantityInMT = c.ReceivedQuantityInMT.Value;
                if (c.ReceivedQuantityInUnit != null) transaction.QuantityInUnit = c.ReceivedQuantityInUnit.Value;
                if (c.CommodityGradeID != null) transaction.CommodityGradeID = c.CommodityGradeID.Value;

                transaction.ProgramID = receiveModels.ProgramID;
                transaction.StoreID = receiveModels.StoreID;
                transaction.Stack = receiveModels.StackNumber;
                transaction.TransactionGroupID = tgroup.TransactionGroupID;
                tgroup.Transactions.Add(transaction);

                // do the second half of the transaction here.

                var transaction2 = new Transaction();
                transaction2.TransactionDate = DateTime.Now;
                //TAKEs the PARENT FROM THE FIRST TRANSACTION
                transaction2.ParentCommodityID = transaction.ParentCommodityID;
                transaction2.CommodityID = c.CommodityID;
                transaction2.HubOwnerID = user.DefaultHub.HubOwnerID;
                //Decide from where the -ve side of the transaction comes from
                //it is either from the allocated stock
                // or it is from goods under care.

                // this means that this receipt is done without having gone through the gift certificate process.

                if (receiveModels.CommoditySourceID == BLL.CommoditySource.Constants.DONATION || receiveModels.CommoditySourceID == BLL.CommoditySource.Constants.LOCALPURCHASE)
                {
                    transaction2.LedgerID = Ledger.Constants.GOODS_UNDER_CARE;
                    transaction2.AccountID = _accountService.GetAccountIdWithCreate(Account.Constants.DONOR, receive.ResponsibleDonorID.Value);
                }
                else if (receiveModels.CommoditySourceID == BLL.CommoditySource.Constants.REPAYMENT)
                {
                    transaction2.LedgerID = Ledger.Constants.GOODS_RECIEVABLE;
                    transaction2.AccountID = _accountService.GetAccountIdWithCreate(Account.Constants.HUB, receiveModels.SourceHubID.Value);
                }
                else
                {
                    transaction2.LedgerID = Ledger.Constants.LIABILITIES;
                    transaction2.AccountID = _accountService.GetAccountIdWithCreate(Account.Constants.HUB, receiveModels.SourceHubID.Value);
                }

                transaction2.ShippingInstructionID = _shippingInstructionService.GetSINumberIdWithCreate(receiveModels.SINumber).ShippingInstructionID;
                //TODO:After Implementing ProjectCodeService Please return here
                //transaction2.ProjectCodeID = repository.ProjectCode.GetProjectCodeIdWIthCreate(receiveModels.ProjectNumber).ProjectCodeID;
                transaction2.HubID = user.DefaultHub.HubID;
                transaction2.UnitID = c.UnitID;
                // this is the credit part, so make it Negative
                if (c.ReceivedQuantityInMT != null) transaction2.QuantityInMT = -c.ReceivedQuantityInMT.Value;
                if (c.ReceivedQuantityInUnit != null) transaction2.QuantityInUnit = -c.ReceivedQuantityInUnit.Value;
                if (c.CommodityGradeID != null) transaction2.CommodityGradeID = c.CommodityGradeID.Value;

                transaction2.ProgramID = receiveModels.ProgramID;
                transaction2.StoreID = receiveModels.StoreID;
                transaction2.Stack = receiveModels.StackNumber;
                transaction2.TransactionGroupID = tgroup.TransactionGroupID;
                // hack to get past same key object in context error
                //repository.Transaction = new TransactionRepository();
                tgroup.Transactions.Add(transaction2);

            }

            // Try to save this transaction
            //   db.Database.Connection.Open();
            //  DbTransaction dbTransaction = db.Database.Connection.BeginTransaction();
            try
            {
                //repository.Receive.Add(receive);
                _unitOfWork.ReceiveRepository.Add(receive);
                _unitOfWork.Save();
            }
            catch (Exception exp)
            {
                //  dbTransaction.Rollback();
                //TODO: Save the exception somewhere
                throw new Exception("The Receipt Transaction Cannot be saved. <br />Detail Message :" + exp.StackTrace);

            }
        }
Esempio n. 11
0
        /// <summary>
        /// Generates the receive model.
        /// </summary>
        /// <param name="receive">The receive.</param>
        /// <param name="user">The user.</param>
        /// <returns></returns>
        public static Models.ReceiveViewModel GenerateReceiveModel(BLL.Receive receive, List <Commodity> commodities, List <CommodityGrade> commodityGrades, List <Transporter> transporters, List <CommodityType> commodityTypes,
                                                                   List <CommoditySource> commoditySources, List <Program> programs, List <Donor> donors, List <Hub> hubs, UserProfile user)
        {
            ReceiveViewModel model = new ReceiveViewModel();

            model._UserProfile = user;

            model.InitalizeViewModel(commodities, commodityGrades, transporters, commodityTypes,
                                     commoditySources, programs, donors, hubs, user);
            model.IsEditMode      = true;
            model.ReceiveID       = receive.ReceiveID;
            model.DriverName      = receive.DriverName;
            model.GRN             = receive.GRN;
            model.PlateNo_Prime   = receive.PlateNo_Prime;
            model.PlateNo_Trailer = receive.PlateNo_Trailer;

            model.TransporterID = receive.TransporterID;
            model.HubID         = receive.HubID;

            ReceiveDetail receiveDetail            = receive.ReceiveDetails.FirstOrDefault();//p=>p.QuantityInMT>0);
            Transaction   receiveDetailtransaction = null;

            if (receiveDetail != null)
            {
                foreach (Transaction transaction in receiveDetail.TransactionGroup.Transactions)
                {
                    var negTransaction = receiveDetail.TransactionGroup.Transactions.FirstOrDefault(p => p.QuantityInMT < 0);
                    if (negTransaction != null)
                    {
                        model.SourceHubID = negTransaction.Account.EntityID;
                    }
                    receiveDetailtransaction = transaction;
                    break;
                }
            }
            if (receiveDetailtransaction != null)
            {
                model.SINumber = receiveDetailtransaction.ShippingInstruction != null ? receiveDetailtransaction.ShippingInstruction.Value : "";

                model.ProjectNumber = receiveDetailtransaction.ProjectCode != null ? receiveDetailtransaction.ProjectCode.Value : "";

                model.ProgramID = receiveDetailtransaction.Program != null ? receiveDetailtransaction.Program.ProgramID : default(int);

                model.StoreID = receiveDetailtransaction.Store != null ? receiveDetailtransaction.Store.StoreID : default(int);

                model.StackNumber = receiveDetailtransaction.Stack.HasValue ? receiveDetailtransaction.Stack.Value : default(int);
            }
            else
            {
                model.SINumber      = "";
                model.ProjectNumber = "";
                model.ProgramID     = default(int);
                model.StoreID       = default(int);
                model.StackNumber   = default(int);
            }

            model.ReceiptDate           = receive.ReceiptDate;
            model.WayBillNo             = receive.WayBillNo;
            model.CommodityTypeID       = receive.CommodityTypeID;
            model.ResponsibleDonorID    = receive.ResponsibleDonorID;
            model.SourceDonorID         = receive.SourceDonorID;
            model.CommoditySourceID     = receive.CommoditySourceID;
            model.TicketNumber          = receive.WeightBridgeTicketNumber;
            model.WeightBeforeUnloading = receive.WeightBeforeUnloading;
            model.WeightAfterUnloading  = receive.WeightAfterUnloading;
            model.VesselName            = receive.VesselName;
            model.PortName            = receive.PortName;
            model.ReceiptAllocationID = receive.ReceiptAllocationID;
            model.PurchaseOrder       = receive.PurchaseOrder;
            model.SupplierName        = receive.SupplierName;

            model.Remark             = receive.Remark;
            model.ReceivedByStoreMan = receive.ReceivedByStoreMan;

            model.ReceiveDetails = DRMFSS.Web.Models.ReceiveDetailViewModel.GenerateReceiveDetailModels(receive.ReceiveDetails);
            return(model);
        }
 public bool EditReceiveDetail(ReceiveDetail receiveDetail)
 {
     _unitOfWork.ReceiveDetailRepository.Edit(receiveDetail);
     _unitOfWork.Save();
     return true;
 }
 public bool AddReceiveDetail(ReceiveDetail receiveDetail)
 {
     _unitOfWork.ReceiveDetailRepository.Add(receiveDetail);
     _unitOfWork.Save();
     return true;
 }
Esempio n. 14
0
 private void detach_ReceiveDetails(ReceiveDetail entity)
 {
     this.SendPropertyChanging("ReceiveDetails");
     entity.ReceiveHeader = null;
 }
Esempio n. 15
0
 private void attach_ReceiveDetails(ReceiveDetail entity)
 {
     this.SendPropertyChanging("ReceiveDetails");
     entity.OrderHeader = this;
 }
Esempio n. 16
0
 public void DeleteReceiveDetail(ReceiveDetail receiveDetail)
 {
     _controller.DeleteEntity(receiveDetail);
 }