Example #1
0
 public List<OrderEntity> SearchOrder(OrderSearchEntity searchObject)
 {
     List<OrderEntity> result = null;
     string sqlStatement = "SELECT " + Environment.NewLine +
         "[Order].OrderId," + Environment.NewLine +
         "[Order].OrderType," + Environment.NewLine +
         "[Order].BusinessId," + Environment.NewLine +
         "[Order].IndustryId," + Environment.NewLine +
         "[Order].CreatedBy," + Environment.NewLine +
         "[Order].ResponsibleBy," + Environment.NewLine +
         "[Order].OrderDate," + Environment.NewLine +
         "[Order].CreatedDate," + Environment.NewLine +
         "[Order].CompanyId," + Environment.NewLine +
         "[Order].LocationId," + Environment.NewLine +
         "[Order].CustomerCompanyId," + Environment.NewLine +
         "[Order].CustomerContactId," + Environment.NewLine +
         "[Order].OrderNumber," + Environment.NewLine +
         "[Order].Description," + Environment.NewLine +
         "[Order].OrderStatus," + Environment.NewLine +
         "Company.Description as CustomerCompanyName," + Environment.NewLine +
         "Location.Description as LocationName," + Environment.NewLine +
         "Business.Description as BusinessName," + Environment.NewLine +
         "Industry.Description as IndustryName," + Environment.NewLine +
         "Contact.FullName as CustomerContactName," + Environment.NewLine +
         "ResponsibleContact.FullName as ResponsibleContactName" + Environment.NewLine +
         "FROM [Order] join Company on [Order].CustomerCompanyId = Company.CompanyId " + Environment.NewLine +
         "left join Contact on [Order].CustomerContactId = Contact.ContactId" + Environment.NewLine +
         "left join Contact ResponsibleContact on [Order].ResponsibleBy = ResponsibleContact.ContactId" + Environment.NewLine +
         "left join Location on [Order].LocationId = Location.LocationId" + Environment.NewLine +
         "join Business on [Order].BusinessId = Business.BusinessId" + Environment.NewLine +
         "join Industry on [Order].IndustryId = Industry.IndustryId" + Environment.NewLine +
         "WHERE 1=1 " + Environment.NewLine;
     if (searchObject.SearchText != null && searchObject.SearchText.Length > 0)
     {
         sqlStatement += "AND ([Order].OrderNumber LIKE N'%" + searchObject.SearchText + "%' OR [Order].Description LIKE N'%" + searchObject.SearchText + "%')" + Environment.NewLine;
     }
     if (searchObject.BusinessId > 0)
     {
         sqlStatement += "AND [Order].BusinessId=" + searchObject.BusinessId + Environment.NewLine;
     }
     if (searchObject.IndustryId > 0)
     {
         sqlStatement += "AND [Order].IndustryId=" + searchObject.IndustryId + Environment.NewLine;
     }
     if (searchObject.OrderType > 0)
     {
         sqlStatement += "AND [Order].OrderType=" + searchObject.OrderType + Environment.NewLine;
     }
     //if (searchObject.FromOrderDate != null)
     //{
     //    sqlStatement += "AND Order.OrderDate>=" + searchObject.FromOrderDate + Environment.NewLine;
     //}
     //if (searchObject.ToOrderDate != null)
     //{
     //    sqlStatement += "AND Order.OrderDate<=" + searchObject.ToOrderDate + Environment.NewLine;
     //}
     //execute
     result = Connection.Query<OrderEntity>(sqlStatement).ToList();
     return result;
 }
Example #2
0
 public List<OrderEntity> SearchOrder(OrderSearchEntity searchObject)
 {
     //execute
     using (var db = VinaGerman.Database.VinagermanDatabase.GetDatabaseInstance())
     {
         try
         {
             db.OpenConnection();
             return db.Resolve<IOrderDB>().SearchOrder(searchObject);
         }
         finally
         {
             db.CloseConnection();
         }
     }
 }
Example #3
0
 public List<OrderEntity> SearchOrder(OrderSearchEntity searchObject)
 {
     return Factory.Resolve<IOrderBL>().SearchOrder(searchObject);
 }