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) { 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(); FarmService.ContactInfo contact = farmService.GetContactDetails(contactId); int userId = farmService.GetUserIdForPlot(contact.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; } ContactIdLabel.Text = contact.ContactId.ToString(); ScheduleNumberTextBox.Text = contact.ScheduleNumber.ToString(); OwnerFullNameTextBox.Text = contact.OwnerFullName; LotTextBox.Text = contact.Lot.ToString(); BlockTextBox.Text = contact.Block; SubDivisionTextBox.Text = contact.Subdivision; FilingTextBox.Text = contact.Filing; SiteAddressTextBox.Text = contact.SiteAddress; BedroomsTextBox.Text = contact.Bedrooms.ToString(); FullBathTextBox.Text = contact.FullBath.ToString(); ThreeQuarterBathTextBox.Text = contact.ThreeQuarterBath.ToString(); HalfBathTextBox.Text = contact.HalfBath.ToString(); AcresTextBox.Text = contact.Acres.ToString(); ActMktCombTextBox.Text = contact.ActMktComb; OwnerFirstNameTextBox.Text = contact.OwnerFirstName; OwnerLastNameTextBox.Text = contact.OwnerLastName; OwnerAddress1TextBox.Text = contact.OwnerAddress1; OwnerAddress2TextBox.Text = contact.OwnerAddress2; OwnerCityTextBox.Text = contact.OwnerCity; OwnerStateTextBox.Text = contact.OwnerState; OwnerZipTextBox.Text = contact.OwnerZip; OwnerCountryTextBox.Text = contact.OwnerCountry; SaleDateTextBox.Text = contact.SaleDate.ToShortDateString(); TransAmountTextBox.Text = contact.TransAmount.ToString(); PlotIdHiddenField.Value = contact.PlotId.ToString(); FarmService.PlotInfo plot = farmService.GetPlotDetail(Convert.ToInt32(PlotIdHiddenField.Value)); PlotNameLabel.Text = plot.PlotName; ContactCountLabel.Text = plot.ContactCount.ToString(); CreateDateLabel.Text = plot.CreateDate.ToShortDateString(); } catch (Exception exception) { log.Error("UNKNOWN ERROR:", exception); } } }