wengMQ 发表于 2019-11-28 22:52:26

在线设计器WebDesigner_MVC保存后自定义后台另存为,保存到数据库实现分享

本帖最后由 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增加

      
      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.Read(Jb.byte_pub, 0, Jb.byte_pub.Length);

                  Jb.sql_Pub = "insert into S_Display(,) values "
                        + "(newid(),@pbstream)";
                  Jb.pars = new SqlParameter[]{
                              new SqlParameter("@pbstream",SqlDbType.Image)
                            };
                  Jb.pars.Value = Jb.byte_pub;
                  SqlHelper.ExecuteQuery(CommandType.Text, Jb.sql_Pub, Jb.pars);

                }

                return "保存成功!!";
            }
            catch (Exception ex)
            {
                return ex.Message.ToString();
            }
      }

KearneyKang 发表于 2019-11-29 09:15:44

非常感谢你的分享,很有价值
页: [1]
查看完整版本: 在线设计器WebDesigner_MVC保存后自定义后台另存为,保存到数据库实现分享