Esempio n. 1
0
        private static List <LoginBL> BuildFromTable(DataTable dtTable)
        {
            List <LoginBL> _list = new List <LoginBL>();

            if (dtTable != null)
            {
                foreach (DataRow dr in dtTable.Rows)
                {
                    LoginBL _thisMember = new LoginBL(dr);
                    _list.Add(_thisMember);
                }
            }
            return(_list);
        }
Esempio n. 2
0
        /// <summary>
        /// Get all users who are in the role of marketing user
        /// </summary>
        /// <returns></returns>
        public static List <LoginBL> GetAllMarketingUsers()
        {
            SummitDS.LoginDataTable thisTable = getAdapter().GetAllMarketingUsers();
            List <LoginBL>          _list     = new List <LoginBL>();

            if (thisTable != null && thisTable.Rows.Count > 0)
            {
                foreach (DataRow dr in thisTable.Rows)
                {
                    LoginBL _thisMember = new LoginBL(dr);
                    _list.Add(_thisMember);
                }
            }
            return(_list);
        }
Esempio n. 3
0
        public static List <LoginBL> getByEmail(String strEmail)
        {
            SummitDS.LoginDataTable thisTable = getAdapter().GetDataByEmail(strEmail);
            List <LoginBL>          _list     = new List <LoginBL>();

            if (thisTable != null && thisTable.Rows.Count > 0)
            {
                foreach (DataRow dr in thisTable.Rows)
                {
                    LoginBL _thisMember = new LoginBL(dr);
                    _list.Add(_thisMember);
                }
            }
            return(_list);
        }
Esempio n. 4
0
        public int CompareTo(LoginBL au2, String comparisonType)
        {
            String baseComparisonType = comparisonType;
            Int32  compareResult      = 0;
            Int32  descFlag           = 1; //-1 for descending, + 1 for ascending, multiply by compare result

            if (comparisonType.Contains("DESC"))
            {
                descFlag = -1;
                string[] compArr = comparisonType.Split(new Char[] { ' ' });
                if (compArr.Length > 0)
                {
                    baseComparisonType = compArr[0];
                }
            }

            switch (comparisonType)
            {
            case "strFirstNameASC":
                descFlag      = 1;
                compareResult = m_strFirstName.CompareTo(au2.m_strFirstName);
                break;

            case "strFirstNameDESC":
                descFlag      = -1;
                compareResult = m_strFirstName.CompareTo(au2.m_strFirstName);
                break;

            case "strLastNameASC":
                descFlag      = 1;
                compareResult = m_strLastName.CompareTo(au2.m_strLastName);
                break;

            case "strLastNameDESC":
                descFlag      = -1;
                compareResult = m_strLastName.CompareTo(au2.m_strLastName);
                break;


            case "strUserNameASC":
                descFlag      = 1;
                compareResult = m_strUserName.CompareTo(au2.m_strUserName);
                break;


            case "strUserNameDESC":
                descFlag      = -1;
                compareResult = m_strUserName.CompareTo(au2.m_strUserName);
                break;


            case "strEmailASC":
                descFlag      = 1;
                compareResult = strEmail.CompareTo(au2.strEmail);
                break;

            case "strEmailDESC":
                descFlag      = -1;
                compareResult = strEmail.CompareTo(au2.strEmail);
                break;

            case "strPhoneDESC":
                descFlag = -1;
                if (strPhone != null && au2.strPhone != null)
                {
                    compareResult = strPhone.CompareTo(au2.strPhone);
                }
                break;


            case "strPhoneASC":
                descFlag = 1;
                if (strPhone != null && au2.strPhone != null)
                {
                    compareResult = strPhone.CompareTo(au2.strPhone);
                }
                break;

            default:
                descFlag      = 1;
                compareResult = strFirstName.CompareTo(au2.strFirstName);
                break;
            }
            return(compareResult * descFlag); //desc flag of -1 returns negative result for descending sort
        }