本帖最后由 wengMQ 于 2019-11-29 10:11 编辑
WebDesigner_MVC\Views\Design\Index.cshtml的onSave方法修改function onSave(options) {
GrapeCity.ActiveReports.WebDesigner.api.saveReport({
reportInfo: {
id: options.reportInfo.id,
name: options.reportInfo.name,
},
}).then(function (saveResult) {
$.ajax("/saverpt/" + saveResult.Id).done(function (data) { alert(data); })
.fail(function (data) { alert("出错啦!"); });
});
}
WebDesigner_MVC\Controllers\DesignController.cs增加
[Route("saverpt/{id}")]
[HttpGet]
public string SaveRpt(string id)
{
try
{
string Path = String.Format(@"{0}.\resources\" + id, HttpRuntime.AppDomainAppPath);
FileInfo rptFile = new FileInfo(Path);
using (FileStream Rpt2Stream = rptFile.OpenRead())
{
Jb.byte_pub = new byte[Rpt2Stream.Length];
Rpt2Stream.Read(Jb.byte_pub, 0, Jb.byte_pub.Length);
Jb.sql_Pub = "insert into S_Display([FNo],[FPbStream]) values "
+ "(newid(),@pbstream)";
Jb.pars = new SqlParameter[]{
new SqlParameter("@pbstream",SqlDbType.Image)
};
Jb.pars[0].Value = Jb.byte_pub;
SqlHelper.ExecuteQuery(CommandType.Text, Jb.sql_Pub, Jb.pars);
}
return "保存成功!!";
}
catch (Exception ex)
{
return ex.Message.ToString();
}
}
|