public List<CUSTOMER> Search(CUSTOMER Customer, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, SortDirection SortDirection) { var result = Context.CUSTOMER.AsQueryable(); if (Customer != null) { if (!String.IsNullOrWhiteSpace(Customer.Name)) { result = result.Where(c => (c.Name + " " + c.Surname).Contains(Customer.Name)); } if (!String.IsNullOrWhiteSpace(Customer.Email)) { result = result.Where(c => c.Email.ToLower().Contains(Customer.Email.ToLower())); } if (Customer.Newsletter.HasValue) { result = result.Where(c => c.Newsletter == Customer.Newsletter.Value); } } TotalRecords = result.Count(); GenericSorterCaller<CUSTOMER> sorter = new GenericSorterCaller<CUSTOMER>(); result = sorter.Sort(result, String.IsNullOrEmpty(OrderExp) ? "ID" : OrderExp, SortDirection); return result.Skip(PageIndex * PageSize).Take(PageSize).ToList(); }
public void Execute() { // Retrieve users in a paginated way, to avoid loading thousands in memory int TotalRecords; CUSTOMER searchCustomer = new CUSTOMER(); searchCustomer.Newsletter = true; List<CUSTOMER> customers = ApplicationContext.Current.Customers.Search(searchCustomer, PageSize, 0, out TotalRecords, "ID", BL.Util.SortDirection.Ascending); int numPages = (int)Math.Floor((double)(TotalRecords / PageSize)); //retrieve campaigns that starts today int TotalCampaignsForToday; int TotalCampaignsForFuture; CAMPAIGN searchCampaign = new CAMPAIGN(){SearchStartDate = DateTime.Today, SearchEndDate = DateTime.Today.AddHours(24)}; List<CAMPAIGN> campaigns = ApplicationContext.Current.Campaigns.Search(searchCampaign, 100, 0, out TotalCampaignsForToday, "Name", BL.Util.SortDirection.Ascending); searchCampaign = new CAMPAIGN() { SearchStartDate = DateTime.Today.AddDays(1), SearchEndDate = DateTime.Today.AddDays(Configuration.FutureCampaignDays) }; List<CAMPAIGN> campaignsFuture = ApplicationContext.Current.Campaigns.Search(searchCampaign, 100, 0, out TotalCampaignsForFuture, "Name", BL.Util.SortDirection.Ascending); StringBuilder subject = new StringBuilder(); subject.Append("Sot ne FZone: "); for (int i = 0; i < campaigns.Count; i++) { if (i != 0 && campaigns.Count > 1 && i == (campaigns.Count - 1)) { subject.Append(" dhe "); } if (i != 0 && campaigns.Count != 1 && i != (campaigns.Count - 1)) { subject.Append(", "); } subject.Append(campaigns.ElementAt(i).BrandName); } subject.Append(" sot ne FZone"); if (campaigns == null || campaigns.Count == 0) { log("There are no campaigns starting today!"); return; } for (int i = 0; i <= numPages; i++) { if (i != 0) { customers = ApplicationContext.Current.Customers.Search(searchCustomer, PageSize, i, out TotalRecords, "ID", BL.Util.SortDirection.Ascending); } foreach (CUSTOMER customer in customers) { SendEmail(customer, campaigns, subject.ToString(), campaignsFuture); // TODO decide if this should be done in different threads/tasks } } log("Newsletter sending terminated"); }
public static void SendCustomerNewsletter(CUSTOMER Customer, List<CAMPAIGN> Campaigns, String Subject, List<CAMPAIGN> FutureCampaigns) { MailMessage mail = new MailMessage(); mail.To.Add(new MailAddress(Customer.Email)); mail.Subject = Subject; mail.IsBodyHtml = true; mail.Body = Transfomer.GenerateNewsletter(Customer, Campaigns, FutureCampaigns); mail.From = new MailAddress("*****@*****.**", "FZone"); SmtpClient client = new SmtpClient(); //client.EnableSsl = true; client.Timeout = 5000; client.Send(mail); }
public static void SendCustomerOrder(CUSTOMER Customer, List<ORDER_DETAIL> Details, String Subject) { MailMessage mail = new MailMessage(); mail.To.Add(new MailAddress(Customer.Email)); mail.Subject = Subject; mail.IsBodyHtml = true; mail.Body = Transfomer.GenerateOrderMail(Customer, Details); mail.From = new MailAddress("*****@*****.**", "FZone"); SmtpClient client = new SmtpClient(); //client.EnableSsl = true; client.Timeout = 5000; client.Send(mail); }
public void Update(CUSTOMER Entity) { Update(Entity, true); }
public List<SHOPPING_CART> GetCart(CUSTOMER Customer) { var shopping = Context.SHOPPING_CART.Where(x => x.CustomerID == Customer.ID).ToList(); return shopping; }
public static string GenerateBonusMail(CUSTOMER Customer) { // Input data will be defined in this XML document. XmlDocument xmlDoc = new XmlDocument(); XmlElement xmlRoot; XmlNode xmlNode, xmlChild2, xmlChild, xmlNode3; xmlDoc.LoadXml( "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<Root>" + "<Customer/>" + "<Invited/>" + "<Bonus/>" + "<Url/>" + "<Campaigns/>" + "</Root>"); // Set the values of the XML nodes that will be used by XSLT. xmlRoot = xmlDoc.DocumentElement; xmlNode = xmlRoot.SelectSingleNode("/Root/Customer"); xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Name", null); xmlChild2.InnerText = Customer.CUSTOMER2.Name + " " + Customer.CUSTOMER2.Surname; xmlNode.AppendChild(xmlChild2); xmlNode = xmlRoot.SelectSingleNode("/Root/Url"); xmlNode.InnerText = Configuration.DeploymentURL; xmlNode = xmlRoot.SelectSingleNode("/Root/Invited"); xmlNode.InnerText = Customer.Email; xmlNode = xmlRoot.SelectSingleNode("/Root/Bonus"); xmlNode.InnerText = Configuration.BonusValue.ToString() + " €"; xmlNode3 = xmlRoot.SelectSingleNode("/Root/Campaigns"); CAMPAIGN searchCampaign = new CAMPAIGN() { Active = true, Approved = true }; int TotalCampaignsForToday; List<CAMPAIGN> campaigns = ApplicationContext.Current.Campaigns.Search(searchCampaign, 100, 0, out TotalCampaignsForToday, "StartDate", BL.Util.SortDirection.Descending); string path; foreach (CAMPAIGN campaign in campaigns) { xmlChild = xmlDoc.CreateNode(XmlNodeType.Element, "Campaign", null); // title xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Title", null); xmlChild2.InnerText = campaign.BrandName; xmlChild.AppendChild(xmlChild2); // from //xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "From", null); //xmlChild2.InnerText = campaign.StartDate.ToString("dd/MM/yyyy"); //xmlChild.AppendChild(xmlChild2); // to xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "To", null); xmlChild2.InnerText = campaign.EndDate.ToString("dd/MM/yyyy"); xmlChild.AppendChild(xmlChild2); // image xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Image", null); if (Configuration.ImagesVisualizationPath.Contains(Configuration.DeploymentURL)) path = Configuration.ImagesVisualizationPath; else path = Configuration.DeploymentURL + Configuration.ImagesVisualizationPath; xmlChild2.InnerText = path + campaign.ImageHome; xmlChild.AppendChild(xmlChild2); // Url xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Url", null); xmlChild2.InnerText = Configuration.DeploymentURL + "/campaign/" + Encryption.Encrypt(campaign.ID.ToString()); xmlChild.AppendChild(xmlChild2); xmlNode3.AppendChild(xmlChild); } // This is our XSL template. XslCompiledTransform xslDoc = new XslCompiledTransform(); xslDoc.Load(@Configuration.BonusTemplate); XsltArgumentList xslArgs = new XsltArgumentList(); StringWriter writer = new StringWriter(); // Merge XSLT document with data XML document // (writer will hold resulted transformation). xslDoc.Transform(xmlDoc, xslArgs, writer); return writer.ToString(); }
public void Update(CUSTOMER Entity, bool Attach = true) { _customerDAO.Update(Entity, Attach); Context.SaveChanges(); }
public static string GenerateOrderMail(CUSTOMER Customer, List<ORDER_DETAIL> Details) { // Input data will be defined in this XML document. XmlDocument xmlDoc = new XmlDocument(); XmlElement xmlRoot; XmlNode xmlNode; XmlNode xmlChild2; xmlDoc.LoadXml( "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<Root>" + //"<UserName/>" + //"<Message/>" + "<Products/>" + "<Customer/>" + "<Order/>" + "</Root>"); // Set the values of the XML nodes that will be used by XSLT. xmlRoot = xmlDoc.DocumentElement; xmlNode = xmlRoot.SelectSingleNode("/Root/Customer"); xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Name", null); xmlChild2.InnerText = Customer.Name + " " + Customer.Surname; xmlNode.AppendChild(xmlChild2); // This is our XSL template. XslCompiledTransform xslDoc = new XslCompiledTransform(); xslDoc.Load(@Configuration.OrderTemplate); XsltArgumentList xslArgs = new XsltArgumentList(); StringWriter writer = new StringWriter(); // Merge XSLT document with data XML document // (writer will hold resulted transformation). xslDoc.Transform(xmlDoc, xslArgs, writer); return writer.ToString(); }
private void Save() { CUSTOMER customer = new CUSTOMER(); customer.Name = txtName.Text; customer.Surname = txtSurname.Text; customer.Email = txtEmail.Text; customer.Active = chkActive.Checked; customer.Newsletter = chkNewsletter.Checked; customer.Telephone = txtPhone.Text; customer.Mobile = txtMobile.Text; if (btnMale.Checked) { customer.Gender = "M"; } else if (btnFemale.Checked) { customer.Gender = "F"; } bool ignorePass = false; if (txtPass.Text != fakePassChars) { customer.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPass.Text, Configuration.PasswordHashMethod).ToLower(); } else { ignorePass = true; } if (!String.IsNullOrWhiteSpace(txtBirthDate.Text)) { customer.BirthDate = DateTime.Parse(txtBirthDate.Text); } // not a new customer int id = 0; lblErrors.Visible = true; lblErrors.ForeColor = Color.Green; string operation = String.Empty; try { if (CustomerID != 0) { customer.ID = CustomerID; ApplicationContext.Current.Customers.Update(customer, ignorePass, true); operation = "updated"; } else { // new customer, set registration date to today customer.RegistrationDate = DateTime.Today.Date; ApplicationContext.Current.Customers.Insert(customer); operation = "inserted"; CustomerID = customer.ID; setAddrCustomerId(); } for (int i = 0; i < Int32.Parse(addressCount.Value); i++) { CustomerAddress custAddr = (CustomerAddress)tabAddresses.FindControl("address" + (i + 1)); custAddr.Save(true); } lblErrors.Text = "Customer " + operation + " correctly."; } catch (Exception ex) { writeError(ex.Message); } }
public void Update(CUSTOMER Customer, bool Attach = true) { Update(Customer, true, Attach); }
private void insertCustomerBonus(CUSTOMER customer) { BONUS b = new BONUS() { CustomerID = customer.InvitedFrom.Value, DateAssigned = DateTime.Today, Validity = DateTime.Today.AddMonths(2), Description = "Per ftesen e " + customer.Email, Value = Configuration.BonusValue, ValueRemainder = Configuration.BonusValue }; _bonusDAO.Insert(b); }
private void FixupCUSTOMER(CUSTOMER previousValue) { if (previousValue != null && previousValue.ADDRESS.Contains(this)) { previousValue.ADDRESS.Remove(this); } if (CUSTOMER != null) { if (!CUSTOMER.ADDRESS.Contains(this)) { CUSTOMER.ADDRESS.Add(this); } if (CustomerID != CUSTOMER.ID) { CustomerID = CUSTOMER.ID; } } }
protected bool facebookAuthenticate() { try { if (!String.IsNullOrWhiteSpace(Request["accessToken"])) { FacebookClient client = new FacebookClient(Request["accessToken"]); dynamic person = client.Get("me"); // data returned from facebook if (person != null) { CUSTOMER customer = new CUSTOMER(person); CUSTOMER fbCustomer = ApplicationContext.Current.Customers.GetByFBId(person.id); // user not found in db with this fb id if (fbCustomer == null) { CUSTOMER myCustomer = ApplicationContext.Current.Customers.GetByEmail(customer.Email); // user not present with this fb id nor with this email if (myCustomer == null) { customer.RegistrationDate = DateTime.Today; ApplicationContext.Current.Customers.Insert(customer); } else { myCustomer.Email = customer.Email; myCustomer.Name = customer.Name; myCustomer.Surname = customer.Surname; myCustomer.Gender = customer.Gender; myCustomer.FBId = customer.FBId; myCustomer.BirthDate = customer.BirthDate; ApplicationContext.Current.Customers.Update(myCustomer, false); customer.ID = myCustomer.ID; } } else { // user already saved as fb user, updating email if necessary if (fbCustomer.Email != customer.Email) { fbCustomer.Email = customer.Email; ApplicationContext.Current.Customers.Update(fbCustomer, false); } customer.ID = fbCustomer.ID; } CurrentCustomer = new SessionCustomer(customer); Session["accessToken"] = Request["accessToken"]; Response.Cookies.Remove(FormsAuthentication.FormsCookieName); FormsAuthentication.SetAuthCookie(customer.Email, false); return true; } else { return false; } } else { return false; } } catch (Exception ex) { Log(ex, ex.Message, ex.StackTrace, "BasePage - FacebookAuth"); return false; } }
internal static void sendOrderMailToCustomer(CUSTOMER customer, List<ORDER_DETAIL> details, string subject) { try { BL.Util.Mailer.SendCustomerOrder(customer, details, subject); } catch (Exception ex) { Log(ex, ex.Message, ex.StackTrace, "Checkout - SendmailAdmins"); } }
protected void lnkRegister_Click(object sender, EventArgs e) { Page.Validate(); if (Page.IsValid) { CUSTOMER customer = new CUSTOMER(); if (String.IsNullOrWhiteSpace(txtEmail.Text) || !valEmail.IsValid) { litError.Text = "Email " + Resources.Lang.NotValidLabel + "."; return; } if (!chkGeneralTerms.Checked) { litError.Text = Resources.Lang.PleaseAcceptLabel; return; } int invCust = 0; //Check if have cookie. Yes ? Add id of customer whu invited : nothing if (Request.Cookies["InvBy"] != null) { if (Request.Cookies["InvBy"]["IdCust"] != null) { if (int.TryParse(Request.Cookies["InvBy"]["IdCust"], out invCust)) { customer.InvitedFrom = invCust; } } } customer.Email = txtEmail.Text; try { if (ApplicationContext.Current.Customers.GetByEmail(txtEmail.Text) != null) { litError.Text = Resources.Lang.AlreadyRegisteredMailLabel; return; } customer.Name = txtName.Text; customer.Surname = txtSurname.Text; DateTime date = new DateTime(); IFormatProvider formatProvider = new CultureInfo("it-IT"); if (!String.IsNullOrWhiteSpace(txtBirthday.Text)) { DateTime.TryParse(txtBirthday.Text, formatProvider, DateTimeStyles.AdjustToUniversal, out date); } customer.BirthDate = date; customer.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, Configuration.PasswordHashMethod).ToLower(); customer.Active = true; customer.RegistrationDate = DateTime.Now; customer.Newsletter = true; customer.Gender = ddlGender.SelectedValue; customer.Telephone = txtPhone.Text; customer.Mobile = txtMobile.Text; //If cookie exist ? delte && set InviteTabele a True : nothing if (Request.Cookies["InvBy"] != null) { if (Request.Cookies["InvBy"]["InvId"] != null) { int idInv; if (int.TryParse(Request.Cookies["InvBy"]["InvId"], out idInv)) { var invitation = ApplicationContext.Current.Invitations.GetById(idInv); if (invitation.InvitedMail == txtEmail.Text) { invitation.Registered = true; invitation.RegistrationDate = DateTime.Now; //ApplicationContext.Current.Invitations.Update(invitation); //No need to do an update (i.e. attach and save context), object already attached } // TODO Check logic // case when invitation id is specified, but user is registering another email else if (invCust != 0) { INVITATION invt = new INVITATION() { CustomerID = invCust, InvitedMail = txtEmail.Text, Registered = true, RegistrationDate = DateTime.Now, IP = Request.UserHostAddress }; ApplicationContext.Current.Invitations.Insert(invt); } } else { //case when invitation id is not specified, user may be referred in another way INVITATION invt = new INVITATION() { CustomerID = invCust, InvitedMail = txtEmail.Text, Registered = true, RegistrationDate = DateTime.Now, IP = Request.UserHostAddress }; ApplicationContext.Current.Invitations.Insert(invt); } } HttpCookie myCookie = new HttpCookie("InvBy"); myCookie.Expires = DateTime.Now.AddDays(-1d); Response.Cookies.Add(myCookie); } ApplicationContext.Current.Customers.Insert(customer); CurrentCustomer = new SessionCustomer(customer); Response.Cookies.Remove(FormsAuthentication.FormsCookieName); FormsAuthentication.SetAuthCookie(customer.Email, false); Response.Redirect("/home"); } catch (System.Threading.ThreadAbortException ex) { } catch (Exception ex) { //TODO log ex Log(ex, ex.Message, ex.StackTrace, "Register"); litError.Text = Resources.Lang.ErrorVerifiedLabel; } } }
public void Insert(CUSTOMER Entity) { _customerDAO.Insert(Entity); Context.SaveChanges(); }
protected void lnkModify_Click(object sender, EventArgs e) { Validate("regValidation"); if (IsValid) { if (CurrentCustomer != null) { var customer = new CUSTOMER() { ID = CurrentCustomer.Id }; try { customer.Name = txtName.Text; customer.Surname = txtSurname.Text; customer.Telephone = txtPhone.Text; customer.Mobile = txtMobile.Text; customer.Active = true; CurrentCustomer.Name = customer.Name; CurrentCustomer.Surname = customer.Surname; DateTime date = new DateTime(); IFormatProvider formatProvider = new CultureInfo("it-IT"); if (!String.IsNullOrWhiteSpace(txtBirthday.Text)) { DateTime.TryParse(txtBirthday.Text, formatProvider, DateTimeStyles.AdjustToUniversal, out date); customer.BirthDate = date; } customer.Gender = ddlGender.SelectedValue; ApplicationContext.Current.Customers.Update(customer); litError.Text = Resources.Lang.DataSavedCorrectly; } catch (Exception ex) { //TODO log ex Log(ex, ex.Message, ex.StackTrace, "PersonalInfo.Modify"); litError.Text = Resources.Lang.ErrorVerifiedLabel; } } } }
public void Insert(CUSTOMER Customer) { Customer.Email = Customer.Email.ToLower(); Context.CUSTOMER.AddObject(Customer); }
public SessionCustomer(CUSTOMER customer) { Id = customer.ID; Name = customer.Name; Surname = customer.Surname; }
public void Update(CUSTOMER Customer, bool IgnorePassword, bool Attach = true) { if (Attach) { Context.CUSTOMER.Attach(Customer); } if (IgnorePassword) { var entry = Context.ObjectStateManager.GetObjectStateEntry(Customer); entry.SetModifiedProperty("Name"); entry.SetModifiedProperty("Surname"); if (!String.IsNullOrWhiteSpace(Customer.Email)) { entry.SetModifiedProperty("Email"); } entry.SetModifiedProperty("Gender"); if (Customer.BirthDate.HasValue) { entry.SetModifiedProperty("BirthDate"); } entry.SetModifiedProperty("Active"); if (Customer.Newsletter.HasValue) { entry.SetModifiedProperty("Newsletter"); } entry.SetModifiedProperty("Telephone"); entry.SetModifiedProperty("Mobile"); } else { Context.ObjectStateManager.ChangeObjectState(Customer, EntityState.Modified); } }
public void Update(CUSTOMER Customer, bool IgnorePass, bool Attach = true) { _customerDAO.Update(Customer, IgnorePass, Attach); Context.SaveChanges(); }
private void loadAddresses(bool Load, CUSTOMER customer) { int i; address1.Visible = false; address2.Visible = false; address3.Visible = false; address4.Visible = false; address5.Visible = false; if (!Load) { address1.ResetControl(true); address2.ResetControl(true); address3.ResetControl(true); address4.ResetControl(true); address5.ResetControl(true); } for (i = 0; i < customer.ADDRESS.Count; i++) { CustomerAddress custAddr = (CustomerAddress)updPanAddress.FindControl("address" + (i + 1)); custAddr.AddrID = customer.ADDRESS.ElementAt(i).ID; custAddr.ReloadControl(false); custAddr.Visible = true; } AddrCounter = i; }
private void SendEmail(CUSTOMER Customer, List<CAMPAIGN> Campaigns, string Subject, List<CAMPAIGN> FutureCampaigns) { try { FashionZone.BL.Util.Mailer.SendCustomerNewsletter(Customer, Campaigns, Subject, FutureCampaigns); log("Mail to " + Customer.Email + " sent."); } catch (Exception ex) { log("Error sending newsletter to " + Customer.Email + " - " + ex.Message); } }
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { password = FormsAuthentication.HashPasswordForStoringInConfigFile(password, Configuration.PasswordHashMethod); var ctx = ApplicationContext.Current.Customers; MembershipUser u = new MembershipUser(Name, username, username, email, passwordQuestion, String.Empty, true, false, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now); CUSTOMER customer = new CUSTOMER(); customer.Password = password; customer.Email = username; customer.Active = true; try { ctx.Insert(customer); } catch (Exception ex) { status = MembershipCreateStatus.ProviderError; return null; } status = MembershipCreateStatus.Success; return u; }
public void Delete(CUSTOMER Customer) { Context.CUSTOMER.Attach(Customer); Context.CUSTOMER.DeleteObject(Customer); }
public static string GenerateNewsletter(CUSTOMER Customer, List<CAMPAIGN> Campaigns, List<CAMPAIGN> FutureCampaigns) { // Input data will be defined in this XML document. XmlDocument xmlDoc = new XmlDocument(); XmlElement xmlRoot; XmlNode xmlNode, xmlNode2; XmlNode xmlChild, xmlChild2; xmlDoc.LoadXml( "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<Root>" + //"<UserName/>" + //"<Message/>" + "<Campaigns/>" + "<FutureCampaigns/>" + "<UnsubscribeUrl/>" + "</Root>"); // Set the values of the XML nodes that will be used by XSLT. xmlRoot = xmlDoc.DocumentElement; //xmlNode = xmlRoot.SelectSingleNode("/Root/UserName"); //string prefix = (Customer.Gender == "M" ? "I " : "E "); //xmlNode.InnerText = prefix + "dashur " + Customer.Name + " " + Customer.Surname; //xmlNode = xmlRoot.SelectSingleNode("/Root/Message"); //xmlNode.InnerText = Configuration.NewsletterHeaderText; xmlNode = xmlRoot.SelectSingleNode("/Root/Campaigns"); foreach (CAMPAIGN campaign in Campaigns) { xmlChild = xmlDoc.CreateNode(XmlNodeType.Element, "Campaign", null); // title xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Title", null); xmlChild2.InnerText = campaign.BrandName; xmlChild.AppendChild(xmlChild2); // from //xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "From", null); //xmlChild2.InnerText = campaign.StartDate.ToString("dd/MM/yyyy"); //xmlChild.AppendChild(xmlChild2); // to xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "To", null); xmlChild2.InnerText = campaign.EndDate.ToString("dd/MM/yyyy"); xmlChild.AppendChild(xmlChild2); // image xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Image", null); xmlChild2.InnerText = Configuration.DeploymentURL + Configuration.ImagesUploadPath + campaign.ImageHome; xmlChild.AppendChild(xmlChild2); // Url xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Url", null); xmlChild2.InnerText = Configuration.DeploymentURL + "/campaign/" + Encryption.Encrypt(campaign.ID.ToString()); xmlChild.AppendChild(xmlChild2); xmlNode.AppendChild(xmlChild); } if (FutureCampaigns != null && FutureCampaigns.Count > 0) { xmlNode2 = xmlRoot.SelectSingleNode("/Root/FutureCampaigns"); foreach (CAMPAIGN campaign in FutureCampaigns) { xmlChild = xmlDoc.CreateNode(XmlNodeType.Element, "Campaign", null); // title xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Title", null); xmlChild2.InnerText = campaign.BrandName; xmlChild.AppendChild(xmlChild2); // from xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "From", null); xmlChild2.InnerText = campaign.StartDate.ToString("dd/MM/yyyy"); xmlChild.AppendChild(xmlChild2); // to xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "To", null); xmlChild2.InnerText = campaign.EndDate.ToString("dd/MM/yyyy"); xmlChild.AppendChild(xmlChild2); // image xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Image", null); xmlChild2.InnerText = Configuration.DeploymentURL + Configuration.ImagesUploadPath + campaign.ImageHome; xmlChild.AppendChild(xmlChild2); // Url xmlChild2 = xmlDoc.CreateNode(XmlNodeType.Element, "Url", null); xmlChild2.InnerText = Configuration.DeploymentURL; // +"/campaign/" + Encryption.Encrypt(campaign.ID.ToString()); xmlChild.AppendChild(xmlChild2); xmlNode2.AppendChild(xmlChild); } } //xmlNode = xmlRoot.SelectSingleNode("/Root/UnsubscribeUrl"); //xmlNode.InnerText = Configuration.UnsubscribeUrl + Encryption.Encrypt(Customer.ID.ToString()); // This is our XSL template. XslCompiledTransform xslDoc = new XslCompiledTransform(); xslDoc.Load(@Configuration.NewsletterTemplate); XsltArgumentList xslArgs = new XsltArgumentList(); StringWriter writer = new StringWriter(); // Merge XSLT document with data XML document // (writer will hold resulted transformation). xslDoc.Transform(xmlDoc, xslArgs, writer); return writer.ToString(); }
public void DeleteById(int id) { var obj = new CUSTOMER() { ID = id }; Delete(obj); }
private void FixupCUSTOMER(CUSTOMER previousValue) { if (previousValue != null && previousValue.BONUS.Contains(this)) { previousValue.BONUS.Remove(this); } if (CUSTOMER != null) { if (!CUSTOMER.BONUS.Contains(this)) { CUSTOMER.BONUS.Add(this); } if (CustomerID != CUSTOMER.ID) { CustomerID = CUSTOMER.ID; } } else if (!_settingFK) { CustomerID = null; } }
public void ResetPassword(CUSTOMER Customer) { // TODO reset password logic throw new NotImplementedException(); }