Пример #1
0
        public ActionResult OrderList()
        {
            #region 获取信息

            JMP.BLL.jmp_paymode        paymodebll  = new JMP.BLL.jmp_paymode();
            List <JMP.MDL.jmp_paymode> paymodeList = paymodebll.GetModelList("1=1 and p_state='1' ");//支付类型
            ViewBag.paymodeList = paymodeList;
            #endregion
            #region 查询
            string sql  = "";
            string sql1 = "";
            //组装查询条件
            string TableName    = "";                                                                                              //表名
            string order        = "o_ptime ";                                                                                      //排序字段
            int    pageCount    = 0;
            int    pageIndexs   = string.IsNullOrEmpty(Request["pageIndexs"]) ? 1 : Int32.Parse(Request["pageIndexs"]);            //当前页
            int    PageSize     = string.IsNullOrEmpty(Request["PageSize"]) ? 20 : Int32.Parse(Request["PageSize"]);               //每页显示数量
            int    searchType   = string.IsNullOrEmpty(Request["searchType"]) ? 0 : Int32.Parse(Request["searchType"]);            //查询条件选择
            string searchname   = string.IsNullOrEmpty(Request["searchname"]) ? "" : Request["searchname"];                        //查询类容
            string stime        = string.IsNullOrEmpty(Request["stime"]) ? DateTime.Now.ToString("yyyy-MM-dd") : Request["stime"]; //开始时间
            string etime        = string.IsNullOrEmpty(Request["etime"]) ? DateTime.Now.ToString("yyyy-MM-dd") : Request["etime"]; //结束时间
            int    paymode      = string.IsNullOrEmpty(Request["paymode"]) ? 0 : Int32.Parse(Request["paymode"]);                  //支付类型
            string paymentstate = string.IsNullOrEmpty(Request["paymentstate"]) ? "1" : Request["paymentstate"];                   //支付状态
            string noticestate  = string.IsNullOrEmpty(Request["noticestate"]) ? "" : Request["noticestate"];                      //通知状态
            int    platformid   = string.IsNullOrEmpty(Request["platformid"]) ? 0 : Int32.Parse(Request["platformid"]);            //关联平台
            int    relationtype = string.IsNullOrEmpty(Request["relationtype"]) ? -1 : Int32.Parse(Request["relationtype"]);       //商户类型

            ViewBag.platformid = platformid;
            ArrayList sjfw = JMP.TOOL.WeekDateTime.WeekMonday(DateTime.Parse(stime), DateTime.Parse(etime));//根据时间返回获取每周周一组装查询语句
            for (int i = 0; i < sjfw.Count; i++)
            {
                TableName = "jmp_order_" + DateTime.Parse(sjfw[i].ToString()).ToString("yyyyMMdd");
                // TableName = "jmp_order_20161107";
                sql += " SELECT o_id,o_code,o_bizcode,o_tradeno,o_paymode_id,o_app_id,o_goodsname,o_term_key,o_price,o_payuser,o_ctime,o_ptime,o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id, o_showaddress  FROM " + TableName + " where 1=1 ";
                if (!string.IsNullOrEmpty(stime) && !string.IsNullOrEmpty(etime))
                {
                    sql += " and convert(varchar(10),o_ptime,120)>='" + stime + "' and convert(varchar(10),o_ptime,120)<='" + etime + "' ";
                }
                if (paymode > 0)
                {
                    sql += " and o_paymode_id='" + paymode + "' ";
                }
                if (!string.IsNullOrEmpty(paymentstate))
                {
                    sql += " and o_state='" + paymentstate + "' ";
                }
                if (!string.IsNullOrEmpty(noticestate))
                {
                    sql += " and o_noticestate='" + noticestate + "' ";
                }
                sql += "    UNION ALL ";
            }
            string where = "where 1=1";//组装查询条件
            if (searchType > 0 && !string.IsNullOrEmpty(searchname))
            {
                switch (searchType)
                {
                case 1:
                    where += " and a.o_code='" + searchname + "' ";
                    break;

                case 2:
                    where += " and  b.a_name='" + searchname + "'   ";
                    break;

                case 3:
                    where += " and  a.o_goodsname='" + searchname + "' ";
                    break;

                case 4:
                    where += " and e.u_realname like '%" + searchname + "%' ";
                    break;

                case 5:
                    where += " and a.o_tradeno= '" + searchname + "' ";
                    break;

                case 6:
                    where += " and a.o_bizcode= '" + searchname + "' ";
                    break;

                case 7:
                    where += " and inn.l_corporatename like '%" + searchname + "%' ";
                    break;
                }
            }
            if (platformid > 0)
            {
                where += " and b.a_platform_id=" + platformid;
            }
            if (relationtype > -1)
            {
                where += " and e.relation_type=" + relationtype;
            }


            //组装时时表数据
            sql1 = "SELECT o_id,o_code,o_bizcode,o_tradeno,o_paymode_id,o_app_id,o_goodsname,o_term_key,o_price,o_payuser,o_ctime,o_ptime,o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id, o_showaddress FROM jmp_order where 1=1";
            if (!string.IsNullOrEmpty(stime) && !string.IsNullOrEmpty(etime))
            {
                sql1 += " and convert(varchar(10),o_ptime,120)>='" + stime + "' and convert(varchar(10),o_ptime,120)<='" + etime + "' ";
            }
            if (paymode > 0)
            {
                sql1 += " and o_paymode_id='" + paymode + "' ";
            }
            if (!string.IsNullOrEmpty(paymentstate))
            {
                sql1 += " and o_state='" + paymentstate + "' ";
            }
            if (!string.IsNullOrEmpty(noticestate))
            {
                sql1 += " and o_noticestate='" + noticestate + "' ";
            }
            sql = sql + sql1;
            ViewBag.searchname   = searchname;
            ViewBag.searchType   = searchType;
            ViewBag.stime        = stime;
            ViewBag.etime        = etime;
            ViewBag.paymode      = paymode;
            ViewBag.paymentstate = paymentstate;
            ViewBag.noticestate  = noticestate;
            List <JMP.MDL.jmp_order> list     = new List <JMP.MDL.jmp_order>();
            JMP.BLL.jmp_order        orderbll = new JMP.BLL.jmp_order();
            list = orderbll.SelectPager(where, sql, order, pageIndexs, PageSize, out pageCount);
            ViewBag.pageIndexs   = pageIndexs;
            ViewBag.PageSize     = PageSize;
            ViewBag.pageCount    = pageCount;
            ViewBag.list         = list;
            ViewBag.relationtype = relationtype;
            #endregion

            return(View());
        }
Пример #2
0
        /// <summary>
        /// 订单列表
        /// </summary>
        /// <returns></returns>
        public ActionResult OrderList()
        {
            #region 获取用户实名认证状态信息

            JMP.BLL.jmp_user sm_bll   = new JMP.BLL.jmp_user();
            JMP.MDL.jmp_user sm_model = new JMP.MDL.jmp_user();

            int u_ids = UserInfo.Uid;

            //查询登录信息
            sm_model = sm_bll.GetModel(u_ids);

            ViewBag.auditstate = sm_model.u_auditstate;
            ViewBag.linkEmail  = sm_model.u_email;

            #endregion

            #region 获取信息

            JMP.BLL.jmp_paymode        paymodebll  = new JMP.BLL.jmp_paymode();
            List <JMP.MDL.jmp_paymode> paymodeList = paymodebll.GetModelList("1=1 and p_state='1' ");//支付类型
            ViewBag.paymodeList = paymodeList;
            #endregion
            #region 查询
            //string sql = " select o_id,o_code,o_bizcode,o_tradeno,o_paymode_id,o_app_id,o_goods_id,o_term_key,o_price,o_payuser,o_ctime,o_ptime,o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id,o_showaddress,b.a_key,b.a_name,c.p_name,d.g_name from (  ";//组装查询条件
            string    sql          = "";
            string    sql1         = "";
            string    TableName    = "";                                                                                              //表名
            string    order        = "o_ptime";                                                                                       //排序字段
            int       pageCount    = 0;
            int       pageIndexs   = string.IsNullOrEmpty(Request["pageIndexs"]) ? 1 : Int32.Parse(Request["pageIndexs"]);            //当前页
            int       PageSize     = string.IsNullOrEmpty(Request["PageSize"]) ? 20 : Int32.Parse(Request["PageSize"]);               //每页显示数量
            int       searchType   = string.IsNullOrEmpty(Request["searchType"]) ? 0 : Int32.Parse(Request["searchType"]);            //查询条件选择
            string    searchname   = string.IsNullOrEmpty(Request["searchname"]) ? "" : Request["searchname"];                        //查询类容
            string    stime        = string.IsNullOrEmpty(Request["stime"]) ? DateTime.Now.ToString("yyyy-MM-dd") : Request["stime"]; //开始时间
            string    etime        = string.IsNullOrEmpty(Request["etime"]) ? DateTime.Now.ToString("yyyy-MM-dd") : Request["etime"]; //结束时间
            int       paymode      = string.IsNullOrEmpty(Request["paymode"]) ? 0 : Int32.Parse(Request["paymode"]);                  //支付类型
            string    paymentstate = string.IsNullOrEmpty(Request["paymentstate"]) ? "1" : Request["paymentstate"];                   //支付状态
            string    noticestate  = string.IsNullOrEmpty(Request["noticestate"]) ? "" : Request["noticestate"];                      //通知状态
            ArrayList sjfw         = JMP.TOOL.WeekDateTime.WeekMonday(DateTime.Parse(stime), DateTime.Parse(etime));                  //根据时间返回获取每周周一组装查询语句
            string where = "where 1=1";
            for (int i = 0; i < sjfw.Count; i++)
            {
                TableName = "jmp_order_" + DateTime.Parse(sjfw[i].ToString()).ToString("yyyyMMdd");
                // TableName = "jmp_order_20161107";
                sql += " SELECT o_id,o_code,o_bizcode,o_tradeno,o_paymode_id,o_app_id,o_goodsname,o_term_key,o_price,o_payuser,o_ctime,o_ptime,o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id,o_showaddress FROM " + TableName + " where 1=1 ";
                if (!string.IsNullOrEmpty(stime) && !string.IsNullOrEmpty(etime))
                {
                    sql += " and convert(varchar(10),o_ptime,120)>='" + stime + "' and convert(varchar(10),o_ptime,120)<='" + etime + "' ";
                }
                if (paymode > 0)
                {
                    sql += " and o_paymode_id='" + paymode + "' ";
                }
                if (!string.IsNullOrEmpty(paymentstate))
                {
                    sql += " and o_state='" + paymentstate + "' ";
                }
                if (!string.IsNullOrEmpty(noticestate))
                {
                    sql += " and o_noticestate='" + noticestate + "' ";
                }
                sql += "    UNION ALL ";
            }
            if (searchType > 0 && !string.IsNullOrEmpty(searchname))
            {
                switch (searchType)
                {
                case 1:
                    where += " and a.o_code='" + searchname + "' ";
                    break;

                case 2:
                    where += " and  b.a_name='" + searchname + "'   ";
                    break;

                case 3:
                    where += " and  a.o_goodsname='" + searchname + "' ";
                    break;

                case 4:
                    where += " and a.o_tradeno= '" + searchname + "' ";
                    break;

                case 5:
                    where += " and a.o_bizcode like '%" + searchname + "%' ";
                    break;
                }
            }
            where += "and b.a_user_id='" + UserInfo.UserId + "'";
            //sql = sql.Remove(sql.Length - 10);//去掉最后一个UNION ALL
            //sql += " ) a   left join jmp_app  b on  a.o_app_id=b.a_id left join jmp_paymode c on c.p_id=a.o_paymode_id  left join jmp_goods d on d.g_id=a.o_goods_id and d.g_app_id=b.a_id and d.g_app_id=a.o_app_id where 1=1  and  " + where;
            //组装时时表数据
            sql1 = "SELECT o_id,o_code,o_bizcode,o_tradeno,o_paymode_id,o_app_id,o_goodsname,o_term_key,o_price,o_payuser,o_ctime,o_ptime,o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id, o_showaddress FROM jmp_order where 1=1";
            if (!string.IsNullOrEmpty(stime) && !string.IsNullOrEmpty(etime))
            {
                sql1 += " and convert(varchar(10),o_ptime,120)>='" + stime + "' and convert(varchar(10),o_ptime,120)<='" + etime + "' ";
            }
            if (paymode > 0)
            {
                sql1 += " and o_paymode_id='" + paymode + "' ";
            }
            if (!string.IsNullOrEmpty(paymentstate))
            {
                sql1 += " and o_state='" + paymentstate + "' ";
            }
            if (!string.IsNullOrEmpty(noticestate))
            {
                sql1 += " and o_noticestate='" + noticestate + "' ";
            }
            sql = sql + sql1;
            ViewBag.searchname   = searchname;
            ViewBag.searchType   = searchType;
            ViewBag.stime        = stime;
            ViewBag.etime        = etime;
            ViewBag.paymode      = paymode;
            ViewBag.paymentstate = paymentstate;
            ViewBag.noticestate  = noticestate;
            List <JMP.MDL.jmp_order> list     = new List <JMP.MDL.jmp_order>();
            JMP.BLL.jmp_order        orderbll = new JMP.BLL.jmp_order();
            list = orderbll.SelectPager(where, sql, order, pageIndexs, PageSize, out pageCount);
            ViewBag.pageIndexs = pageIndexs;
            ViewBag.PageSize   = PageSize;
            ViewBag.pageCount  = pageCount;
            ViewBag.list       = list;
            #endregion
            return(View());
        }