Esempio n. 1
0
        /// <summary>
        /// 得到用户统计
        /// </summary>
        /// <returns></returns>
        public ActionResult GetUsersStatList(UsersStatSearchDTO dto)
        {
            ResultData <List <UsersStatModel> > result = new ResultData <List <UsersStatModel> >();

            result = SystemProvider.GetUsersStatList(dto);

            return(Json(new { total = result.Count, rows = result.Object }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        /// <summary>
        /// 导出用户统计
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ActionResult ExportUsersStat(UsersStatSearchDTO dto)
        {
            string result = null;

            dto.page = 1;
            dto.rows = 10000000;
            List <UsersStatModel> pp = null;

            pp = SystemProvider.GetUsersStatList(dto).Object;

            string        strTemplateFile = Server.MapPath(@"~/TempLate/UsersStatTemplate.xlsx");
            string        strGenarateDir  = Server.MapPath(@"~/TempFile");
            string        strGenarateFile = Guid.NewGuid().ToString("N") + ".xlsx";
            string        strExportFile   = strGenarateDir + "\\" + strGenarateFile;
            List <object> ratelist        = new List <object>();

            pp.ForEach(g =>
            {
                Models.Model.Excel.ExcelUsersStat er = new Models.Model.Excel.ExcelUsersStat();
                er.部门   = g.DepartName;
                er.用户名称 = g.FullName;
                er.用户类型 = g.UserTypeName;
                er.手机号  = g.PhoneNumber;
                er.经销商  = g.UserDistributorstr;
                er.使用模块 = g.UseModel;
                er.使用时间 = g.UseModelTime.HasValue?g.UseModelTime.Value.ToString("yyyy-MM-dd HH:mm:ss"):null;
                ratelist.Add(er);
            });

            if (Common.ExcelHelper.Export(strTemplateFile, strGenarateDir, strGenarateFile, ratelist, "Sheet1"))
            {
                result = strGenarateFile;
            }

            return(Json(result));
        }