Beispiel #1
0
 public List<CompanyEntity> SearchCompanies(CompanySearchEntity searchObject)
 {
     //execute
     using (var db = VinaGerman.Database.VinagermanDatabase.GetDatabaseInstance())
     {
         try
         {
             db.OpenConnection();
             return db.Resolve<ICompanyDB>().SearchCompanies(searchObject);
         }
         finally
         {
             db.CloseConnection();
         }
     }
 }
Beispiel #2
0
        public List<CompanyEntity> SearchCompanies(CompanySearchEntity searchObject)
        {
            List<CompanyEntity> result = null;
            string sqlStatement = "SELECT TOP 100  " + Environment.NewLine +
                "Company.CompanyId," + Environment.NewLine +
                "Company.CompanyOwner," + Environment.NewLine +
                "Company.Description," + Environment.NewLine +
                "Company.Deleted," + Environment.NewLine +
                "Company.Address," + Environment.NewLine +
                "Company.CompanyCode," + Environment.NewLine +
                "Company.TaxCode," + Environment.NewLine +
                "Company.Website," + Environment.NewLine +
                "Company.Phone," + Environment.NewLine +
                "Company.IsSupplier," + Environment.NewLine +
                "Company.IsCustomer" + Environment.NewLine +
                "FROM Company " + Environment.NewLine +
                "WHERE Deleted=0 " + Environment.NewLine;

            if (searchObject.IsCustomer)
            {
                sqlStatement += "AND IsCustomer=" + (searchObject.IsCustomer ? 1 : 0) + Environment.NewLine;
            }

            if (searchObject.IsSupplier)
            {
                sqlStatement += "AND IsSupplier=" + (searchObject.IsSupplier ? 1 : 0) + Environment.NewLine;
            }

            if (searchObject.SearchText != null && searchObject.SearchText.Length > 0)
            {
                sqlStatement += "AND (Description LIKE N'%" + searchObject.SearchText + "%' OR TaxCode LIKE N'%" + searchObject.SearchText + "%' OR Phone LIKE N'%" + searchObject.SearchText + "%' OR CompanyCode LIKE N'%" + searchObject.SearchText + "%')" + Environment.NewLine;
            }

            if (searchObject.NotIncludedCompany > 0)
            {
                sqlStatement += "AND CompanyId <>" + searchObject.NotIncludedCompany + Environment.NewLine;
            }

            //execute
            result = Connection.Query<CompanyEntity>(sqlStatement, null, Transaction).ToList();
            return result;
        }
Beispiel #3
0
 public List<CompanyEntity> SearchCompanies(CompanySearchEntity searchObject)
 {
     return Factory.Resolve<ICompanyBL>().SearchCompanies(searchObject);
 }