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


C# Customer.Update方法代码示例

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


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

示例1: Save

        public dynamic Save(int id = 0, string email = "", string fname = "", string lname = "")
        {
            string error = "";
            try {
                Customer cust = new Customer { ID = id };
                cust.Get();
                cust.Update(email, fname, lname);

            } catch (Exception e) {
                error = e.Message;
            }

            return RedirectToAction("Info", "Customers", new { id = id });
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:14,代码来源:CustomersController.cs

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

示例3: CreateFromPartner

        public Customer CreateFromPartner(System.String __Name, Services.Packages.Customer _Partner, string SessionToken)
        {
            ModelSession session = CustomerSecureService.CheckSessionImp(SessionToken);

            Customer _Customer = new Customer(__Name);

            if (!_Customer.Exists && !Services.Packages.Security.CustomerSecureService.CheckAccessImp(_Partner, SessionToken, "Create PartnerCustomers"))
                throw new UnauthorizedAccessException("Access Denied");
            else if (_Customer.Exists && !CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Update"))
                throw new UnauthorizedAccessException("Access Denied");

            // Customer _Customer = Customer.CreateCustomer(__Name);
            _Customer.Owner = session.User;
            _Customer.Partner = _Partner;
            _Customer.Update();
            return _Customer;
        }
开发者ID:phaetto,项目名称:services-update,代码行数:17,代码来源:Services.Packages.Security.CustomerSecureService.cs

示例4: SetACLs

            public void SetACLs(Customer _Customer, Services.Packages.Security.CustomerAccessControlListCollection _ACLs, string SessionToken)
            {
                _Customer.Reload();

                //*
                if (!Services.Packages.Security.CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Traverse"))
                throw new UnauthorizedAccessException("Access Denied");
                //*/

                /*
                _ACLs.Reload();
                if (_ACLs.Exists && !Services.Packages.Security.Security.CustomerAccessControlListSecureService.CheckAccessImp(_ACLs, SessionToken, "Update"))
                throw new UnauthorizedAccessException("Access Denied");
                else if (!_ACLs.Exists && !Services.Packages.Security.CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Create ACLs"))
                throw new UnauthorizedAccessException("Access Denied");
                //*/

                _Customer.ACLs = _ACLs;
                _Customer.Update();
            }
开发者ID:phaetto,项目名称:services-update,代码行数:20,代码来源:Services.Packages.Security.CustomerSecureService.cs

示例5: SetCustomerUserEntries

            public void SetCustomerUserEntries(Customer _Customer, Services.Packages.CustomerUserEntryCollection _CustomerUserEntries, string SessionToken)
            {
                _Customer.Reload();

                //*
                if (!Services.Packages.Security.CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Traverse"))
                throw new UnauthorizedAccessException("Access Denied");
                //*/

                /*
                _CustomerUserEntries.Reload();
                if (_CustomerUserEntries.Exists && !Services.Packages.Security.CustomerUserEntrySecureService.CheckAccessImp(_CustomerUserEntries, SessionToken, "Update"))
                throw new UnauthorizedAccessException("Access Denied");
                else if (!_CustomerUserEntries.Exists && !Services.Packages.Security.CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Create CustomerUserEntries"))
                throw new UnauthorizedAccessException("Access Denied");
                //*/

                _Customer.CustomerUserEntries = _CustomerUserEntries;
                _Customer.Update();
            }
开发者ID:phaetto,项目名称:services-update,代码行数:20,代码来源:Services.Packages.Security.CustomerSecureService.cs

示例6: SetLicensesIssued

            public void SetLicensesIssued(Customer _Customer, Services.Packages.ApiKeyCollection _LicensesIssued, string SessionToken)
            {
                _Customer.Reload();

                //*
                if (!Services.Packages.Security.CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Traverse"))
                throw new UnauthorizedAccessException("Access Denied");
                //*/

                /*
                _LicensesIssued.Reload();
                if (_LicensesIssued.Exists && !Services.Packages.Security.ApiKeySecureService.CheckAccessImp(_LicensesIssued, SessionToken, "Update"))
                throw new UnauthorizedAccessException("Access Denied");
                else if (!_LicensesIssued.Exists && !Services.Packages.Security.CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Create LicensesIssued"))
                throw new UnauthorizedAccessException("Access Denied");
                //*/

                _Customer.LicensesIssued = _LicensesIssued;
                _Customer.Update();
            }
开发者ID:phaetto,项目名称:services-update,代码行数:20,代码来源:Services.Packages.Security.CustomerSecureService.cs

示例7: SetOwner

            public void SetOwner(Customer _Customer, Services.Packages.Security.ModelUser _Owner, string SessionToken)
            {
                _Customer.Reload();

                //*
                if (!Services.Packages.Security.CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Traverse"))
                throw new UnauthorizedAccessException("Access Denied");
                //*/

                //*
                _Owner.Reload();
                if (_Owner.Exists && !Services.Packages.Security.Security.ModelUserSecureService.CheckAccessImp(_Owner, SessionToken, "Update"))
                throw new UnauthorizedAccessException("Access Denied");
                else if (!_Owner.Exists && !Services.Packages.Security.CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Create CustomerOwning"))
                throw new UnauthorizedAccessException("Access Denied");
                //*/

                _Customer.Owner = _Owner;
                _Customer.Update();
            }
开发者ID:phaetto,项目名称:services-update,代码行数:20,代码来源:Services.Packages.Security.CustomerSecureService.cs

示例8: UpdateObject

            public void UpdateObject(Customer _Customer, string SessionToken)
            {
                if (!CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Update"))
                throw new UnauthorizedAccessException("Access Denied");

                _Customer.Update();
            }
开发者ID:phaetto,项目名称:services-update,代码行数:7,代码来源:Services.Packages.Security.CustomerSecureService.cs


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