Ejemplo n.º 1
0
        public ActionResult ChangeOrderStatus(string orderId, string orderStatus)
        {
            if (orderId != null && orderStatus != null)
            {
                switch (orderStatus)
                {
                case "Despatched":
                    OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Despatched, User);
                    break;

                case "Delivered":
                    OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Delivered, User);
                    break;

                case "Collected":
                    OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Collected, User);
                    break;

                case "Received":
                    OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Received, User);
                    break;

                case "Closed":
                    OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Closed, User);
                    break;
                }

                return(Json(new { success = true }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Ejemplo n.º 2
0
        public ActionResult AcceptOffer(string offerId)
        {
            if (offerId != null)
            {
                Offer offer = OfferHelpers.GetOffer(db, GeneralHelpers.GetGuidFromStringId(offerId));

                OfferHelpers.AcceptOffer(db, User, offer);

                return(Json(new { success = true }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Ejemplo n.º 3
0
        public ActionResult SubmitCounterOffer(string offerId, string offerQuantity)
        {
            if (offerId != null && offerQuantity != null)
            {
                decimal offerQty = 0;
                decimal.TryParse(offerQuantity, out offerQty);

                if (offerQty > 0)
                {
                    Offer offer = OfferHelpers.GetOffer(db, GeneralHelpers.GetGuidFromStringId(offerId));

                    OfferHelpers.UpdateCounterOffer(db, User, offer, offerQty);
                }

                return(Json(new { success = true }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }