Exemple #1
0
        public List<Entities.User> GetFilterListUsers(string firstName, string firstSurname, string idType, string idNum, string audience, DateTime date1, DateTime date2, string accountName, string nit, string subNit, string company, string userType, string creationDate)
        {
            try
            {
                List<Entities.Filter> listFilter = new List<CAFAM.WebPortal.Entities.Filter>();

                Entities.Filter filter = null;

                if (!string.IsNullOrEmpty(firstName))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("FirstName", firstName, CAFAM.WebPortal.Entities.EnumOperator.Like);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(firstSurname))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("FirstSurname", firstSurname, CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(idType))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("IdentificationType", idType, CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(idNum))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("IdentificationNumber", idNum, CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(audience))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("Audience", audience, CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }
                if (date1 != DateTime.MinValue)
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("BirthDate", date1, CAFAM.WebPortal.Entities.EnumOperator.LessThanOrEqual);
                    listFilter.Add(filter);
                }

                if (date2 != DateTime.MinValue)
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("BirthDate", date2, CAFAM.WebPortal.Entities.EnumOperator.GreaterThan);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(accountName))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("AccountName", string.Format("{0}:{1}", ConfigurationSettings.AppSettings["ProviderName"], accountName), CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(nit))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("NIT", nit, CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(subNit))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("SubNIT", subNit, CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(company))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("Company", company, CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(userType))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("UserType", userType, CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }
                if (!string.IsNullOrEmpty(creationDate))
                {
                    filter = new CAFAM.WebPortal.Entities.Filter("CreationDate", creationDate, CAFAM.WebPortal.Entities.EnumOperator.Equal);
                    listFilter.Add(filter);
                }

                DAO.UserDAO userDAO = new CAFAM.WebPortal.DAO.UserDAO(Web);

                return userDAO.FilterUsers(listFilter);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }