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"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ((HyperLink)CreditCardWebUserControl1.FindControl("HelpHyperLink")).NavigateUrl = "javascript: openHelp('../Help/CvvNumber.htm')"; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.CreditCardInfo creditCardInfo = registrationService.GetCreditCard(loginInfo.UserId); //((CustomValidator)CreditCardWebUserControl1.FindControl("CardNumberTextBoxCustomValidator")).Enabled = false; if (creditCardInfo != null) { ((DropDownList)CreditCardWebUserControl1.FindControl("CardTypeDropDownList")).SelectedValue = creditCardInfo.Type.LookupId.ToString(); ((TextBox)CreditCardWebUserControl1.FindControl("CardNumberTextBox")).Text = creditCardInfo.Number; ((DropDownList)CreditCardWebUserControl1.FindControl("CardMonthDropDownList")).SelectedValue = creditCardInfo.ExpirationMonth.ToString(); ((DropDownList)CreditCardWebUserControl1.FindControl("CardYearDropDownList")).SelectedValue = creditCardInfo.ExpirationYear.ToString(); ((TextBox)CreditCardWebUserControl1.FindControl("CVVNumberTextBox")).Text = creditCardInfo.CvvNumber; ((TextBox)CreditCardWebUserControl1.FindControl("CardHolderNameTextBox")).Text = creditCardInfo.HolderName; ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress1TextBox")).Text = creditCardInfo.Address.Address1; ((TextBox)CreditCardWebUserControl1.FindControl("BillingAddress2TextBox")).Text = creditCardInfo.Address.Address2; ((TextBox)CreditCardWebUserControl1.FindControl("BillingCityTextBox")).Text = creditCardInfo.Address.City; ((DropDownList)CreditCardWebUserControl1.FindControl("BillingCountryDropDownList")).SelectedValue = creditCardInfo.Address.Country.CountryId.ToString(); ((DropDownList)CreditCardWebUserControl1.FindControl("BillingStateDropDownList")).SelectedValue = creditCardInfo.Address.State.StateId.ToString(); ((TextBox)CreditCardWebUserControl1.FindControl("BillingZipTextBox")).Text = creditCardInfo.Address.Zip; } } }
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) { if ((Request.QueryString["plotId"] == "") && (Request.QueryString["plotId"] == null)) { ErrorLiteral.Text = "Improper Parameter."; } else { int plotId = 0; int.TryParse(Request.QueryString["plotId"].ToString(), out plotId); try { ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; String fileName = farmService.ExportContactListToExcel(loginInfo.UserId, plotId); Response.Redirect("~/Members/UserData/" + loginInfo.UserId.ToString() + "/" + fileName); } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE EXPORTING CONTACT LIST:", exception); ErrorLiteral.Text = "Error: Unable to Export Contact List to Excel File"; } } }
protected void SaveButton_Click(object sender, EventArgs e) { RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; int statusId = 0; switch (StatusLabel.Text) { case "Not Uploaded": statusId = (int)DesignStatus.Uploaded; break; case "Uploaded": statusId = (int)DesignStatus.Uploaded; break; case "Submitted": statusId = (int)DesignStatus.Submitted; break; } if (Save(statusId)) { string queryString = "?aId=" + AgentIdHiddenField.Value; Response.Redirect("~/Members/DesignManagement.aspx" + queryString); } else { ResetUploadFilePanels(); } }
protected void CancelEventButton_Click(object sender, EventArgs e) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; int eventId = Convert.ToInt32(IdHiddenField.Value); string notes = NotesTextBox.Text.Trim(); try { ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule(); scheduleService.CancelEvent(eventId, notes, loginInfo.UserId); CancelButton_Click(BackButton, new EventArgs()); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } }
protected void LoginButton_Click(object sender, EventArgs e) { RegistrationService.LoginInfo loginInfo = new RegistrationService.LoginInfo(); string userName; string password; userName = UserNameTextBox.Text; password = PasswordTextBox.Text; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); loginInfo = registrationService.Login(userName, password); if (loginInfo != null) { Session["loginInfo"] = loginInfo; Response.Redirect("~/Members/Welcome.aspx"); } else { ErrorLiteral.Text = "Error: Invalid UserName or Password"; } }
protected void CompleteEventButton_Click(object sender, EventArgs e) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; int eventId = Convert.ToInt32(IdHiddenField.Value); string mailingListFile = string.Empty; string remarks = RemarksTextBox.Text.Trim(); int mailingCount = Convert.ToInt32(MailingCountTextBox.Text); try { // Get the upload location. string path = Server.MapPath("~/Members/MailingLists"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } // Validate mailing list file. if (MailingListFileUpload.HasFile) { if (!(MailingListFileUpload.FileName.ToLower().EndsWith(".xls") || MailingListFileUpload.FileName.ToLower().EndsWith(".csv"))) { ErrorMessageLabel.Text = "Enter a valid Mailing List File (.xls and .csv only)."; ErrorMessageLabel.Visible = true; return; } } // Upload the file. if (MailingListFileUpload.HasFile) { mailingListFile = eventId + "_" + MailingListFileUpload.FileName; MailingListFileUpload.SaveAs(path + "\\" + mailingListFile); } // Save the data. ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule(); scheduleService.CompleteEvent(eventId, mailingListFile, remarks, mailingCount, loginInfo.UserId); CancelButton_Click(BackButton, new EventArgs()); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } }
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 Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; if (loginInfo.Role == RegistrationService.UserRole.Agent) { // Load the agent specific design and brochure details. AgentIdHiddenField.Value = loginInfo.UserId.ToString(); DisplayDesigns(loginInfo.UserId); } else { try { AgentSelectionPanel.Visible = true; // Get the list of agents and display. CommonService.CommonService commonService = serviceLoader.GetCommon(); AgentNameDropDownList.DataSource = commonService.GetAgentsList(); AgentNameDropDownList.DataValueField = "UserId"; AgentNameDropDownList.DataTextField = "UserName"; AgentNameDropDownList.DataBind(); AgentNameDropDownList.Items.Insert(0, new ListItem("<Select an Agent>", "-1")); // Set the design controls. EnableControls(false); // Get the query string values and set the agent id. NameValueCollection coll = Request.QueryString; if (coll.Get("aId") != "" && coll.Get("aId") != null) { AgentNameDropDownList.SelectedValue = coll.Get("aId"); GoButton_Click(AgentNameDropDownList, new EventArgs()); } } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } } } }
protected void Page_Load(object sender, EventArgs e) { ErrorMessageLabel.Visible = false; // Get the query string values. NameValueCollection coll = Request.QueryString; int farmId = Convert.ToInt32(coll.Get("farmId")); DateTime startDate = Convert.ToDateTime(coll.Get("start_date")); if (!IsPostBack) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; // Set the required query string varables into hidden fields. FarmIdHiddenField.Value = farmId.ToString(); StartDateHiddenField.Value = startDate.ToString("MM/dd/yyyy"); try { // Get the farm details and display. FarmService.FarmService farmService = serviceLoader.GetFarm(); FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId); FarmNameLabel.Text = farm.FarmName; PlotCountLabel.Text = farm.PlotCount.ToString(); ContactCountLabel.Text = farm.ContactCount.ToString(); int planId = farm.MailingPlan.MailingPlanId; PlanIdHiddenField.Value = planId.ToString(); MailingPlanLabel.Text = farm.MailingPlan.Title; CreatedOnLabel.Text = farm.CreateDate.ToString("MM/dd/yyyy"); // Get the scheduled events and display. ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule(); IList <ScheduleService.ScheduleEventInfo> events = scheduleService.GetPlanEvents(planId, startDate); EventsDataGrid.DataSource = events; EventsDataGrid.DataBind(); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; 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 int GetAgentId() { RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; int agentId = 0; if (IsAgentRole) { agentId = LoginUserId; } else { AgentListErrorLiteral.Text = ""; int.TryParse(AgentListDropDownList.SelectedValue.ToString(), out agentId); } return(agentId); }
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"; } } }
protected void CheckUniqueEmail(Object source, ServerValidateEventArgs args) { string email = args.Value; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; if (registrationService.IsEmailExists(email, loginInfo.UserId)) { args.IsValid = false; } else { args.IsValid = true; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["loginInfo"] == null || Session["loginInfo"] == "") { if (!(Request.Url.AbsolutePath.ToUpper().Contains("ABOUTUS.ASPX") || Request.Url.AbsolutePath.ToUpper().Contains("CONTACTUS.ASPX") || Request.Url.AbsolutePath.ToUpper().Contains("FEEDBACK.ASPX") || Request.Url.AbsolutePath.ToUpper().Contains("SITEMAP.ASPX"))) { Response.Redirect("../userLogin.aspx?Message=SessionExpired"); } } else { RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; NameLabel.Text = loginInfo.FirstName + " " + loginInfo.LastName; RoleLabel.Text = loginInfo.Role.ToString(); pageDateLabel.Text = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " " + GetTimeZoneText(); } }
protected void FirmUpButton_Click(object sender, EventArgs e) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; // Get the required data. int farmId = Convert.ToInt32(FarmIdHiddenField.Value); int planId = Convert.ToInt32(PlanIdHiddenField.Value); DateTime startDate = Convert.ToDateTime(StartDateHiddenField.Value); int userId = loginInfo.UserId; try { // Save the data. ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule(); scheduleService.FirmUp(farmId, planId, startDate, userId); try { Util.Schedule.SendEmailAsFirmedUp(FarmNameLabel.Text, MailingPlanLabel.Text, startDate, loginInfo.FirstName, loginInfo.LastName, Request.ApplicationPath); } catch (Exception ex) { log.Error("Unknown Error", ex); } string queryString = "?farmId=" + FarmIdHiddenField.Value; Response.Redirect("~/Members/ViewFarm.aspx" + queryString, true); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } }
protected void Page_Load(object sender, EventArgs e) { ErrorMessageLabel.Visible = false; if (!IsPostBack) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; if (loginInfo.Role == RegistrationService.UserRole.Agent) { AgentIdHiddenField.Value = loginInfo.UserId.ToString(); } else { try { AgentSelectionPanel.Visible = true; // Get the list of agents and display. CommonService.CommonService commonService = serviceLoader.GetCommon(); AgentNameDropDownList.DataSource = commonService.GetAgentsList(); AgentNameDropDownList.DataValueField = "UserId"; AgentNameDropDownList.DataTextField = "UserName"; AgentNameDropDownList.DataBind(); AgentNameDropDownList.Items.Insert(0, new ListItem("<Select an Agent>", "-1")); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } } } }
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 Page_Load(object sender, EventArgs e) { ListOfAgentsWebUserControl1.OnSelectChanged += new EventHandler(ListOfAgentsWebUserControl1_OnSelectChanged); if (!IsPostBack) { Session["SelectedMessage"] = null; ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.LoginInfo regInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; ListOfAgentsWebUserControl1.Visible = false; if (regInfo.Role != RegistrationService.UserRole.Agent) { ListOfAgentsWebUserControl1.Visible = true; ListOfAgentsWebUserControl1.FillDropDown(); ListOfAgentsWebUserControl1.SelectedValue = Request.QueryString["userId"].ToString(); AgentLabel.Text = "Selected Agent: " + ListOfAgentsWebUserControl1.SelectedText; Session["SelectedAgentName"] = ListOfAgentsWebUserControl1.SelectedText; AgentLabel.Visible = true; AddMessageButton.Visible = false; } FillMessageDataGrid(); } }
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) { } }
protected void SaveButton_Click(object sender, EventArgs e) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; int eventId = Convert.ToInt32(IdHiddenField.Value); string postalTariff = PostalTariffDropDownList.SelectedValue; string notes = string.Empty; if (NotesReadOnlyPanel.Visible) { notes = NotesLabel.Text.Trim(); } else { notes = NotesTextBox.Text.Trim(); } try { ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule(); scheduleService.UpdatePostalTariff(eventId, postalTariff, notes, loginInfo.UserId); CancelButton_Click(SaveButton, new EventArgs()); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } }
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"); } }
protected void SaveButton_Click(object sender, EventArgs e) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; int farmId = Convert.ToInt32(FarmIdHiddenField.Value); int plotId = Convert.ToInt32(IdHiddenField.Value); int eventId = Convert.ToInt32(EventIdHiddenField.Value); int messageId = Convert.ToInt32(MessageDropDownList.SelectedValue); try { ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule(); if (Convert.ToInt32(PrevMessageIdHiddenField.Value) == 0) { scheduleService.InsertEventEntry(farmId, plotId, eventId, messageId, loginInfo.UserId); } else { scheduleService.UpdateEventEntry(farmId, plotId, eventId, messageId, loginInfo.UserId); } CancelButton_Click(CancelButton, new EventArgs()); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } }
private void FillMessageDataGrid() { try { ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.LoginInfo regInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; MessageService messageService = serviceLoader.GetMessage(); int userId; if (IsAgentRole) { userId = regInfo.UserId; } else { userId = Convert.ToInt32(ListOfAgentsWebUserControl1.SelectedValue); } MessageInfo[] dataSource = messageService.GetCustomMessageList(userId); if (dataSource.Length == 0) { NoRecordsTable.Visible = true; } else { NoRecordsTable.Visible = false; MessageDataGrid.DataSource = dataSource; ViewState["dataSource"] = MessageDataGrid.DataSource; MessageDataGrid.DataBind(); } } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to load the message list."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } }
protected void RejectUserButton_Click(object sender, EventArgs e) { try { int userId = Convert.ToInt32(UserIdHiddenField.Value); ServiceAccess serviceLoader = ServiceAccess.GetInstance(); RegistrationService.RegistrationService registrationService = serviceLoader.GetRegistration(); RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; registrationService.DeleteUser(userId, loginInfo.UserId); SendRejectEmail(); SendRejectEmailCSR(); } catch (Exception ex) { ErrorLiteral.Text = "Error in Rejecting the user"; } string selectedValue = Request.QueryString["selectedCriteria"]; if (ErrorLiteral.Text == "") { Response.Redirect("SearchUsers.aspx" + "?selectedCriteria=" + selectedValue); } }
private bool Save(int statusId) { string approvedDesignRoot = ConfigurationManager.AppSettings["ApprovedDesignRoot"]; // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; // Get the upload location. string path = Server.MapPath("~/Members/UserData/" + AgentIdHiddenField.Value); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (!ValidateFiles()) { return(false); } // Upload the files. string lowResolutionFile = LowResolutionFileHiddenField.Value; string highResolutionFile = HighResolutionFileHiddenField.Value; string additionalFile = AdditionalFileHiddenField.Value; try { Util.Design.UploadFiles(path, ref lowResolutionFile, ref highResolutionFile, ref additionalFile, Convert.ToInt32(IdHiddenField.Value), LowResolutionFileUpload, HighResolutionFileUpload, AdditionalFileUpload, ref RemoveAdditionalFileHiddenField); try { if (statusId == (int)DesignStatus.Approved) { if (StatusLabel.Text == "Submitted") { File.Copy(path + "\\" + lowResolutionFile, approvedDesignRoot + "\\" + lowResolutionFile, true); } } } catch (Exception ex) { log.Error("Unknown Error", ex); } } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); return(false); } // Save the data. try { string[] typeArgs = TypeDropDownList.SelectedValue.Split("|".ToCharArray()); decimal length = 0, width = 0; DesignService.DesignService designService = serviceLoader.GetDesign(); DesignService.DesignInfo design = new DesignService.DesignInfo(); // Design Details. design.DesignId = Convert.ToInt32(IdHiddenField.Value); design.UserId = Convert.ToInt32(AgentIdHiddenField.Value); DesignService.LookupInfo category = new DesignService.LookupInfo(); category.LookupId = (int)DesignCategory.PowerKard; category.Name = DesignCategory.PowerKard.ToString(); design.Category = category; DesignService.LookupInfo type = new DesignService.LookupInfo(); if (typeArgs[0] == DesignType.Standard.ToString().Substring(0, 1)) { type.LookupId = (int)DesignType.Standard; type.Name = DesignType.Standard.ToString(); length = Convert.ToDecimal(typeArgs[1]); width = Convert.ToDecimal(typeArgs[2]); } else { type.LookupId = (int)DesignType.Custom; type.Name = DesignType.Custom.ToString(); length = Convert.ToDecimal(LengthTextBox.Text); width = Convert.ToDecimal(WidthTextBox.Text); } design.Type = type; DesignService.SizeF size = new DesignService.SizeF(); size.Width = (float)length; size.Height = (float)width; design.Size = size; // Attributes. design.Gender = GenderDropDownList.SelectedValue; design.OnDesignName = AgentNameTextBox.Text; design.Justification = (DesignService.JustificationType)Convert.ToInt32(JustificationDropDownList.SelectedValue); design.Gutter = GutterDropDownList.SelectedValue; DesignService.RectangleF messageRectangle = new DesignService.RectangleF(); messageRectangle.X = MessageXTextBox.Text.Trim() != "" ? (float)Convert.ToDecimal(MessageXTextBox.Text.Trim()) : 0; messageRectangle.Y = MessageYTextBox.Text.Trim() != "" ? (float)Convert.ToDecimal(MessageYTextBox.Text.Trim()) : 0; messageRectangle.Width = MessageLengthTextBox.Text.Trim() != "" ? (float)Convert.ToDecimal(MessageLengthTextBox.Text.Trim()) : 0; messageRectangle.Height = MessageWidthTextBox.Text.Trim() != "" ? (float)Convert.ToDecimal(MessageWidthTextBox.Text.Trim()) : 0; design.MessageRectangle = messageRectangle; // Upload Files. design.LowResolutionFile = lowResolutionFile; design.HighResolutionFile = highResolutionFile; design.ExtraFile = additionalFile; // Additional fields. DesignService.LookupInfo status = new DesignService.LookupInfo(); status.LookupId = statusId; design.Status = status; design.LastModifyBy = loginInfo.UserId; design.Comments = NotesTextBox.Text; if (statusId == (int)DesignStatus.Approved) { design.ApproveBy = loginInfo.UserId; } else { design.ApproveBy = 0; } designService.Update(loginInfo.UserId, design); try { if (statusId == (int)DesignStatus.Approved) { if (StatusLabel.Text == "Submitted") { Util.Design.SendEmailAsApproved(design, Request.ApplicationPath, Request.Url.ToString()); } } else if (statusId == (int)DesignStatus.Submitted) { if (design.UserId == design.LastModifyBy) { Util.Design.SendEmailAsSubmitted(design, Request.ApplicationPath, Request.Url.ToString()); } } } catch (Exception ex) { log.Error("Unknown Error", ex); } return(true); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); return(false); } }
protected void Page_Load(object sender, EventArgs e) { // Get the query string values. NameValueCollection coll = Request.QueryString; int id = Convert.ToInt32(coll.Get("id")); string mode = coll.Get("mode"); string type = coll.Get("type"); decimal length = Convert.ToDecimal(coll.Get("length")); decimal width = Convert.ToDecimal(coll.Get("width")); int agentId = Convert.ToInt32(coll.Get("aId")); string agentName = coll.Get("aName"); // Change the title of the page. Page.Title = "Mailing Cycle " + mode + " PowerKard"; PageTitleLabel.Text = mode + " PowerKard"; if (mode == "Edit") { AddPageDescriptionPanel.Visible = false; EditPageDescriptionPanel.Visible = true; } else if (mode == "Review") { AddPageDescriptionPanel.Visible = false; ReviewPageDescriptionPanel.Visible = true; } else if (mode == "View") { AddPageDescriptionPanel.Visible = false; ViewPageDescriptionPanel.Visible = true; } if (agentName != "") { AgentNameLabel.Text = "Agent Name: " + agentName + " "; } ErrorMessageLabel.Visible = false; if (!IsPostBack) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; // Set the required query string varables into hidden fields. IdHiddenField.Value = id.ToString(); ModeHiddenField.Value = mode.ToString(); AgentIdHiddenField.Value = agentId.ToString(); AgentNameHiddenField.Value = agentName; // Set the controls based on the role. if (loginInfo.Role == RegistrationService.UserRole.Agent) { NotesRow.Visible = false; } // Set the design details section. TypeDropDownList.SelectedValue = type + "|" + (type == "S" ? length.ToString("####.####") : "0") + "|" + (type == "S" ? width.ToString("####.####") : "0"); LengthTextBox.Text = length.ToString("####.####"); WidthTextBox.Text = width.ToString("####.####"); if (type != "C") { LengthTextBox.Enabled = false; WidthTextBox.Enabled = false; } // Get the design details, if one exists. if (id != 0) { try { DesignService.DesignService designService = serviceLoader.GetDesign(); DesignService.DesignInfo design = designService.Get(id); // Display Data - Status. AgentIdHiddenField.Value = design.UserId.ToString(); StatusLabel.Text = design.Status.Name; UsedHiddenField.Value = design.Used.ToString(); // Display Data - Attributes. GenderDropDownList.SelectedValue = design.Gender; AgentNameTextBox.Text = design.OnDesignName; JustificationDropDownList.SelectedValue = ((int)design.Justification).ToString(); GutterDropDownList.SelectedValue = design.Gutter; MessageXTextBox.Text = design.MessageRectangle.X.ToString("####.####"); MessageYTextBox.Text = design.MessageRectangle.Y.ToString("####.####"); MessageLengthTextBox.Text = design.MessageRectangle.Width.ToString("####.####"); MessageWidthTextBox.Text = design.MessageRectangle.Height.ToString("####.####"); // Display Data - Upload Files. string path = Server.MapPath("~/Members/UserData/" + AgentIdHiddenField.Value) + "\\"; string lowResolutionFile, highResolutionFile, additionalFile = string.Empty; lowResolutionFile = design.LowResolutionFile; LowResolutionFileHyperLink.Text = lowResolutionFile.Substring(lowResolutionFile.IndexOf("_") + 1); LowResolutionFileHyperLink.NavigateUrl = "~/Members/UserData/" + AgentIdHiddenField.Value + "/" + lowResolutionFile; LowResolutionFileHyperLink.Target = "_blank"; FileInfo file = new FileInfo(path + lowResolutionFile); if (file.Exists) { LowResolutionFileSizeLabel.Text = Convert.ToInt32(file.Length / 1024).ToString() + " KB"; } else { LowResolutionFileSizeLabel.Text = "-"; } LowResolutionFileNotExistsPanel.Style.Value = "position: absolute; visibility: hidden;"; LowResolutionFileExistsPanel.Style.Value = "position: relative; visibility: visible;"; LowResolutionFileRequiredFieldValidator.Enabled = false; LowResolutionFileHiddenField.Value = lowResolutionFile; highResolutionFile = design.HighResolutionFile; HighResolutionFileHyperLink.Text = highResolutionFile.Substring(highResolutionFile.IndexOf("_") + 1); HighResolutionFileHyperLink.NavigateUrl = "~/Members/UserData/" + AgentIdHiddenField.Value + "/" + highResolutionFile; HighResolutionFileHyperLink.Target = "_blank"; file = new FileInfo(path + highResolutionFile); if (file.Exists) { HighResolutionFileSizeLabel.Text = Convert.ToInt32(file.Length / 1024).ToString() + " KB"; } else { HighResolutionFileSizeLabel.Text = "-"; } HighResolutionFileNotExistsPanel.Style.Value = "position: absolute; visibility: hidden;"; HighResolutionFileExistsPanel.Style.Value = "position: relative; visibility: visible;"; HighResolutionFileRequiredFieldValidator.Enabled = false; HighResolutionFileHiddenField.Value = highResolutionFile; if (design.ExtraFile != "") { additionalFile = design.ExtraFile; AdditionalFileHyperLink.Text = additionalFile.Substring(additionalFile.IndexOf("_") + 1); AdditionalFileHyperLink.NavigateUrl = "~/Members/UserData/" + AgentIdHiddenField.Value + "/" + additionalFile; AdditionalFileHyperLink.Target = "_blank"; file = new FileInfo(path + additionalFile); if (file.Exists) { AdditionalFileSizeLabel.Text = Convert.ToInt32(file.Length / 1024).ToString() + " KB"; } else { AdditionalFileSizeLabel.Text = "-"; } AdditionalFileNotExistsPanel.Style.Value = "position: absolute; visibility: hidden;"; AdditionalFileExistsPanel.Style.Value = "position: relative; visibility: visible;"; AdditionalFileHiddenField.Value = additionalFile; } // Display Data - History. HistoryTextBox.Text = design.History; if (mode == "View") { DisableDesignInformation(); NotesTextBox.Enabled = false; AgentButtonsPanel.Visible = false; ReadOnlyButtonsPanel.Visible = true; AgentButtonsHelpPanel.Visible = false; ReadOnlyButtonsHelpPanel.Visible = true; } else if (mode == "Review") { AgentButtonsPanel.Visible = false; ReviewButtonsPanel.Visible = true; MessageLocnManLabel.Visible = true; MessageSizeManLabel.Visible = true; MessageXTextBoxRequiredFieldValidator.Enabled = true; MessageYTextBoxRequiredFieldValidator.Enabled = true; MessageLengthTextBoxRequiredFieldValidator.Enabled = true; MessageWidthTextBoxRequiredFieldValidator.Enabled = true; AgentButtonsHelpPanel.Visible = false; ReviewButtonsHelpPanel.Visible = true; } else if (mode == "Edit") { if (StatusLabel.Text == "Uploaded") { if (loginInfo.Role != RegistrationService.UserRole.Agent) { AgentButtonsPanel.Visible = false; ReadWriteButtonsPanel.Visible = true; AgentButtonsHelpPanel.Visible = false; ReadWriteButtonsHelpPanel.Visible = true; } } else if (StatusLabel.Text == "Submitted") { DisableDesignInformation(); AgentButtonsPanel.Visible = false; ReadWriteButtonsPanel.Visible = true; AgentButtonsHelpPanel.Visible = false; ReadWriteButtonsHelpPanel.Visible = true; } else if (StatusLabel.Text == "Approved") { DisableDesignInformation(); AgentButtonsPanel.Visible = false; DeleteButtonsPanel.Visible = true; AgentButtonsHelpPanel.Visible = false; DeleteButtonsHelpPanel.Visible = true; // Check whether pages already extracted. int index = LowResolutionFileHiddenField.Value.LastIndexOf("."); string approvedDesignPage = ConfigurationManager.AppSettings["ApprovedDesignRoot"] + "\\ExtractedPages\\" + LowResolutionFileHiddenField.Value.Substring(0, index) + "_Page.jpg"; file = new FileInfo(approvedDesignPage); if (file.Exists) { ExtractPagesButton.Enabled = false; } else { ExtractPagesButton.Enabled = true; } } } } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } } if (mode == "Add") { if (loginInfo.Role != RegistrationService.UserRole.Agent) { AgentButtonsPanel.Visible = false; ReadWriteButtonsPanel.Visible = true; AgentButtonsHelpPanel.Visible = false; ReadWriteButtonsHelpPanel.Visible = true; } } } }
protected void DeleteButton_Click(object sender, EventArgs e) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; if (UsedHiddenField.Value == DesignUsed.Never.ToString()) { string approvedDesignRoot = ConfigurationManager.AppSettings["ApprovedDesignRoot"]; // Get the upload location. string path = Server.MapPath("~/Members/UserData/" + AgentIdHiddenField.Value); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } // Delete the files and the record. string lowResolutionFile = LowResolutionFileHiddenField.Value; string highResolutionFile = HighResolutionFileHiddenField.Value; string additionalFile = AdditionalFileHiddenField.Value; try { if (File.Exists(path + "\\" + lowResolutionFile)) { File.Delete(path + "\\" + lowResolutionFile); } // Delete the file from the approved designs location. // ********************************************************************* string approvedDesign = approvedDesignRoot + "\\" + lowResolutionFile; int index = lowResolutionFile.LastIndexOf("."); string approvedDesignPage = approvedDesignRoot + "\\ExtractedPages\\" + lowResolutionFile.Substring(0, index) + "_Page.jpg"; if (File.Exists(approvedDesign)) { File.Delete(approvedDesign); } if (File.Exists(approvedDesignPage)) { File.Delete(approvedDesignPage); } // ********************************************************************* if (File.Exists(path + "\\" + highResolutionFile)) { File.Delete(path + "\\" + highResolutionFile); } if (additionalFile != "") { if (File.Exists(path + "\\" + additionalFile)) { File.Delete(path + "\\" + additionalFile); } } DesignService.DesignService designService = serviceLoader.GetDesign(); int designId = Convert.ToInt32(IdHiddenField.Value); designService.Delete(designId, loginInfo.UserId); string queryString = "?aId=" + AgentIdHiddenField.Value; Response.Redirect("~/Members/DesignManagement.aspx" + queryString); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); ResetUploadFilePanels(); } } else if (UsedHiddenField.Value == DesignUsed.Found.ToString()) { if (Save((int)DesignStatus.Inactivated)) { string queryString = "?aId=" + AgentIdHiddenField.Value; Response.Redirect("~/Members/DesignManagement.aspx" + queryString); } else { ResetUploadFilePanels(); } } }
protected void RejectButton_Click(object sender, EventArgs e) { // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; // Get the upload location. string path = Server.MapPath("~/Members/UserData/" + AgentIdHiddenField.Value); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } // Delete the files and the record. string lowResolutionFile = LowResolutionFileHiddenField.Value; string highResolutionFile = HighResolutionFileHiddenField.Value; string additionalFile = AdditionalFileHiddenField.Value; try { if (IdHiddenField.Value != "0") { if (File.Exists(path + "\\" + lowResolutionFile)) { File.Delete(path + "\\" + lowResolutionFile); } } if (IdHiddenField.Value != "0") { if (File.Exists(path + "\\" + highResolutionFile)) { File.Delete(path + "\\" + highResolutionFile); } } if (IdHiddenField.Value != "0" && additionalFile != "") { if (File.Exists(path + "\\" + additionalFile)) { File.Delete(path + "\\" + additionalFile); } } DesignService.DesignService designService = serviceLoader.GetDesign(); int designId = Convert.ToInt32(IdHiddenField.Value); designService.Delete(designId, loginInfo.UserId); try { Util.Design.SendEmailAsRejected(Convert.ToInt32(AgentIdHiddenField.Value), "PowerKard", NotesTextBox.Text.Trim(), Request.ApplicationPath); } catch (Exception ex) { log.Error("Unknown Error", ex); } string queryString = "?aId=" + AgentIdHiddenField.Value; Response.Redirect("~/Members/DesignManagement.aspx" + queryString); } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); ResetUploadFilePanels(); } }