示例#1
0
 public List <object> SelectAll(object[] obj)
 {
     using (EFContext Context = new EFContext())
     {
         string str       = obj[0].ToString();
         int    PageIndex = IsNumber.IsNum(obj[1].ToString()) ? int.Parse(obj[1].ToString()) : 1;
         int    PageSize  = IsNumber.IsNum(obj[2].ToString()) ? int.Parse(obj[3].ToString()) : 10;
         var    list      = (from a in Context.Courier
                             join b in Context.OrderInfo
                             on a.OID equals b.OrderId
                             orderby a.CourierId descending
                             select new
         {
             CourierId = a.CourierId,
             CourierNum = a.CourierNum,
             OrderId = b.OrderId,
             OTGName = b.OTGName,
             OTGPhone = b.OTGPhone,
             OTGAddress = b.OTGAddress,
             OrderNum = b.OrderNum,
             BuyGoodsAndSum = b.BuyGoodsAndSum
         }).Where(m => str == "" ? true : m.CourierNum == str || m.OTGName == str || m.OTGPhone == str || m.OTGAddress.Contains(str) || m.OrderNum == str || m.BuyGoodsAndSum.Contains(str)).Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();
         List <object> olist = new List <object>();
         foreach (var item in list)
         {
             olist.Add(item);
         }
         return(olist);
     }
 }
示例#2
0
        /// <summary>
        /// 查询所有商品
        /// </summary>
        /// <returns></returns>
        public List <object> SelectAll(object[] obj)
        {
            string str       = obj[0].ToString();
            int    IndexPage = IsNumber.IsNum(obj[1].ToString()) ? int.Parse(obj[1].ToString()) : 1;
            int    IndexSize = IsNumber.IsNum(obj[2].ToString()) ? int.Parse(obj[2].ToString()) : 10;
            int    state     = IsNumber.IsNum(obj[3].ToString()) ? int.Parse(obj[3].ToString()) : 1;

            using (EFContext Context = new EFContext())
            {
                var goods = (from s in Context.GoodsInfo
                             join b in Context.GoodType
                             on s.GTID equals b.GoodTypeId
                             orderby s.GoodId descending
                             where s.GoodState.Equals(state)
                             select new
                {
                    s.GoodId,
                    s.GoodPhotoPath,
                    s.GoodName,
                    s.GoodInfo,
                    s.GoodSellSum,
                    s.GoodSum,
                    s.GoodPrice,
                    b.GoodTypeName,
                    s.GoodState,
                    href = "/detail/" + s.GoodId
                }).Where(m => str == "" ? true : m.GoodName.Contains(str) || m.GoodInfo.Contains(str) || m.GoodTypeName == str).Skip((IndexPage - 1) * IndexSize).Take(IndexSize).ToList();
                List <object> data = new List <object>();
                foreach (var item in goods)
                {
                    data.Add(item);
                }
                return(data);
            }
        }
示例#3
0
        /// <summary>
        /// 返回所有用户信息
        /// </summary>
        /// <param name="obj">参数数组(string 查询关键字,int 页码,int 记录数 )</param>
        /// <returns></returns>
        public List <object> SelectAll(object[] obj)
        {
            string str       = obj[0].ToString();
            int    PageIndex = IsNumber.IsNum(obj[1].ToString()) ? int.Parse(obj[1].ToString()) : 1;
            int    PageSize  = IsNumber.IsNum(obj[2].ToString()) ? int.Parse(obj[2].ToString()) : 10;

            using (EFContext Context = new EFContext())
            {
                var users = (from s in Context.UserInfo
                             join b in Context.TakeGoodsInfo
                             on s.UserId equals b.UID into joinleft
                             from b in joinleft.DefaultIfEmpty()
                             orderby s.UserId descending
                             select new
                {
                    UserAccount = s.UserAccount,
                    PhotoPath = s.PhotoPath,
                    UserName = s.UserName,
                    PhoneNumber = s.PhoneNumber,
                    Email = s.Email,
                    TGName = b.TGName,
                    TGAddress = b.TGAddress,
                    TGPhone = b.TGPhone
                }).Where(m => str == "" ? true : m.UserAccount == str || m.UserName == str || m.PhoneNumber == str || m.Email == str || m.TGName == str || m.TGPhone == str || m.TGAddress.Contains(str)).Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();
                List <object> data = new List <object>();
                foreach (var item in users)
                {
                    data.Add(item);
                }
                return(data);
            }
        }
示例#4
0
 public List <object> SelectAll(object[] obj)
 {
     using (EFContext Context = new EFContext())
     {
         string str       = obj[0].ToString();
         int    IndexPage = IsNumber.IsNum(obj[1].ToString()) ? int.Parse(obj[1].ToString()) : 1;
         int    IndexSize = IsNumber.IsNum(obj[2].ToString()) ? int.Parse(obj[2].ToString()) : 10;
         int    state     = IsNumber.IsNum(obj[3].ToString()) ? int.Parse(obj[3].ToString()) : 1;
         var    list      = (from a in Context.OrderInfo
                             orderby a.OrderId descending
                             select a).Where(m => str == "" ? true : m.OTGAddress.Contains(str) || m.BuyGoodsAndSum.Contains(str) || m.OrderNum == str || m.OTGPhone == str).Where(m => m.OrderState == state).ToList();
         List <object> data = new List <object>();
         foreach (var item in list)
         {
             data.Add(item);
         }
         return(data);
     }
 }