Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Property = REIQ.Access.Property.GetFromPropertyId(this.PropertyId);

            if (Property != null)
            {
                Suburb = REIQ.Access.Suburb.GetFromName(Property.suburb);

                if (!IsPostBack)
                {
                    //Suburb Chart stuff
                    ch = new ChartClass();
                    ch.intChartRange = Convert.ToInt32("4");

                    cboChartType.SelectedValue = ChartType.ToString();

                    if (Suburb != null)
                    {
                        DataTable dtsuburbChart = ch.GetSubrub("any", Suburb.name, Suburb.postcode == null ? "0" : Suburb.postcode.ToString());

                        if (dtsuburbChart.Rows.Count > 0)
                        {
                            chartwork(int.Parse(dtsuburbChart.Rows[0]["suburbid"].ToString()), dtsuburbChart.Rows[0]["suburbname"].ToString());
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                int gridSize = 0;
                if (!int.TryParse(ConfigurationManager.AppSettings["FindAnAgent.GridSize"], out gridSize))
                {
                    gridSize = 20;
                }
                ResultsGridView.PageSize = gridSize;

                OfficeActivityListBox.DataSource = ActivityHelper.GetActivities();
                OfficeActivityListBox.DataBind();

                OfficeActivityListBox.Items.Insert(0, new ListItem("(Any)", string.Empty));
                OfficeActivityListBox.SelectedIndex = 0;
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Agent = REIQ.Access.Agent.GetFromAgentId(this.AgentId);
            if (Agent != null)
            {
                Int32 featuredPropertyID = 0;
                //Getting featured propertyID
                if (Agent.featurepid != null)
                {
                    if (Agent.featurepid > 0)
                    {
                        featuredPropertyID = (int)Agent.featurepid;
                    }
                }
                //If no featured PropertyId defined - try get random PropertyID for this agent
                if (featuredPropertyID == 0)
                {
                    featuredPropertyID = REIQ.Access.Agent.GetRandomPropertyIdByAgent(AgentId);
                }

                if (featuredPropertyID > 0)
                {
                    Property = REIQ.Access.Property.GetFromPropertyId(featuredPropertyID);
                }
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
Beispiel #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Hide Our Team unless the "showTeam=1" parameter provided in queryString
        if (Request.QueryString["showTeam"] == "1")
        {
            pnlOurTeam.Visible = true;
        }
        else
        {
            return;
        }

        try
        {
            if (!IsPostBack)
            {
                Agency = REIQ.Access.Agency.GetFromAgencyId(this.AgencyId);

                //Our team init
                if (Agency != null)
                {
                    rptAgent.DataSource = REIQ.Access.Agency.GetOfficeAgentsImisProfile(this.AgencyId);
                    rptAgent.DataBind();
                }
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Node CurrentPage = Node.GetCurrent();

            if (CurrentPage.GetProperty("showRefineSearch") == null)
            {
                return;
            }

            if (CurrentPage.GetProperty("showRefineSearch").Value != "1")
            {
                return;
            }
            else
            {
                phSearchRefineForm.Visible = true;
            }

            if (!IsPostBack)
            {
                InitControls();
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Suburb = REIQ.Access.Suburb.GetFromName(SuburbName);
     }
     catch (Exception ex)
     {
         AutoMail.sendErrorMail(ex);
     }
 }
Beispiel #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Property = REIQ.Access.Property.GetFromPropertyId(this.PropertyId);
     }
     catch (Exception ex)
     {
         AutoMail.sendErrorMail(ex);
     }
 }
Beispiel #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            CurrentPage = Node.GetCurrent();

            if (CurrentPage.GetProperty("showContactForm") == null)
            {
                return;
            }

            if (CurrentPage.GetProperty("showContactForm").Value != "1")
            {
                return;
            }
            else
            {
                ContactForm.Visible = true;

                if (CurrentPage.GetProperty("contactFormEmailAddress") != null && !String.IsNullOrEmpty(CurrentPage.GetProperty("contactFormEmailAddress").Value))
                {
                    Int32 emailAddressNodeID = Convert.ToInt32(CurrentPage.GetProperty("contactFormEmailAddress").Value);
                    if (emailAddressNodeID > 0)
                    {
                        Node emailAddressNode = new Node(emailAddressNodeID);

                        if (emailAddressNode != null)
                        {
                            if (emailAddressNode.GetProperty("emailAddress") != null && !String.IsNullOrEmpty(emailAddressNode.GetProperty("emailAddress").Value))
                            {
                                ToEmail = DataUtility.Encrypt(emailAddressNode.GetProperty("emailAddress").Value);
                            }
                            if (emailAddressNode.GetProperty("relatedThankYouPage") != null && !String.IsNullOrEmpty(emailAddressNode.GetProperty("relatedThankYouPage").Value))
                            {
                                Int32 relatedThankYouPageID = Convert.ToInt32(emailAddressNode.GetProperty("relatedThankYouPage").Value);
                                if (relatedThankYouPageID > 0)
                                {
                                    Node relatedThankYouPageNode = new Node(relatedThankYouPageID);
                                    if (relatedThankYouPageNode != null)
                                    {
                                        RelatedThankYouPage = relatedThankYouPageNode.Url;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
Beispiel #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         TowerAdString = GetTowerAdvertisements();
     }
     catch (Exception ex)
     {
         AutoMail.sendErrorMail(ex);
     }
 }
Beispiel #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!String.IsNullOrEmpty(Request.QueryString["pid"]))
         {
             Property = REIQ.Access.Property.GetFromPropertyId(this.PropertyId);
             address  = getAddress();
         }
     }
     catch (Exception ex)
     {
         AutoMail.sendErrorMail(ex);
     }
 }
Beispiel #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Agency = REIQ.Access.Agency.GetFromAgencyId(this.AgencyId);
         if (Agency != null)
         {
             AgencyAddress = AgencyHelper.GetAgencyAddress(Agency);
         }
     }
     catch (Exception ex)
     {
         AutoMail.sendErrorMail(ex);
     }
 }
Beispiel #12
0
 protected void SearchButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (Page.IsValid)
         {
             ResultsGridView.PageIndex = 0;
             GridBind();
         }
     }
     catch (Exception ex)
     {
         AutoMail.sendErrorMail(ex);
     }
 }
Beispiel #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Agency = REIQ.Access.Agency.GetFromAgencyId(this.AgencyId);
         //Gmap  initialise
         if (Agency != null)
         {
             ClientScriptManager cs = Page.ClientScript;
             cs.RegisterStartupScript(GetType(), "onLoadCall", "<Script>load('" + AgencyHelper.GetAgencyAddress(Agency) + "')</Script>", false);
         }
     }
     catch (Exception ex)
     {
         AutoMail.sendErrorMail(ex);
     }
 }
Beispiel #14
0
    private void LoadMail()
    {
        int organizationId = Convert.ToInt32(this.DropOrganizations.SelectedValue);
        int geographyId    = 0;

        if (this.DropGeographies.SelectedIndex > -1)
        {
            geographyId = Convert.ToInt32(this.DropGeographies.SelectedValue);

            AutoMail mail = AutoMail.FromTypeOrganizationAndGeography(
                AutoMailType.Welcome, Organization.FromIdentity(organizationId), Geography.FromIdentity(geographyId));

            HttpContext.Current.Session["AutoMail"] = mail;

            this.PanelMailContents.Visible = true;

            if (mail != null)
            {
                this.TextBody.Text = mail.Body;
            }
            else
            {
                this.TextBody.Text = string.Empty;
            }
        }
        else
        {
            this.LabelSelectedGeography.Text           = string.Empty;
            this.LabelOrganizationsInGeographies2.Text = string.Empty;
        }

        try
        {
            Person localLead = Roles.GetLocalLead(organizationId, geographyId);
            this.LabelSender.Text     = localLead.Name;
            this.LabelSender.CssClass = string.Empty;
        }
        catch (Exception)
        {
            this.LabelSender.Text     = "No Local Lead";
            this.LabelSender.CssClass = "ErrorMessage";
        }

        CreatePreview();
    }
Beispiel #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Agent = REIQ.Access.Agent.GetFromAgentId(this.AgentId);
         if (Agent != null)
         {
             if (Agent.acID != null)
             {
                 Agency = REIQ.Access.Agency.GetFromAgencyId((int)Agent.acID);
             }
         }
     }
     catch (Exception ex)
     {
         AutoMail.sendErrorMail(ex);
     }
 }
Beispiel #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Property = REIQ.Access.Property.GetFromPropertyId(this.PropertyId);

            if (Property != null)
            {
                DefaultAgent = REIQ.Access.Agent.GetFromPropertyId(Property.pID);
                Agency       = REIQ.Access.Agency.GetFromPropertyId(this.PropertyId);
                Region       = REIQ.Access.Property.GetPropertyRegion(Property.pID);

                CurrentPage = Node.GetCurrent();
                CurrentUrl  = DataUtility.Encrypt("http://" + Request.Url.Host + Request.RawUrl);

                if (CurrentPage.GetProperty("relatedThankYouPage") != null && !String.IsNullOrEmpty(CurrentPage.GetProperty("relatedThankYouPage").Value))
                {
                    Int32 relatedThankYouPageID = Convert.ToInt32(CurrentPage.GetProperty("relatedThankYouPage").Value);
                    if (relatedThankYouPageID > 0)
                    {
                        Node relatedThankYouPageNode = new Node(relatedThankYouPageID);
                        if (relatedThankYouPageNode != null)
                        {
                            RelatedThankYouPage = relatedThankYouPageNode.Url;
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }

        if (Property == null)
        {
            btnSend.Enabled = false;
        }
    }
Beispiel #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Agency = REIQ.Access.Agency.GetFromAgencyId(this.AgencyId);

            if (Agency != null)
            {
                if (Agency.email != null && !String.IsNullOrEmpty(Agency.email))
                {
                    ToEmail = DataUtility.Encrypt(Agency.email);
                }
                if (Agency.name != null && !String.IsNullOrEmpty(Agency.name))
                {
                    AgencyName = Agency.name;
                }

                CurrentPage = Node.GetCurrent();

                if (CurrentPage.GetProperty("relatedThankYouPage") != null && !String.IsNullOrEmpty(CurrentPage.GetProperty("relatedThankYouPage").Value))
                {
                    Int32 relatedThankYouPageID = Convert.ToInt32(CurrentPage.GetProperty("relatedThankYouPage").Value);
                    if (relatedThankYouPageID > 0)
                    {
                        Node relatedThankYouPageNode = new Node(relatedThankYouPageID);
                        if (relatedThankYouPageNode != null)
                        {
                            RelatedThankYouPage = relatedThankYouPageNode.Url;
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
Beispiel #18
0
    protected void ButtonSave_Click(object sender, EventArgs e)
    {
        AutoMail mail = (AutoMail)HttpContext.Current.Session["AutoMail"];

        if (mail != null)
        {
            // Setting the properties saves to database.

            mail.Body = this.TextBody.Text.Trim();
        }
        else
        {
            int organizationId = Convert.ToInt32(this.DropOrganizations.SelectedValue);
            int geographyId    = Convert.ToInt32(this.DropGeographies.SelectedValue);

            mail = AutoMail.Create(AutoMailType.Welcome, Organization.FromIdentity(organizationId),
                                   Geography.FromIdentity(geographyId), null, string.Empty, this.TextBody.Text.Trim());
        }
        Page.ClientScript.RegisterStartupScript(this.GetType(), "StartupMessage", "alert('Your changes have been saved.');", true);

        HttpContext.Current.Session["AutoMail"] = mail;
        CreatePreview(); // to reflect saved changes
    }
Beispiel #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //Property = REIQ.Access.Property.GetFromPropertyId(this.PropertyId);
            Property = REIQ.Access.Property.GetAnyFromPropertyId(this.PropertyId);

            //Log page view
            if (Property != null && !IsPostBack)
            {
                LogHelper.EditPublicLog(Property.pID.ToString(), Property.acID.ToString());
                //cheking if property is hidden for some reason and make redirection in that case
                REIQ.Helpers.PropertyHelper.CheckIfHidden(Property);
            }
        }
        catch (System.Threading.ThreadAbortException)
        {
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
Beispiel #20
0
        public void ProcessRequest(HttpContext context)
        {
            String txtName         = context.Request["txtName"];
            String txtPhone        = context.Request["txtPhone"];
            String txtEmail        = context.Request["txtEmail"];
            String txtComments     = context.Request["txtComments"];
            String txtCode         = context.Request["txtCode"];
            String toEmail         = (!String.IsNullOrEmpty(context.Request["sendToEmail"]) ? DataUtility.Decrypt(context.Request["sendToEmail"]) : ConfigurationManager.AppSettings["adminemail"]);
            String currentPageName = context.Request["currentPageName"];

            String capthcaImageText = String.Empty;

            if (context.Session["CaptchaImageText"] != null)
            {
                capthcaImageText = context.Session["CaptchaImageText"].ToString();
            }

            context.Response.ContentType = "text/html";

            if (String.IsNullOrEmpty(txtCode) || txtCode != capthcaImageText)
            {
                context.Response.Write("captchaFail");
            }
            else
            {
                try
                {
                    string strBody = "";

                    //strBody = strBody + "<br>To " + agencyName + "<br><br>";
                    strBody = strBody + "<font style='color:#c0143c'>The form on " + currentPageName + " was submitted</font><br><br>";
                    strBody = strBody + "<b>Please find below an enquiry from reiq.com</b><br><br>";

                    strBody = strBody + "<table width=600 border=0>";
                    strBody = strBody + "<tr>";
                    strBody = strBody + "<td width=150>From: </td>";
                    strBody = strBody + "<td width=450>" + txtName + "</td>";
                    strBody = strBody + "</tr>";
                    strBody = strBody + "<tr>";
                    strBody = strBody + "<tr>";
                    strBody = strBody + "<td>Email: </td>";
                    strBody = strBody + "<td>" + txtEmail + "</td>";
                    strBody = strBody + "</tr>";
                    strBody = strBody + "<tr>";
                    strBody = strBody + "<td>Phone: </td>";
                    strBody = strBody + "<td>" + txtPhone + "</td>";
                    strBody = strBody + "</tr>";
                    strBody = strBody + "<tr>";
                    strBody = strBody + "<td>Date of enquiry: </td>";
                    strBody = strBody + "<td>" + DateTime.Now.ToLongDateString() + "</td>";
                    strBody = strBody + "</tr>";
                    strBody = strBody + "<tr>";
                    strBody = strBody + "<td valign='top'>Message: </td>";
                    strBody = strBody + "<td >" + txtComments + "</td>";
                    strBody = strBody + "</tr>";
                    strBody = strBody + "</table>";

                    strBody = strBody + "<br><br><font style='color:#c0143c'>PLEASE HIT 'REPLY' TO RESPOND DIRECTLY TO THIS ENQUIRY.</font><br><br>";

                    strBody = AgencyHelper.GetEmailBox(strBody);

                    AutoMail.Mail_Send(txtEmail, toEmail, "Web Enquiry from REIQ", strBody);
                    context.Response.Write("true");
                }
                catch (Exception ex)
                {
                    AutoMail.sendErrorMail(ex);
                    context.Response.Write(ex.Message);
                }
            }
        }
Beispiel #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Suburb = REIQ.Access.Suburb.GetFromName(SuburbName);

            if (!IsPostBack)
            {
                //Binding Suburbs
                //DataTable dtsuburb = ch.GetAllSubrubWithdesc("1000");

                //ahc.connection.Close();

                //for (int i = 0; i < dtsuburb.Rows.Count; i++)
                //{
                //    cboSuburbInfo.Items.Add(new ListItem(dtsuburb.Rows[i]["name"].ToString() + ", " + dtsuburb.Rows[i]["postcode"].ToString(), dtsuburb.Rows[i]["sid"].ToString()));
                //}

                //cboSuburbInfo.DataSource = REIQ.Access.Suburb.GetAllSuburbsByTop(1000);

                //cboSuburbInfo.Items.Insert(0, new ListItem("-Select Suburb-", ""));
                //cboSuburbInfo.DataBind();


                //Bedrooms setup
                cboSuburbInfo.Items.Add(new ListItem("Select Suburb", ""));
                foreach (REIQ.Entities.Suburb suburb in REIQ.Access.Suburb.GetAllSuburbsByTop(2000))
                {
                    cboSuburbInfo.Items.Add(new ListItem(suburb.name, suburb.name));
                }
                cboSuburbInfo.DataBind();

                cboSuburbInfo.SelectedValue = SuburbName;


                //if (!String.IsNullOrEmpty(Request.QueryString["su"]) && Request.QueryString["postcode"] != null)
                //{
                //    strSearchSuburb = Request.QueryString["su"].ToString();
                //    strSearchPostcode = Request.QueryString["postcode"].ToString();
                //}
                //else
                //{
                //    //cboSuburbInfo.SelectedIndex = 1;

                //    //DataRow[] drsuburb = dtsuburb.Select("sid=" + cboSuburbInfo.SelectedValue);

                //    //strSearchSuburb = drsuburb[0]["name"].ToString();
                //    //strSearchPostcode = drsuburb[0]["postcode"].ToString();
                //}

                //Suburb Chart stuff
                ch = new ChartClass();
                ch.intChartRange = Convert.ToInt32("4");

                cboChartType.SelectedValue = ChartType.ToString();

                if (Suburb != null)
                {
                    DataTable dtsuburbChart = ch.GetSubrub("any", Suburb.name, Suburb.postcode == null ? "0" : Suburb.postcode.ToString());

                    if (dtsuburbChart.Rows.Count > 0)
                    {
                        chartwork(int.Parse(dtsuburbChart.Rows[0]["suburbid"].ToString()), dtsuburbChart.Rows[0]["suburbname"].ToString());
                    }
                }
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
Beispiel #22
0
        public static string CreateWelcomeMail(Person person, Organization organization)
        {
            // for this person, iterate over all applicable geographies and organizations

            Organizations orgLine = organization.GetLine();
            Geographies   geoLine = person.Geography.GetLine();

            orgLine.Reverse(); // Start at the most local org

            Dictionary <int, bool> orgMailedLookup = new Dictionary <int, bool>();

            int    delay  = 0;
            string result = string.Empty;
            Random random = new Random();

            foreach (Organization org in orgLine)
            {
                foreach (Geography geo in geoLine) // but at the top geography
                {
                    AutoMail autoMail = AutoMail.FromTypeOrganizationAndGeography(AutoMailType.Welcome, org, geo);

                    if (autoMail == null)
                    {
                        continue;
                    }

                    Person lead    = null;
                    string geoName = geo.Name;

                    try
                    {
                        lead = Roles.GetLocalLead(org, geo);
                        orgMailedLookup[org.Identity] = true;
                        // Make sure that the chairman doesn't mail at a lower level
                    }
                    catch (ArgumentException)
                    {
                    }

                    if (lead == null && !orgMailedLookup.ContainsKey(org.Identity))
                    {
                        // If we get here, there is a mail template at the highest possible geo for this org, but no local lead.
                        // That's usually the case with board-centric organizations rather than executive-centric.
                        // Try to mail from chairman rather than the local lead.

                        try
                        {
                            orgMailedLookup[org.Identity] = true;
                            lead    = Roles.GetChairman(org);
                            geoName = "Chairman";
                        }
                        catch (ArgumentException)
                        {
                        }
                    }

                    if (lead == null)
                    {
                        // ok, give up if there isn't a chairman either or if we've already mailed this org from the chairman
                        continue;
                    }

                    // TODO: fetch lead from roles
                    WelcomeMail welcomemail = new WelcomeMail();

                    welcomemail.pOrgName = org.MailPrefixInherited;

                    welcomemail.pGeographyName = "";
                    if (geo.Identity != Geography.RootIdentity)
                    {
                        welcomemail.pGeographyName = geo.Name;
                    }

                    welcomemail.pBodyContent = autoMail.Body;
                    welcomemail.pSubject     = autoMail.Title;

                    OutboundMail newMail = welcomemail.CreateOutboundMail(lead, OutboundMail.PriorityNormal,
                                                                          org, geo, DateTime.Now.AddMinutes(delay));
                    newMail.AddRecipient(person.Identity, false);
                    newMail.SetRecipientCount(1);
                    newMail.SetResolved();
                    newMail.SetReadyForPickup();

                    result += String.Format(" - {0}/{1} by {2} (",
                                            org.NameShort, geoName, lead.Canonical);
                    if (delay == 0)
                    {
                        result += "sent now";
                        delay  += 37;
                    }
                    else
                    {
                        result += "sending at " + DateTime.Now.AddMinutes(delay).ToString("HH:mm");
                        delay  += 31 + random.Next(52);
                    }
                    result += ")\r\n";
                }
            }

            if (result.Length < 4)
            {
                result = "none\r\n";
            }

            return(result);
        }
Beispiel #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!String.IsNullOrEmpty(Request.QueryString["pid"]))
            {
                Property = REIQ.Access.Property.GetFromPropertyId(this.PropertyId);

                if (Property != null)
                {
                    string gaddress = PropertyHelper.GetGoogleAddress(null, Property.unitNum, Property.rdNum, Property.rdName, Property.rdType, Property.suburb, Property.hideRoadName, Property.hideRoadNum) + "," + Property.state + " " + Property.postcode;;

                    daddress = gaddress.Replace(" ", "+");
                    daddress = daddress.Replace(",", "+");
                    if (gaddress.Contains("'"))
                    {
                        daddress = Property.suburb + "," + Property.state + " " + Property.postcode;
                    }
                    else
                    {
                        daddress = gaddress;
                    }

                    strLoadMap = strLoadMap + Environment.NewLine + "function load(){";

                    strLoadMap = strLoadMap + Environment.NewLine + "var mapOptions = {";
                    strLoadMap = strLoadMap + Environment.NewLine + "zoom: 13,";
                    strLoadMap = strLoadMap + Environment.NewLine + "overviewMapControl: true,";
                    strLoadMap = strLoadMap + Environment.NewLine + "overviewMapControlOptions:{opened:true},";
                    strLoadMap = strLoadMap + Environment.NewLine + "mapTypeId: google.maps.MapTypeId.ROADMAP,";
                    strLoadMap = strLoadMap + Environment.NewLine + "scaleControl: true";
                    strLoadMap = strLoadMap + Environment.NewLine + "};";

                    strLoadMap = strLoadMap + Environment.NewLine + "map = new google.maps.Map(document.getElementById('map'), mapOptions);";
                    //strLoadMap = strLoadMap + Environment.NewLine + "map.setCenter(new google.maps.LatLng(-19.7061, 145.774002), 13);";
                    strLoadMap = strLoadMap + Environment.NewLine + "geocoder = new google.maps.Geocoder();";
                    strLoadMap = strLoadMap + Environment.NewLine + "var strTable = ''";
                    if (gaddress.Contains("'"))
                    {
                        strLoadMap = strLoadMap + Environment.NewLine + "strTable = '<table border=0 celllpadding=0 cellspacing=0><tr><td valign=top>" + Property.suburb + "," + Property.state + " " + Property.postcode + "</td></tr>';";
                    }
                    else
                    {
                        strLoadMap = strLoadMap + Environment.NewLine + "strTable = '<table border=0 celllpadding=0 cellspacing=0><tr><td valign=top>" + gaddress + "</td></tr>';";
                    }
                    //strLoadMap = strLoadMap + Environment.NewLine + "strTable = strTable + '<tr><td>Directions <a href=javascript:myShow1();javascript:myHide1();>To here</a>  | <a href=javascript:myShow2();javascript:myHide2();>From here</a></td></tr></table>';";
                    //strLoadMap = strLoadMap + Environment.NewLine + "strTable = strTable + '<table border=0 celllpadding=0 cellspacing=0 height=50><tr><td height=5></td></tr><tr><td valign=top id=tohere STYLE=display:none;>Enter your start point<br><input name=txtfrom id=txtfrom type=text ><input type=button onclick=javascript:openFrom() name=btnGo1 value=Go></td></tr>';";
                    //strLoadMap = strLoadMap + Environment.NewLine + "strTable = strTable + '<tr><td id=fromhere STYLE=display:none;>End address<br><input name=txtto id=txtto type=text ><input type=button onclick=javascript:openTo() name=btnGo2 value=Go></td></tr>';";
                    strLoadMap = strLoadMap + Environment.NewLine + "strTable = strTable + '</table>';";
                    if (gaddress.Contains("'"))
                    {
                        strLoadMap = strLoadMap + Environment.NewLine + "showAddress('" + Property.suburb + "," + Property.state + " " + Property.postcode + "', strTable);";
                    }
                    else
                    {
                        strLoadMap = strLoadMap + Environment.NewLine + "showAddress('" + gaddress + "', strTable);";
                    }
                    strLoadMap = strLoadMap + Environment.NewLine + "}";
                }
            }
            if (!String.IsNullOrEmpty(Request.QueryString["add"]))
            {
                daddress = ConfigurationManager.AppSettings["companyaddress"];
                daddress = daddress.Replace(",", "+");

                strLoadMap = strLoadMap + Environment.NewLine + "function load(){";

                strLoadMap = strLoadMap + Environment.NewLine + "var mapOptions = {";
                strLoadMap = strLoadMap + Environment.NewLine + "zoom: 13,";
                strLoadMap = strLoadMap + Environment.NewLine + "overviewMapControl: true,";
                strLoadMap = strLoadMap + Environment.NewLine + "overviewMapControlOptions:{opened:true},";
                strLoadMap = strLoadMap + Environment.NewLine + "mapTypeId: google.maps.MapTypeId.ROADMAP,";
                strLoadMap = strLoadMap + Environment.NewLine + "scaleControl: true";
                strLoadMap = strLoadMap + Environment.NewLine + "};";

                strLoadMap = strLoadMap + Environment.NewLine + "map = new google.maps.Map(document.getElementById('map'), mapOptions);";
                //strLoadMap = strLoadMap + Environment.NewLine + "map.setCenter(new google.maps.LatLng(-19.7061,145.774002), 13);";
                strLoadMap = strLoadMap + Environment.NewLine + "geocoder = new google.maps.Geocoder();";
                strLoadMap = strLoadMap + Environment.NewLine + "var strTable = ''";
                strLoadMap = strLoadMap + Environment.NewLine + "strTable = '<table border=0 celllpadding=0 cellspacing=0><tr><td valign=top>" + ConfigurationManager.AppSettings["companyaddress"] + "</td></tr>';";
                //strLoadMap = strLoadMap + Environment.NewLine + "strTable = strTable + '<tr><td>Directions <a href=javascript:myShow1();javascript:myHide1();>To here</a>  | <a href=javascript:myShow2();javascript:myHide2();>From here</a></td></tr></table>';";
                //strLoadMap = strLoadMap + Environment.NewLine + "strTable = strTable + '<table border=0 celllpadding=0 cellspacing=0 height=50><tr><td height=5></td></tr><tr><td valign=top id=tohere STYLE=display:none;>Enter your start point<br><input name=txtfrom id=txtfrom type=text ><input type=button onclick=javascript:openFrom() name=btnGo1 value=Go></td></tr>';";
                //strLoadMap = strLoadMap + Environment.NewLine + "strTable = strTable + '<tr><td id=fromhere STYLE=display:none;>End address<br><input name=txtto id=txtto type=text ><input type=button onclick=javascript:openTo() name=btnGo2 value=Go></td></tr>';";
                strLoadMap = strLoadMap + Environment.NewLine + "strTable = strTable + '</table>';";
                strLoadMap = strLoadMap + Environment.NewLine + "showAddress('" + ConfigurationManager.AppSettings["companyaddress"] + "', strTable);";
                strLoadMap = strLoadMap + Environment.NewLine + "}";
            }
        }
        catch (Exception ex)
        {
            AutoMail.sendErrorMail(ex);
        }
    }
Beispiel #24
0
        public void ProcessRequest(HttpContext context)
        {
            String txtName         = context.Request["txtName"];
            String txtPhone        = context.Request["txtPhone"];
            String txtEmail        = context.Request["txtEmail"];
            String txtComments     = context.Request["txtComments"];
            String txtCode         = context.Request["txtCode"];
            String toEmail         = ConfigurationManager.AppSettings["adminemail"];
            String currentPageName = context.Request["currentPageName"];
            String replyBy         = context.Request["replyBy"];
            String toKnow          = context.Request["toKnow"];
            int    propertyId      = Convert.ToInt32(context.Request["propertyId"]);
            String link            = DataUtility.Decrypt(context.Request["link"]);

            REIQ.Entities.Property Property = REIQ.Access.Property.GetFromPropertyId(propertyId);
            DefaultAgent = REIQ.Access.Agent.GetFromPropertyId(propertyId);
            Agency       = REIQ.Access.Agency.GetFromPropertyId(propertyId);
            Region       = REIQ.Access.Property.GetPropertyRegion(propertyId);

            String capthcaImageText = String.Empty;

            if (context.Session["CaptchaImageText"] != null)
            {
                capthcaImageText = context.Session["CaptchaImageText"].ToString();
            }

            context.Response.ContentType = "text/html";

            if (String.IsNullOrEmpty(txtCode) || txtCode != capthcaImageText)
            {
                context.Response.Write("captchaFail");
            }
            else
            {
                string agentNames = String.Empty;

                //Trying to get all associated agents emails
                if (Property.aID1 != null)
                {
                    Agent1 = REIQ.Access.Agent.GetFromAgentId((int)Property.aID1);
                    if (Agent1 != null)
                    {
                        toEmail    = Agent1.email;
                        agentNames = Agent1.firstname + " " + Agent1.surname;
                    }
                }

                if (Property.aID2 != null)
                {
                    Agent2 = REIQ.Access.Agent.GetFromAgentId((int)Property.aID2);
                    if (Agent2 != null)
                    {
                        if (!String.IsNullOrEmpty(Agent2.email))
                        {
                            toEmail += ", " + Agent2.email;
                        }
                        agentNames = ", " + Agent2.firstname + " " + Agent2.surname;
                    }
                }

                if (Property.aID3 != null)
                {
                    Agent3 = REIQ.Access.Agent.GetFromAgentId((int)Property.aID3);
                    if (Agent3 != null)
                    {
                        if (!String.IsNullOrEmpty(Agent3.email))
                        {
                            toEmail += ", " + Agent3.email;
                        }
                        agentNames = ", " + Agent3.firstname + " " + Agent3.surname;
                    }
                }

                //If no associated agents - then try get associated agency
                if (string.IsNullOrEmpty(toEmail))
                {
                    if (Agency != null)
                    {
                        toEmail = Agency.email;
                    }
                }

                //If still nothing associated - send error message.
                if (string.IsNullOrEmpty(toEmail))
                {
                    AutoMail.sendErrorMail(new Exception("No email found for propertyID:" + propertyId));
                }

                string strlink  = link;
                string strprice = PropertyHelper.GetPropertyPrice(Property);
                string address  = PropertyHelper.GetAddress(Property);

                string strBody = "";

                strBody = strBody + "To " + agentNames + "<br><br>";
                strBody = strBody + "<font style='color:#c0143c'>RE: WEB ENQUIRY FOR " + address + "</font><br><br>";
                strBody = strBody + "<b>Please find below an enquiry from reiq.com</b><br><br>";

                strBody = strBody + "<table width=650 border=0>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td width=250>From: </td>";
                strBody = strBody + "<td >" + txtName + "</td>";
                strBody = strBody + "</tr>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td>Email: </td>";
                strBody = strBody + "<td>" + txtEmail + "</td>";
                strBody = strBody + "</tr>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td>Phone: </td>";
                strBody = strBody + "<td>" + txtPhone + "</td>";
                strBody = strBody + "</tr>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td>Preferred Contact: </td>";
                strBody = strBody + "<td>" + replyBy + "</td>";
                strBody = strBody + "</tr>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td>Date of enquiry: </td>";
                strBody = strBody + "<td>" + DateTime.Now.ToLongDateString() + "</td>";
                strBody = strBody + "</tr>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td>Would like to request information on: </td>";
                strBody = strBody + "<td>" + toKnow + "</td>";
                strBody = strBody + "</tr>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td valign='top'>Comments: </td>";
                strBody = strBody + "<td >" + txtComments + "</td>";
                strBody = strBody + "</tr>";
                strBody = strBody + "</table>";

                strBody = strBody + "<br><br><font style='color:#c0143c'>PLEASE HIT 'REPLY' TO RESPOND DIRECTLY TO THIS ENQUIRY.</font><br><br>";

                strBody = strBody + "<table border='0' width='650'>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td valign='top'><a href='" + strlink + "'>" + PropertyHelper.GetSearchImageUrl(Property.pID.ToString(), Property.hasPhotoLarge, Property.type, address, Property.status, strprice, "106", "70") + "</a></td>";
                strBody = strBody + "<td width='10'></td>";
                strBody = strBody + "<td valign='top' align='left'>";
                strBody = strBody + "<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td colspan='2' align='left' class='txtAddress' height='25' valign='top'>" + address.ToUpper() + "&nbsp;<span class='newly'>" + Property.type + "</span>  &nbsp;" + PropertyHelper.GetFurnished(Property.isFurnished) + "" + PropertyHelper.GetNewlyAdded(Property.dateListed == null ? DateTime.MinValue : (DateTime)Property.dateListed) + "" + getstatus(Property.status) + "</span></td>";
                strBody = strBody + "</tr>";
                strBody = strBody + "<tr height='20'><td colspan='2' style='color:#595a5f;' valign='top'><b>" + Property.descriptionShort + "</b></td></tr>";
                strBody = strBody + "<tr>";
                strBody = strBody + "<td colspan='2' align='left'>";
                strBody = strBody + PropertyHelper.GetShortDescription(Property.descriptionLong, 120) + "...<br />   ";
                strBody = strBody + PropertyHelper.GetAuctionFormat(Property.auctionDate == null ? String.Empty : Property.auctionDate.ToString(), Property.auctionTime);
                strBody = strBody + "</td>";
                strBody = strBody + "</tr>";
                strBody = strBody + checkHomeOpen(PropertyHelper.GetHomeOpensFormat_New(Property.homeopen1From.ToString(), Property.homeopen1To.ToString(), Property.homeopen2From.ToString(), Property.homeopen2To.ToString()));
                strBody = strBody + "<tr height='20'><td  colspan='2'><b><span class='txtPink14'>" + strprice + "</span> | <span class='txtPink'>Property Type: " + Property.type + "</span></b></td></tr>";
                strBody = strBody + "</table>";
                strBody = strBody + "<a href='" + strlink + "' ><img name='btn_view_more2' src='images/btn_view_more.jpg' onMouseOver='this.src='images/btn_view_more_f2.jpg''  onMouseOut='this.src='images/btn_view_more.jpg''/></a>";
                strBody = strBody + "</td>";
                strBody = strBody + "<td valign='top' width='200' align='right'>";
                strBody = strBody + PropertyHelper.GetDisplaySearchFeaturesSmall(Property.numBedrooms.ToString(), Property.numBathrooms.ToString(), Property.numCarbays.ToString(), Property.numStudy.ToString(), Property.hasPool.ToString(), Property.numGarage.ToString());
                strBody = strBody + "<br />";
                if (Agency != null)
                {
                    strBody = strBody + Images.GetAgencyImage(Agency.acID, 196, 88);
                    strBody = strBody + "<br /><br />";
                }
                if (DefaultAgent != null)
                {
                    strBody = strBody + PropertyHelper.GetAgentData(DefaultAgent, Property.pID);
                }
                strBody = strBody + "</td>";
                strBody = strBody + "</tr>";
                strBody = strBody + "</table>";

                strBody = PropertyHelper.GetEmailbox(strBody);

                string sub = "";
                if (address != null)
                {
                    sub = "Web Enquiry for " + address.Replace("<b>", "").Replace("</b>", "") + "  from REIQ";
                }
                else
                {
                    sub = "Web Enquiry for from REIQ";
                }

                try
                {
                    AutoMail.Mail_Send(txtEmail, toEmail, sub, strBody);

                    LogHelper.InsertLog(Property.pID.ToString(), Property.acID.ToString(), Property.aID1.ToString(), Property.suburb, txtEmail, txtPhone);

                    context.Response.Write("true");
                }
                catch (Exception ex)
                {
                    AutoMail.sendErrorMail(ex);
                    context.Response.Write(ex.Message);
                }
            }
        }