Ejemplo n.º 1
0
        public PageModel <ProductPreSaleInfo> GetPreSaleList(ProductPreSaleQuery preSaleQuery)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (!string.IsNullOrEmpty(preSaleQuery.ProductName))
            {
                stringBuilder.AppendFormat(" ProductName like '%{0}%'", DataHelper.CleanSearchString(preSaleQuery.ProductName));
            }
            if (preSaleQuery.PreSaleStatus > 0)
            {
                if (stringBuilder.Length > 0)
                {
                    stringBuilder.Append(" AND ");
                }
                if (preSaleQuery.PreSaleStatus.Value == 1)
                {
                    stringBuilder.Append(" PreSaleEndDate >= getdate()");
                }
                else if (preSaleQuery.PreSaleStatus.Value == 2)
                {
                    stringBuilder.Append(" PreSaleEndDate <= getdate()");
                }
            }
            return(DataHelper.PagingByRownumber <ProductPreSaleInfo>(preSaleQuery.PageIndex, preSaleQuery.PageSize, preSaleQuery.SortBy, preSaleQuery.SortOrder, preSaleQuery.IsCount, "(select A.*,B.ProductName from Hishop_ProductPreSale as A left join Hishop_Products as B ON A.ProductId=B.ProductId) as Hishop_ProductPreSale", "PreSaleId", stringBuilder.ToString(), "*"));
        }
Ejemplo n.º 2
0
        public void GetList(HttpContext context)
        {
            int num  = 1;
            int num2 = 10;

            num = base.GetIntParam(context, "page", false).Value;
            if (num < 1)
            {
                num = 1;
            }
            num2 = base.GetIntParam(context, "rows", false).Value;
            if (num2 < 1)
            {
                num2 = 10;
            }
            ProductPreSaleQuery productPreSaleQuery = new ProductPreSaleQuery();

            productPreSaleQuery.ProductName   = context.Request["ProductName"];
            productPreSaleQuery.PreSaleStatus = base.GetIntParam(context, "PreSaleStatus", true);
            productPreSaleQuery.PageIndex     = num;
            productPreSaleQuery.PageSize      = num2;
            productPreSaleQuery.SortBy        = "PreSaleId";
            productPreSaleQuery.SortOrder     = SortAction.Desc;
            DataGridViewModel <Dictionary <string, object> > dataList = this.GetDataList(productPreSaleQuery);
            string s = base.SerializeObjectToJson(dataList);

            context.Response.Write(s);
            context.Response.End();
        }
Ejemplo n.º 3
0
        private DataGridViewModel <Dictionary <string, object> > GetDataList(ProductPreSaleQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();

            if (query != null)
            {
                PageModel <ProductPreSaleInfo> preSaleList = ProductPreSaleHelper.GetPreSaleList(query);
                dataGridViewModel.rows  = new List <Dictionary <string, object> >();
                dataGridViewModel.total = preSaleList.Total;
                foreach (ProductPreSaleInfo model in preSaleList.Models)
                {
                    Dictionary <string, object> dictionary = model.ToDictionary();
                    dictionary.Add("IsPreSaleEnd", !this.IsPreSaleEnd(model.PreSaleEndDate));
                    dictionary.Add("IsPreSaleHasOrder", ProductPreSaleHelper.IsPreSaleHasOrder(model.PreSaleId));
                    dataGridViewModel.rows.Add(dictionary);
                }
            }
            return(dataGridViewModel);
        }
Ejemplo n.º 4
0
 public static PageModel <ProductPreSaleInfo> GetPreSaleList(ProductPreSaleQuery preSaleQuery)
 {
     return(new PreSaleDao().GetPreSaleList(preSaleQuery));
 }