• 分页显示


    /// <summary>
            /// 分页显示
            /// </summary>
            /// <returns></returns>
            public object getShopping(string shopName,int addresName=0,int addresHome=0,int pageIndex=1,int pageSize=4)
            {
                Page page = new Page();
                var getShoppings= Context.shops.ToList();
                if (shopName != null)
                {
                    getShoppings = getShoppings.Where(r => r.ShopName.Contains(shopName)).ToList();
                }
                if (addresName != 0)
                {
                    getShoppings = getShoppings.Where(r => r.ShopSheng.Equals(addresName)).ToList();
                }
                if (addresHome != 0)
                {
                    getShoppings = getShoppings.Where(r => r.ShopHome.Equals(addresHome)).ToList();
                }
                page.RowCount = getShoppings.Count;
                page.PageCount = getShoppings.Count / pageSize + (getShoppings.Count % pageSize == 0 ? 0 : 1);
                page.Data = getShoppings.Skip((pageIndex-1)*pageSize).Take(pageSize);
                return page;
            }

      $.ajax({
                    url: "http://localhost:8889/OrderFormApi/getShopping",
                    type: "get",
                    data: {
                        shopName: $("input[name=ShopName]").val(),
                        addresName: $("select[name=ShopSheng]").val(),
                        addresHome: $("select[name=ShopHome]").val(),
                        pageIndex: pageIndex,
                        pageSize: pageSize,
                    },
                    success: function (data) {
                        $("#tab").children().children().not(":first").remove(); console.log(data)
                        pageCount = data.PageCount;
                        $(data.Data).each(function (index, data) {
                            var aaa = data.ShopPrice * data.ShopCount;
                            $("#tab").append("<tr><td><input name='checkbox' type='checkbox'value='" + data.ShopID + "' /></td><td>" + data.ShopID + "</td> <td><img style='50px;height:45px' src=" + data.ShopImages + "></td> <td>" + data.ShopName + "</td> <td>" + data.ShopNumber + "</td> <td>" + data.ShopPrice + "</td> <td>" + data.ShopCount + "</td> <td>" + aaa + "¥</td> <td>  </td> <td>" + data.ShopSheng + "</td> <td>" + data.ShopHome + "</td>  <td><a onclick=' DelShopping(" + data.ShopID + ")'>✖</a>&nbsp&nbsp&nbsp<a href='/OrderForm/UptShopping?ID=" + data.ShopID + "'>✎</a> </td></tr>");
                        })
                    }
                })

    ==工厂
     using System.Configuration;
        using System.Reflection;//反射
        public class _工厂泛型反射<T> where T:class
        {
        
            public static T getStudent(string Sname)
            {
                //通过Asssembly程序集的Load方法加载 命名空间,用 CreateInstance 方法加载命名空间下的一个类
                return (T)Assembly.Load("DAL").CreateInstance("DAL." + Sname);
            }
        }
      
  • 相关阅读:
    MySql主从库配置
    Linux安装MySql5.6.43(亲测)
    Linux安装ffmpeg(亲测)
    Linux JDK安装(亲测)
    Linux磁盘挂载(亲测)
    Finance_CAPM&APT
    Python_QT_量化投资/量化交易 基础入门课
    581. Shortest Unsorted Continuous Subarray
    3. Longest Substring Without Repeating Characters
    239. Sliding Window Maximum
  • 原文地址:https://www.cnblogs.com/lyboke/p/10003394.html
Copyright © 2020-2023  润新知