示例#1
0
        public ActionResult EditShippingAddress()
        {
            if (Request["cmd"] == null)
            {
                throw new BusinessException("无效的请求");
            }

            int    contactAddressSysNo;
            string command = Request["cmd"].Trim().ToUpper();

            switch (command)
            {
            case "GET":

                if (Request["id"] == null || !int.TryParse(Request["id"], out contactAddressSysNo))
                {
                    throw new BusinessException("无效的请求");
                }
                else
                {
                    ShippingContactInfo customerShippingAddressInfo = CustomerShippingAddresssFacade.GetCustomerShippingAddress(contactAddressSysNo, CurrUser.UserSysNo);
                    if (customerShippingAddressInfo == null)
                    {
                        throw new BusinessException("无效的收货地址");
                    }
                    return(PartialView("_RMAShippingAddressEditPanel", customerShippingAddressInfo));
                }

            case "DEL":

                if (Request["id"] == null || !int.TryParse(Request["id"], out contactAddressSysNo))
                {
                    throw new BusinessException("无效的请求");
                }
                else
                {
                    CustomerShippingAddresssFacade.DeleteCustomerContactInfo(contactAddressSysNo, CurrUser.UserSysNo);
                    return(Json(new { sysno = contactAddressSysNo }));
                }

            case "DEFAULT":
                if (Request["id"] == null || !int.TryParse(Request["id"], out contactAddressSysNo))
                {
                    throw new BusinessException("无效的请求");
                }
                else
                {
                    CustomerShippingAddresssFacade.SetCustomerContactAsDefault(contactAddressSysNo, CurrUser.UserSysNo);
                    return(Content("y"));
                }

            default:
                break;
            }

            return(Json(""));
        }
        public ActionResult CreateCustomerShippingInfo(FormCollection form)
        {
            string Action = Request["Action"].ToString();
            string Data   = Request["Data"].ToString();

            Data = System.Web.HttpUtility.UrlDecode(Data);
            JavaScriptSerializer jss             = new JavaScriptSerializer();
            ShippingContactInfo  shippingAddress = jss.Deserialize <ShippingContactInfo>(Data); // JsonHelper.JsonToObject<ShippingContactInfo>(Data);

            shippingAddress.ReceiveName = shippingAddress.ReceiveContact;
            if (Action == "2")
            {
                CustomerShippingAddresssFacade.DeleteCustomerContactInfo(shippingAddress.SysNo, CurrUser.UserSysNo);
            }
            else
            {
                CustomerShippingAddresssFacade.EditCustomerContactInfo(shippingAddress, CurrUser.UserSysNo);
            }
            return(Json("s", JsonRequestBehavior.AllowGet));
        }