Example #1
0
        /// <summary>
        /// Переименовать отчет
        /// </summary>
        /// <param name="obj">Отчет</param>
        public void Rename(object obj = null)
        {
            ReportItem_M item = (ReportItem_M)obj;

            var frm = new SaveReportFrm();

            frm.DataContext = item.Clone();
            var result = frm.ShowDialog();

            if (result == true)
            {
                Program.ReportModel.Apply((ReportItem_M)frm.DataContext);
            }
        }
Example #2
0
        public bool?SaveReport(bool isNew = false)
        {
            if (_reportItemM.IsNew || isNew)
            {
                var frm = new SaveReportFrm();
                frm.DataContext = _reportItemM;
                var result = frm.ShowDialog();
                if (result == true)
                {
                    if (isNew)
                    {
                        _reportItemM.SetNew();
                    }
                }
                else
                {
                    return(null);
                }
            }
            string connString   = string.Empty;
            var    postgresConn = FindConnection(_report, "Current data") as PostgresDataConnection;

            if (postgresConn != null)
            {
                connString = postgresConn.ConnectionString;
                postgresConn.ConnectionString = string.Empty;
            }
            _reportItemM.Body = _report.ReportResourceString;
            if (postgresConn != null)
            {
                postgresConn.ConnectionString = connString;
            }
            Program.ReportModel.Apply(_reportItemM);

            return(true);
        }