|
using DevExpress.XtraEditors;
|
using Gs.DevApp.Entity;
|
using Gs.DevApp.ToolBox;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
using DevExpress.XtraBars.Navigation;
|
using DevExpress.XtraTab;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Drawing;
|
using System.Reflection;
|
using System.Windows.Forms;
|
using Gs.DevApp.ToolBox;
|
using Newtonsoft.Json;
|
using Gs.DevApp.Entity;
|
using Newtonsoft.Json.Linq;
|
using System.IO;
|
|
namespace Gs.DevApp.DevFrm.Rpt
|
{
|
public partial class RptPreview : DevExpress.XtraEditors.XtraForm
|
{
|
private string _reportType;
|
public RptPreview(string reportType)
|
{
|
_reportType = reportType;
|
InitializeComponent();
|
getPageList();
|
}
|
|
/// <summary>
|
/// 读取报表数据列表
|
/// </summary>
|
private void getPageList()
|
{
|
var _obj = new
|
{
|
reportType = _reportType,
|
sortName = "a.userName",
|
sortOrder = "asc",
|
keyWhere = ""
|
};
|
try
|
{
|
string strJson = UtilityHelper.HttpPost("", "Report/GetUserRoleReport", JsonConvert.SerializeObject(_obj));
|
JObject _job = JObject.Parse(strJson);
|
string rtnCode = _job["rtnCode"].ToString();
|
if (int.Parse(rtnCode) > 0)
|
{
|
JArray array = new JArray();
|
foreach (var a in _job["rtnData"]["list"])
|
{
|
array.Add(a);
|
}
|
DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
|
DataSet ds = new DataSet();
|
dt.TableName = "Table1";
|
ds.Tables.Add(dt);
|
FastReport.Report report = new FastReport.Report();
|
byte[] buffer = (byte[])_job["rtnData"]["reportData"];
|
using (MemoryStream Stream = new MemoryStream(buffer))
|
{
|
report.Load(Stream);
|
}
|
report.RegisterData(ds);
|
report.Preview = previewControl1;
|
report.Prepare();
|
report.ShowPrepared();
|
}
|
}
|
catch (Exception ex)
|
{
|
ToolBox.MsgHelper.Warning("提示:" + ex.Message);
|
}
|
}
|
}
|
}
|