protected void PlotListGridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); int farmId = Convert.ToInt32(FarmIdHiddenField.Value); FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId); FillPlotGrid(farm.Plots, e.NewPageIndex); }
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 (!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 Farm_Changed(object sender, EventArgs e) { // Populate plots into dropdown list. try { int farmId = Convert.ToInt32(FarmDropDownList.SelectedValue); FarmService.FarmService farmService = serviceLoader.GetFarm(); PlotDropDownList.DataSource = farmService.GetFarmDetail(farmId).Plots; PlotDropDownList.DataValueField = "PlotId"; PlotDropDownList.DataTextField = "PlotName"; PlotDropDownList.DataBind(); PlotDropDownList.Items.Insert(0, new ListItem("<All Plots>", "0")); } 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) { 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) { 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:"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int farmId = 0; int plotId = 0; string contactIdsFromGET = ""; if ((Request.QueryString["farmId"] != "") && (Request.QueryString["farmId"] != null)) { int.TryParse(Request.QueryString["farmId"], out farmId); } if ((Request.QueryString["plotId"] != "") && (Request.QueryString["plotId"] != null)) { int.TryParse(Request.QueryString["plotId"], out plotId); } contactIdsFromGET = Request.QueryString["contactIds"]; FarmIdHiddenField.Value = farmId.ToString(); PlotIdHiddenField.Value = plotId.ToString(); ContactIdsHiddenField.Value = contactIdsFromGET; try { // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); //Getting Farm Name FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId); FarmNameLabel.Text = farm.FarmName; //Getting From Plot Name FarmService.PlotInfo plot = farmService.GetPlotDetail(plotId); PlotNameLabel.Text = plot.PlotName; //Get Plot List for the Farm IList <FarmService.PlotInfo> plots = farmService.GetPlotListSummaryForFarm(farmId); PlotListDropDownList.DataSource = plots; PlotListDropDownList.DataValueField = "PlotId"; PlotListDropDownList.DataTextField = "PlotName"; PlotListDropDownList.DataBind(); PlotListDropDownList.Items.Insert(0, new ListItem("<Select a Plot>", "-1")); PlotListDropDownList.Items.Remove(PlotListDropDownList.Items.FindByValue(plotId.ToString())); PlotListDropDownList.Items.Add(new ListItem("New Plot ...", "-2")); PlotListDropDownList.Attributes.Add("onChange", "javascript: newPlot(this);"); NewPlotHiddenField.Value = ""; } catch (Exception exception) { log.Error("UNKNOWN ERROR WHILE LOADING MOVECONTACT:", exception); ErrorLiteral.Text = "Unable to Load the Farm"; SaveButton.Visible = false; } } else { if ((NewPlotHiddenField.Value.ToString() != "") && (PlotListDropDownList.SelectedValue.ToString() == "-2")) { PlotListDropDownList.Items.FindByValue("-2").Text = NewPlotHiddenField.Value.ToString(); } else { PlotListDropDownList.Items.FindByValue("-2").Text = "New Plot ..."; NewPlotHiddenField.Value = ""; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Panel1.Visible = true; Panel2.Visible = false; try { 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"); } // Get the common web service instance. ServiceAccess serviceLoader = ServiceAccess.GetInstance(); FarmService.FarmService farmService = serviceLoader.GetFarm(); ScheduleService.ScheduleService scheduleService = serviceLoader.GetSchedule(); IList <FarmService.MailingPlanInfo> mailingPlans = farmService.GetMailingPlanList(); MailingPlanDropDownList.DataSource = mailingPlans; MailingPlanDropDownList.DataValueField = "MailingPlanId"; MailingPlanDropDownList.DataTextField = "Title"; MailingPlanDropDownList.DataBind(); FarmService.FarmInfo farm = farmService.GetFarmDetail(farmId); farm.UserId = farmService.GetUserIdForFarm(farmId); UserIdHiddenField.Value = farm.UserId.ToString(); if (!IsAgentRole) { ForAgentLiteral.Visible = true; RegistrationService.RegistrationService regservice = serviceLoader.GetRegistration(); RegistrationService.RegistrationInfo regInfo = regservice.GetDetails(farm.UserId); ForAgentLiteral.Text = "Selected Agent: " + regInfo.UserName + " / " + regInfo.FirstName + " " + regInfo.LastName + " "; ForAgentUserIdHiddenField.Value = farm.UserId.ToString(); } else { ForAgentLiteral.Visible = false; } FarmIdHiddenField.Value = farm.FarmId.ToString(); PlotIdHiddenField.Value = farm.Plots[0].PlotId.ToString(); FarmNameTextBox.Text = farm.FarmName; MailingPlanDropDownList.SelectedValue = farm.MailingPlan.MailingPlanId.ToString(); if (farm.Plots[0].ContactCount > 0) { ContactListFileRequiredFieldValidator.Enabled = false; } if (farm.Firmup) { MailingPlanDropDownList.Enabled = false; } } catch (Exception ex) { log.Error("UNKNOWN ERROR:", ex); } } }