Пример #1
0
        public async Task <ActionResult> Edit(int pq, int customerID, [Bind(Include = "ProductQuoteID, QuotedEstimatedDate, QuotedRealDate, QuotedCompleted, CustomerOrderEstimatedDate, CustomerOrderRealDate, CustomerOrderCompleted, ApprovedEstimatedDate, ApprovedRealDate, ApprovedCompleted, InProductionEstimatedDate, InProductionRealDate, InProductionCompleted, ETDEstimatedDate, ETDRealDate, ETDCompleted, ETAEstimatedDate, ETARealDate, ETACompleted, NationalizedEstimatedDate, NationalizedRealDate, NationalizedCompleted, DeliveredEstimatedDate, DeliveredRealDate, DeliveredCompleted, InProductionEnabled, ETDEnabled, ETAEnabled, NationalizedEnabled, DeliveredEnabled")] ShipmentTracking shipmentTracking)
        {
            if (ModelState.IsValid)
            {
                await shipmentTrackingRepository.UpdateAsync(shipmentTracking);

                return(RedirectToAction("../ProductQuote", new { pq = pq, customerID = customerID }));
            }

            return(View(shipmentTracking));
        }
Пример #2
0
        public async Task <ActionResult> Create(int pq, int customerID, [Bind(Include = "ProductQuoteID,DateOrder")] CustomerOrder customerOrder)
        {
            ViewBag.Pq         = pq;
            ViewBag.CustomerID = customerID;

            if (ModelState.IsValid)
            {
                if (!IsValidProductQuote(customerOrder.ProductQuoteID))
                {
                    ModelState.AddModelError("", "La Cotización esta fuera de término");
                    return(View(customerOrder));
                }

                await customerOrderRepository.CreateAsync(customerOrder);

                ShipmentTracking shipmentTracking = shipmentTrackingRepository.FindShipmentTrackingByProductQuoteID(customerOrder.ProductQuoteID);

                shipmentTracking.CustomerOrderEstimatedDate = customerOrder.DateOrder;
                shipmentTracking.CustomerOrderRealDate      = customerOrder.DateOrder;
                shipmentTracking.CustomerOrderCompleted     = true;

                //Si no es un usuario Cliente, se crea la OC directamente como APROBADA
                if (User.IsInRole("SellerUser"))
                {
                    shipmentTracking.ApprovedEstimatedDate = customerOrder.DateOrder;
                    shipmentTracking.ApprovedRealDate      = customerOrder.DateOrder;
                    shipmentTracking.ApprovedCompleted     = true;
                }

                await shipmentTrackingRepository.UpdateAsync(shipmentTracking);


                return(RedirectToAction("../ProductQuote", new { pq = ViewBag.Pq, customerID = ViewBag.CustomerID }));
            }

            return(View(customerOrder));
        }