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; 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); } } } }
protected void Page_Load(object sender, EventArgs e) { ErrorMessageLabel.Visible = false; ScheduleService.PlanType planType = ScheduleService.PlanType.Active; int pageNumber = 0; int agentId = 0; // Get the logged in account information. RegistrationService.LoginInfo loginInfo = (RegistrationService.LoginInfo)Session["loginInfo"]; if (loginInfo.Role == RegistrationService.UserRole.Agent) { agentId = loginInfo.UserId; } if (!IsPostBack) { // Get the query string values. NameValueCollection coll = Request.QueryString; if (coll.Get("ptype") != "" && coll.Get("ptype") != null) { planType = (ScheduleService.PlanType)Convert.ToInt32(coll.Get("ptype")); } if (coll.Get("pg") != "" && coll.Get("pg") != null) { pageNumber = Convert.ToInt32(coll.Get("pg")); } if (coll.Get("aId") != "" && coll.Get("aId") != null) { agentId = Convert.ToInt32(coll.Get("aId")); } if (loginInfo.Role != RegistrationService.UserRole.Agent) { 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")); // Get the query string values and set the agent id. if (agentId != 0) { AgentNameDropDownList.SelectedValue = agentId.ToString(); AgentNameHiddenField.Value = AgentNameDropDownList.SelectedItem.Text; } } catch (Exception ex) { ErrorMessageLabel.Text = "Unable to process the request. Please contact your administrator."; ErrorMessageLabel.Visible = true; log.Error("Unknown Error", ex); } } } else { planType = (ScheduleService.PlanType)Convert.ToInt32(PlanTypeHiddenField.Value); pageNumber = Convert.ToInt32(PageNumberHiddenField.Value); if (AgentSelectionPanel.Visible == true) { agentId = Convert.ToInt32(AgentNameDropDownList.SelectedValue); AgentNameHiddenField.Value = AgentNameDropDownList.SelectedItem.Text; } else { agentId = Convert.ToInt32(AgentIdHiddenField.Value); } } // Set the required query string values in hidden fields. PlanTypeHiddenField.Value = Convert.ToInt32(planType).ToString(); PageNumberHiddenField.Value = pageNumber.ToString(); AgentIdHiddenField.Value = agentId.ToString(); // Set the screen elements based on the type of plans that are displayed. string queryString = "?aId=" + agentId.ToString() + "&ptype=" + (planType == ScheduleService.PlanType.Active ? Convert.ToInt32(ScheduleService.PlanType.Completed) : Convert.ToInt32(ScheduleService.PlanType.Active)) + "&pg=0"; if (planType == ScheduleService.PlanType.Active) { SetHyperLink(ActivePlansHyperLink, ""); LegendTitleLabel.Text = "List of Active Mailing Plans"; SetHyperLink(CompletedPlansHyperLink, "~/Members/ScheduleManagement.aspx" + queryString); } else { SetHyperLink(CompletedPlansHyperLink, ""); LegendTitleLabel.Text = "List of Completed Mailing Plans"; SetHyperLink(ActivePlansHyperLink, "~/Members/ScheduleManagement.aspx" + queryString); } // Load the agent specific schedule details. DisplayMailingPlans(agentId, planType); }