protected void Page_Load(object sender, EventArgs e) { ErrorMessageLabel.Visible = false; if (!IsPostBack) { // Populate data into dropdown lists. try { CommonService.CommonService commonService = serviceLoader.GetCommon(); // Agents. AgentDropDownList.DataSource = commonService.GetAgentsList(); AgentDropDownList.DataValueField = "UserId"; AgentDropDownList.DataTextField = "UserName"; AgentDropDownList.DataBind(); AgentDropDownList.Items.Insert(0, new ListItem("<All Agents>", "0")); // Categories. CategoryDropDownList.DataSource = commonService.GetLookups("Design Category"); CategoryDropDownList.DataValueField = "LookupId"; CategoryDropDownList.DataTextField = "Name"; CategoryDropDownList.DataBind(); CategoryDropDownList.Items[0].Text = "<All Categories>"; // Statuses. StatusDropDownList.DataSource = commonService.GetLookups("Design Status"); StatusDropDownList.DataValueField = "LookupId"; StatusDropDownList.DataTextField = "Name"; StatusDropDownList.DataBind(); StatusDropDownList.Items[0].Text = "<All Statuses>"; } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } } }
protected void SendRegistrationEmail(RegistrationService.RegistrationInfo registration) { bool IsDevelopmentPC = true; string URLAddress = ""; try { URLAddress = CommonEvents.GetDynamicPath(Request); ///Creating HTML MAil from HTML Template Hashtable templateVars = new Hashtable(); String emailTemplateFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\HTMLTemplate\\Email_CreateAccount.html"; templateVars.Add("FIRST_NAME", registration.FirstName); templateVars.Add("LAST_NAME", registration.LastName); templateVars.Add("USER_NAME", registration.UserName); templateVars.Add("PASSWORD", registration.Password); templateVars.Add("URL", URLAddress); templateVars.Add("IMAGE_PATH", AppDomain.CurrentDomain.BaseDirectory); Parser parser = new Parser(emailTemplateFilePath, templateVars); ServiceAccess serviceLoader = ServiceAccess.GetInstance(); CommonService.CommonService cs = serviceLoader.GetCommon(); IList <CommonService.LookupInfo> info = cs.GetLookups("FeedBackEmailTo"); string toAddress = info[1].Name; //Creating Mail Message Body MailMessage mailmsg = new MailMessage(); mailmsg.To.Add(registration.Email); mailmsg.Bcc.Add("*****@*****.**"); mailmsg.From = new MailAddress("*****@*****.**"); mailmsg.Subject = "MailingCycle Registration Confirmation"; mailmsg.IsBodyHtml = true; mailmsg.Body = parser.Parse(); mailmsg.Priority = MailPriority.Normal; Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath); MailSettingsSectionGroup mailSettings = config.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup; if (mailSettings != null) { int port = mailSettings.Smtp.Network.Port; string host = mailSettings.Smtp.Network.Host; string password = mailSettings.Smtp.Network.Password; string username = mailSettings.Smtp.Network.UserName; SmtpClient smtpclient = new SmtpClient(host, 587); smtpclient.Credentials = new NetworkCredential(username, password); smtpclient.EnableSsl = true; smtpclient.Send(mailmsg); } } catch (Exception ex) { log.Error("User Registration Email Sending Failed", ex); ErrorLiteral.Text = "User registration Successful. But Confirmation email could not be sent !!! "; } }
protected void Page_Load(object sender, EventArgs e) { Util.Validations.RegisterZipScriptBlock(Page.ClientScript, this.GetType(), CountryDropDownList.ClientID); //testpath.Text = Request.PhysicalPath.Replace("AgentRegistration.aspx","Members"); if (!Page.IsPostBack) { try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); CommonService.CommonService commonService = serviceLoader.GetCommon(); // Get the list of contries and populate. IList <CommonService.CountryInfo> countries = commonService.GetCountries(); CountryDropDownList.DataSource = countries; CountryDropDownList.DataValueField = "CountryId"; CountryDropDownList.DataTextField = "Name"; CountryDropDownList.DataBind(); CountryDropDownList.Items.FindByText("United States").Selected = true; CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs()); // Get the list of secret questions and populate. IList <CommonService.LookupInfo> secretQuestions = commonService.GetLookups("Secret Question"); SecretQuestionDropDownList.DataSource = secretQuestions; SecretQuestionDropDownList.DataValueField = "LookupId"; SecretQuestionDropDownList.DataTextField = "Name"; SecretQuestionDropDownList.DataBind(); // SecretQuestionDropDownList.Items.Add(new ListItem(" ","100")); SecretQuestionDropDownList.Attributes.Add("onChange", "javascript: newQuestion(this);"); } catch (Exception ex) { log.Error("UNKNOWN ERROR:", ex); ErrorLiteral.Text = "An unknown error occurred. Please try again. If the problem persists, please contact your system administrator."; } if (Session["registrationInfo"] != null) { InitializeValuesFromSession(); } } else { if ((SecQuestionHiddenField.Value != "") && (SecretQuestionDropDownList.SelectedValue == "13")) { SecretQuestionDropDownList.SelectedItem.Text = SecQuestionHiddenField.Value; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); CommonService.CommonService commonService = serviceLoader.GetCommon(); // Get the list of secret questions and populate. IList <CommonService.LookupInfo> secretQuestions = commonService.GetLookups("Secret Question"); SecretQuestionDropDownList.DataSource = secretQuestions; SecretQuestionDropDownList.DataValueField = "LookupId"; SecretQuestionDropDownList.DataTextField = "Name"; SecretQuestionDropDownList.DataBind(); //SecretQuestionDropDownList.Items.Add(new ListItem(" ", "100")); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); registration = registrationService.GetDetails(loginInfo.UserId); ListItem questionItem = new ListItem(); questionItem = SecretQuestionDropDownList.Items.FindByText(registration.PasswordQuestion); if (questionItem == null) { //SecretQuestionDropDownList.SelectedValue = "13"; //SecretQuestionDropDownList.Items.FindByValue("13").Text = registration.PasswordQuestion; } else { //SecretQuestionDropDownList.SelectedValue = questionItem.Value; //SecretAnswerTextBox.Text = registration.PasswordAnswer; SecretQuestionDropDownList.Attributes.Add("onChange", "javascript: newQuestion(this);"); } } else { if ((SecQuestionHiddenField.Value != "") && (SecretQuestionDropDownList.SelectedValue == "13")) { SecretQuestionDropDownList.SelectedItem.Text = SecQuestionHiddenField.Value; } } }
protected void Page_Load(object sender, EventArgs e) { Util.Validations.RegisterZipScriptBlock(Page.ClientScript, this.GetType(), BillingCountryDropDownList.ClientID); if (!Page.IsPostBack) { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); CommonService.CommonService commonService = serviceLoader.GetCommon(); // Get the list of Card Types and populate. IList <CommonService.LookupInfo> cardTypes = commonService.GetLookups("Credit Card Type"); CardTypeDropDownList.DataSource = cardTypes; CardTypeDropDownList.DataValueField = "LookupId"; CardTypeDropDownList.DataTextField = "Name"; CardTypeDropDownList.DataBind(); //Credit Card Expiry Year List int currentYear = DateTime.Now.Year; List <int> avlYears = new List <int>(); for (int i = currentYear; i <= (currentYear + 20); i++) { avlYears.Add(i); } CardYearDropDownList.DataSource = avlYears; CardYearDropDownList.DataBind(); //Get country List for Billing Address IList <CommonService.CountryInfo> countries = commonService.GetCountries(); BillingCountryDropDownList.DataSource = countries; BillingCountryDropDownList.DataValueField = "CountryId"; BillingCountryDropDownList.DataTextField = "Name"; BillingCountryDropDownList.DataBind(); //BillingCountryDropDownList.Items.FindByText("United States").Selected = true; BillingCountryDropDownList_SelectedIndexChanged(BillingCountryDropDownList, new EventArgs()); } }