70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using GeneralApi.Core.Repositories;
|
|
using Microsoft.Practices.ServiceLocation;
|
|
using Microsoft.SharePoint;
|
|
using Taloyhtio.GeneralApi.Common.Extensions;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Taloyhtio.GeneralApi.MOSS
|
|
{
|
|
public partial class BoardMembers : UserControl
|
|
{
|
|
private string VIEW_STATE_KEY_VISIBLE_PROPERTIES = "VisibleProperties";
|
|
public string VisibleProperties
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState[VIEW_STATE_KEY_VISIBLE_PROPERTIES];
|
|
}
|
|
set
|
|
{
|
|
ViewState[VIEW_STATE_KEY_VISIBLE_PROPERTIES] = value;
|
|
}
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!this.IsPostBack)
|
|
{
|
|
var condoRepository = ServiceLocator.Current.GetInstance<ICondoRepository>();
|
|
var condo = condoRepository.GetFirstByWebId(SPContext.Current.Web.ID);
|
|
|
|
// 2011-06-16 if Condo is deactivated no board members should be shown
|
|
if (condo == null || condo.Deactivated)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var boardMembersRepository = ServiceLocator.Current.GetInstance<IBoardMemberRepository>();
|
|
var boardMembers = boardMembersRepository.GetActiveByCondoName(condo.OfficialName);
|
|
if (boardMembers.IsNullOrEmpty())
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.rptBoardMembers.DataSource = boardMembers;
|
|
this.rptBoardMembers.DataBind();
|
|
}
|
|
}
|
|
|
|
protected bool IsPropertyVisible(string propertyName)
|
|
{
|
|
if (string.IsNullOrEmpty(this.VisibleProperties))
|
|
{
|
|
return false;
|
|
}
|
|
var properties = this.VisibleProperties.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
|
|
if (properties.IsNullOrEmpty())
|
|
{
|
|
return false;
|
|
}
|
|
return properties.Any(p => string.Compare(p, propertyName, true) == 0);
|
|
}
|
|
}
|
|
}
|