Пример #1
0
        private IDataReader ExecuteReader(string report, string oids, DateTime?meetingDate1, DateTime?meetingDate2)
        {
            var content = DbUtil.Db.ContentOfTypeSql(report);

            if (!content.HasValue())
            {
                throw new Exception("no content");
            }
            if (!SpecialReportViewModel.CanRunScript(content))
            {
                throw new Exception("Not Authorized to run this script");
            }

            if (!content.Contains("@OrgIds", ignoreCase: true))
            {
                throw new Exception("missing @OrgIds");
            }

            var p  = GetSqlParameters(oids, meetingDate1, meetingDate2, content);
            var cs = HttpContext.Current.User.IsInRole("Finance")
                ? Util.ConnectionStringReadOnlyFinance
                : Util.ConnectionStringReadOnly;
            var cn = new SqlConnection(cs);

            cn.Open();
            return(cn.ExecuteReader(content, p, commandTimeout: 1200));
        }
Пример #2
0
        private IDataReader ExecuteReader(string report, string oids)
        {
            var content = DbUtil.Db.ContentOfTypeSql(report);

            if (content == null)
            {
                throw new Exception("no content");
            }
            if (!SpecialReportViewModel.CanRunScript(content.Body))
            {
                throw new Exception("Not Authorized to run this script");
            }

            if (!content.Body.Contains("@OrgIds"))
            {
                throw new Exception("missing @OrgIds");
            }

            var p = new DynamicParameters();

            p.Add("@OrgIds", oids);
            var cs = HttpContext.Current.User.IsInRole("Finance")
                ? Util.ConnectionStringReadOnlyFinance
                : Util.ConnectionStringReadOnly;
            var cn = new SqlConnection(cs);

            cn.Open();
            return(cn.ExecuteReader(content.Body, p));
        }
Пример #3
0
        private IDataReader ExecuteReader(string report, string oids, DateTime?meetingDate1, DateTime?meetingDate2)
        {
            var content = CurrentDatabase.ContentOfTypeSql(report);

            if (!content.HasValue())
            {
                throw new Exception("no content");
            }
            if (!SpecialReportViewModel.CanRunScript(content))
            {
                throw new Exception("Not Authorized to run this script");
            }

            if (!content.Contains("@OrgIds", ignoreCase: true))
            {
                throw new Exception("missing @OrgIds");
            }

            var p  = GetSqlParameters(oids, meetingDate1, meetingDate2, content);
            var cn = CurrentDatabase.ReadonlyConnection();

            cn.Open();
            return(cn.ExecuteReader(content, p, commandTimeout: 1200));
        }