using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using digioz;

/// <summary>
/// Summary description for MembersManagement
/// </summary>
public class MembersManagement
{
    private static PortalSettings coPortalSettings;
    private const string SQL_MEMBERS_P = "spSelectMembers";

    public static MembersList GetMembersList()
    {
        MembersList loMembersList = new MembersList();
        coPortalSettings = PortalSettingsManagement.GetPortalSettings();

        if (coPortalSettings.DBRelational == true)
        {
            Members loMember;
            IDataRelational loDB = DataFactory.GetDataObject(coPortalSettings);
            DataTable loMembers = null;

            loDB.openConnection();
            loMembers = loDB.QueryDBDataset(SQL_MEMBERS_P);
            loDB.closeConnection();

            foreach (DataRow loDR in loMembers.Rows)
            {
                loMember = new Members();
                loMember.ID = loDR["profile_id"].ToString();
                loMember.UserName = loDR["profile_username"].ToString();
                loMember.Avatar = loDR["profile_avatar"].ToString();
                loMember.Picturs = loDR["picture_cnt"].ToString();
                loMember.Videos = loDR["video_cnt"].ToString();
                loMember.FormPosts = loDR["post_cnt"].ToString();
                loMember.Status = loDR["user_online"].ToString();

                loMembersList.Add(loMember);
            }
        }
        return loMembersList;
    }
}
