本文整理汇总了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 });
}
示例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");
}
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例8: UpdateObject
public void UpdateObject(Customer _Customer, string SessionToken)
{
if (!CustomerSecureService.CheckAccessImp(_Customer, SessionToken, "Update"))
throw new UnauthorizedAccessException("Access Denied");
_Customer.Update();
}