public ActionResult ShowTransferData(string orderId, string productId)
        {
            Guid orderIdGuid   = new Guid(orderId);
            Guid productIdGuid = new Guid(productId);

            Order order = UnitOfWork.OrderRepository.GetById(orderIdGuid);

            Product            product      = UnitOfWork.ProductRepository.GetById(productIdGuid);
            string             orderCode    = string.Empty;
            List <InputDetail> inputDetails = UnitOfWork.InputDetailsRepository
                                              .Get(c => c.OrderId == order.Id).ToList();

            if (inputDetails.Count() == 1)
            {
                orderCode = order.Code;
            }
            else
            {
                orderCode = GenerateCode.GetChildOrderCode(order.Id);
            }

            TransferDetailViewModel transfer = new TransferDetailViewModel()
            {
                RemainQuantity   = GetRemainProduct(productIdGuid, orderIdGuid, order.CustomerId).RemainQuantity,
                RemainWight      = GetRemainProduct(productIdGuid, orderIdGuid, order.CustomerId).RemainWeight,
                OrderCode        = orderCode,
                ProductTitle     = product.Title,
                CustomerFullName = order.Customer.FullName,
                ParentOrderId    = orderId,
                ProductId        = productId
            };

            return(Json(transfer, JsonRequestBehavior.AllowGet));
        }
        public ActionResult ShowLoadingData(string inputDetailId)
        {
            Guid inputDetailIdGuid = new Guid(inputDetailId);

            InputDetail inputDetail = UnitOfWork.InputDetailsRepository.GetById(inputDetailIdGuid);

            Order order = UnitOfWork.OrderRepository.GetById(inputDetail.OrderId.Value);

            Product product = UnitOfWork.ProductRepository.GetById(inputDetail.ProductId);


            TransferDetailViewModel transfer = new TransferDetailViewModel()
            {
                RemainQuantity   = inputDetail.RemainQuantity,
                RemainWight      = inputDetail.RemainDestinationWeight,
                OrderCode        = order.Code,
                ProductTitle     = product.Title,
                CustomerFullName = order.Customer.FullName,
                ParentOrderId    = order.Id.ToString(),
                ProductId        = product.Id.ToString()
            };

            return(Json(transfer, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public TransferDetailPage(TransferDetailViewModel viewModel)
        {
            InitializeComponent();

            BindingContext = viewModel;
        }