protected override void OnInit(EventArgs e) { Agent = REIQ.Access.Agent.GetFromAgentId(this.AgentId); if (Agent != null) { var propertyIds = REIQ.Access.Agent.GetPropertiesIdByAgentId(AgentId); if (propertyIds.Count() == 0) { lblNoResults.Visible = true; return; } // put the search results into request context so we can access them from the other controls base.RememberPropertyIds(propertyIds); var properties = REIQ.Access.Property.ListForDisplay(propertyIds, ParamSort, ParamPageNumber, PageSize); rptProperties.DataSource = properties; rptProperties.DataBind(); base.OnInit(e); } }
protected void rptAgent_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { REIQ.Entities.Agent agent = (REIQ.Entities.Agent)e.Item.DataItem; Literal litTeamContent = e.Item.FindControl("litTeamContent") as Literal; litTeamContent.Text = REIQ.Helpers.AgencyHelper.GetAgentDetail( agent.acID.ToString(), agent.aID.ToString(), agent.firstname + " " + agent.surname, bool.Parse(agent.hasPhoto.ToString()), agent.phone, agent.mobile, agent.email, (bool?)agent.hidemobile, Agency.suburb); } }
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); } } }
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>"; } } }