Example #1
0
        public ActionResult Index()
        {
            DeliveryModels.UpdateDelivery ud = new DeliveryModels.UpdateDelivery();
            string Msg = string.Empty;

            if (!string.IsNullOrEmpty(Request.QueryString["ActiveDeliveries"]))
            {
                ud  = UIDeliveryHelper.GetDelivery(Convert.ToInt32(Request.QueryString["ActiveDeliveries"]));
                Msg = UIDeliveryHelper.Message;
            }

            DeliveryModels model = new DeliveryModels
            {
                Deliveries   = UIDeliveryHelper.GetDelTypes(),
                Message      = Msg,
                deliveriesId = ud.deliveriesId,
                deliveryId   = ud.deliveryId,
                from         = ud.from,
                to           = ud.to,
                message      = ud.message,
                active       = ud.active,
                TableHeader  = string.IsNullOrEmpty(Request.Form["ActiveDeliveries"]) ? Settings.CreateDelivery : Settings.UpdateDelivery
            };

            return(View(model));
        }
        public ActionResult GetDeactivateList()
        {
            DeactivateModels model = new DeactivateModels
            {
                AllDeactivates = UIDeliveryHelper.GetDeliveries(),
                TableHeader    = Settings.DeliveryToDeactivate,
                Message        = UIDeliveryHelper.Message
            };

            return(View(model));
        }
Example #3
0
        public ActionResult Action()
        {
            Actions model = new Actions
            {
                AllActions  = UIDeliveryHelper.GetActions(),
                TableHeader = UIDeliveryHelper.Message,
                Message     = UIDeliveryHelper.CheckApi()
            };

            return(View(model));
        }
Example #4
0
        public ActionResult GetUpdateList()
        {
            // Leverage Deactivate models as it is exactly what we need.
            DeactivateModels model = new DeactivateModels
            {
                AllDeactivates = UIDeliveryHelper.GetDeliveries(),
                TableHeader    = Settings.DeliveryToUpdate,
                Message        = UIDeliveryHelper.Message
            };

            // This activates a dropdown on the UI.

            return(View(model));
        }
Example #5
0
        public ActionResult SaveDelivery()
        {
            string Msg = string.Empty;

            if (ModelState.IsValid)
            {
                string Method      = string.Empty;
                string ApiEnd      = string.Empty;
                string RequestBody = "deliveryid=" + Request.Form["DeliveryField"] +
                                     "&from=" + Request.Form["from"] +
                                     "&to=" + Request.Form["to"] +
                                     "&message=" + Request.Form["message"] +
                                     "&active=" + Request.Form["active"].Contains("true").ToString();

                // InsertDelivery.deliveriesId is only used when updating or deleting a delivery.
                switch (string.IsNullOrEmpty(Request.Form["deliveriesId"]) || Request.Form["deliveriesId"] == "0")
                {
                case true:
                    // We are creating a new delivery.
                    Method = "POST";
                    ApiEnd = Settings.SaveDeliveryEndPoint;

                    break;

                default:
                    // We are editing an existing delivery.
                    Method       = "PUT";
                    ApiEnd       = Settings.UpdateDeliveryEndPoint;
                    RequestBody += "&deliveriesId=" + Request.Form["deliveriesId"];

                    break;
                }

                UIDeliveryHelper.CallAPIPost(Method, ApiEnd, "application/x-www-form-urlencoded", RequestBody);
                Msg = UIDeliveryHelper.Message;
            }

            Actions model = new Actions
            {
                AllActions  = UIDeliveryHelper.GetActions(),
                TableHeader = UIDeliveryHelper.Message,
                Message     = Msg
            };

            return(View("~/Views/Actions/Action.cshtml", model));
        }
        public ActionResult DeactivateDelivery()
        {
            string Msg = string.Empty;

            if (ModelState.IsValid)
            {
                // Web browser does not support put. Accept post and change as needed.
                UIDeliveryHelper.CallAPIPost("DELETE", Settings.UpdateDeliveryEndPoint, "application/x-www-form-urlencoded", "deliveriesId=" + Request.Form["ActiveDeliveries"].ToString());
                Msg = UIDeliveryHelper.Message;
            }

            Actions model = new Actions
            {
                AllActions  = UIDeliveryHelper.GetActions(),
                Message     = Msg,
                TableHeader = UIDeliveryHelper.Message
            };

            return(View("~/Views/Actions/Action.cshtml", model));
        }