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


C# Customer.LoggedIn方法代码示例

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


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

示例1: Index

        public async Task<ActionResult> Index() {
            HttpContext ctx = System.Web.HttpContext.Current;


            var pcats = CURTAPI.GetParentCategoriesAsync();
            await Task.WhenAll(new Task[] { pcats });

            ViewBag.parent_cats = await pcats;

            // Instantiate our Customer object
            Customer cust = new Customer();

            // Retrieve from Session/Cookie
            cust.GetFromStorage(ctx);

            if (!cust.LoggedIn(ctx)) {
                return RedirectToAction("Index","Authenticate");
            }

            // Get the Customer record
            cust.Get();

            cust.BindAddresses();

            ViewBag.countries = UDF.GetCountries();
            ViewBag.cust = cust;
            ViewBag.error = TempData["error"];
            return View();
        }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:29,代码来源:AccountController.cs

示例2: OnActionExecuting

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            // We need to make sure the user is logged in, if they are not we will redirect them to the customer login page
            Customer cust = new Customer();
            if (!cust.LoggedIn()) {
                Response.Redirect("/Authenticate");
            }
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:10,代码来源:CustomerAuthController.cs

示例3: OnActionExecuting

        protected override void OnActionExecuting(ActionExecutingContext filterContext) {
            base.OnActionExecuting(filterContext);

            // We need to make sure the user is logged in, if they are not we will redirect them to the customer login page
            Customer cust = new Customer();
            HttpContext ctx = System.Web.HttpContext.Current;
            ViewBag.timezone = EcommercePlatform.Models.UDF.GetTimeZone(ctx);
            if (!cust.LoggedIn(ctx)) {
                Response.Redirect("/Authenticate");
            }

        }
开发者ID:janiukjf,项目名称:CURTeCommerce,代码行数:12,代码来源:CustomerAuthController.cs

示例4: 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

示例5: Password

        public async Task<ActionResult> Password(string message = "") {
            HttpContext ctx = System.Web.HttpContext.Current;

            var pcats = CURTAPI.GetParentCategoriesAsync();
            await Task.WhenAll(new Task[] { pcats });

            ViewBag.parent_cats = await pcats;

            ViewBag.message = message;
            Customer cust = new Customer();
            cust.GetFromStorage(ctx);
            if (!cust.LoggedIn(ctx)) {
                return RedirectToAction("Index", "Authenticate");
            }
            ViewBag.cust = cust;
            return View();
        }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:17,代码来源:AccountController.cs

示例6: AddAddress

        public ActionResult AddAddress()
        {
            try {
                // Create Customer
                Customer customer = new Customer();
                customer.GetFromStorage();
                if (!customer.LoggedIn()) {
                    return RedirectToAction("Index", "Authenticate");
                }

                Address address = new Address();
                // Build out our Billing object
                address = new Address {
                    first = Request.Form["first"],
                    last = Request.Form["last"],
                    street1 = Request.Form["street1"],
                    street2 = (Request.Form["street2"].Trim() == "") ? null : Request.Form["street2"].Trim(),
                    city = Request.Form["city"],
                    postal_code = Request.Form["zip"],
                    residential = (Request.Form["residential"] == null) ? false : true,
                    active = true
                };
                try {
                    address.state = Convert.ToInt32(Request.Form["state"]);
                } catch (Exception) {
                    throw new Exception("You must select a state/province.");
                }
                address.Save(customer.ID);

            } catch (Exception e) {
                if (e.Message.ToLower().Contains("a potentially dangerous")) {
                    throw new HttpException(403, "Forbidden");
                }
            }
            return RedirectToAction("Addresses");
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:36,代码来源:AccountController.cs

示例7: ResetPassword

        public ActionResult ResetPassword() {
            HttpContext ctx = System.Web.HttpContext.Current;
            Customer cust = new Customer();
            cust.GetFromStorage(ctx);
            if (!cust.LoggedIn(ctx)) {
                return RedirectToAction("Index", "Authenticate");
            }
            string message = "";
            try {
                string current = Request.Form["current"];
                string newpw = Request.Form["new"];
                string confirm = Request.Form["confirm"];

                if (String.IsNullOrEmpty(current) || String.IsNullOrEmpty(newpw) || String.IsNullOrEmpty(confirm)) {
                    throw new Exception("You must enter all password fields. Try Again");
                }

                cust.ValidateCurrentPassword(current);

                cust.ValidatePasswords(newpw, confirm);
                cust.UpdatePassword();
                message = "Your password was successfully updated.";

            } catch (Exception e) {
                message = e.Message;
            }
            return RedirectToAction("Password", new { message = message });
        }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:28,代码来源:AccountController.cs

示例8: SetShippingDefault

 public ActionResult SetShippingDefault(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.SetShippingDefaultAddress(id);
         cust.BindAddresses();
     }
     return RedirectToAction("Addresses");
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:14,代码来源:AccountController.cs

示例9: DeleteAddress

 public ActionResult DeleteAddress(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);
     cust.ClearAddress(a.ID);
     if (a.cust_id == cust.ID) {
         a.Delete(id);
     }
     return RedirectToAction("Addresses");
 }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:14,代码来源:AccountController.cs

示例10: Save

        public ActionResult Save() {
            HttpContext ctx = System.Web.HttpContext.Current;

            Customer cust = new Customer();
            try {
                cust.GetFromStorage(ctx);

                if (!cust.LoggedIn(ctx)) {
                    return RedirectToAction("Index", "Authenticate");
                }
                #region Basic Information
                string email = cust.email;
                if (Request.Form["email"] != null && Request.Form["email"].Length > 0) {
                    email = Request.Form["email"];
                }
                if (email != cust.email) {
                    // Make sure we don't have an account with this e-mail address
                    if (Customer.CheckCustomerEmail(email)) {
                        throw new Exception("An account using the E-Mail address you provided already exists.");
                    }
                }
                string fname = cust.fname;
                if(Request.Form["fname"] != null && Request.Form["fname"].Length > 0){
                    fname = Request.Form["fname"];
                }
                string lname = cust.lname;
                if(Request.Form["lname"] != null && Request.Form["lname"].Length > 0){
                    lname = Request.Form["lname"];
                }
                string phone = cust.phone;
                if(Request.Form["phone"] != null && Request.Form["phone"].Length > 0){
                    phone = Request.Form["phone"];
                }
                int receiveOffers = cust.receiveOffers;
                int receiveNewsletter = cust.receiveNewsletter;
                if (Request.Form["receiveOffers"] != null) {
                    try {
                        receiveOffers = Convert.ToInt32(Request.Form["receiveOffers"]);
                    } catch (Exception) { }
                } else {
                    receiveOffers = 0;
                }
                if (Request.Form["receiveNewsletter"] != null) {
                    try {
                        receiveNewsletter = Convert.ToInt32(Request.Form["receiveNewsletter"]);
                    } catch (Exception) { }
                } else {
                    receiveNewsletter = 0;
                }
                cust.Update(email,fname,lname,phone,receiveOffers,receiveNewsletter);
                #endregion

                TempData["error"] = "You're account has been successfully updated.";
                return Redirect("/Account");
            } catch (Exception e) {
                if (e.Message.ToLower().Contains("a potentially dangerous")) {
                    throw new HttpException(403, "Forbidden");
                }
                TempData["customer"] = cust;
                TempData["error"] = "Failed to save your account information. " + e.Message + e.StackTrace;
                return Redirect("/Account");
            }
        }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:63,代码来源:AccountController.cs

示例11: Order

        public async Task<ActionResult> Order(int id = 0) {
            HttpContext ctx = System.Web.HttpContext.Current;
            
            var pcats = CURTAPI.GetParentCategoriesAsync();
            await Task.WhenAll(new Task[] { pcats });

            ViewBag.parent_cats = await pcats;

            Customer cust = new Customer();
            if (!cust.LoggedIn(ctx)) {
                return RedirectToAction("Index", "Authenticate");
            }
            cust.ID = ViewBag.customer.ID;
            Cart order = cust.GetOrderByPayment(id);
            if (order == null || order.ID == 0) {
                return RedirectToAction("Orders", "Account");
            }
            Payment payment = order.getPayment();
            ViewBag.payment = payment;
            ViewBag.order = order;
            return View();
        }
开发者ID:curt-labs,项目名称:CURTeCommerce,代码行数:22,代码来源:AccountController.cs

示例12: UpgradeShipping

        public ActionResult UpgradeShipping(string type = "")
        {
            ShippingResponse resp = getShipping();
            if (resp.Status_Description == "OK") {
                ShipmentRateDetails details = resp.Result.FirstOrDefault<ShipmentRateDetails>();
                RateDetail rate = details.Rates.FirstOrDefault<RateDetail>();

                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" });
                }

                decimal shipping_price = Convert.ToDecimal(rate.NetCharge.Key);
                string shipping_type = details.ServiceType;
                customer.Cart.setShippingType(shipping_type, shipping_price);
            }
            TempData["shipping_response"] = resp;
            return RedirectToAction("shipping");
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:22,代码来源:CartController.cs

示例13: getShipping

        public ShippingResponse getShipping()
        {
            Customer customer = new Customer();
            Settings settings = ViewBag.settings;
            customer.GetFromStorage();
            if (!customer.LoggedIn()) {
                Response.Redirect("/Authenticate");
            }

            FedExAuthentication auth = new FedExAuthentication {
                AccountNumber = Convert.ToInt32(settings.Get("FedExAccount")),
                Key = settings.Get("FedExKey"),
                Password = settings.Get("FedExPassword"),
                CustomerTransactionId = "",
                MeterNumber = Convert.ToInt32(settings.Get("FedExMeter"))
            };

            customer.Cart.BindAddresses();

            ShippingAddress destination = new ShippingAddress();
            try {
                destination = customer.Cart.Shipping.getShipping();
            } catch (Exception) {
                Response.Redirect("/Authenticate");
            }
            DistributionCenter d = new DistributionCenter().GetNearest(customer.Cart.Shipping.GeoLocate());
            ShippingAddress origin = d.getAddress().getShipping();
            List<int> parts = new List<int>();
            foreach (CartItem item in customer.Cart.CartItems) {
                for (int i = 1; i <= item.quantity; i++) {
                    parts.Add(item.partID);
                }
            }

            ShippingResponse response = CURTAPI.GetShipping(auth, origin, destination, parts);

            return response;
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:38,代码来源:CartController.cs

示例14: ChooseShippingType

        public ActionResult ChooseShippingType(string shipping_type = "")
        {
            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) {

                decimal shipping_price = 0;
                string shiptype = "";
                try {
                    string[] typesplit = shipping_type.Split('|');
                    shiptype = typesplit[0];
                    shipping_price = Convert.ToDecimal(typesplit[1]);
                    customer.Cart.setShippingType(shiptype, shipping_price);

                    // We need to calculate the tax now that we know the shipping state
                    customer.Cart.SetTax();

                    if (customer.Cart.Validate()) {
                        return RedirectToAction("Index", "Payment");
                    } else if (customer.Cart.bill_to == 0) {
                        return RedirectToAction("Billing");
                    } else if (customer.Cart.ship_to == 0) {
                        return RedirectToAction("Shipping");
                    } else {
                        return RedirectToAction("Index");
                    }
                } catch {
                    return RedirectToAction("Checkout", "Cart");
                }
            } else {
                UDF.ExpireCart(customer.ID);
                return RedirectToAction("Index");
            }
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:39,代码来源:CartController.cs

示例15: ChooseShipping

        //[RequireHttps]
        public ActionResult ChooseShipping(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.shippingID == 0) {
                    customer.SetShippingDefaultAddress(id);
                }
                customer.Cart.SetShipping(id);

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


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