Ejemplo n.º 1
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);
        }
    }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Property = REIQ.Access.Property.GetFromPropertyId(this.PropertyId);
     }
     catch (Exception ex)
     {
         AutoMail.sendErrorMail(ex);
     }
 }
Ejemplo n.º 3
0
    protected void rptProperties_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            REIQ.Entities.Property property = (REIQ.Entities.Property)e.Item.DataItem;

            Literal litAgencyImage = e.Item.FindControl("litAgencyImage") as Literal;

            if (property.acID > 0)
            {
                REIQ.Entities.Agency agency = REIQ.Access.Agency.GetFromPropertyId(property.pID);
                litAgencyImage.Text = "<a href='/" + REIQ.Helpers.PropertyHelper.GenerateURLAgency(agency.name.ToString(), property.suburb.ToString(), property.acID) + "'><img src=" + Images.GetAgencyImage(property.acID, 196, 88) + " class='agent-logo'/></a>";
            }
        }
    }
Ejemplo n.º 4
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);
     }
 }
Ejemplo n.º 5
0
    protected void rptProperties_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            REIQ.Entities.Property property = (REIQ.Entities.Property)e.Item.DataItem;

            //Label lblPrice = e.Item.FindControl("lblPrice") as Label;
            Literal litAgencyImage = e.Item.FindControl("litAgencyImage") as Literal;

            if (property.acID > 0)
            {
                REIQ.Entities.Agency agency = REIQ.Access.Agency.GetFromPropertyId(property.pID);
                litAgencyImage.Text = "<a href='/" + REIQ.Helpers.PropertyHelper.GenerateURLAgency(agency.name.ToString(), property.suburb.ToString(), property.acID) + "'><img src=" + Images.GetAgencyImage(property.acID, 196, 88) + " class='agent-logo'/></a>";
            }

            REIQ.Entities.Agent agent = REIQ.Access.Agent.GetFromPropertyId(property.pID);

            if (agent != null)
            {
                Literal litAgentName  = e.Item.FindControl("litAgentName") as Literal;
                Literal litAgentPhone = e.Item.FindControl("litAgentPhone") as Literal;
                litAgentName.Text  = "<span class='agent-name'>" + (agent.firstname + " " + agent.surname).ToUpper() + "</span><br />";
                litAgentPhone.Text = "<span class='agent-pg' nowrap>" + AgentHelper.GetAgentPhoneWithLog(agent) + "</span>";//"<span class='agent-pg' nowrap>" + agent.phone + "</span>";
            }

            //Showing New span
            Literal ltlNew = e.Item.FindControl("ltlNew") as Literal;
            if (REIQ.Helpers.PropertyHelper.isNewlyAdded(property.dateListed))
            {
                ltlNew.Text = "<span class='new-label'></span>";
            }

            //Banner ads management, showing banner after each 5th property
            if (e.Item.ItemIndex > 0 && (e.Item.ItemIndex + 1) % 5 == 0)
            {
                Literal ltlBannerAd = e.Item.FindControl("ltlBannerAd") as Literal;
                ltlBannerAd.Text = GetRandomBannerAdFromList(e.Item.ItemIndex + 1);
            }
        }
    }
Ejemplo n.º 6
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);
        }
    }
Ejemplo n.º 7
0
    protected void rptProperties_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            REIQ.Entities.Property property = (REIQ.Entities.Property)e.Item.DataItem;

            //Label lblPrice = e.Item.FindControl("lblPrice") as Label;
            Literal litAgencyImage = e.Item.FindControl("litAgencyImage") as Literal;

            //if (property.pricetext == "0$" || String.IsNullOrEmpty(property.pricetext))
            //    lblPrice.Text = "N/A";
            //else lblPrice.Text = HttpUtility.HtmlDecode(property.pricetext).ToUpper();

            if (property.acID > 0)
            {
                REIQ.Entities.Agency agency = REIQ.Access.Agency.GetFromPropertyId(property.pID);
                litAgencyImage.Text = "<a href='/" + REIQ.Helpers.PropertyHelper.GenerateURLAgency(agency.name.ToString(), property.suburb.ToString(), property.acID) + "'><img src=" + Images.GetAgencyImage(property.acID, 150, 50) + " class='agent-logo'/></a>";
            }
            REIQ.Entities.Agent agent = REIQ.Access.Agent.GetFromPropertyId(property.pID);

            if (agent != null)
            {
                Literal litAgentName  = e.Item.FindControl("litAgentName") as Literal;
                Literal litAgentPhone = e.Item.FindControl("litAgentPhone") as Literal;
                litAgentName.Text  = "<span class='agent-name'>" + (agent.firstname + " " + agent.surname).ToUpper() + "</span><br />";
                litAgentPhone.Text = "<span class='agent-pg'>" + AgentHelper.GetAgentPhoneWithLog(agent) + "</span>";//"<span class='agent-pg'>" + agent.phone + "</span>";
            }

            //Showing New span
            Literal ltlNew = e.Item.FindControl("ltlNew") as Literal;
            if (REIQ.Helpers.PropertyHelper.isNewlyAdded(property.dateListed))
            {
                ltlNew.Text = "<span class='new-label'></span>";
            }
        }
    }
Ejemplo n.º 8
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);
        }
    }
Ejemplo n.º 9
0
    protected string getPriceText(object item)
    {
        REIQ.Entities.Property property = (REIQ.Entities.Property)item;

        return(PropertyHelper.GetPropertyPrice(property));
    }
Ejemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var currentNode = umbraco.NodeFactory.Node.GetCurrent();

        if (currentNode != null)
        {
            String        type                  = String.Empty;
            String        keyword               = String.Empty;
            String        address               = String.Empty;
            String        status                = String.Empty;
            String        urlParts              = String.Empty;
            String        outputMetaTitle       = String.Empty;
            String        outputMetaDescription = String.Empty;
            String        suburbOrRegion        = String.Empty;
            String        forAction             = String.Empty;
            List <String> urlPartsArray         = new List <String>();
            String        region                = String.Empty;
            String        suburb                = String.Empty;
            string        location              = string.Empty;

            #region Property Details
            //Set meta tags
            if (currentNode.NodeTypeAlias.ToString() == "IframePropertyDetails" || currentNode.NodeTypeAlias.ToString() == "PropertyDetail")
            {
                if (!String.IsNullOrEmpty(Request.QueryString["pid"].ToString()))
                {
                    //Get property
                    REIQ.Entities.Property property = REIQ.Access.Property.GetFromPropertyId(Convert.ToInt32(Request.QueryString["pid"]));
                    if (property != null)
                    {
                        //Make property address
                        address = REIQ.Helpers.PropertyHelper.GetAddress(property);
                        string ty = Request.QueryString["ty"];
                        //Prepare type of property
                        urlParts = Request.RawUrl.ToString().ToLower().TrimStart('/').Split('/').ToList()[0];
                        if (urlParts.Contains("house") && !urlParts.Contains("town"))
                        {
                            type = "House ";
                        }
                        else if (urlParts.Contains("land"))
                        {
                            type = "Land ";
                        }
                        else if (urlParts.Contains("apartment"))
                        {
                            type = "Apartment & Unit ";
                        }
                        else if (urlParts.Contains("block"))
                        {
                            type = "Block of Units ";
                        }
                        else if (urlParts.Contains("town"))
                        {
                            type = "Villa & Townhouse ";
                        }
                        else if (urlParts.Contains("business"))
                        {
                            type = "Business ";
                        }
                        else if (urlParts.Contains("rural"))
                        {
                            type = "Rural Property ";
                        }
                        else if (urlParts.Contains("commercial"))
                        {
                            type = "Commercial Property for ";
                            string urlPartsCommercial = Request.RawUrl.ToString().ToLower().TrimStart('/').Split('/').ToList()[1];
                            if (urlPartsCommercial.Contains("sale"))
                            {
                                status += "Sale ";
                            }
                            if (urlPartsCommercial.Contains("lease"))
                            {
                                status += "Lease ";
                            }
                        }

                        //Prepare status of property
                        if (!urlParts.Contains("commercial"))
                        {
                            if (urlParts.Contains("sale"))
                            {
                                status += "for Sale ";
                            }
                            if (urlParts.Contains("rent"))
                            {
                                status += "for Rent ";
                            }
                            if (urlParts.Contains("lease"))
                            {
                                status += "for Lease ";
                            }
                            if (urlParts.Contains("offer"))
                            {
                                status += "under Offer ";
                            }
                        }

                        //add additional "hypen" sign for commercial and business properties
                        if (urlParts.Contains("business") || urlParts.Contains("commercial"))
                        {
                            status += "- ";
                        }

                        //Output meta title tag
                        if (!String.IsNullOrEmpty(type) && !String.IsNullOrEmpty(status) && !String.IsNullOrEmpty(address))
                        {
                            outputMetaTitle = type + status + address + " | REIQ";
                            //MetaTitle.Text = "<meta name='title' content='" + outputMetaTitle + "' />";
                            MetaTitle.Text = "<title>" + outputMetaTitle + "</title>";
                        }

                        //Output meta description tag
                        if (!String.IsNullOrEmpty(property.descriptionLong))
                        {
                            if (property.descriptionLong.Length > 156)
                            {
                                MetaDescription.Text = "<meta name='description' content='" + property.descriptionLong.Substring(0, 156) + "' />";
                            }
                            else
                            {
                                MetaDescription.Text = "<meta name='description' content='" + property.descriptionLong + "' />";
                            }
                        }
                        else if (!String.IsNullOrEmpty(property.descriptionShort))
                        {
                            if (property.descriptionShort.Length > 156)
                            {
                                MetaDescription.Text = "<meta name='description' content='" + property.descriptionShort.Substring(0, 156) + "' />";
                            }
                            else
                            {
                                MetaDescription.Text = "<meta name='description' content='" + property.descriptionShort + "' />";
                            }
                        }
                    }
                }
            }
            #endregion

            #region Search Results
            else if (currentNode.NodeTypeAlias.ToString() == "SearchResults" || currentNode.NodeTypeAlias.ToString() == "IframeListings")
            {
                #region Url rewriting doesn't use
                //bool test = false;
                //if (test)
                if (!String.IsNullOrEmpty(Request.QueryString["st"]))
                {
                    status = Request.QueryString["st"];

                    //Exclude Sold and rented
                    if (!String.IsNullOrEmpty(Request.QueryString["ex"]))
                    {
                        if (Request.QueryString["ex"].ToString() == "1")
                        {
                            if (status == "fs")
                            {
                                status = "sa";
                            }
                            if (status == "fr")
                            {
                                status = "ra";
                            }
                        }
                    }

                    //property type selected
                    if (!String.IsNullOrEmpty(Request.QueryString["ty"]))
                    {
                        type = Request.QueryString["ty"].ToLower().Trim();
                    }

                    //determine for which action property is intended
                    forAction = GetForAction(status, type, false);

                    //format type
                    if (!String.IsNullOrEmpty(type) && type.Split(',').Length > 1)
                    {
                        type = String.Empty;
                    }

                    type = FormatTypeForMetaTitle(status, type, "search");

                    //txt parameter specified
                    if (!String.IsNullOrEmpty(Request.QueryString["txt"]) && Request.QueryString["txt"] != REIQ.usercontrols.PropertySearchBase.DefaultSearchText)
                    {
                        keyword = Request.QueryString["txt"];
                    }

                    //search region or suburb in querystring
                    if (!String.IsNullOrEmpty(type))
                    {
                        suburbOrRegion = REIQ.Access.Suburb.TryGetSuburbOrRegionFromSearchstring(keyword);
                    }

                    //format meta title
                    outputMetaTitle = FormatMetaTitle(type, status, forAction, suburbOrRegion, null);
                    //display meta title
                    //MetaTitle.Text = "<meta name='title' content='" + outputMetaTitle + "' />";
                    MetaTitle.Text = "<title>" + outputMetaTitle + "</title>";

                    //format meta description
                    outputMetaDescription = FormatMetaDescription(type, status, forAction, suburbOrRegion);
                    //display meta description
                    MetaDescription.Text = "<meta name='description' content='" + outputMetaDescription + "' />";
                }
                #endregion
                #region Url rewriting use
                else
                {
                    //string testString = "property-for-sale/brisbane-eastern-suburbs";
                    //string testString = "property-for-sale/brisbane-eastern-suburbs/yam-island";
                    //string testString = "business-for-sale/brisbane-eastern-suburbs/yam-island";
                    //string testString = "land-for-lease/brisbane-cbd/yam-island";
                    //string testString = "rental-properties/brisbane-eastern-suburbs";
                    //string testString = "rental-properties/brisbane-eastern-suburbs/yam-island";
                    //string testString = "rural-properties-for-sale/brisbane-eastern-suburbs";
                    //string testString = "rural-properties-for-sale/";
                    //string testString = "commercial-real-estate/property-for-lease/brisbane-eastern-suburbs";
                    //string testString = "commercial-real-estate/property-for-lease/brisbane-eastern-suburbs/yam-island";

                    //urlPartsArray = testString.ToLower().Trim('/').Split('/').ToList();
                    urlPartsArray = Request.RawUrl.ToString().ToLower().TrimStart('/').Split('/').ToList();

                    //commercial property (+1 url part)
                    if (urlPartsArray[0].ToString().Contains("commercial"))
                    {
                        if (urlPartsArray.Count == 2)
                        {
                            urlParts = urlPartsArray[1];
                        }
                        if (urlPartsArray.Count == 3)
                        {
                            urlParts = urlPartsArray[1];
                            region   = urlPartsArray[2];
                        }
                        else if (urlPartsArray.Count == 4)
                        {
                            urlParts = urlPartsArray[1];
                            suburb   = urlPartsArray[3];
                        }
                    }
                    else
                    {
                        //no keywords were specified
                        if (urlPartsArray.Count == 1)
                        {
                            urlParts = urlPartsArray[0];
                        }
                        //region search
                        if (urlPartsArray.Count == 2)
                        {
                            urlParts = urlPartsArray[0];
                            region   = urlPartsArray[1];
                        }
                        //suburb search
                        else if (urlPartsArray.Count == 3)
                        {
                            urlParts = urlPartsArray[0];
                            suburb   = urlPartsArray[2];
                        }
                    }

                    //get for Action
                    forAction = GetForAction(null, urlParts, true);

                    //get location
                    if (!urlPartsArray[0].ToString().Contains("commercial") && urlPartsArray.Count > 1 || urlPartsArray[0].ToString().Contains("commercial") && urlPartsArray.Count > 2)
                    {
                        List <REIQ.Entities.Suburb> allLocations = REIQ.Access.Suburb.GetAlllocations();

                        if (!String.IsNullOrEmpty(suburb))
                        {
                            List <string> suburbParts = suburb.Split('-').ToList();

                            foreach (var s in allLocations)
                            {
                                for (var i = 0; i < suburbParts.Count; i++)
                                {
                                    if (!s.name.ToLower().Contains(suburbParts[i]))
                                    {
                                        break;
                                    }
                                    else if (i == suburbParts.Count - 1)
                                    {
                                        location = s.name + ", " + s.postcode;
                                    }
                                }
                                if (!String.IsNullOrEmpty(location))
                                {
                                    break;
                                }
                            }
                        }
                        else if (!String.IsNullOrEmpty(region))
                        {
                            List <string> regionParts = region.Split('-').ToList();

                            foreach (var r in allLocations)
                            {
                                for (var i = 0; i < regionParts.Count; i++)
                                {
                                    if (!r.region.ToLower().Contains(regionParts[i]))
                                    {
                                        break;
                                    }
                                    else if (i == regionParts.Count - 1)
                                    {
                                        location = r.region;
                                    }
                                }
                                if (!String.IsNullOrEmpty(location))
                                {
                                    break;
                                }
                            }
                        }
                    }

                    //get type of property
                    if (urlPartsArray[0].ToString().Contains("commercial"))
                    {
                        type = GetPropertyType(urlParts, "search", true);
                    }
                    else
                    {
                        type = GetPropertyType(urlParts, "search", false);
                    }

                    //format meta title
                    if (urlPartsArray[0].ToString().Contains("commercial"))
                    {
                        outputMetaTitle = FormatMetaTileUrlRewrited(type, forAction, location, true);
                    }
                    else
                    {
                        outputMetaTitle = FormatMetaTileUrlRewrited(type, forAction, location, false);
                    }
                    //display meta title
                    //MetaTitle.Text = "<meta name='title' content='" + outputMetaTitle + "' />";
                    MetaTitle.Text = "<title>" + outputMetaTitle + "</title>";

                    //format meta description
                    outputMetaDescription = FormatMetaDescriptionUrlRewrited(type, forAction, location);
                    //display meta description
                    MetaDescription.Text = "<meta name='description' content='" + outputMetaDescription + "' />";
                }
                #endregion
            }
            #endregion
            else
            {
                if (currentNode.GetProperty("metaDescription") != null && !String.IsNullOrEmpty(currentNode.GetProperty("metaDescription").Value))
                {
                    MetaDescription.Text = "<meta name='description' content='" + currentNode.GetProperty("metaDescription").Value + "' />";
                }
                if (currentNode.GetProperty("metaKeywords") != null && !String.IsNullOrEmpty(currentNode.GetProperty("metaKeywords").Value))
                {
                    MetaKeywords.Text = "<meta name='keywords' content='" + currentNode.GetProperty("metaKeywords").Value + "' />";
                }
                if (currentNode.GetProperty("seoTitle") != null)
                {
                    MetaTitle.Text = "<title>" + currentNode.GetProperty("seoTitle").Value + "</title>";
                }
                else
                {
                    MetaTitle.Text = "<title>" + currentNode.GetProperty("PageName").Value + "</title>";
                }
            }
        }
    }