public EProspect GetProspectByID(Int64 HostId) { FranchisorDAL objDAL = new FranchisorDAL(); var listProspect = objDAL.GetHostDetails(HostId.ToString(), 1); return(listProspect[0]); }
/// <summary> /// Fill Prospect in case of edit prospect /// </summary> private void FillProspect(bool blnIsHost) { //FranchisorService service = new FranchisorService(); EProspect[] prospect = null; if (blnIsHost == false) { FranchisorDAL objDAL = new FranchisorDAL(); var listProspect = objDAL.GetProspectDetails(ViewState["ProspectID"].ToString(), 4); if (listProspect != null) { prospect = listProspect.ToArray(); } //prospect = service.GetProspectDetailsBYProspectID(Convert.ToInt32(ViewState["ProspectID"].ToString()), true); } else { FranchisorDAL objDAL = new FranchisorDAL(); var listProspect = objDAL.GetHostDetails(ViewState["ProspectID"].ToString(), 1); if (listProspect != null) { prospect = listProspect.ToArray(); } //prospect = service.GetHostDetailsBYHostID(Convert.ToInt32(ViewState["ProspectID"].ToString()), true); } if (prospect != null) { ViewState["ProspectID"] = prospect[0].ProspectID; ViewState["AddressIDBilling"] = prospect[0].Address.AddressID; ViewState["AddressIDMailing"] = prospect[0].AddressMailing.AddressID; ViewState["ProspectDetailsID"] = prospect[0].ProspectDetails.ProspectDetailID; txtaddress1Billing.Text = prospect[0].Address.Address1.ToString(); txtaddress2Billing.Text = prospect[0].Address.Address2; txtaddress1Mailing.Text = prospect[0].AddressMailing.Address1.ToString(); txtaddress2Mailing.Text = prospect[0].AddressMailing.Address2; txtEmail.Text = prospect[0].EMailID.ToString(); // Billing State if (prospect[0].Address.State.Length > 0) { int selectedindex = Convert.ToInt32(ddlstateBilling.Items.FindByText(prospect[0].Address.State.Trim()).Value); ddlstateBilling.SelectedValue = selectedindex.ToString(); } else { ddlstateBilling.SelectedValue = "0"; } // Mailing State if (prospect[0].AddressMailing.State.Length > 0) { int selectedindex = Convert.ToInt32(ddlstateMailing.Items.FindByText(prospect[0].AddressMailing.State.Trim()).Value); ddlstateMailing.SelectedValue = selectedindex.ToString(); } else { ddlstateMailing.SelectedValue = "0"; } txtcityBilling.Text = prospect[0].Address.City; txtcityMailing.Text = prospect[0].AddressMailing.City; txtOrgName.Text = prospect[0].OrganizationName.ToString(); if (prospect[0].PhoneOffice.Trim().Equals("(___)-___-____")) { txtcphoneoffice.Text = ""; } else { txtcphoneoffice.Text = prospect[0].PhoneOffice.ToString(); } txtwebaddress.Text = prospect[0].WebSite.ToString(); // Billing Zip if (prospect[0].Address.ZipID.ToString() != "0") { txtzipBilling.Text = prospect[0].Address.ZipID.ToString(); } else { txtzipBilling.Text = ""; } // Mailing Zip if (prospect[0].AddressMailing.ZipID.ToString() != "0") { txtzipMailing.Text = prospect[0].AddressMailing.ZipID.ToString(); } else { txtzipMailing.Text = ""; } txtFax.Text = prospect[0].Address.Fax; txtNotes.Text = prospect[0].Notes; if (prospect[0].ProspectType != null) { ddlHostType.SelectedValue = prospect[0].ProspectType.ProspectTypeID.ToString(); } if (!prospect[0].ActualMembership.ToString().Equals("0")) { txtActualMembers.Text = prospect[0].ActualMembership.ToString(); } else { txtActualMembers.Text = ""; } if (!prospect[0].Attendance.ToString().Equals("0")) { txtAttendence.Text = prospect[0].Attendance.ToString(); } else { txtAttendence.Text = ""; } if (ddlFeederPromotionStatus.Items.FindByValue(prospect[0].WillCommunicate.ToString().Trim()).Value != null) { ddlFeederPromotionStatus.SelectedValue = prospect[0].WillCommunicate.ToString().Trim(); } if (ddlFeederPromotionStatus.SelectedValue.Equals("0")) { spWillPromote.Style.Add(HtmlTextWriterStyle.Display, "block"); txtWillPromote.Text = prospect[0].ReasonWillCommunicate.Trim(); } txtFacilitiesFee.Text = prospect[0].ProspectDetails.FacilitiesFee; int flagShowDivFee = 0; if (prospect[0].ProspectDetails.FacilitiesFee != "") { flagShowDivFee = 1; } // checked payment method checkbox if (prospect[0].ProspectDetails.PaymentMethod.Length > 1) { chkPaymentMethod.Items[0].Selected = true; chkPaymentMethod.Items[1].Selected = true; flagShowDivFee = 1; } else { if (chkPaymentMethod.Items.FindByValue(prospect[0].ProspectDetails.PaymentMethod) != null) { chkPaymentMethod.SelectedValue = prospect[0].ProspectDetails.PaymentMethod; flagShowDivFee = 1; } } // Deposite requires checkbox if (prospect[0].ProspectDetails.DepositsRequire == 1) { rbtnDepositsRequired.Items[0].Selected = true; rbtnDepositsRequired.Items[1].Selected = false; spnDepositeAmount.Style.Add(HtmlTextWriterStyle.Display, "block"); flagShowDivFee = 1; } else { rbtnDepositsRequired.Items[1].Selected = true; rbtnDepositsRequired.Items[0].Selected = false; spnDepositeAmount.Style.Add(HtmlTextWriterStyle.Display, "none"); } txtAmount.Text = prospect[0].ProspectDetails.DepositsAmount.ToString(); if (prospect[0].ProspectDetails.DepositsAmount != 0) { flagShowDivFee = 1; } if (flagShowDivFee == 1) { divFee.Style.Add(HtmlTextWriterStyle.Display, "block"); rbtnFeeRequired.Items[1].Selected = false; rbtnFeeRequired.Items[0].Selected = true; } else { rbtnFeeRequired.Items[1].Selected = true; rbtnFeeRequired.Items[0].Selected = false; divFee.Style.Add(HtmlTextWriterStyle.Display, "none"); } if (ddlhostStatus.Items.FindByValue(prospect[0].ProspectDetails.WillHost.ToString().Trim()) != null) { ddlhostStatus.SelectedValue = prospect[0].ProspectDetails.WillHost.ToString().Trim(); } if (ddlViableHost.Items.FindByValue(prospect[0].ProspectDetails.ViableHostSite.ToString().Trim()) != null) { ddlViableHost.SelectedValue = prospect[0].ProspectDetails.ViableHostSite.ToString().Trim(); } if (ddlHostedInPast.Items.FindByValue(prospect[0].ProspectDetails.HostedInPast.ToString().Trim()) != null) { ddlHostedInPast.SelectedValue = prospect[0].ProspectDetails.HostedInPast.ToString().Trim(); } if (ddlhostStatus.SelectedValue.Equals("0")) { spWillHost.Style.Add(HtmlTextWriterStyle.Display, "block"); txtWillHost.Text = prospect[0].ProspectDetails.ReasonWillHost; } if (ddlViableHost.SelectedValue.Equals("0")) { spViableHostSite.Style.Add(HtmlTextWriterStyle.Display, "block"); txtViableHostSite.Text = prospect[0].ProspectDetails.ReasonViableHostSite; } if (ddlHostedInPast.SelectedValue.Equals("0")) { spHostInPast.Style.Add(HtmlTextWriterStyle.Display, "block"); txtHostInPast.Text = prospect[0].ProspectDetails.ReasonHostedInPast; } if (prospect[0].ProspectDetails.HostedInPast == 1) { txtHostedInPast.Text = prospect[0].ProspectDetails.HostedInPastWith; spnHostedInPast.Style.Add(HtmlTextWriterStyle.Display, "block"); } else { spnHostedInPast.Style.Add(HtmlTextWriterStyle.Display, "none"); } } }
private void GetProspectDetails(Int64 prospectid) { int iprospectid = Convert.ToInt32(prospectid); EProspect[] prospect = null; FranchisorDAL objDAL = new FranchisorDAL(); if (!string.IsNullOrEmpty(Request["IsHost"])) { if (Request["IsHost"].Equals("True")) { var listProspect = objDAL.GetHostDetails(iprospectid.ToString(), 1); if (listProspect != null) { prospect = listProspect.ToArray(); } } else { var listProspect = objDAL.GetProspectDetails(iprospectid.ToString(), 4); if (listProspect != null) { prospect = listProspect.ToArray(); } } } else { var listProspect = objDAL.GetProspectDetails(iprospectid.ToString(), 4); if (listProspect != null) { prospect = listProspect.ToArray(); } } if (prospect != null) { spProspectName2.InnerText = prospect[0].OrganizationName.ToString(); string strAddress = string.Empty; // Address if (!string.IsNullOrEmpty(prospect[0].Address.Address1)) { strAddress = strAddress + prospect[0].Address.Address1 + ", "; } // Suit if (!string.IsNullOrEmpty(prospect[0].Address.Address2)) { strAddress = strAddress + prospect[0].Address.Address2 + ", "; } // City if (!string.IsNullOrEmpty(prospect[0].Address.City)) { strAddress = strAddress + HttpUtility.HtmlEncode(prospect[0].Address.City) + ", "; } // State if (!string.IsNullOrEmpty(prospect[0].Address.State)) { strAddress = strAddress + HttpUtility.HtmlEncode(prospect[0].Address.State) + ", "; } // ZipID if (prospect[0].Address.ZipID > 0) { strAddress = strAddress + HttpUtility.HtmlEncode(prospect[0].Address.ZipID) + ", "; } if (strAddress.Length > 0) { if ((strAddress.Substring(strAddress.Length - 2, 2) == ", ")) { strAddress = strAddress.Substring(0, strAddress.Length - 2); } if (strAddress.Length > 0) { if ((strAddress.Substring(strAddress.Length - 1, 1) == ",")) { strAddress = strAddress.Substring(0, strAddress.Length - 1); } } if (strAddress.Length > 0) { if ((strAddress.Substring(0, 1) == ",")) { strAddress = strAddress.Substring(1, strAddress.Length - 1); } } else { strAddress = "-N/A-"; } } else { strAddress = "-N/A-"; } spAddress.InnerText = strAddress; spURL.InnerHtml = prospect[0].WebSite.Length > 0 ? HttpUtility.HtmlEncode(prospect[0].WebSite) : "-N/A-"; // format phone no. CommonCode objCommonCode = new CommonCode(); if (prospect[0].PhoneCell.Length > 0) { spPhone.InnerHtml = objCommonCode.FormatPhoneNumberGet(prospect[0].PhoneCell); } else if (prospect[0].PhoneOffice.Length > 0) { spPhone.InnerHtml = objCommonCode.FormatPhoneNumberGet(prospect[0].PhoneOffice); } else if (prospect[0].PhoneOther.Length > 0) { spPhone.InnerHtml = objCommonCode.FormatPhoneNumberGet(prospect[0].PhoneOther); } else { spPhone.InnerHtml = "-N/A-"; } string email = "-N/A-"; string eventname = "-N/A-"; string eventdate = "-N/A-"; string spnTemp = "-N/A-"; if (prospect[0].EMailID.Length > 0) { email = prospect[0].EMailID; } if ((prospect[0].EMailID.Length > 0)) { spOther.InnerText = email; } else { spOther.InnerText = "-N/A-"; } if (prospect[0].LastEventName.Length > 0) { eventdate = Convert.ToDateTime(prospect[0].LastEventDate).ToLongDateString(); eventname = prospect[0].LastEventName; } // Prospect type if (!string.IsNullOrEmpty(prospect[0].ProspectType.Name)) { spnProspectType.InnerText = prospect[0].ProspectType.Name; } else { spnProspectType.InnerText = "-N/A-"; } // Members/Employees if (prospect[0].ActualMembership > 0) { spnMembersEmployees.InnerText = prospect[0].ActualMembership.ToString(); } else { spnMembersEmployees.InnerText = "-N/A-"; } // Actual Attendence if (prospect[0].Attendance > 0) { spnAttendence.InnerText = prospect[0].Attendance.ToString(); } else { spnAttendence.InnerText = "-N/A-"; } // Facilities Fee if (!string.IsNullOrEmpty(prospect[0].ProspectDetails.FacilitiesFee)) { spnFacilitiesFee.InnerText = prospect[0].ProspectDetails.FacilitiesFee; } else { spnFacilitiesFee.InnerText = "-N/A-"; } // Will Promote if (prospect[0].WillCommunicate >= 0) { switch (prospect[0].WillCommunicate) { case 0: spnTemp = "No"; break; case 1: spnTemp = "Yes"; break; case 2: spnTemp = "Unknown"; break; default: spnTemp = "-N/A-"; break; } spnWillPromote.InnerText = spnTemp; spnTemp = ""; } // Will Host if (prospect[0].ProspectDetails.WillHost >= 0) { switch (prospect[0].ProspectDetails.WillHost) { case 0: spnTemp = "No"; break; case 1: spnTemp = "Yes"; break; case 2: spnTemp = "Unknown"; break; default: spnTemp = "-N/A-"; break; } spnWillHost.InnerText = spnTemp; spnTemp = ""; } // Viable Host Site if (prospect[0].ProspectDetails.ViableHostSite >= 0) { if (prospect[0].ProspectDetails.ViableHostSite == 0) { spnTemp = "No"; } else if (prospect[0].ProspectDetails.ViableHostSite == 1) { spnTemp = "Yes"; } else if (prospect[0].ProspectDetails.ViableHostSite == 2) { spnTemp = "Unknown"; } else { spnTemp = "-N/A-"; } spnViableHostSite.InnerText = spnTemp; spnTemp = ""; } } }