• 分页显示


    /// <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);
            }
        }
      
  • 相关阅读:
    java基础英语---第二天
    树莓派的版本
    Linux系统下安装.deb文件
    在Raspberry上安装ROS
    树莓派文件权限的转换
    树莓派中Linux的相关命令
    raspberry连接ssh和vnc
    链表的建立及释放
    一些小细节问题
    关于构建二维动态内存(堆)及释放
  • 原文地址:https://www.cnblogs.com/lyboke/p/10003394.html
Copyright © 2020-2023  润新知