protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadConditionData(); try { ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); AgentListPanel.Visible = true; CommonService commonService = serviceLoader.GetCommon(); AgentListDropDownList.DataSource = commonService.GetAgentsList(); AgentListDropDownList.DataValueField = "UserId"; AgentListDropDownList.DataTextField = "UserName"; AgentListDropDownList.DataBind(); AgentListDropDownList.Items.Insert(0, "All Agents"); IList <FarmService.MailingPlanInfo> mailingPlans = farmService.GetMailingPlanList(); MailingPlanDropDownList.DataSource = mailingPlans; MailingPlanDropDownList.DataValueField = "MailingPlanId"; MailingPlanDropDownList.DataTextField = "Title"; MailingPlanDropDownList.DataBind(); } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE LOADIN FARM DATA REPORT CRITERIA:", exception); } } }
protected void Page_Load(object sender, EventArgs e) { try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); //Check for Admin Login if (!IsPostBack) { ReportViewerUserControl1.ReportHeight = 580; ReportViewerUserControl1.ReportWidth = 800; if (IsAgentRole) { AgentListPanel.Visible = false; //Populate Report FarmService.FarmDetailsReportInfo[] details = farmService.ReportForFarmDetails(GetAgentId()); //ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("FarmDetailsReportInfo", details)); ReportViewerUserControl1.DataSource = details; ReportViewerUserControl1.DataSourceName = "FarmDetailsReportInfo"; ReportViewerUserControl1.ReportPath = "Members/Reports/FarmPlotContactListReport.rdlc"; } else { AgentListPanel.Visible = true; CommonService commonService = serviceLoader.GetCommon(); AgentListDropDownList.DataSource = commonService.GetAgentsList(); AgentListDropDownList.DataValueField = "UserId"; AgentListDropDownList.DataTextField = "UserName"; AgentListDropDownList.DataBind(); AgentListDropDownList.Items.Insert(0, "Select an Agent"); } } else { if (!IsAgentRole) { if (AgentListDropDownList.SelectedIndex > 0) { //Populate Report FarmService.FarmDetailsReportInfo[] details = farmService.ReportForFarmDetails(GetAgentId()); //ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("FarmDetailsReportInfo", details)); //ReportViewer1.LocalReport.Refresh(); ReportViewerUserControl1.DataSource = details; ReportViewerUserControl1.DataSourceName = "FarmDetailsReportInfo"; ReportViewerUserControl1.ReportPath = "Members/Reports/FarmPlotContactListReport.rdlc"; } } } } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE LOADING FARM PLOT REPORT:", exception); ErrorLiteral.Text = "UNKNOWN ERROR: Contact Administrator"; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPrinterRole) { CreateFarmButton.Visible = false; ArchivedFarmHyperLink.Visible = false; } if (!Page.IsPostBack) { try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); if (IsAgentRole) { AgentListPanel.Visible = false; FillFarmGrid(0); } else { AgentListPanel.Visible = true; CommonService commonService = serviceLoader.GetCommon(); AgentListDropDownList.DataSource = commonService.GetAgentsList(); AgentListDropDownList.DataValueField = "UserId"; AgentListDropDownList.DataTextField = "UserName"; AgentListDropDownList.DataBind(); AgentListDropDownList.Items.Insert(0, "Select an Agent"); } } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE LOADING FARM MANAGEMENT:", exception); ErrorLiteral.Text = "UNKNOWN ERROR. Contact Administrator"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); if (IsAgentRole) { AgentListDropDownList.Items.Clear(); AgentListDropDownList.Items.Add(new ListItem(LoginUserId.ToString(), LoginUserId.ToString())); AgentListDropDownList.SelectedIndex = 0; AgentListPanel.Visible = false; } else { AgentListPanel.Visible = true; CommonService commonService = serviceLoader.GetCommon(); AgentListDropDownList.DataSource = commonService.GetAgentsList(); AgentListDropDownList.DataValueField = "UserId"; AgentListDropDownList.DataTextField = "UserName"; AgentListDropDownList.DataBind(); AgentListDropDownList.Items.Insert(0, "All Agents"); } FarmStatusDropDownList.Items.Add(new ListItem("Firmed Up", "Firmed Up")); FarmStatusDropDownList.Items.Add(new ListItem("Not Firmed Up", "Not Firmed Up")); } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE LOADING FARM MANAGEMENT:", exception); } } }
protected void Page_Load(object sender, EventArgs e) { // Register the client side script. ClientScriptManager csManager = Page.ClientScript; Type type = this.GetType(); string newLine = Environment.NewLine; if (!csManager.IsClientScriptBlockRegistered(type, "BodyLoadScript")) { StringBuilder csText = new StringBuilder(); csText.Append("<script type=\"text/javascript\">" + newLine); csText.Append("<!--" + newLine); csText.Append("function onBodyLoad() {" + newLine); csText.Append(" var allInputTags = document.getElementsByTagName(\"input\");" + newLine); csText.Append(" var msg = \"\";" + newLine); csText.Append(" var conformation;" + newLine); csText.Append(" for(i = 0; i < allInputTags.length; i++) {" + newLine); csText.Append(" if(allInputTags[i].type == \"hidden\") {" + newLine); csText.Append(" if(allInputTags[i].name.indexOf(\"DeleteMessageHiddenField\") >= 0)" + newLine); csText.Append(" msg = allInputTags[i].value;" + newLine); csText.Append(" else if(allInputTags[i].name.indexOf(\"DeleteConformationHiddenField\") >= 0)" + newLine); csText.Append(" conformation = allInputTags[i];" + newLine); csText.Append(" }" + newLine); csText.Append(" } " + newLine); csText.Append(" if (msg != \"\") {" + newLine); csText.Append(" if (confirm(msg))" + newLine); csText.Append(" conformation.value = \"true\";" + newLine); csText.Append(" else" + newLine); csText.Append(" conformation.value = \"false\";" + newLine); csText.Append(" document.forms[0].submit();" + newLine); csText.Append(" }" + newLine); csText.Append("}" + newLine); csText.Append("document.body.onload = onBodyLoad;" + newLine); csText.Append("// -->" + newLine); csText.Append("</script>"); csManager.RegisterClientScriptBlock(type, "BodyLoadScript", csText.ToString(), false); } if (!IsPostBack) { DeleteMessageHiddenField.Value = ""; DeleteConformationHiddenField.Value = ""; DeleteContactIdHiddenField.Value = ""; try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); SearchCriteriaPane.Visible = true; SearchResultPane.Visible = false; if (IsAgentRole) { AgentListPanel.Visible = false; FarmDropDownList.DataSource = farmService.GetFarmListForUser(GetAgentId()); FarmDropDownList.DataValueField = "FarmId"; FarmDropDownList.DataTextField = "FarmName"; FarmDropDownList.DataBind(); FarmDropDownList.Items.Insert(0, new ListItem("All Farms", "0")); PlotDropDownList.Items.Add(new ListItem("All Plots", "0")); } else { AgentListPanel.Visible = true; SearchCriteriaPane.Visible = false; CommonService commonService = serviceLoader.GetCommon(); AgentListDropDownList.DataSource = commonService.GetAgentsList(); AgentListDropDownList.DataValueField = "UserId"; AgentListDropDownList.DataTextField = "UserName"; AgentListDropDownList.DataBind(); AgentListDropDownList.Items.Insert(0, "Select an Agent"); } ResultCountLiteral.Text = "Search for the Farm Contacts"; if ((Request.QueryString["accessType"] != "") && (Request.QueryString["accessType"] != null) && (Request.QueryString["accessType"] == "old")) { if (Session["SearchFarmDataWhere"] != null) { string where = Session["SearchFarmDataWhere"].ToString(); int pageIndex = 1; if (Session["SearchFarmDataPageIndex"] != null) { pageIndex = int.Parse(Session["SearchFarmDataPageIndex"].ToString()); } FarmService.FarmDetailsReportInfo[] farms = farmService.GetSearchFarmData(where); SearchFarmResultGridView.DataSource = farms; SearchFarmResultGridView.PageIndex = pageIndex; SearchFarmResultGridView.DataBind(); //Disable actions on deleted Contacts for (int i = 0; i < SearchFarmResultGridView.Rows.Count; i++) { if (farms[SearchFarmResultGridView.Rows[i].DataItemIndex].Deleted) { SearchFarmResultGridView.Rows[i].Cells[1].Enabled = false; } } if (IsPrinterRole) { SearchFarmResultGridView.Columns[0].Visible = false; SearchFarmResultGridView.Columns[1].Visible = false; DeleteButton.Visible = false; } SearchCriteriaPane.Visible = false; SearchResultPane.Visible = true; ResultCountLiteral.Text = "Farm data results - " + farms.Length + " Contacts found."; if (!IsAgentRole) { AgentListPanel.Visible = false; if (where.Contains("TBL_FARM.User_Id = ")) { int startPos = where.IndexOf("TBL_FARM.User_Id = ") + "TBL_FARM.User_Id = ".Length; int endPos = where.IndexOf(" AND "); endPos = endPos - startPos; string agentid = where.Substring(startPos, endPos); for (int i = 0; i < AgentListDropDownList.Items.Count; i++) { if (AgentListDropDownList.Items[i].Value.ToString().Equals(agentid)) { AgentListDropDownList.SelectedIndex = i; } } ForAgentLiteral.Text = AgentListDropDownList.SelectedValue + " / " + AgentListDropDownList.SelectedItem.Text; } } MessageLiteral.Text = ""; } } } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE LOADING SEARCH FARM:", exception); ErrorLiteral.Text = "UNKNOWN ERROR: Please Contact Administrator"; } } else { if ((!DeleteMessageHiddenField.Value.ToString().Equals("")) && (DeleteConformationHiddenField.Value.ToString().Equals("true"))) { // List of Contacts to be deleted List <Int64> contactIdList = new List <Int64>(); for (int i = 0; i < SearchFarmResultGridView.Rows.Count; i++) { GridViewRow row = SearchFarmResultGridView.Rows[i]; bool isChecked = ((CheckBox)row.FindControl("SelectContactCheckBox")).Checked; if (isChecked) { Int64 temp = Int64.Parse(((CheckBox)row.FindControl("SelectContactCheckBox")).ToolTip); contactIdList.Add(temp); } } try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); for (int j = 0; j < contactIdList.Count; j++) { farmService.DeleteContact(contactIdList[j], LoginUserId); } MessageLiteral.Text = "Selected Contacts have been Deleted"; int CurrentPageIndex = SearchFarmResultGridView.PageIndex; string where = GenerateSearchCondition(); FarmService.FarmDetailsReportInfo[] farms = farmService.GetSearchFarmData(where); SearchFarmResultGridView.DataSource = farms; SearchFarmResultGridView.PageIndex = CurrentPageIndex; SearchFarmResultGridView.DataBind(); //Disable actions on deleted Contacts for (int k = 0; k < SearchFarmResultGridView.Rows.Count; k++) { if (farms[SearchFarmResultGridView.Rows[k].DataItemIndex].Deleted) { SearchFarmResultGridView.Rows[k].Cells[1].Enabled = false; } } ResultCountLiteral.Text = "Found " + farms.Length + " matching records."; } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE DELECTING CONATACTS:", exception); MessageLiteral.Text = "UNKNOWN ERROR : Please Contact Administrator"; } } DeleteMessageHiddenField.Value = ""; DeleteConformationHiddenField.Value = ""; DeleteContactIdHiddenField.Value = ""; } }
protected void Page_Load(object sender, EventArgs e) { IsArchived = true; if (!Page.IsPostBack) { try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); if (IsAgentRole) { AgentListPanel.Visible = false; FarmService.FarmInfo[] farmList; farmList = farmService.GetArchivedFarmSummary(GetAgentId()); FarmGridView.DataSource = farmList; FarmGridView.DataBind(); if (farmList.Length == 0) { NoFarmDataPanel.Visible = true; } else { NoFarmDataPanel.Visible = false; for (int i = 0; i < FarmGridView.Rows.Count; i++) { if (farmList[i].Deleted == true) { FarmGridView.Rows[i].ForeColor = System.Drawing.Color.Red; } else if (farmList[i].PlotCount == 0) { FarmGridView.Rows[i].ForeColor = System.Drawing.Color.Green; } else { FarmGridView.Rows[i].ForeColor = System.Drawing.Color.DarkKhaki; } if (farmList[i].Deleted == false) { FarmGridView.Rows[i].Cells[0].Enabled = false; } } } } else { AgentListPanel.Visible = true; CommonService commonService = serviceLoader.GetCommon(); AgentListDropDownList.DataSource = commonService.GetAgentsList(); AgentListDropDownList.DataValueField = "UserId"; AgentListDropDownList.DataTextField = "UserName"; AgentListDropDownList.DataBind(); AgentListDropDownList.Items.Insert(0, "Select an Agent"); } } catch (Exception exception) { log.Error("UNKNOWN ERROR:", exception); ErrorLiteral.Text = "UNKNOWN ERROR. Contact Administrator"; } } }