示例#1
0
        public ActionResult GetUserPages2(C_WxUserShowVM.Condition condition)
        {
            string where = StrWhere(condition);

            PageJsonModel <C_WxUserShowVM> page = new PageJsonModel <C_WxUserShowVM>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = @"(select a.ID,a.UserName,a.IsValid,a.NickName,a.Mobile,a.Grade,a.TrueName,
                                a.WxNo,a.DatRegister,a.Email,a.PortraitUrl,wx.openid wx_openid,
                                wx.nickname wx_nickname,wx.sex wx_sex,wx.headimgurl wx_headimgurl,wx.remark wx_remark,
                                wx.groupid wx_groupid,wx.subscribe wx_subscribe,wx.subscribe_time wx_subscribe_time,
                                wx.country wx_country,wx.language wx_language 
                                from C_WxUser as a left join C_UserWxInfo as wx on a.UserName=wx.C_UserName) as userwxvm";
            page.strSelect = "*";
            page.strWhere  = where + " and Email<>''";
            if (string.IsNullOrWhiteSpace(condition.orderby) == false)
            {
                page.strOrder = Common.FilteSQLStr(condition.orderby);
            }
            else
            {
                page.strOrder = "ID desc";
            }

            page.LoadList();

            return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <returns></returns>
        public FileResult ExportExcel(C_WxUserShowVM.Condition condition)
        {
            StringBuilder where = new StringBuilder();
            where.Append("select UserName,NickName,TrueName,Mobile from [C_WxUser] where 1=1 ");
            where.Append(StrWhere(condition));
            DataTable dt = ExportWay.ExcelDataTable(where.ToString());

            string[] list = { "用户账号", "昵称", "姓名", "电话" };
            return(File(ExportWay.GetExcel(dt, list), "application/vnd.ms-excel", "客户" + DateTime.Now.ToShortTimeString() + ".xls"));
        }
示例#3
0
        private string StrWhere(C_WxUserShowVM.Condition condition)
        {
            string where = string.Empty;
            //客户ID
            if (!string.IsNullOrWhiteSpace(condition.UserName))
            {
                where += " and UserName like '%" + Common.Filter(condition.UserName) + "%' ";
            }
            //微信关注状态
            if (!string.IsNullOrWhiteSpace(condition.wx_subscribeStat))
            {
                if (condition.wx_subscribeStat == "1")
                {
                    where += " and wx_subscribe=1 ";
                }
                else if (condition.wx_subscribeStat == "0")
                {
                    where += " and (wx_subscribe is null or wx_subscribe=0) ";
                }
            }
            //客户微信昵称
            if (!string.IsNullOrWhiteSpace(condition.wx_nickname))
            {
                condition.wx_nickname = Common.Filter(condition.wx_nickname);
                where += " and (wx_nickname like '%" + condition.wx_nickname + "%' or NickName like '%" + condition.wx_nickname + "%') ";
            }
            //关键字搜索
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                condition.keyword = Common.Filter(condition.keyword);
                where            += string.Format(@" and (wx_nickname like '%{0}%' or NickName like '%{0}%' or UserName like '%{0}%') ", condition.keyword);
            }

            if (!string.IsNullOrWhiteSpace(condition.DatCreateB))
            {
                where += string.Format(" and wx_subscribe_time >='{0} 00:00:00' ", Common.Filter(condition.DatCreateB));
            }
            if (!string.IsNullOrWhiteSpace(condition.DatCreateE))
            {
                where += string.Format(" and wx_subscribe_time <'{0} 23:59:59' ", Common.Filter(condition.DatCreateE));
            }
            return(where);
        }