namespace Repositories
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Data;
    using System.Reflection;
    using MvcApplication1.Models;

    public class OrganizationUsersRepository
    {
        public static IList<OrganizationsAdmined> GetOrganizationsAdmined(Guid userId, int pageIndex, int pageSize)
        {
            //IOrganizationUsersService _organizationUsersService = ServiceProxyFactory.Create<IOrganizationUsersService>("OrganizationUsersService");

            //DataSet result = _organizationUsersService.GetOrganizationsAdmined(UserId,pageIndex, pageSize);

            //if (result.Tables[0].Rows.Count == 0)
            //{
            //    return null;
            //}
            //else
            //{
            //    List<OrganizationsAdmined> myList = (List<OrganizationsAdmined>)DataSetListConverter.DataSetToIList<OrganizationsAdmined>(result, 0);
            //    return myList;
            //}
            List<OrganizationsAdmined> myList = new List<OrganizationsAdmined>();
            myList.Add(new OrganizationsAdmined 
            { 
                 OrganizationId =Guid.NewGuid(),
                 OrganizationName ="Test1",
                 UserId =userId
            });

            myList.Add(new OrganizationsAdmined
            {
                OrganizationId = Guid.NewGuid(),
                OrganizationName = "Test2",
                UserId = userId
            });

            return myList;
        }

        public static IList<OrganizationUser> GetOrganizationAdministrators(Guid OrganizationId, int pageIndex, int pageSize)
        {
            //IOrganizationUsersService _organizationUsersService = ServiceProxyFactory.Create<IOrganizationUsersService>("OrganizationUsersService");

            //DataSet result = _organizationUsersService.GetOrganizationAdministrators(OrganizationId, pageIndex, pageSize);

            //if (result.Tables[0].Rows.Count == 0)
            //{
            //    OrganizationUser _default = new OrganizationUser
            //    {
            //        UserName = "No administrator defined Yet"
            //    };
            //    List<OrganizationUser> myList = new List<OrganizationUser>();
            //    myList.Add(_default);
            //    return myList;
            //}
            //else
            //{
            //    List<OrganizationUser> myList = (List<OrganizationUser>)DataSetListConverter.DataSetToIList<OrganizationUser>(result, 0);
            //    return myList;
            //}
            List<OrganizationUser> myList = new List<OrganizationUser>();
            myList.Add(new OrganizationUser
            {
                ID = Guid.NewGuid(),
                UserId = Guid.NewGuid(),
                UserName = "User1",
                Email = "hhh@abc.com",
                OrganizationId = OrganizationId,
                OrganizationRole = "Administrator"


            });

            myList.Add(new OrganizationUser
            {
                ID = Guid.NewGuid(),
                UserId = Guid.NewGuid(),
                UserName = "User2",
                Email = "mmm@abc.com",
                OrganizationId = OrganizationId,
                OrganizationRole = "AccountAdministrator"


            });
            return myList;

        }

    }
}
