Exemplo n.º 1
0
 public void Add()
 {
     if (IsEdit == true)
     {
         toEdit.DeliveredItem    = DeliveredItem;
         toEdit.ItemQuantity     = ItemQuantity;
         toEdit.RecipientCompany = RecipientCompany;
         toEdit.CityTown         = CityTown;
         toEdit.PostalCode       = string.Format("{0}-{1}", PostalCode1, PostalCode2);
         toEdit.StreetAddress    = StreetAddress;
         toEdit.Weight           = Weight;
         toEdit.Description      = Description;
         DeliveryService.Edit(toEdit);
     }
     else
     {
         var newDelivery = new DeliveryDTO();
         newDelivery.DeliveredItem    = DeliveredItem;
         newDelivery.ItemQuantity     = ItemQuantity;
         newDelivery.RecipientCompany = RecipientCompany;
         newDelivery.CityTown         = CityTown;
         newDelivery.PostalCode       = string.Format("{0}-{1}", PostalCode1, PostalCode2);
         newDelivery.StreetAddress    = StreetAddress;
         newDelivery.Weight           = Weight;
         newDelivery.Description      = Description;
         DeliveryService.Add(newDelivery);
     }
     TryClose();
 }
Exemplo n.º 2
0
        public void Add()
        {
            var newDelivery = new DeliveryDTO();

            newDelivery.DeliveredItem    = DeliveredItem;
            newDelivery.ItemQuantity     = ItemQuantity;
            newDelivery.RecipientCompany = RecipientCompany;
            newDelivery.CityTown         = CityTown;
            newDelivery.PostalCode       = string.Format("{0}-{1}", PostalCode1, PostalCode2);
            newDelivery.StreetAddress    = StreetAddress;
            newDelivery.Weight           = Weight;
            newDelivery.Description      = Description;
            DeliveryService.Add(newDelivery);
            TryClose();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="context"></param>
        public void AddDeliveryRequest(HttpContext context)
        {
            var response = new ResponseMessage<string>();
            try
            {
                string complete = context.Request.Form["Complete"];
                string userId = context.Request.Form["UserId"];
                string consignee = context.Request.Form["Consignee"];
                string phone = context.Request.Form["Phone"];


                Delivery Delivery = new Delivery
                {
                    DeliveryId = Guid.NewGuid().ToString(),
                    Complete = complete,
                    Consignee = consignee,
                    Phone = phone,
                    UserId = userId,
                };
                var add = _userInfoService.Add(Delivery);

                if (add)
                {
                    response.code = 0;
                    response.msg = "添加成功";
                    context.Response.Write(SerializeHelp.ToJson(response));
                    return;
                }
                response.code = 500;
                response.msg = "添加失败";
                context.Response.Write(SerializeHelp.ToJson(response));
            }
            catch (Exception e)
            {
                response.code = 500;
                response.msg = "失败,请重试";
                context.Response.Write(SerializeHelp.ToJson(response));
            }

        }