コード例 #1
0
        public static UserOrders GetUserOrderDetail(string ordercode)
        {
            DataTable  dt    = UserOrdersDAL.BaseProvider.GetUserOrderDetail(ordercode);
            UserOrders model = null;

            if (dt.Rows.Count == 1)
            {
                model = new UserOrders();
                model.FillData(dt.Rows[0]);
            }
            return(model);
        }
コード例 #2
0
        public static List <UserOrders> GetUserOrders(string keyWords, string userid, int type, int status, int payway, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string begintime = "", string endtime = "")
        {
            string tablename = "UserOrders  a left join M_Users b  on a.UserID =b.UserID ";
            string sqlwhere  = " a.status<>9 ";

            if (!string.IsNullOrEmpty(keyWords))
            {
                sqlwhere += " and (b.UserName like '%" + keyWords + "%' or a.BankName like '%" + keyWords + "%' or a.OrderCode like '%" + keyWords + "%'  or a.Sku like '%" + keyWords + "%' or a.OtherCode like '%" + keyWords + "%')";
            }
            if (type > -1)
            {
                sqlwhere += " and a.Type=" + type;
            }
            if (status > -1)
            {
                sqlwhere += " and a.status=" + status;
            }
            if (payway > -1)
            {
                sqlwhere += " and a.PayType=" + payway;
            }
            if (!string.IsNullOrEmpty(userid))
            {
                sqlwhere += " and a.UserID='" + userid + "' ";
            }
            if (!string.IsNullOrEmpty(begintime))
            {
                sqlwhere += " and a.CreateTime>='" + begintime + " 00:00:00'";
            }
            if (!string.IsNullOrEmpty(endtime))
            {
                sqlwhere += " and a.CreateTime<'" + endtime + " 23:59:59:999'";
            }
            DataTable         dt   = CommonBusiness.GetPagerData(tablename, "a.*,b.UserName ", sqlwhere, "a.AutoID ", pageSize, pageIndex, out totalCount, out pageCount);
            List <UserOrders> list = new List <UserOrders>();

            foreach (DataRow dr in dt.Rows)
            {
                UserOrders model = new UserOrders();
                model.FillData(dr);
                list.Add(model);
            }
            return(list);
        }