public MssqlCondition PrepareCondition(PointProductSearchInfo searchInfo) { MssqlCondition mssqlCondition = new MssqlCondition(); mssqlCondition.Add("[Id]", searchInfo.ProductId, ConditionType.Equal); mssqlCondition.Add("[Name]", searchInfo.ProductName, ConditionType.Like); mssqlCondition.Add("[Point]", searchInfo.Point, ConditionType.Equal); mssqlCondition.Add("[BeginDate]", searchInfo.BeginDate, ConditionType.MoreOrEqual); mssqlCondition.Add("[EndDate]", searchInfo.EndDate, ConditionType.LessOrEqual); mssqlCondition.Add("[IsSale]", searchInfo.IsSale, ConditionType.Equal); mssqlCondition.Add("[BeginDate]", searchInfo.ValidDate, ConditionType.LessOrEqual); mssqlCondition.Add("[EndDate]", searchInfo.ValidDate, ConditionType.MoreOrEqual); return(mssqlCondition); }
public List <PointProductInfo> SearchList(int currentPage, int pageSize, PointProductSearchInfo searchInfo, ref int count) { using (var conn = new SqlConnection(connectString)) { ShopMssqlPagerClass pc = new ShopMssqlPagerClass(); pc.TableName = "PointProduct"; pc.Fields = "*"; pc.CurrentPage = currentPage; pc.PageSize = pageSize; pc.OrderField = "[OrderId],[Id]"; pc.OrderType = OrderType.Asc; pc.MssqlCondition = PrepareCondition(searchInfo); count = pc.Count; return(conn.Query <PointProductInfo>(pc).ToList()); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckAdminPower("ReadPointProduct", PowerCheckType.Single); string productName = RequestHelper.GetQueryString <string>("ProductName"); DateTime beginDate = RequestHelper.GetQueryString <DateTime>("BeginDate"); DateTime endDate = RequestHelper.GetQueryString <DateTime>("EndDate"); ProductName.Text = productName; BeginDate.Text = beginDate == DateTime.MinValue ? "" : beginDate.ToString("yyyy-MM-dd"); EndDate.Text = endDate == DateTime.MinValue ? "" : endDate.ToString("yyyy-MM-dd"); PointProductSearchInfo searchPointProduct = new PointProductSearchInfo(); searchPointProduct.ProductName = productName; searchPointProduct.BeginDate = beginDate; searchPointProduct.EndDate = endDate; List <PointProductInfo> pointProductInfoList = PointProductBLL.SearchList(CurrentPage, PageSize, searchPointProduct, ref Count); BindControl(pointProductInfoList, RecordList, MyPager); } }
public static List <PointProductInfo> SearchList(int currentPage, int pageSize, PointProductSearchInfo searchInfo, ref int count) { return(dal.SearchList(currentPage, pageSize, searchInfo, ref count)); }