bug
lu
8 天以前 9bc1c241443169dde866ccc73fe28a743ebf3874
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using Gs.DevApp.DevFrm.Rpt;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
using System.Windows.Forms;
 
namespace Gs.DevApp.UserControl
{
    public partial class UcBtnPrint : DevExpress.XtraEditors.XtraUserControl
    {
        public UcBtnPrint()
        {
            InitializeComponent();
            this.btnPrint.Click += (s, e) =>
            {
                if (btnPrintClick != null)
                    btnPrintClick(this, e);
                else
                    return;
 
                if (rptParameter == "return false")
                    return;
                if (string.IsNullOrEmpty(rptParameter))
                {
                    MsgHelper.ShowError("没有指定报表参数,请联系技术开发人员!");
                    return;
                }
                var _bl = false;
                _bl = _ckRptService();
                if (_bl)
                {
                    try
                    {
                        using (Form frm = new RptPreview(guidKey, rptParameter))
                        {
                            frm.ShowDialog();
                        }
                    }
                    catch (Exception)
                    {
                    }
                    return;
                }
 
                MsgHelper.ShowError("没有设计模板,请先设计模板!");
            };
            this.btnAll.Click += (s, e) =>
            {
                if (btnAllClick != null)
                    btnAllClick(this, e);
                else
                    return;
            };
        }
        /// <summary>
        ///     关键字,一般是主键
        /// </summary>
        public string guidKey { get; set; }
 
 
        /// <summary>
        /// 批量操作时的关键字:托板码
        /// </summary>
        public string allClickKey { get; set; }
 
 
        /// <summary>
        ///     报表,在数据库中要唯一,如:存储过程名{入参1名|入参值,入参2名|入参值}
        /// </summary>
        public string rptParameter { get; set; }
 
        /// <summary>
        /// 打印
        /// </summary>
        public event EventHandler btnPrintClick;
 
        /// <summary>
        /// 批量操作
        /// </summary>
        public event EventHandler btnAllClick;
 
        private bool _ckRptService()
        {
            try
            {
                var _obj = new
                {
                    guid = guidKey,
                    rptParameter,
                    isDesign = 1
                };
                var strJson = UtilityHelper.HttpPost("", "Report/GetRptData",
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0) return true;
                return false;
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
                return true;
            }
            return false;
        }
 
    }
}