protected void ForgetPwdStep2Button_Click(object sender, EventArgs e) { registrationInfo = (RegistrationService.RegistrationInfo)ViewState["RegistrationInfo"]; if (SecurityAnswerTextBox.Text == registrationInfo.PasswordAnswer) { PageDescriptionLabel.Text = "Email message has been sent to your email address."; SuccessText.InnerHtml = "An email message with reset password has been sent to " + "the email address you provided during registration.<br /><br />" + "If you do not receive reset password email from us, please check your " + "spam, bulk, or junk mail folders. If you find the email there, your " + "ISP or your own software spam-blocker or filters are diverting our email."; ForgetPwdStep1Panel.Visible = false; ForgetPwdStep2Panel.Visible = false; ForgetPwdStep3Panel.Visible = true; // Generate a new password and save it. string password = Guid.NewGuid().ToString().Substring(0, 8); registrationInfo.Password = password; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); registrationService.UpdatePassword(registrationInfo); // Send email to the user. SendPasswordEmail(); } else { ErrorMessageLabel.Text = "Error: Invalid Secret Answer"; ErrorMessageLabel.Visible = true; } }
protected void InitializeValuesFromSession() { RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"]; UserNameTextBox.Text = registration.UserName; EmailTextBox.Text = registration.Email; ListItem li = SecretQuestionDropDownList.Items.FindByText(registration.PasswordQuestion); if (li == null) { SecretQuestionDropDownList.SelectedValue = "13"; SecretQuestionDropDownList.Items.FindByValue("13").Text = registration.PasswordQuestion; } else { SecretQuestionDropDownList.SelectedValue = li.Value; } SecretAnswerTextBox.Text = registration.PasswordAnswer; FirstNameTextBox.Text = registration.FirstName; MiddleNameTextBox.Text = registration.MiddleName; LastNameTextBox.Text = registration.LastName; CompanyNameTextBox.Text = registration.CompanyName; Address1TextBox.Text = registration.Address.Address1; Address2TextBox.Text = registration.Address.Address2; CityTextBox.Text = registration.Address.City; StateDropDownList.SelectedValue = registration.Address.State.StateId.ToString(); CountryDropDownList.SelectedValue = registration.Address.Country.CountryId.ToString(); ZipTextBox.Text = registration.Address.Zip; PhoneTextBox.Text = registration.Address.Phone; MobileTextBox.Text = registration.Address.Mobile; FaxTextBox.Text = registration.Address.Fax; CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs()); }
protected void InitializeValuesFromSession() { ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo registration = registrationService.GetDetails(loginInfo.UserId); FirstNameTextBox.Text = registration.FirstName; MiddleNameTextBox.Text = registration.MiddleName; LastNameTextBox.Text = registration.LastName; CompanyNameTextBox.Text = registration.CompanyName; Address1TextBox.Text = registration.Address.Address1; Address2TextBox.Text = registration.Address.Address2; CityTextBox.Text = registration.Address.City; StateDropDownList.SelectedValue = registration.Address.State.StateId.ToString(); CountryDropDownList.SelectedValue = registration.Address.Country.CountryId.ToString(); ZipTextBox.Text = registration.Address.Zip; PhoneTextBox.Text = registration.Address.Phone; MobileTextBox.Text = registration.Address.Mobile; FaxTextBox.Text = registration.Address.Fax; EmailTextBox.Text = registration.Email; CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs()); }
protected void Page_Load(object sender, EventArgs e) { CancelButton.Attributes.Add("onClick", "return cancelRegistration()"); if (!Page.IsPostBack) { if (Session["registrationInfo"] != null) { RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"]; UserNameLabel.Text = registration.UserName; Emailabel.Text = registration.Email; RoleLabel.Text = registration.Role.ToString(); FirstNameLabel.Text = registration.FirstName; MiddleNameLabel.Text = registration.MiddleName; LastNameLabel.Text = registration.LastName; CompanyNameLabel.Text = registration.CompanyName; Address1Label.Text = registration.Address.Address1; Address2Label.Text = registration.Address.Address2; CityLabel.Text = registration.Address.City; StateLabel.Text = registration.Address.State.Name; CountryLabel.Text = registration.Address.Country.Name; ZipLabel.Text = registration.Address.Zip; } } }
protected void SaveButton_Click(object sender, EventArgs e) { try { ErrorLiteral.Text = ""; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo registration = registrationService.GetDetails(loginInfo.UserId); if (PasswordTextBox.Text == registration.Password) { registration.PasswordQuestion = SecretQuestionDropDownList.SelectedItem.Text; registration.PasswordAnswer = SecretAnswerTextBox.Text; registrationService.UpdateSecretDetails(registration); } else { ErrorLiteral.Text = "Error: Invalid Password"; } } catch (Exception ex) { } if (ErrorLiteral.Text == "") { MessagesLabel.Text = "Secret details Updated Successfully"; } }
public static bool SendEmailAsRejected(int agentId, string category, string notes, string applicationPath) { try { // Send email to the Agent. RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo agent = registrationService.GetDetails(agentId); string templatePath = AppDomain.CurrentDomain.BaseDirectory + "HTMLTemplate\\Email_DesignRejected_Agent.html"; Hashtable variables = new Hashtable(); variables.Add("FIRST_NAME", agent.FirstName); variables.Add("LAST_NAME", agent.LastName); variables.Add("DESIGN_CATEGORY", category); variables.Add("DESIGN_NOTES", (notes == "" ? "---" : notes)); MailAddressCollection mailAddresses = new MailAddressCollection(); mailAddresses.Add(agent.Email); Mail.Send(templatePath, variables, mailAddresses, "MailingCycle Design Rejected", applicationPath); // Send email to all the Admins. CommonService.CommonService commonService = serviceLoader.GetCommon(); IList <CommonService.RegistrationInfo> users = commonService.GetUsersByRole(CommonService.UserRole.Admin.ToString()); templatePath = AppDomain.CurrentDomain.BaseDirectory + "HTMLTemplate\\Email_DesignRejected_Admin.html"; variables = new Hashtable(); variables.Add("DESIGN_CATEGORY", category); variables.Add("FIRST_NAME", agent.FirstName); variables.Add("LAST_NAME", agent.LastName); variables.Add("DESIGN_NOTES", (notes == "" ? "---" : notes)); mailAddresses = new MailAddressCollection(); foreach (CommonService.RegistrationInfo user in users) { mailAddresses.Add(user.Email); } Mail.Send(templatePath, variables, mailAddresses, "MailingCycle Design Rejected", applicationPath); } catch (Exception ex) { log.Error("Unknown Error", ex); return(false); } return(true); }
protected void InitializeValuesFromSession() { ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); int userId = -1; if (Request.QueryString["UserId"] != "") { userId = Convert.ToInt32(Request.QueryString["UserId"]); } else { Response.Redirect("SearchUsers.aspx"); } UserIdHiddenField.Value = userId.ToString(); RegistrationService.RegistrationInfo registration = registrationService.GetDetails(userId); UserNameTextBox.Text = registration.UserName; foreach (ListItem listItem in RoleDropDownList.Items) { if (listItem.Text == registration.Role.ToString()) { listItem.Selected = true; break; } } StatusTextBox.Text = registration.Status.ToString(); if (StatusTextBox.Text == "ApprovalRequired") { StatusTextBox.Text = "Approval Required"; } FirstNameTextBox.Text = registration.FirstName; MiddleNameTextBox.Text = registration.MiddleName; LastNameTextBox.Text = registration.LastName; CompanyNameTextBox.Text = registration.CompanyName; Address1TextBox.Text = registration.Address.Address1; Address2TextBox.Text = registration.Address.Address2; CityTextBox.Text = registration.Address.City; StateDropDownList.SelectedValue = registration.Address.State.StateId.ToString(); CountryDropDownList.SelectedValue = registration.Address.Country.CountryId.ToString(); ZipTextBox.Text = registration.Address.Zip; PhoneTextBox.Text = registration.Address.Phone; MobileTextBox.Text = registration.Address.Mobile; FaxTextBox.Text = registration.Address.Fax; EmailTextBox.Text = registration.Email; CountryDropDownList_SelectedIndexChanged(CountryDropDownList, new EventArgs()); }
protected void SaveButton_Click(object sender, EventArgs e) { if (Page.IsValid) { try { ErrorLiteral.Text = ""; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo registration = new RegistrationService.RegistrationInfo(); // Get user's personal modified information. RegistrationService.StateInfo state = new RegistrationService.StateInfo(); state.StateId = Convert.ToInt32(StateDropDownList.SelectedValue); state.Name = StateDropDownList.SelectedItem.Text; RegistrationService.CountryInfo country = new RegistrationService.CountryInfo(); country.CountryId = Convert.ToInt32(CountryDropDownList.SelectedValue); country.Name = CountryDropDownList.SelectedItem.Text; RegistrationService.AddressInfo address = new RegistrationService.AddressInfo(); address.Address1 = Address1TextBox.Text; address.Address2 = Address2TextBox.Text; address.City = CityTextBox.Text; address.State = state; address.Zip = ZipTextBox.Text; address.Country = country; address.Phone = PhoneTextBox.Text; address.Fax = FaxTextBox.Text; address.Mobile = MobileTextBox.Text; registration.UserId = loginInfo.UserId; registration.UserName = loginInfo.UserName; registration.FirstName = FirstNameTextBox.Text; registration.MiddleName = MiddleNameTextBox.Text; registration.LastName = LastNameTextBox.Text; registration.CompanyName = CompanyNameTextBox.Text; registration.Address = address; registration.Email = EmailTextBox.Text; registration.Role = loginInfo.Role; registration.Status = loginInfo.Status; registrationService.Update(registration, loginInfo.UserId); } catch (Exception ex) { ErrorLiteral.Text = "Error in Update"; } if (ErrorLiteral.Text == "") { MessagesLabel.Text = "Profile Updated Successfully"; } } }
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 !!! "; } }
private void CaptureValuesIntoSession() { // Get user's personal information. RegistrationService.StateInfo state = new RegistrationService.StateInfo(); state.StateId = Convert.ToInt32(StateDropDownList.SelectedValue); state.Name = StateDropDownList.SelectedItem.Text; RegistrationService.CountryInfo country = new RegistrationService.CountryInfo(); country.CountryId = Convert.ToInt32(CountryDropDownList.SelectedValue); country.Name = CountryDropDownList.SelectedItem.Text; RegistrationService.AddressInfo address = new RegistrationService.AddressInfo(); address.Address1 = Address1TextBox.Text; address.Address2 = Address2TextBox.Text; address.City = CityTextBox.Text; address.State = state; address.Zip = ZipTextBox.Text; address.Country = country; address.Phone = PhoneTextBox.Text; address.Fax = FaxTextBox.Text; address.Mobile = MobileTextBox.Text; RegistrationService.RegistrationInfo registration = new RegistrationService.RegistrationInfo(); registration.UserName = UserNameTextBox.Text; registration.Email = EmailTextBox.Text; registration.Password = PasswordTextBox.Text; if ((SecQuestionHiddenField.Value != "") && (SecretQuestionDropDownList.SelectedValue == "13")) { SecretQuestionDropDownList.SelectedItem.Text = SecQuestionHiddenField.Value; } registration.PasswordQuestion = SecretQuestionDropDownList.SelectedItem.Text; registration.PasswordAnswer = SecretAnswerTextBox.Text; registration.FirstName = FirstNameTextBox.Text; registration.MiddleName = MiddleNameTextBox.Text; registration.LastName = LastNameTextBox.Text; registration.CompanyName = CompanyNameTextBox.Text; registration.Address = address; registration.Status = Irmac.MailingCycle.BLLServiceLoader.Registration.RegistrationStatus.Active; registration.Role = Irmac.MailingCycle.BLLServiceLoader.Registration.UserRole.Agent; if (Session["registrationInfo"] != null) { RegistrationService.RegistrationInfo registrationSession = (RegistrationService.RegistrationInfo)Session["registrationInfo"]; if (registrationSession.CreditCard != null) { registration.CreditCard = registrationSession.CreditCard; } } Session["registrationInfo"] = registration; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Panel1.Visible = true; Panel2.Visible = false; int farmId = 0; if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null)) { int.TryParse(Request.QueryString["farmId"], out farmId); } if (farmId == 0) { Response.Redirect("~/Members/FarmManagement.aspx"); } FarmIdHiddenField.Value = farmId.ToString(); try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); int userId = farmService.GetUserIdForFarm(farmId); UserIdHiddenField.Value = userId.ToString(); if (!IsAgentRole) { ForAgentLiteral.Visible = true; RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo regInfo = regservice.GetDetails(userId); ForAgentLiteral.Text = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " "; ForAgentUserIdHiddenField.Value = userId.ToString(); } else { ForAgentLiteral.Visible = false; } FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId); FarmNameLabel.Text = farm.FarmName; MailingPlanLabel.Text = farm.MailingPlan.Title; CreateDateLabel.Text = farm.CreateDate.ToShortDateString(); FarmContactCountLabel.Text = farm.ContactCount.ToString(); } catch (Exception ex) { log.Error("UNKNOWN ERROR:", ex); } } }
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) { if (!Page.IsPostBack) { Panel1.Visible = true; Panel2.Visible = false; try { // Get the common web service instance. int userId = 0; if ((Request.QueryString["userId"] != "") && (Request.QueryString["userId"] != null)) { int.TryParse(Request.QueryString["userId"], out userId); } if (userId == 0) { Response.Redirect("~/Members/FarmManagement.aspx"); } UserIdHiddenField.Value = userId.ToString(); ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); if (!IsAgentRole) { ForAgentLiteral.Visible = true; RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo regInfo = regservice.GetDetails(userId); ForAgentLiteral.Text = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " "; ForAgentUserIdHiddenField.Value = userId.ToString(); } else { ForAgentLiteral.Visible = false; } IList <FarmService.MailingPlanInfo> mailingPlans = farmService.GetMailingPlanList(); MailingPlanDropDownList.DataSource = mailingPlans; MailingPlanDropDownList.DataValueField = "MailingPlanId"; MailingPlanDropDownList.DataTextField = "Title"; MailingPlanDropDownList.DataBind(); } catch (Exception ex) { log.Error("UNKNOWN ERROR:", ex); } } }
protected void Page_Load(object sender, EventArgs e) { CancelButton.Attributes.Add("onClick", "return cancelRegistration()"); if (!Page.IsPostBack) { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); CommonService.CommonService commonService = serviceLoader.GetCommon(); // Get the Membership fee CommonService.PropertyInfo property = commonService.GetProperty("Membership Fee"); MembershipFeeLabel.Text = property.Value.ToString(); if (Session["registrationInfo"] != null) { RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"]; UserNameLabel.Text = registration.UserName; Emailabel.Text = registration.Email; FirstNameLabel.Text = registration.FirstName; MiddleNameLabel.Text = registration.MiddleName; LastNameLabel.Text = registration.LastName; CompanyNameLabel.Text = registration.CompanyName; Address1Label.Text = registration.Address.Address1; Address2Label.Text = registration.Address.Address2; CityLabel.Text = registration.Address.City; StateLabel.Text = registration.Address.State.Name; CountryLabel.Text = registration.Address.Country.Name; ZipLabel.Text = registration.Address.Zip; CardTypeLabel.Text = registration.CreditCard.Type.Name; CardNumberLabel.Text = registration.CreditCard.Number.Substring(registration.CreditCard.Number.Length - 4).PadLeft(registration.CreditCard.Number.Length, '*'); ExpiryDateLabel.Text = registration.CreditCard.ExpirationMonth + " " + registration.CreditCard.ExpirationYear; DateTime expiryDate = DateTime.Parse(ExpiryDateLabel.Text); ExpiryDateLabel.Text = expiryDate.ToString("y"); CardHolderNameLabel.Text = registration.CreditCard.HolderName; BillingAddress1Label.Text = registration.CreditCard.Address.Address1; BillingAddress2Label.Text = registration.CreditCard.Address.Address2; BillingCityLabel.Text = registration.CreditCard.Address.City; BillingCountryLabel.Text = registration.CreditCard.Address.Country.Name; BillingStateLabel.Text = registration.CreditCard.Address.State.Name; BillingZipLabel.Text = registration.CreditCard.Address.Zip; } } }
protected void SetPermissions(object sender, GridViewRowEventArgs e) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationInfo regInfo = (RegistrationService.RegistrationInfo)e.Row.DataItem; RegistrationService.UserRole userRole = (RegistrationService.UserRole)Convert.ToInt32(RoleDropDownList.SelectedValue); string firstName = FirstNameTextBox.Text; string lastName = LastNameTextBox.Text; string userName = UserNameTextBox.Text; if (e.Row.RowType == DataControlRowType.DataRow) { string rowuserRole = ((Label)e.Row.FindControl("RoleLabel")).Text; string rowuserStatus = ((Label)e.Row.FindControl("StatusLabel")).Text; ((HyperLink)e.Row.FindControl("EditUserHyperLink")).NavigateUrl = "~/Members/ModifyUser.aspx?UserId=" + regInfo.UserId + "&PageName=SearchUsers.aspx" + "&selectedCriteria=" + userRole + "|" + firstName + "|" + lastName + "|" + userName; ((HyperLink)e.Row.FindControl("UserNameHyperLink")).NavigateUrl = "~/Members/ViewUser.aspx?UserId=" + regInfo.UserId + "&PageName=SearchUsers.aspx" + "&selectedCriteria=" + userRole + "|" + firstName + "|" + lastName + "|" + userName; if (loginInfo.Role == RegistrationService.UserRole.CSR) { if (rowuserRole != RegistrationService.UserRole.Agent.ToString()) { ((HyperLink)e.Row.FindControl("EditUserHyperLink")).Enabled = false; ((HyperLink)e.Row.FindControl("UserNameHyperLink")).Enabled = false; } } else if (loginInfo.Role == RegistrationService.UserRole.Printer) { SearchUsersResultGridView.Columns[0].Visible = false; ((HyperLink)e.Row.FindControl("UserNameHyperLink")).Visible = false; ((Label)e.Row.FindControl("UserNameLabel")).Visible = true; } if (rowuserStatus == "ApprovalRequired") { ((Label)e.Row.FindControl("StatusLabel")).Text = "Approval Required"; } } }
private void ApproveRejectUser(RegistrationService.RegistrationStatus status) { try { int userId; ErrorLiteral.Text = ""; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo registration = new RegistrationService.RegistrationInfo(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; userId = Convert.ToInt32(UserIdHiddenField.Value); registrationService.UpdateStatus(userId, status, loginInfo.UserId); } catch (Exception ex) { ErrorLiteral.Text = "Error in Update"; } }
protected void InitializeValuesFromSession() { RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"]; if (registration.CreditCard != null) { ((DropDownList)CreditCardDetails1.FindControl("CardTypeDropDownList")).SelectedValue = registration.CreditCard.Type.LookupId.ToString(); ((TextBox)CreditCardDetails1.FindControl("CardNumberTextBox")).Text = registration.CreditCard.Number; ((DropDownList)CreditCardDetails1.FindControl("CardMonthDropDownList")).SelectedValue = registration.CreditCard.ExpirationMonth.ToString(); ((DropDownList)CreditCardDetails1.FindControl("CardYearDropDownList")).SelectedValue = registration.CreditCard.ExpirationYear.ToString(); ((TextBox)CreditCardDetails1.FindControl("CVVNumberTextBox")).Text = registration.CreditCard.CvvNumber; ((TextBox)CreditCardDetails1.FindControl("CardHolderNameTextBox")).Text = registration.CreditCard.HolderName; ((TextBox)CreditCardDetails1.FindControl("BillingAddress1TextBox")).Text = registration.CreditCard.Address.Address1; ((TextBox)CreditCardDetails1.FindControl("BillingAddress2TextBox")).Text = registration.CreditCard.Address.Address2; ((TextBox)CreditCardDetails1.FindControl("BillingCityTextBox")).Text = registration.CreditCard.Address.City; // ((DropDownList)CreditCardDetails1.FindControl("BillingStateDropDownList")).SelectedValue = registration.CreditCard.Address.State.StateId.ToString(); // ((DropDownList)CreditCardDetails1.FindControl("BillingCountryDropDownList")).SelectedValue = registration.CreditCard.Address.Country.CountryId.ToString(); ((TextBox)CreditCardDetails1.FindControl("BillingZipTextBox")).Text = registration.CreditCard.Address.Zip; } }
protected void SaveButton_Click(object sender, EventArgs e) { try { if (Page.IsValid) { ErrorLiteral.Text = ""; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo registration = registrationService.GetDetails(loginInfo.UserId); if (OldPasswordTextBox.Text == registration.Password) { if (OldPasswordTextBox.Text == NewPasswordTextBox.Text) { ErrorLiteral.Text = "Error: New password cannot be same as Old"; } else { registration.Password = NewPasswordTextBox.Text; registrationService.UpdatePassword(registration); } } else { ErrorLiteral.Text = "Error: Invalid Old Password"; } if (ErrorLiteral.Text == "") { MessagesLabel.Text = "Password Updated Successfully"; } } } catch (Exception ex) { } }
private void CaptureValuesIntoSession() { RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"]; RegistrationService.CreditCardInfo creditCard = new RegistrationService.CreditCardInfo(); RegistrationService.StateInfo billingState = new RegistrationService.StateInfo(); billingState.StateId = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("BillingStateDropDownList")).SelectedValue); billingState.Name = ((DropDownList)CreditCardDetails1.FindControl("BillingStateDropDownList")).SelectedItem.Text; RegistrationService.CountryInfo billingCountry = new RegistrationService.CountryInfo(); billingCountry.CountryId = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("BillingCountryDropDownList")).SelectedValue); billingCountry.Name = ((DropDownList)CreditCardDetails1.FindControl("BillingCountryDropDownList")).SelectedItem.Text; RegistrationService.AddressInfo billingAddress = new RegistrationService.AddressInfo(); billingAddress.Address1 = ((TextBox)CreditCardDetails1.FindControl("BillingAddress1TextBox")).Text; billingAddress.Address2 = ((TextBox)CreditCardDetails1.FindControl("BillingAddress2TextBox")).Text; billingAddress.City = ((TextBox)CreditCardDetails1.FindControl("BillingCityTextBox")).Text; billingAddress.State = billingState; billingAddress.Zip = ((TextBox)CreditCardDetails1.FindControl("BillingZipTextBox")).Text; billingAddress.Country = billingCountry; RegistrationService.LookupInfo creditCardType = new RegistrationService.LookupInfo(); creditCardType.LookupId = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("CardTypeDropDownList")).SelectedValue); creditCardType.Name = ((DropDownList)CreditCardDetails1.FindControl("CardTypeDropDownList")).SelectedItem.Text; creditCard.Type = creditCardType; creditCard.Number = ((TextBox)CreditCardDetails1.FindControl("CardNumberTextBox")).Text; creditCard.CvvNumber = ((TextBox)CreditCardDetails1.FindControl("CVVNumberTextBox")).Text; creditCard.HolderName = ((TextBox)CreditCardDetails1.FindControl("CardHolderNameTextBox")).Text; creditCard.ExpirationMonth = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("CardMonthDropDownList")).SelectedValue); creditCard.ExpirationYear = Convert.ToInt32(((DropDownList)CreditCardDetails1.FindControl("CardYearDropDownList")).SelectedValue); creditCard.Address = billingAddress; registration.CreditCard = creditCard; Session["registrationInfo"] = registration; }
protected void FinishButton_Click(object sender, EventArgs e) { ErrorLiteral.Text = ""; RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"]; int userId = 0; try { // Insert the registration details // Get the service loader ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); userId = registrationService.Insert(registration); } catch (Exception ex) { log.Error("User Registration is not sucessful", ex); ErrorLiteral.Text = "User registration failed"; } if (ErrorLiteral.Text == "") { RegistrationService.LoginInfo loginInfo = new RegistrationService.LoginInfo(); loginInfo.UserId = userId; loginInfo.UserName = registration.UserName; loginInfo.FirstName = registration.FirstName; loginInfo.LastName = registration.LastName; loginInfo.Role = registration.Role; loginInfo.Status = registration.Status; SendRegistrationEmail(registration); Session["registrationInfo"] = null; Response.Redirect("RoleRegistrationThanks.aspx"); } }
private bool IsUserExists(string userName) { bool isValid = false; try { RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); registrationInfo = registrationService.GetUserDetails(userName); if (registrationInfo != null) { ViewState.Add("RegistrationInfo", registrationInfo); isValid = true; } } catch (Exception ex) { log.Error("Unknown Error", ex); } return(isValid); }
protected void InitializeValuesFromSession() { ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); int userId = -1; if (Request.QueryString["UserId"] != "") { userId = Convert.ToInt32(Request.QueryString["UserId"]); } else { Response.Redirect("SearchUsers.aspx"); } UserIdHiddenField.Value = userId.ToString(); RegistrationService.RegistrationInfo registration = registrationService.GetDetails(userId); if (registration.Status == Irmac.MailingCycle.BLLServiceLoader.Registration.RegistrationStatus.ApprovalRequired) { ApproveUserButton.Visible = true; RejectUserButton.Visible = true; //ApprovePanel.Visible = true; } else { //ActivatePanel.Visible = true; if (registration.Status == Irmac.MailingCycle.BLLServiceLoader.Registration.RegistrationStatus.Active) { InactivateUserButton.Visible = true; ActivateSpaceImage.Visible = false; ApproveSpaceImage.Visible = false; RejectSpaceImage.Visible = false; } else { ActivateUserButton.Visible = true; InActivateSpaceImage.Visible = false; ApproveSpaceImage.Visible = false; RejectSpaceImage.Visible = false; } } UserNameLabel.Text = registration.UserName; RoleLabel.Text = registration.Role.ToString(); FirstNameLabel.Text = registration.FirstName; MiddleNameLabel.Text = registration.MiddleName; LastNameLabel.Text = registration.LastName; CompanyNameLabel.Text = registration.CompanyName; Address1Label.Text = registration.Address.Address1; Address2Label.Text = registration.Address.Address2; CityLabel.Text = registration.Address.City; StateLabel.Text = registration.Address.State.Name; CountryLabel.Text = registration.Address.Country.Name; ZipLabel.Text = registration.Address.Zip; PhoneLabel.Text = registration.Address.Phone; MobileLabel.Text = registration.Address.Mobile; FaxLabel.Text = registration.Address.Fax; EmailLabel.Text = registration.Email; StatusLabel.Text = registration.Status.ToString(); if (StatusLabel.Text == "ApprovalRequired") { StatusLabel.Text = "Approval Required"; } }
protected void FinishButton_Click(object sender, EventArgs e) { ErrorLiteral.Text = ""; RegistrationService.RegistrationInfo registration = (RegistrationService.RegistrationInfo)Session["registrationInfo"]; int userId = 0; string folderPath = Request.PhysicalPath.Replace("AgentRegistrationConf.aspx", "Members\\UserData\\"); String username = registration.UserName; registration.UserName = username + ";" + folderPath; OrderService.OrderInfo orderInfo = new OrderService.OrderInfo(); int membershipFee; try { // Get the service loader ServiceAccess serviceLoader = ServiceAccess.GetInstance(); CommonService.CommonService commonService = serviceLoader.GetCommon(); // Get the Membership fee CommonService.PropertyInfo property = commonService.GetProperty("Membership Fee"); membershipFee = Convert.ToInt32(property.Value); // Insert the registration details RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); userId = registrationService.Insert(registration); registration.UserName = username; // Insert the membership details if (registration.Role == Irmac.MailingCycle.BLLServiceLoader.Registration.UserRole.Agent) { try { OrderService.CreditCardInfo creditCard = new OrderService.CreditCardInfo(); OrderService.StateInfo billingState = new OrderService.StateInfo(); billingState.StateId = registration.Address.State.StateId; billingState.Name = registration.Address.State.Name; OrderService.CountryInfo billingCountry = new OrderService.CountryInfo(); billingCountry.CountryId = registration.Address.Country.CountryId; billingCountry.Name = registration.Address.Country.Name; OrderService.AddressInfo billingAddress = new OrderService.AddressInfo(); billingAddress.Address1 = registration.Address.Address1; billingAddress.Address2 = registration.Address.Address2; billingAddress.City = registration.Address.City; billingAddress.State = billingState; billingAddress.Zip = registration.Address.Zip; billingAddress.Country = billingCountry; OrderService.LookupInfo creditCardType = new OrderService.LookupInfo(); creditCardType.LookupId = registration.CreditCard.Type.LookupId; creditCardType.Name = registration.CreditCard.Type.Name; creditCard.Type = creditCardType; creditCard.Number = registration.CreditCard.Number; creditCard.CvvNumber = registration.CreditCard.CvvNumber; creditCard.HolderName = registration.CreditCard.HolderName; creditCard.ExpirationMonth = registration.CreditCard.ExpirationMonth; creditCard.ExpirationYear = registration.CreditCard.ExpirationYear; creditCard.Address = billingAddress; orderInfo.Number = 100; orderInfo.Type = Irmac.MailingCycle.BLLServiceLoader.Order.OrderType.MembershipFee; orderInfo.Date = DateTime.Now; orderInfo.Amount = membershipFee; orderInfo.CreditCard = creditCard; orderInfo.TransactionCode = -1; orderInfo.TransactionMessage = "Dummy Transaction"; orderInfo.Items = null; OrderService.OrderService orderService = serviceLoader.GetOrder(); orderService.Insert(userId, orderInfo, userId); } catch (Exception ex) { log.Error("Transaction is not sucessful", ex); ErrorLiteral.Text = "credit card transaction failed"; } } } catch (Exception ex) { log.Error("User Registration is not sucessful", ex); ErrorLiteral.Text = "User registration failed" + " | " + ex.Message + " | " + ex.StackTrace.ToString(); } if (ErrorLiteral.Text == "") { RegistrationService.LoginInfo loginInfo = new RegistrationService.LoginInfo(); loginInfo.UserId = userId; loginInfo.UserName = registration.UserName; loginInfo.FirstName = registration.FirstName; loginInfo.LastName = registration.LastName; loginInfo.Role = registration.Role; loginInfo.Status = registration.Status; SendRegistrationEmail(registration); Session["registrationInfo"] = null; Session["loginInfo"] = loginInfo; Response.Redirect("AgentRegistrationThanks.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (IsPrinterRole) { DeleteContactButton.Enabled = false; EditContactButton.Enabled = false; } Int64 contactId = 0; if ((Request.QueryString["contactId"] != "") && (Request.QueryString["contactId"] != null)) { Int64.TryParse(Request.QueryString["contactId"], out contactId); } if (contactId == 0) { Response.Redirect("~/Members/FarmManagement.aspx"); } if ((Request.QueryString["parentPage"] != "") && (Request.QueryString["parentPage"] != null)) { ParentPageHiddenField.Value = Request.QueryString["parentPage"]; } else { ParentPageHiddenField.Value = ""; } try { //Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); //Getting Required Data FarmService.ContactInfo contact = farmService.GetContactDetails(contactId); FarmService.PlotInfo plot = farmService.GetPlotDetail(contact.PlotId); FarmService.FarmInfo farm = farmService.GetFarmDetail(plot.FarmId); int contactCount = farmService.GetContactCountForPlot(contact.PlotId); int userId = farmService.GetUserIdForFarm(plot.FarmId); UserIdHiddenField.Value = userId.ToString(); if (!IsAgentRole) { ForAgentLiteral.Visible = true; RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo regInfo = regservice.GetDetails(userId); ForAgentLiteral.Text = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " "; ForAgentUserIdHiddenField.Value = userId.ToString(); } else { ForAgentLiteral.Visible = false; } //Header Details FarmNameLabel.Text = farm.FarmName; PlotNameLabel.Text = plot.PlotName; ContactCountLabel.Text = contactCount.ToString(); ContactCountHiddenField.Value = contactCount.ToString(); if (farmService.IsDefaultPlot(plot.PlotId)) { DefaultPlotFlagHiddenField.Value = "true"; } else { DefaultPlotFlagHiddenField.Value = "false"; } CreatedOnLabel.Text = contact.CreateDate.ToShortDateString(); ModifiedOnLable.Text = contact.LastModifyDate.ToShortDateString(); //Hidden Fields FarmIdHiddenField.Value = farm.FarmId.ToString(); PlotIdHiddenField.Value = plot.PlotId.ToString(); ContactIdHiddenField.Value = contact.ContactId.ToString(); //Contact Details ContactIdLabel.Text = contact.ContactId.ToString(); ScheduleNumberLabel.Text = contact.ScheduleNumber.ToString(); OwnerFullNameLabel.Text = contact.OwnerFullName; LotNumberLabel.Text = contact.Lot.ToString(); BlockLabel.Text = contact.Block; SubdivisionLabel.Text = contact.Subdivision; FilingLabel.Text = contact.Filing; SiteAddressLabel.Text = contact.SiteAddress; BedroomsLabel.Text = contact.Bedrooms.ToString(); FullBathLabel.Text = contact.FullBath.ToString(); ThreeQuarterBathLabel.Text = contact.ThreeQuarterBath.ToString(); HalfBathLabel.Text = contact.HalfBath.ToString(); AcresLabel.Text = contact.Acres.ToString(); ActMktComboLabel.Text = contact.ActMktComb; OwnerFirstNameLabel.Text = contact.OwnerFirstName; OwnerLastNameLabel.Text = contact.OwnerLastName; OwnerAddress1Label.Text = contact.OwnerAddress1; OwnerArrdess2Label.Text = contact.OwnerAddress2; OwnerCityLabel.Text = contact.OwnerCity; OwnerStateLabel.Text = contact.OwnerState; OwnerZipLabel.Text = contact.OwnerZip; OwnerCountryLabel.Text = contact.OwnerCountry; SaleDateLabel.Text = contact.SaleDate.ToShortDateString(); TransAmountLabel.Text = contact.TransAmount.ToString(); } catch (Exception exception) { log.Error("UNKNOWN ERROR:", exception); ErrorLiteral.Text = "UNKNOWN ERROR: Contact Administrator"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int plotId = 100107; //if ((Request.QueryString["plotId"] != "") && (Request.QueryString["plotId"] != null)) // int.TryParse(Request.QueryString["plotId"], out plotId); //if (plotId == 0) // Response.Redirect("~/Members/FarmManagement.aspx"); PlotIdHiddenField.Value = plotId.ToString(); try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); int userId = farmService.GetUserIdForPlot(plotId); UserIdHiddenField.Value = userId.ToString(); if (!IsAgentRole) { ForAgentLiteral.Visible = true; RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo regInfo = regservice.GetDetails(userId); ForAgentLiteral.Text = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " "; ForAgentUserIdHiddenField.Value = userId.ToString(); } else { ForAgentLiteral.Visible = false; } FarmService.PlotInfo plot = farmService.GetPlotDetail(plotId); FarmIdHiddenField.Value = plot.FarmId.ToString(); ContactListGridView.DataSource = plot.Contacts; ContactListGridView.DataBind(); //Block Edit Course for the Printer /* * if (IsPrinterRole) * { * ContactListGridView.Columns.RemoveAt(0); * ContactListGridView.Columns.RemoveAt(1); * * for (int i = 0; i < plot.Contacts.Length; i++) * { * ContactListGridView.Rows[i].Cells[0].FindControl("EditContactHyperLink").Visible = false; * ContactListGridView.Rows[i].Cells[0].FindControl("ContactIdCheckBox").Visible = false; * } * } */ } catch (Exception exception) { log.Error("UNKNOWN ERROR:", exception); } } }
public static bool SendEmailAsSubmitted(DesignService.DesignInfo design, string applicationPath, string url) { try { RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo agent = registrationService.GetDetails(design.UserId); // Send email to all the Printers. CommonService.CommonService commonService = serviceLoader.GetCommon(); IList <CommonService.RegistrationInfo> users = commonService.GetUsersByRole(CommonService.UserRole.Printer.ToString()); string templatePath = AppDomain.CurrentDomain.BaseDirectory + "HTMLTemplate\\Email_DesignSubmitted.html"; Hashtable variables = new Hashtable(); variables.Add("ROLE", CommonService.UserRole.Printer.ToString()); variables.Add("DESIGN_CATEGORY", design.Category.Name); variables.Add("FIRST_NAME", agent.FirstName); variables.Add("LAST_NAME", agent.LastName); variables.Add("DESIGN_INFO", BuildInformation(design, agent.UserId, url)); MailAddressCollection mailAddresses = new MailAddressCollection(); foreach (CommonService.RegistrationInfo user in users) { mailAddresses.Add(user.Email); } Mail.Send(templatePath, variables, mailAddresses, "MailingCycle Design Submitted for Approval", applicationPath); // Send email to all the Admins. users = commonService.GetUsersByRole(CommonService.UserRole.Admin.ToString()); templatePath = AppDomain.CurrentDomain.BaseDirectory + "HTMLTemplate\\Email_DesignSubmitted.html"; variables = new Hashtable(); variables.Add("ROLE", "Administrator"); variables.Add("DESIGN_CATEGORY", design.Category.Name); variables.Add("FIRST_NAME", agent.FirstName); variables.Add("LAST_NAME", agent.LastName); variables.Add("DESIGN_INFO", BuildInformation(design, agent.UserId, url)); mailAddresses = new MailAddressCollection(); foreach (CommonService.RegistrationInfo user in users) { mailAddresses.Add(user.Email); } Mail.Send(templatePath, variables, mailAddresses, "MailingCycle Design Submitted for Approval", applicationPath); } catch (Exception ex) { log.Error("Unknown Error", ex); return(false); } return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (IsPrinterRole) { MoveToButton.Enabled = false; DeleteContactButton.Enabled = false; DeletePlotButton.Enabled = false; AddContactButton.Enabled = false; EditPlotButton.Enabled = false; } int plotId = 0; if ((Request.QueryString["plotId"] != "") && (Request.QueryString["plotId"] != null)) { int.TryParse(Request.QueryString["plotId"], out plotId); } if (plotId == 0) { Response.Redirect("~/Members/FarmManagement.aspx"); } ExportToExcelButton.CausesValidation = false; ExportToExcelButton.OnClientClick = "javascript: window.open('./ExcelOrCsvFileDownload.aspx?plotId=" + plotId.ToString() + "');"; PlotIdHiddenField.Value = plotId.ToString(); try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); int userId = farmService.GetUserIdForPlot(plotId); UserIdHiddenField.Value = userId.ToString(); if (!IsAgentRole) { ForAgentLiteral.Visible = true; RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo regInfo = regservice.GetDetails(userId); ForAgentLiteral.Text = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " "; ForAgentUserIdHiddenField.Value = userId.ToString(); } else { ForAgentLiteral.Visible = false; } FarmService.PlotInfo plot = farmService.GetPlotDetail(plotId); PlotNameLabel.Text = plot.PlotName; ContactCountLabel.Text = plot.ContactCount.ToString(); CreateDateLabel.Text = plot.CreateDate.ToShortDateString(); FarmIdHiddenField.Value = plot.FarmId.ToString(); ContactListGridView.DataSource = plot.Contacts; ContactListGridView.DataBind(); //Default Plot flag for validation in Javascript if (farmService.IsDefaultPlot(plotId)) { DefaultPlotFlagHiddenField.Value = "true"; } else { DefaultPlotFlagHiddenField.Value = "false"; } //Validation related Data stored in Hidden Field if (farmService.IsDefaultPlot(plot.PlotId)) { DefaultContactHiddenField.Value = "true"; MoveToButton.Enabled = true; //Move to for single contact in a default plot disabled /*if (plot.Contacts.Length < 2) * MoveToButton.Enabled = false; * else * MoveToButton.Enabled = true;*/ } else { DefaultContactHiddenField.Value = "false"; MoveToButton.Enabled = true; } ContactCountHiddenField.Value = plot.Contacts.Length.ToString(); //For Single Contact in Default Plot if (IsPrinterRole) { for (int i = 0; i < plot.Contacts.Length; i++) { ContactListGridView.Rows[i].Cells[0].FindControl("EditContactHyperLink").Visible = false; ContactListGridView.Rows[i].Cells[0].FindControl("ContactIdCheckBox").Visible = false; } } } catch (Exception exception) { log.Error("UNKNOWN ERROR:", exception); } } }
protected void SaveButton_Click(object sender, EventArgs e) { if (Page.IsValid) { try { ErrorLiteral.Text = ""; if (StatusTextBox.Text == "Approval Required") { StatusTextBox.Text = "ApprovalRequired"; } ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo registration = new RegistrationService.RegistrationInfo(); // Get user's personal modified information. RegistrationService.StateInfo state = new RegistrationService.StateInfo(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; state.StateId = Convert.ToInt32(StateDropDownList.SelectedValue); state.Name = StateDropDownList.SelectedItem.Text; RegistrationService.CountryInfo country = new RegistrationService.CountryInfo(); country.CountryId = Convert.ToInt32(CountryDropDownList.SelectedValue); country.Name = CountryDropDownList.SelectedItem.Text; RegistrationService.AddressInfo address = new RegistrationService.AddressInfo(); address.Address1 = Address1TextBox.Text; address.Address2 = Address2TextBox.Text; address.City = CityTextBox.Text; address.State = state; address.Zip = ZipTextBox.Text; address.Country = country; address.Phone = PhoneTextBox.Text; address.Fax = FaxTextBox.Text; address.Mobile = MobileTextBox.Text; registration.UserId = Convert.ToInt32(UserIdHiddenField.Value); registration.UserName = UserNameTextBox.Text; registration.FirstName = FirstNameTextBox.Text; registration.MiddleName = MiddleNameTextBox.Text; registration.LastName = LastNameTextBox.Text; registration.CompanyName = CompanyNameTextBox.Text; registration.Address = address; registration.Email = EmailTextBox.Text; registration.Role = (Irmac.MailingCycle.BLLServiceLoader.Registration.UserRole)Enum.Parse(typeof(Irmac.MailingCycle.BLLServiceLoader.Registration.UserRole), RoleDropDownList.SelectedValue, true); registration.Status = (Irmac.MailingCycle.BLLServiceLoader.Registration.RegistrationStatus)Enum.Parse(typeof(Irmac.MailingCycle.BLLServiceLoader.Registration.RegistrationStatus), StatusTextBox.Text, true); registrationService.Update(registration, loginInfo.UserId); } catch (Exception ex) { ErrorLiteral.Text = "Error in Update"; } if (ErrorLiteral.Text == "") { RedirectPage(Request.QueryString["PageName"]); } } }
protected void GetCreditCardDetails(ref RegistrationService.RegistrationInfo regInfo) { // regInfo.CreditCard = 1; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (IsPrinterRole) { DeleteFarmButton.Enabled = false; EditFarmButton.Enabled = false; FirmUpButton.Enabled = false; CreatePlotButton.Enabled = false; } int farmId = 0; if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null)) { int.TryParse(Request.QueryString["farmId"], out farmId); } if (farmId == 0) { Response.Redirect("~/Members/FarmManagement.aspx"); } FarmIdHiddenField.Value = farmId.ToString(); try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); int userId = farmService.GetUserIdForFarm(farmId); UserIdHiddenField.Value = userId.ToString(); if (!IsAgentRole) { ForAgentLiteral.Visible = true; RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo regInfo = regservice.GetDetails(userId); ForAgentLiteral.Text = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " "; ForAgentUserIdHiddenField.Value = userId.ToString(); } else { ForAgentLiteral.Visible = false; } FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId); FarmNameLabel.Text = farm.FarmName; MailingPlanLabel.Text = farm.MailingPlan.Title; CreateDateLabel.Text = farm.CreateDate.ToShortDateString(); if (farm.Firmup) { FirmupStatusLabel.Text = "Firmed Up"; } else { FirmupStatusLabel.Text = "Not Firmed Up"; } FarmContactCountLabel.Text = farm.ContactCount.ToString(); PlotCountLabel.Text = farm.PlotCount.ToString(); FillPlotGrid(farm.Plots, 0); // ***************** Firm Up ***************** \\ if (IsAgentRole) { // Set the firm up button visible to agent. FirmUpButtonPanel.Visible = true; // Get the mailing plan of the farm. int mailingPlanId = farm.MailingPlan.MailingPlanId; // Get the design details of the agent. DesignService.DesignService designService = serviceLoader.GetDesign(); DesignService.DesignInfo design = new DesignService.DesignInfo(); DesignService.DesignInfo brochure = new DesignService.DesignInfo(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; IList <DesignService.DesignInfo> designs = designService.GetList(loginInfo.UserId); foreach (DesignService.DesignInfo designInfo in designs) { if (designInfo.Category.Name == "PowerKard") { design = designInfo; } else { brochure = designInfo; } } // Get the credit card details of the logged in agent. RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.CreditCardInfo creditCard = registrationService.GetCreditCard(loginInfo.UserId); bool isCreditCardValid = false; if (creditCard != null) { DateTime expirationDate = new DateTime(creditCard.ExpirationYear, creditCard.ExpirationMonth, 1); expirationDate = expirationDate.AddMonths(1); if (expirationDate > DateTime.Today) { isCreditCardValid = true; } } // Check whether the farm is ready for firm up. if (mailingPlanId == 0) { FirmUpStatusHiddenField.Value = "MP_REQ"; } else if (mailingPlanId == 100003) { // 8 x 8. if (design.Status.Name != "Approved") { FirmUpStatusHiddenField.Value = "DESIGN_REQ"; } } else { if (design.Status.Name != "Approved" || brochure.Status.Name != "Approved") { FirmUpStatusHiddenField.Value = "DESIGN_REQ"; } } if (!isCreditCardValid) { FirmUpStatusHiddenField.Value = "CC_INVALID"; } if (farm.Firmup) { FirmUpButton.Enabled = false; } } // ******************************************* \\ } catch (Exception ex) { log.Error("UNKNOWN ERROR:", ex); ErrorLiteral.Text = "Unknown Error Please contact Administrator:"; } } }