private void BindData() { Affiliate affiliate = AffiliateManager.GetAffiliateById(this.AffiliateId); if (affiliate != null) { this.lblAffiliateId.Text = affiliate.AffiliateId.ToString(); this.hlAffiliateUrl.NavigateUrl = this.hlAffiliateUrl.Text = CommonHelper.ModifyQueryString(CommonHelper.GetStoreLocation() + "default.aspx", "AffiliateID=" + affiliate.AffiliateId.ToString(), null); this.txtFirstName.Text = affiliate.FirstName; this.txtLastName.Text = affiliate.LastName; this.txtMiddleName.Text = affiliate.MiddleName; this.txtPhoneNumber.Text = affiliate.PhoneNumber; this.txtEmail.Text = affiliate.Email; this.txtFaxNumber.Text = affiliate.FaxNumber; this.txtCompany.Text = affiliate.Company; this.txtAddress1.Text = affiliate.Address1; this.txtAddress2.Text = affiliate.Address2; this.txtCity.Text = affiliate.City; this.txtStateProvince.Text = affiliate.StateProvince; this.txtZipPostalCode.Text = affiliate.ZipPostalCode; this.pnlAffiliateId.Visible = true; CommonHelper.SelectListItem(this.ddlCountry, affiliate.CountryId); this.cbActive.Checked = affiliate.Active; } else { this.pnlAffiliateId.Visible = false; this.pnlAffiliateUrl.Visible = false; } }
private void BindData() { Affiliate affiliate = AffiliateManager.GetAffiliateById(this.AffiliateId); if (affiliate != null) { gvAffiliateCustomers.DataSource = CustomerManager.GetAffiliatedCustomers(this.AffiliateId); gvAffiliateCustomers.DataBind(); } else { Response.Redirect("Affiliates.aspx"); } }
public Affiliate SaveInfo() { Affiliate affiliate = AffiliateManager.GetAffiliateById(this.AffiliateId); if (affiliate != null) { affiliate = AffiliateManager.UpdateAffiliate(affiliate.AffiliateId, txtFirstName.Text, txtLastName.Text, txtMiddleName.Text, txtPhoneNumber.Text, txtEmail.Text, txtFaxNumber.Text, txtCompany.Text, txtAddress1.Text, txtAddress2.Text, txtCity.Text, txtStateProvince.Text, txtZipPostalCode.Text, int.Parse(this.ddlCountry.SelectedItem.Value), affiliate.Deleted, cbActive.Checked); } else { affiliate = AffiliateManager.InsertAffiliate(txtFirstName.Text, txtLastName.Text, txtMiddleName.Text, txtPhoneNumber.Text, txtEmail.Text, txtFaxNumber.Text, txtCompany.Text, txtAddress1.Text, txtAddress2.Text, txtCity.Text, txtStateProvince.Text, txtZipPostalCode.Text, int.Parse(this.ddlCountry.SelectedItem.Value), false, cbActive.Checked); } return(affiliate); }
protected void CheckAffiliate() { Affiliate affiliate = AffiliateManager.GetAffiliateById(CommonHelper.QueryStringInt("AffiliateId")); if (affiliate != null && affiliate.Active) { if (NopContext.Current.User == null) { HttpCookie affiliateCookie = HttpContext.Current.Request.Cookies.Get("NopCommerce.AffiliateId"); if (affiliateCookie == null) { affiliateCookie = new HttpCookie("NopCommerce.AffiliateId"); } affiliateCookie.Value = affiliate.AffiliateId.ToString(); affiliateCookie.Expires = DateTime.Now.AddDays(10.0); HttpContext.Current.Response.Cookies.Set(affiliateCookie); } else if (NopContext.Current.User.AffiliateId != affiliate.AffiliateId) { NopContext.Current.User = CustomerManager.SetAffiliate(NopContext.Current.User.CustomerId, affiliate.AffiliateId); } } }