/// <summary> /// 数据导出 /// </summary> public void ExportExcel([DefaultValue(-1)] int Stuts, string keywords, string ProvinceId, string CityId, string CountyId) { Am_CollectorBll bll = new Am_CollectorBll(); var ListData = bll.GetPageList(keywords, Stuts, ProvinceId, CityId, CountyId); var newlist = new List <Am_CollectorNew>(); foreach (var item in ListData) { var model = new Am_CollectorNew(); model.Address = item.Address; model.AmCount = item.AmCount.ToString(); model.City = item.City; model.CollectorCode = item.CollectorCode; model.County = item.County; model.CreateTime = item.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); model.LastConnectTime = item.LastConnectTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); model.Province = item.Province; model.Remark = GetDays(item.LastConnectTime.Value) + "天"; model.StatusStr = item.StatusStr; model.URealName = item.URealName; model.UserName = item.UserName; newlist.Add(model); } string[] columns = new string[] { "业主帐号:UserName", "业主姓名:URealName", "采集器编号:CollectorCode", "省:Province", "市:City", "区:County", "地址:Address", "状态:StatusStr", "电表数:AmCount", "创建时间:CreateTime", "上次连接:LastConnectTime", "累积在线时间:Remark" }; DeriveExcel.ListToExcel <Am_CollectorNew>(newlist, columns, "会员数据" + DateTime.Now.ToString("yyyyMMddHHmmss")); }
/// <summary> /// 搜索 /// </summary> /// <returns></returns> public ActionResult GridPageListJson(JqGridParam jqgridparam, string keywords, [DefaultValue(-1)] int Stuts, string ProvinceId, string CityId, string CountyId) { try { Stopwatch watch = CommonHelper.TimerStart(); Am_CollectorBll bll = new Am_CollectorBll(); var ListData = bll.GetPageList(ref jqgridparam, keywords, Stuts, ProvinceId, CityId, CountyId); var JsonData = new { total = jqgridparam.total, page = jqgridparam.page, records = jqgridparam.records, costtime = CommonHelper.TimerEnd(watch), rows = ListData }; return(Content(JsonData.ToJson())); } catch (Exception ex) { Base_SysLogBll.Instance.WriteLog("", OperationType.Query, "-1", "异常错误:" + ex.Message); return(null); } }