当前位置: 首页>>代码示例>>C#>>正文


C# Customer.SetBillingDefaultAddress方法代码示例

本文整理汇总了C#中Customer.SetBillingDefaultAddress方法的典型用法代码示例。如果您正苦于以下问题:C# Customer.SetBillingDefaultAddress方法的具体用法?C# Customer.SetBillingDefaultAddress怎么用?C# Customer.SetBillingDefaultAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Customer的用法示例。


在下文中一共展示了Customer.SetBillingDefaultAddress方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddBillingAddress

        //[RequireHttps]
        public ActionResult AddBillingAddress()
        {
            try {
                // Create Customer
                Customer customer = new Customer();
                customer.GetFromStorage();
                if (!customer.LoggedIn()) {
                    return RedirectToAction("Index", "Authenticate", new { referrer = "https://" + Request.Url.Host + "/Cart/Checkout" });
                }

                if (customer.Cart.payment_id == 0) {
                    Address billing = new Address();
                    // Build out our Billing object
                    billing = new Address {
                        first = Request.Form["bfirst"],
                        last = Request.Form["blast"],
                        street1 = Request.Form["bstreet1"],
                        street2 = Request.Form["bstreet2"],
                        city = Request.Form["bcity"],
                        postal_code = Request.Form["bzip"],
                        residential = (Request.Form["bresidential"] == null) ? false : true,
                        active = true
                    };
                    try {
                        billing.state = Convert.ToInt32(Request.Form["bstate"]);
                    } catch (Exception) {
                        throw new Exception("You must select a billing state/province.");
                    }
                    billing.Save(customer.ID);
                    if (customer.billingID == 0) {
                        customer.SetBillingDefaultAddress(billing.ID);
                    }
                    if (customer.shippingID == 0) {
                        customer.SetShippingDefaultAddress(billing.ID);
                    }

                    // Retrieve Customer from Sessions/Cookie

                    customer.Cart.SetBilling(billing.ID);
                    if (customer.Cart.ship_to == 0) {
                        customer.Cart.SetShipping(billing.ID);
                    }
                } else {
                    UDF.ExpireCart(customer.ID);
                    return RedirectToAction("index");
                }
            } catch { }

            return RedirectToAction("shipping");
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:51,代码来源:CartController.cs

示例2: AddBillingAddress

        //[RequireHttps]
        public ActionResult AddBillingAddress() {
            try {
                // Create Customer
                Customer customer = new Customer();
                HttpContext ctx = System.Web.HttpContext.Current;
                customer.GetFromStorage(ctx);

                if (customer.Cart.payment_id == 0) {
                    Address billing = new Address();
                    // Build out our Billing object
                    billing = new Address {
                        first = Request.Form["bfirst"],
                        last = Request.Form["blast"],
                        street1 = Request.Form["bstreet1"],
                        street2 = Request.Form["bstreet2"],
                        city = Request.Form["bcity"],
                        postal_code = Request.Form["bzip"],
                        residential = (Request.Form["bresidential"] == null) ? false : true,
                        active = true
                    };
                    try {
                        billing.state = Convert.ToInt32(Request.Form["bstate"]);
                    } catch (Exception) {
                        throw new Exception("You must select a billing state/province.");
                    }
                    billing.Save(customer.ID);
                    if (customer.billingID == 0) {
                        customer.SetBillingDefaultAddress(billing.ID);
                    }
                    if (customer.shippingID == 0 && !billing.isPOBox()) {
                        customer.SetShippingDefaultAddress(billing.ID);
                    }

                    // Retrieve Customer from Sessions/Cookie

                    customer.Cart.SetBilling(billing.ID);
                    if (customer.Cart.ship_to == 0 && !billing.isPOBox()) {
                        customer.Cart.SetShipping(billing.ID);
                    }
                } else {
                    UDF.ExpireCart(ctx, customer.ID);
                    return RedirectToAction("index");
                }
            } catch { }

            return RedirectToAction("shipping");
        }
开发者ID:janiukjf,项目名称:CURTeCommerce,代码行数:48,代码来源:CartController.cs

示例3: ChooseBilling

        //[RequireHttps]
        public ActionResult ChooseBilling(int id = 0) {
            // Create Customer
            Customer customer = new Customer();
            HttpContext ctx = System.Web.HttpContext.Current;

            // Retrieve Customer from Sessions/Cookie
            customer.GetFromStorage(ctx);

            if (customer.Cart.payment_id == 0) {
                if (customer.billingID == 0) {
                    customer.SetBillingDefaultAddress(id);
                }
                customer.Cart.SetBilling(id);

                return RedirectToAction("billing");
            } else {
                UDF.ExpireCart(ctx, customer.ID);
                return RedirectToAction("index");
            }
        }
开发者ID:janiukjf,项目名称:CURTeCommerce,代码行数:21,代码来源:CartController.cs

示例4: SetBillingDefault

 public ActionResult SetBillingDefault(int id = 0) {
     HttpContext ctx = System.Web.HttpContext.Current;
     Customer cust = new Customer();
     cust.GetFromStorage(ctx);
     if (!cust.LoggedIn(ctx)) {
         return RedirectToAction("Index", "Authenticate");
     }
     Address a = new Address().Get(id);
     if (a.cust_id == cust.ID) {
         cust.SetBillingDefaultAddress(id);
         cust.BindAddresses();
     }
     return RedirectToAction("Addresses");
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:14,代码来源:AccountController.cs

示例5: ChooseBilling

        //[RequireHttps]
        public ActionResult ChooseBilling(int id = 0)
        {
            // Create Customer
            Customer customer = new Customer();

            // Retrieve Customer from Sessions/Cookie
            customer.GetFromStorage();
            if (!customer.LoggedIn()) {
                return RedirectToAction("Index", "Authenticate", new { referrer = "https://" + Request.Url.Host + "/Cart/Checkout" });
            }

            if (customer.Cart.payment_id == 0) {
                if (customer.billingID == 0) {
                    customer.SetBillingDefaultAddress(id);
                }
                customer.Cart.SetBilling(id);

                return RedirectToAction("billing");
            } else {
                UDF.ExpireCart(customer.ID);
                return RedirectToAction("index");
            }
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:24,代码来源:CartController.cs

示例6: SetBillingDefault

 public ActionResult SetBillingDefault(int id = 0)
 {
     Customer cust = new Customer();
     cust.GetFromStorage();
     Address a = new Address().Get(id);
     if (a.cust_id == cust.ID) {
         cust.SetBillingDefaultAddress(id);
         cust.BindAddresses();
     }
     return RedirectToAction("Addresses");
 }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:11,代码来源:AccountController.cs


注:本文中的Customer.SetBillingDefaultAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。