public SupplierList(string message = "", SupplierFilter filter = null) { Data = new List <SupplierInfo>(); Filter = filter != null ? filter : new SupplierFilter(); Message = message; }
public static SupplierList Find(int userID, int employeeID, int bussinessID, string message = "", SupplierFilter filter = null, bool log = false) { QueryOutput queryResult; var conditions = new List <string>(); if (filter != null) { if (!String.IsNullOrEmpty(filter.Address)) { conditions.Add(String.Format("and Address like N'%{0}%'", filter.Address)); } if (!String.IsNullOrEmpty(filter.Name)) { conditions.Add(String.Format("and Name like N'%{0}%'", filter.Name)); } if (!String.IsNullOrEmpty(filter.Phone)) { conditions.Add(String.Format("and Phone like N'%{0}%'", filter.Phone)); } } var result = new SupplierList(message, filter); result.Data = Query <SupplierInfo>(new DbQuery(userID, employeeID, DbAction.Supplier.View, String.Format("select * from Supplier where Status = 'active' and BussinessID = {0} {1} order by Name", bussinessID, String.Join(" ", conditions)), log), out queryResult); return(result); }