Пример #1
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);
            }
        }
    }
Пример #2
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>";
            }
        }
    }