请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册

QQ登录

只需一步,快速开始

wengMQ 悬赏达人认证
银牌会员   /  发表于:2019-11-28 22:52  /   查看:2515  /  回复:1
本帖最后由 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();
            }
        }

评分

参与人数 1金币 +1000 收起 理由
KearneyKang + 1000 神马都是浮云

查看全部评分

1 个回复

倒序浏览
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2019-11-29 09:15:44
沙发
非常感谢你的分享,很有价值
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部