Пример #1
0
        public OrderInfoResponse(Order_Allinfo order_Allinfo, List <Tuple <string, string> > payList, List <Tuple <string, string> > statusList)
        {
            //订单Id
            this.Id = order_Allinfo.Id;
            //总价格
            this.TotalPrice = order_Allinfo.TotalPrice;
            //支付方式
            if (order_Allinfo.PayType != null)
            {
                var payTuple = payList.Where(p => p.Item1 == order_Allinfo.PayType.Value.ToString()).FirstOrDefault();
                this.PayType = payTuple == null ? "" : payTuple.Item2;
            }
            else
            {
                this.PayType = "暂时未支付!";
            }
            //状态
            if (order_Allinfo.Status != null)
            {
                var statusTuple = statusList.Where(p => p.Item1 == order_Allinfo.Status.Value.ToString()).FirstOrDefault();
                if (statusTuple != null)
                {
                    this.Status = statusTuple.Item2;
                }
                else
                {
                    this.Status = "暂无状态!";
                }
            }
            else
            {
                this.Status = "暂无状态!";
            }
            //订单编号
            this.OrderNo = order_Allinfo.OrderNo == null ? "暂无订单!" : order_Allinfo.OrderNo;
            //下单时间
            this.OrderTime = order_Allinfo.OrderTime == null ? "暂无下单时间" : order_Allinfo.OrderTime.Value.ToString("yyyy-MM-dd HH:mm");
            //订单类型
            this.OrderType = order_Allinfo.OrderType == 1 ? "网页订单" : "手机订单";
            //用户名称
            this.Name = order_Allinfo.Name == null ? (order_Allinfo.AdminName == null ? "" : order_Allinfo.AdminName) : order_Allinfo.Name;
            //购买人姓名
            this.BuyName = order_Allinfo.BuyName;
            //地址区域
            if (order_Allinfo.Address != null)
            {
                this.AddrArea = order_Allinfo.Address;
            }
            else if (order_Allinfo.AddrArea != null && order_Allinfo.AddrDetail != null)
            {
                var arrayList = order_Allinfo.AddrArea.Split(',');
                foreach (var item in arrayList)
                {
                    this.AddrArea += item;
                }
                this.AddrArea += order_Allinfo.AddrDetail;
            }

            this.ToErp = order_Allinfo.ToErp == true ? true : false;
        }
Пример #2
0
        /// <summary>
        /// 获得订单的信息
        /// </summary>
        /// <param name="OrderId">订单Id</param>
        /// <returns></returns>
        public Tuple <Order_Allinfo, List <Order_Detail_View> > GetOrderInfo(int OrderId)
        {
            Order_Allinfo            order = Order_AllinfoOper.Instance.SelectById(OrderId);
            List <Order_Detail_View> list  = Order_Detail_ViewOper.Instance.SelectAll(new Order_Detail_View {
                OrderId = OrderId
            });

            return(new Tuple <Order_Allinfo, List <Order_Detail_View> >(item1: order, item2: list));
        }
Пример #3
0
        /// <summary>
        /// 模糊查找分页筛选数据
        /// </summary>
        /// <param name="Key">主键</param>
        /// <param name="start">开始数据</param>
        /// <param name="PageSize">页面长度</param>
        /// <param name="desc">排序</param>
        /// <param name="model">对象</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public List <Order_Allinfo> SelectByVaguePage(string Key, int start, int PageSize, bool desc, Order_Allinfo model, string SearchName)
        {
            var query = new LambdaQuery <Order_Allinfo>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.UserId.IsNullOrEmpty())
                {
                    query.Where(p => p.UserId == model.UserId);
                }
                if (!model.AddressId.IsNullOrEmpty())
                {
                    query.Where(p => p.AddressId == model.AddressId);
                }
                if (!model.TotalPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.TotalPrice == model.TotalPrice);
                }
                if (!model.PayType.IsNullOrEmpty())
                {
                    query.Where(p => p.PayType == model.PayType);
                }
                if (!model.Status.IsNullOrEmpty())
                {
                    query.Where(p => p.Status == model.Status);
                }
                if (!model.OrderNo.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderNo == model.OrderNo);
                }
                if (!model.OrderTime.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderTime == model.OrderTime);
                }
                if (!model.OrderType.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderType == model.OrderType);
                }
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name == model.Name);
                }
                if (!model.AddrArea.IsNullOrEmpty())
                {
                    query.Where(p => p.AddrArea == model.AddrArea);
                }
                if (!model.AddrDetail.IsNullOrEmpty())
                {
                    query.Where(p => p.AddrDetail == model.AddrDetail);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
                if (!model.IsAdmin.IsNullOrEmpty())
                {
                    query.Where(p => p.IsAdmin == model.IsAdmin);
                }
            }
            if (SearchName != null)
            {
                query.Where(p => p.OrderNo.Like(SearchName) || p.Name.Like(SearchName) || p.AddrArea.Like(SearchName) || p.AddrDetail.Like(SearchName));
            }
            if (Key != null)
            {
                query.OrderByKey(Key, desc);
            }
            return(query.GetQueryPageList(start, PageSize, null, null));
        }
Пример #4
0
        /// <summary>
        /// 模糊查找数据条数
        /// </summary>
        /// <param name="Key">主键</param>
        /// <param name="start">开始数据</param>
        /// <param name="PageSize">页面长度</param>
        /// <param name="desc">排序</param>
        /// <param name="model">对象</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public int SelectByVagueCount(Order_Allinfo model, string SearchName)
        {
            var query = new LambdaQuery <Order_Allinfo>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.UserId.IsNullOrEmpty())
                {
                    query.Where(p => p.UserId == model.UserId);
                }
                if (!model.AddressId.IsNullOrEmpty())
                {
                    query.Where(p => p.AddressId == model.AddressId);
                }
                if (!model.TotalPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.TotalPrice == model.TotalPrice);
                }
                if (!model.PayType.IsNullOrEmpty())
                {
                    query.Where(p => p.PayType == model.PayType);
                }
                if (!model.Status.IsNullOrEmpty())
                {
                    query.Where(p => p.Status == model.Status);
                }
                if (!model.OrderNo.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderNo == model.OrderNo);
                }
                if (!model.OrderTime.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderTime == model.OrderTime);
                }
                if (!model.OrderType.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderType == model.OrderType);
                }
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name == model.Name);
                }
                if (!model.AddrArea.IsNullOrEmpty())
                {
                    query.Where(p => p.AddrArea == model.AddrArea);
                }
                if (!model.AddrDetail.IsNullOrEmpty())
                {
                    query.Where(p => p.AddrDetail == model.AddrDetail);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
                if (!model.IsAdmin.IsNullOrEmpty())
                {
                    query.Where(p => p.IsAdmin == model.IsAdmin);
                }
            }
            if (SearchName != null)
            {
                query.Where(p => p.OrderNo.Like(SearchName) || p.Name.Like(SearchName) || p.AddrArea.Like(SearchName) || p.AddrDetail.Like(SearchName));
            }
            return(query.GetQueryCount());
        }
Пример #5
0
        /// <summary>
        /// 根据分页筛选数据
        /// </summary>
        /// <param name="Key">主键</param>
        /// <param name="start">开始数据</param>
        /// <param name="PageSize">页面长度</param>
        /// <param name="desc">排序</param>
        /// <param name="model">对象</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public List <Order_Allinfo> SelectByPage(string Key, int start, int PageSize, bool desc = true, Order_Allinfo model = null, string SelectFiled = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Order_Allinfo>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.UserId.IsNullOrEmpty())
                {
                    query.Where(p => p.UserId == model.UserId);
                }
                if (!model.AddressId.IsNullOrEmpty())
                {
                    query.Where(p => p.AddressId == model.AddressId);
                }
                if (!model.TotalPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.TotalPrice == model.TotalPrice);
                }
                if (!model.DiscountPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.DiscountPrice == model.DiscountPrice);
                }
                if (!model.DisCountResult.IsNullOrEmpty())
                {
                    query.Where(p => p.DisCountResult == model.DisCountResult);
                }
                if (!model.PayType.IsNullOrEmpty())
                {
                    query.Where(p => p.PayType == model.PayType);
                }
                if (!model.Status.IsNullOrEmpty())
                {
                    query.Where(p => p.Status == model.Status);
                }
                if (!model.OrderNo.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderNo == model.OrderNo);
                }
                if (!model.OrderTime.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderTime == model.OrderTime);
                }
                if (!model.OrderType.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderType == model.OrderType);
                }
                if (!model.BuyName.IsNullOrEmpty())
                {
                    query.Where(p => p.BuyName == model.BuyName);
                }
                if (!model.Address.IsNullOrEmpty())
                {
                    query.Where(p => p.Address == model.Address);
                }
                if (!model.Phone.IsNullOrEmpty())
                {
                    query.Where(p => p.Phone == model.Phone);
                }
                if (!model.ExpressCompany.IsNullOrEmpty())
                {
                    query.Where(p => p.ExpressCompany == model.ExpressCompany);
                }
                if (!model.ExpressNo.IsNullOrEmpty())
                {
                    query.Where(p => p.ExpressNo == model.ExpressNo);
                }
                if (!model.Invoice.IsNullOrEmpty())
                {
                    query.Where(p => p.Invoice == model.Invoice);
                }
                if (!model.InvoiceId.IsNullOrEmpty())
                {
                    query.Where(p => p.InvoiceId == model.InvoiceId);
                }
                if (!model.LastCodeTime.IsNullOrEmpty())
                {
                    query.Where(p => p.LastCodeTime == model.LastCodeTime);
                }
                if (!model.WechatFaild.IsNullOrEmpty())
                {
                    query.Where(p => p.WechatFaild == model.WechatFaild);
                }
                if (!model.ToErp.IsNullOrEmpty())
                {
                    query.Where(p => p.ToErp == model.ToErp);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
                if (!model.Freight.IsNullOrEmpty())
                {
                    query.Where(p => p.Freight == model.Freight);
                }
                if (!model.UserDesign.IsNullOrEmpty())
                {
                    query.Where(p => p.UserDesign == model.UserDesign);
                }
                if (!model.IsAdmin.IsNullOrEmpty())
                {
                    query.Where(p => p.IsAdmin == model.IsAdmin);
                }
                if (!model.AdminName.IsNullOrEmpty())
                {
                    query.Where(p => p.AdminName == model.AdminName);
                }
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name == model.Name);
                }
                if (!model.AddrArea.IsNullOrEmpty())
                {
                    query.Where(p => p.AddrArea == model.AddrArea);
                }
                if (!model.AddrDetail.IsNullOrEmpty())
                {
                    query.Where(p => p.AddrDetail == model.AddrDetail);
                }
            }
            if (SelectFiled != null)
            {
                SelectFiled = SelectFiled.ToLowerInvariant();
                if (SelectFiled.Contains("id,"))
                {
                    query.Select(p => new { p.Id });
                }
                if (SelectFiled.Contains("userid,"))
                {
                    query.Select(p => new { p.UserId });
                }
                if (SelectFiled.Contains("addressid,"))
                {
                    query.Select(p => new { p.AddressId });
                }
                if (SelectFiled.Contains("totalprice,"))
                {
                    query.Select(p => new { p.TotalPrice });
                }
                if (SelectFiled.Contains("discountprice,"))
                {
                    query.Select(p => new { p.DiscountPrice });
                }
                if (SelectFiled.Contains("discountresult,"))
                {
                    query.Select(p => new { p.DisCountResult });
                }
                if (SelectFiled.Contains("paytype,"))
                {
                    query.Select(p => new { p.PayType });
                }
                if (SelectFiled.Contains("status,"))
                {
                    query.Select(p => new { p.Status });
                }
                if (SelectFiled.Contains("orderno,"))
                {
                    query.Select(p => new { p.OrderNo });
                }
                if (SelectFiled.Contains("ordertime,"))
                {
                    query.Select(p => new { p.OrderTime });
                }
                if (SelectFiled.Contains("ordertype,"))
                {
                    query.Select(p => new { p.OrderType });
                }
                if (SelectFiled.Contains("buyname,"))
                {
                    query.Select(p => new { p.BuyName });
                }
                if (SelectFiled.Contains("address,"))
                {
                    query.Select(p => new { p.Address });
                }
                if (SelectFiled.Contains("phone,"))
                {
                    query.Select(p => new { p.Phone });
                }
                if (SelectFiled.Contains("expresscompany,"))
                {
                    query.Select(p => new { p.ExpressCompany });
                }
                if (SelectFiled.Contains("expressno,"))
                {
                    query.Select(p => new { p.ExpressNo });
                }
                if (SelectFiled.Contains("invoice,"))
                {
                    query.Select(p => new { p.Invoice });
                }
                if (SelectFiled.Contains("invoiceid,"))
                {
                    query.Select(p => new { p.InvoiceId });
                }
                if (SelectFiled.Contains("lastcodetime,"))
                {
                    query.Select(p => new { p.LastCodeTime });
                }
                if (SelectFiled.Contains("wechatfaild,"))
                {
                    query.Select(p => new { p.WechatFaild });
                }
                if (SelectFiled.Contains("toerp,"))
                {
                    query.Select(p => new { p.ToErp });
                }
                if (SelectFiled.Contains("isdelete,"))
                {
                    query.Select(p => new { p.IsDelete });
                }
                if (SelectFiled.Contains("freight,"))
                {
                    query.Select(p => new { p.Freight });
                }
                if (SelectFiled.Contains("userdesign,"))
                {
                    query.Select(p => new { p.UserDesign });
                }
                if (SelectFiled.Contains("isadmin,"))
                {
                    query.Select(p => new { p.IsAdmin });
                }
                if (SelectFiled.Contains("adminname,"))
                {
                    query.Select(p => new { p.AdminName });
                }
                if (SelectFiled.Contains("name,"))
                {
                    query.Select(p => new { p.Name });
                }
                if (SelectFiled.Contains("addrarea,"))
                {
                    query.Select(p => new { p.AddrArea });
                }
                if (SelectFiled.Contains("addrdetail,"))
                {
                    query.Select(p => new { p.AddrDetail });
                }
            }
            if (Key != null)
            {
                query.OrderByKey(Key, desc);
            }
            return(query.GetQueryPageList(start, PageSize, connection, transaction));
        }
Пример #6
0
        /// <summary>
        /// 数据条数
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public int SelectCount(Order_Allinfo model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Order_Allinfo>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.UserId.IsNullOrEmpty())
                {
                    query.Where(p => p.UserId == model.UserId);
                }
                if (!model.AddressId.IsNullOrEmpty())
                {
                    query.Where(p => p.AddressId == model.AddressId);
                }
                if (!model.TotalPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.TotalPrice == model.TotalPrice);
                }
                if (!model.DiscountPrice.IsNullOrEmpty())
                {
                    query.Where(p => p.DiscountPrice == model.DiscountPrice);
                }
                if (!model.DisCountResult.IsNullOrEmpty())
                {
                    query.Where(p => p.DisCountResult == model.DisCountResult);
                }
                if (!model.PayType.IsNullOrEmpty())
                {
                    query.Where(p => p.PayType == model.PayType);
                }
                if (!model.Status.IsNullOrEmpty())
                {
                    query.Where(p => p.Status == model.Status);
                }
                if (!model.OrderNo.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderNo == model.OrderNo);
                }
                if (!model.OrderTime.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderTime == model.OrderTime);
                }
                if (!model.OrderType.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderType == model.OrderType);
                }
                if (!model.BuyName.IsNullOrEmpty())
                {
                    query.Where(p => p.BuyName == model.BuyName);
                }
                if (!model.Address.IsNullOrEmpty())
                {
                    query.Where(p => p.Address == model.Address);
                }
                if (!model.Phone.IsNullOrEmpty())
                {
                    query.Where(p => p.Phone == model.Phone);
                }
                if (!model.ExpressCompany.IsNullOrEmpty())
                {
                    query.Where(p => p.ExpressCompany == model.ExpressCompany);
                }
                if (!model.ExpressNo.IsNullOrEmpty())
                {
                    query.Where(p => p.ExpressNo == model.ExpressNo);
                }
                if (!model.Invoice.IsNullOrEmpty())
                {
                    query.Where(p => p.Invoice == model.Invoice);
                }
                if (!model.InvoiceId.IsNullOrEmpty())
                {
                    query.Where(p => p.InvoiceId == model.InvoiceId);
                }
                if (!model.LastCodeTime.IsNullOrEmpty())
                {
                    query.Where(p => p.LastCodeTime == model.LastCodeTime);
                }
                if (!model.WechatFaild.IsNullOrEmpty())
                {
                    query.Where(p => p.WechatFaild == model.WechatFaild);
                }
                if (!model.ToErp.IsNullOrEmpty())
                {
                    query.Where(p => p.ToErp == model.ToErp);
                }
                if (!model.IsDelete.IsNullOrEmpty())
                {
                    query.Where(p => p.IsDelete == model.IsDelete);
                }
                if (!model.Freight.IsNullOrEmpty())
                {
                    query.Where(p => p.Freight == model.Freight);
                }
                if (!model.UserDesign.IsNullOrEmpty())
                {
                    query.Where(p => p.UserDesign == model.UserDesign);
                }
                if (!model.IsAdmin.IsNullOrEmpty())
                {
                    query.Where(p => p.IsAdmin == model.IsAdmin);
                }
                if (!model.AdminName.IsNullOrEmpty())
                {
                    query.Where(p => p.AdminName == model.AdminName);
                }
                if (!model.Name.IsNullOrEmpty())
                {
                    query.Where(p => p.Name == model.Name);
                }
                if (!model.AddrArea.IsNullOrEmpty())
                {
                    query.Where(p => p.AddrArea == model.AddrArea);
                }
                if (!model.AddrDetail.IsNullOrEmpty())
                {
                    query.Where(p => p.AddrDetail == model.AddrDetail);
                }
            }
            return(query.GetQueryCount(connection, transaction));
        }
Пример #7
0
 /// <summary>
 /// 根据分页筛选数据
 /// </summary>
 /// <param name="Key">主键</param>
 /// <param name="start">开始数据</param>
 /// <param name="PageSize">页面长度</param>
 /// <param name="desc">排序</param>
 /// <param name="model">对象</param>
 /// <returns>对象列表</returns>
 public List <Order_Allinfo> SelectByPage(string Key, int start, int PageSize, bool desc, Order_Allinfo model, string SelectFiled)
 {
     return(Order_AllinfoOper.Instance.SelectByPage(Key, start, PageSize, desc, model));
 }
Пример #8
0
 /// <summary>
 /// 数据条数
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>对象列表</returns>
 public int SelectCount(Order_Allinfo model)
 {
     return(Order_AllinfoOper.Instance.SelectCount(model));
 }
Пример #9
0
 /// <summary>
 /// 筛选全部数据
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>对象列表</returns>
 public List <Order_Allinfo> SelectByModel(Order_Allinfo model)
 {
     return(Order_AllinfoOper.Instance.SelectAll(model));
 }