Beispiel #1
0
        // GET: /ProductMaster/Delete/5

        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Courier Courier = _CourierService.GetCourier(id);

            if (Courier == null)
            {
                return(HttpNotFound());
            }

            ReasonViewModel vm = new ReasonViewModel()
            {
                id = id,
            };

            return(PartialView("_Reason", vm));
        }
Beispiel #2
0
        public ActionResult GetDeliveryInfo(string point, int index, string nextPoint, int orderId)
        {
            Order order = _orderService.GetOrderByOrderId(orderId);

            int maxIndex    = _deliveryInfoService.GetMaxIndex(orderId);
            int backUpIndex = maxIndex;

            OriginPointViewModel currentLocation = JsonHelper.DeserializeJsonToObject <OriginPointViewModel>(point);
            OriginPointViewModel nextLocation    = JsonHelper.DeserializeJsonToObject <OriginPointViewModel>(nextPoint);

            switch (index)
            {
            case 1:
            {
                order.OrderStatus = OrderStatusEnumType.DELIVERY.ToString();
                _orderService.UpdateOrder(order);

                DeliveryInfo packageDeliveryInfo  = new DeliveryInfo(string.Format(MessageConstants.DELIVERYINFO_PACKAGE_MESSAGE, currentLocation.Name), ++maxIndex, orderId);
                DeliveryInfo transferDeliveryInfo = new DeliveryInfo(string.Format(MessageConstants.DELIVERYINFO_TRANSFER_MESSAGE, currentLocation.Name, nextLocation.Name), ++maxIndex, orderId);
                AddDeliveryInfo(new List <DeliveryInfo>()
                    {
                        packageDeliveryInfo,
                        transferDeliveryInfo
                    });
            }
            break;

            case 4:
            {
                DeliveryInfo receiveDeliveryInfo = new DeliveryInfo(string.Format(
                                                                        MessageConstants.DELIVERYINFO__RECEIVE_MESSAGE, currentLocation.Name), ++maxIndex, orderId);
                DeliveryStation deliveryStation = _deliveryStationService.GetDeliveryStation(currentLocation.Longitude, currentLocation.Latitude);

                Courier      courier = _courierService.GetCourier(deliveryStation.Id);
                DeliveryInfo deliveryDeliveryInfo = new DeliveryInfo(string.Format(MessageConstants.DELIVERYINFO_DELIVERY_MESSAGE, currentLocation.Name, courier.Name, courier.Phone), ++maxIndex, orderId
                                                                     );
                AddDeliveryInfo(new List <DeliveryInfo>()
                    {
                        receiveDeliveryInfo,
                        deliveryDeliveryInfo
                    });
            }
            break;

            case 5:
            {
                DeliveryInfo endDeliveryInfo = new DeliveryInfo(
                    string.Format(MessageConstants.DELIVERYINFO_END_MESSAGE, currentLocation.Name), ++maxIndex, orderId
                    );
                _deliveryInfoService.AddDeliverInfo(endDeliveryInfo);

                order.OrderStatus = OrderStatusEnumType.FINISHED.ToString();
                _orderService.UpdateOrder(order);
            }
            break;

            default:
            {
                DeliveryInfo receiveDeliveryInfo = new DeliveryInfo(string.Format(
                                                                        MessageConstants.DELIVERYINFO__RECEIVE_MESSAGE, currentLocation.Name), ++maxIndex, orderId);
                DeliveryInfo transferDeliveryInfo = new DeliveryInfo(string.Format(
                                                                         MessageConstants.DELIVERYINFO_TRANSFER_MESSAGE,
                                                                         currentLocation.Name, nextLocation.Name), ++maxIndex, orderId);
                AddDeliveryInfo(new List <DeliveryInfo>()
                    {
                        receiveDeliveryInfo,
                        transferDeliveryInfo
                    });
            }
            break;
            }

            List <DeliveryInfo> deliveryInfoList = _deliveryInfoService.GetDeliveryInfoInRange(orderId, backUpIndex);

            return(Json(deliveryInfoList));
        }