public ReportDefinition(
            DatabaseCore.Core core,
            string fileName,
            string fileNameWorkflow,
            string fileNameWeighting,
            HierarchyFilter hierarchyFilter,
            string userDefaultSettings = null
            )
            : this(core, hierarchyFilter)
        {
            this.FileName = fileName;

            XmlNode xmlNodeWeighting = null;

            if (fileNameWeighting != null)
            {
                XmlDocument xmlDocumentWeighting = new XmlDocument();
                xmlDocumentWeighting.Load(fileNameWeighting);

                xmlNodeWeighting = xmlDocumentWeighting.DocumentElement;
            }

            // Create a new report definition xml file.
            Create(fileNameWorkflow, xmlNodeWeighting, userDefaultSettings);

            //this.Workflow.SelectAll();

            // Save the report definition.
            Save();
        }
Ejemplo n.º 2
0
 public bool HasHierarchyPermission(DatabaseCore.Core core, Guid idHierarchy, Guid idUser)
 {
     return((int)core.WorkgroupHierarchies.ExecuteReader(
                "SELECT Count(*) FROM WorkgroupHierarchies WHERE IdHierarchy={0} AND IdWorkgroup IN (SELECT IdWorkgroup FROM UserWorkgroups WHERE IdUser={1})",
                new object[] { idHierarchy, idUser }
                )[0][0] != 0);
 }
 /// <summary>
 /// Creates a new instance of a report definition.
 /// </summary>
 /// <param name="core">The used database core.</param>
 protected BaseReportDefinition(DatabaseCore.Core core, HierarchyFilter hierarchyFilter)
 {
     this.HierarchyFilter  = hierarchyFilter;
     this.Core             = core;
     this.IdHierarchies    = new List <Guid>();
     this.FilterCategories = new List <FilterCategoryOperator>();
 }
 public CustomCharts(DatabaseCore.Core core)
     : base(core)
 {
     this.StorageMethod = new DataCore.Classes.StorageMethods.Database(
         this.Core,
         null
         );
 }
 public ExcelDataReader(string fileName, DatabaseCore.Core core, Study study, string respondentVariable, string createResponsesFile, int idLanguage)
     : base(fileName, core, study, createResponsesFile, idLanguage)
 {
     this.RespondentVariable = respondentVariable;
     this.Respondents        = new Dictionary <string, Guid>();
     this.Variables          = new Dictionary <string, Variable>();
     this.Categories         = new Dictionary <Guid, Dictionary <string, Guid> >();
 }
Ejemplo n.º 6
0
 public HTML(DatabaseCore.Core core, LinkBiDefinition definition)
     : base(core, definition)
 {
     this.StorageMethod = new DataCore.Classes.StorageMethods.Database(
         this.Core,
         null
         );
 }
Ejemplo n.º 7
0
 public HTML(DatabaseCore.Core core)
     : base(core)
 {
     this.StorageMethod = new DataCore.Classes.StorageMethods.Database(
         this.Core,
         null
         );
 }
        public void ProcessRequest(HttpContext context)
        {
            string fileName = Path.Combine(
                ConfigurationManager.AppSettings["DashboardRoot"],
                context.Request.Params["Dashboard"],
                "Definition.xml"
                );

            // Create a new database core for the session.
            DatabaseCore.Core core = new DatabaseCore.Core(
                ConfigurationManager.AppSettings["DatabaseProvider"],
                string.Format(ConfigurationManager.AppSettings["ConnectionString"], "iheartmedia"),
                ConfigurationManager.AppSettings["DatabaseProviderUserManagement"],
                string.Format(ConfigurationManager.AppSettings["ConnectionString"], "iheartmedia"),
                new string[0]
                );

            Dashboard dashboard = new Dashboard(fileName, core);

            dashboard.Parse();

            if (context.Request.Params["Export"] == "True")
            {
                /*context.Response.ContentType = "application/vnd.ms-excel;charset=utf-8";
                 * context.Response.AddHeader("Content-Disposition", "attachment;filename = ExcelFile.xls");
                 * context.Response.ContentEncoding = Encoding.UTF8;
                 * context.Response.Write(dashboard.Render());
                 * context.Response.End();
                 * return;*/

                //DashboardExporter exporter = new DashboardExporterExcel(dashboard);
                DashboardExporter exporter = new DashboardExporterPdf(dashboard);

                string test = exporter.Export(HttpUtility.UrlDecode(context.Request.Params["Html"]), Path.Combine(
                                                  HttpContext.Current.Request.PhysicalApplicationPath,
                                                  "Temp",
                                                  Guid.NewGuid() + exporter.Extension
                                                  ));

                WriteFileToResponse(
                    test,
                    dashboard.Document.DocumentElement.Attributes["Name"].Value + exporter.Extension,
                    exporter.MimeType,
                    true
                    );
                return;
            }

            StringBuilder result = new StringBuilder();


            context.Response.Write(dashboard.Render(false));
            context.Response.ContentType = "text/html";

            result.Clear();
        }
        /// <summary>
        /// Creates a new instance of a report definition.
        /// </summary>
        /// <param name="core">The used database core.</param>
        public BaseReportDefinition(DatabaseCore.Core core, XmlDocument document, HierarchyFilter hierarchyFilter)
            : this(core, hierarchyFilter)
        {
            this.FileName = "";

            // Create a new xml document.
            this.XmlDocument = document;

            // Parse the report definition xml file.
            ParseBase();
        }
Ejemplo n.º 10
0
        public static void ClearCaches(DatabaseCore.Core core)
        {
            DataCore.Classes.StorageMethods.Database database = new DataCore.Classes.StorageMethods.Database(
                core,
                null
                );

            database.ClearCaseDataCache();

            core.ClearCache();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Creates a new instance of the BenchmarkTest class.
        /// </summary>
        /// <param name="total">Defines how many aggregations the benchmark test should perform in total.</param>
        /// <param name="steps">Defines how many steps the benchmark test should do.</param>
        /// <param name="step">Defines what is the current performing step.</param>
        /// <param name="reportDefinitionFileName">Defines the full path to the report definition file which is used to perform the benchmark tests.</param>
        /// <param name="core">The instance of the database connection object which is used to perform the benchmark tests.</param>
        public BenchmarkTest(int total, int steps, int step, string reportDefinitionFileName, DatabaseCore.Core core)
        {
            this.Sessions   = new List <HttpSessionState>();
            this.Steps      = steps;
            this.Step       = step;
            this.TotalTests = total;

            this.Tests = (total / steps) * step;
            this.ReportDefinitionFileName = reportDefinitionFileName;
            this.Core = core;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates a new instance of the dashboard object.
        /// </summary>
        /// <param name="fileName">
        /// The full path to the dashboard definition file.
        /// </param>
        public Dashboard(string fileName, DatabaseCore.Core core)
        {
            this.FileName = fileName;
            this.Core     = core;
            this.Document = new XmlDocument();
            this.Document.Load(fileName);

            this.Identity = new System.IO.DirectoryInfo(System.IO.Path.GetDirectoryName(fileName)).Name;

            this.Settings = new DashboardSettings(this);

            this.InitCache();
        }
Ejemplo n.º 13
0
        private void BindActiveSessions()
        {
            Table table = new Table();

            table.CellSpacing = 0;
            table.CellPadding = 0;

            /*IEnumerable<SessionStateItemCollection> activeSessions = GetActiveSessions();
             *
             * foreach (SessionStateItemCollection session in activeSessions)*/
            foreach (string clientName in Global.AllSessions.Keys)
            {
                foreach (Guid idUser in Global.AllSessions[clientName].Keys)
                {
                    string username = "******";

                    if (Global.AllSessions[clientName][idUser]["Core"] != null)
                    {
                        try
                        {
                            DatabaseCore.Core core = (DatabaseCore.Core)Global.AllSessions[clientName][idUser]["Core"];

                            DatabaseCore.Items.User user = core.Users.GetSingle(idUser);

                            username = user.Name;
                        }
                        catch { }
                    }

                    TableRow tableRow = new TableRow();

                    TableCell tableCellClient = new TableCell();
                    TableCell tableCellUser   = new TableCell();
                    TableCell tableCellId     = new TableCell();

                    tableCellClient.Text = clientName;
                    tableCellUser.Text   = username;
                    tableCellId.Text     = Global.AllSessions[clientName][idUser].SessionID;

                    tableRow.Cells.Add(tableCellClient);
                    tableRow.Cells.Add(tableCellUser);
                    tableRow.Cells.Add(tableCellId);

                    table.Rows.Add(tableRow);
                }
            }

            pnlActiveSessions.Controls.Add(table);
        }
        /// <summary>
        /// Creates a new instance of a report definition.
        /// </summary>
        /// <param name="core">The used database core.</param>
        /// <param name="fileName">The full path to the report definition xml file.</param>
        public BaseReportDefinition(DatabaseCore.Core core, string fileName, HierarchyFilter hierarchyFilter)
            : this(core, hierarchyFilter)
        {
            this.FileName = fileName;

            // Create a new xml document.
            this.XmlDocument = new XmlDocument();

            // Load the contents of the report definition
            // xml file into the xml document.
            this.XmlDocument.Load(this.FileName);

            // Parse the report definition xml file.
            ParseBase();
        }
Ejemplo n.º 15
0
        public List <string> GetReports(DatabaseCore.Core core, Guid idUser)
        {
            List <string> reports = new List <string>();

            string[] files = Directory.GetFiles(Path.GetDirectoryName(this.FileName)).
                             OrderBy(x => (new FileInfo(x)).CreationTime).ToArray();

            foreach (string report in files)
            {
                if (report.EndsWith("Info.xml"))
                {
                    continue;
                }

                try
                {
                    XmlDocument xmlDocument = new XmlDocument();
                    xmlDocument.Load(report);

                    XmlNodeList xmlNodesHierarchies    = xmlDocument.DocumentElement.SelectNodes("HierarchyFilter/Hierarchy");
                    bool        hasHierarchyPermission = true;

                    foreach (XmlNode xmlNodeHierarchy in xmlNodesHierarchies)
                    {
                        Guid idHierarchy = Guid.Parse(xmlNodeHierarchy.Attributes["Id"].Value);

                        if (!this.HasHierarchyPermission(core, idHierarchy, idUser))
                        {
                            hasHierarchyPermission = false;
                            break;
                        }
                    }

                    if (hasHierarchyPermission)
                    {
                        reports.Add(report);
                    }
                }
                catch
                {
                    reports.Add(report);
                }
            }

            this.Reports = reports;

            return(reports);
        }
        private void InitFilter(string source, DatabaseCore.Core core, HierarchyFilter hierarchyFilter)
        {
            ReportDefinitionClasses.ReportDefinition definition = new ReportDefinitionClasses.ReportDefinition(
                core,
                source,
                hierarchyFilter
                );

            DataCore.Classes.ReportCalculator test = new ReportCalculator(
                definition,
                core,
                HttpContext.Current.Session
                );

            this.Filter = test.GetFilter();
        }
Ejemplo n.º 17
0
        public Equation(DatabaseCore.Core core, string equation, int weightMissingValue)
        {
            this.WeightMissingValue = weightMissingValue;
            this.CaseDataLocation   = core.CaseDataLocation;

            if (equation.Contains("return ") == false &&
                equation.Contains("double ") == false &&
                equation.Contains("int ") == false &&
                equation.Contains(" long") == false)
            {
                equation = "return " + equation + ";";
            }

            this.Core           = core;
            this.EquationString = equation.Replace("\n", " ").Replace("\r", " ");
            this.Values         = new Dictionary <string, EquationPlaceHolder>();

            this.ParsePlaceHolders();
            this.Validate();

            if (SecurityCheck(new Data(), new Database(core, null, 1), null).Count > 0)
            {
                //throw new Exception("InsecureEquationDetected");
                Log("<![CDATA[[InsecureEquationDetected]: " + this.EquationString + "]]>");
                return;
            }

            EquationEvaluator evaluator = new EquationEvaluator(this);

            try
            {
                this.Assembly = evaluator.Compile();
            }
            catch (Exception ex)
            {
                Log(string.Format(
                        "<Error><![CDATA[{0}]]></Error><Equation><![CDATA[{1}]]></Equation>",
                        ex.ToString(),
                        this.EquationString
                        ));
            }
        }
Ejemplo n.º 18
0
        public Workflow(
            DatabaseCore.Core core,
            string source,
            XmlNode xmlNode,
            string service,
            HierarchyFilter hierarchyFilter
            )
        {
            this.HierarchyFilter = hierarchyFilter;
            this.Source          = source;
            this.Editable        = false;
            this.Selections      = new Dictionary <string, WorkflowSelection>();
            this.Service         = service;
            this.Core            = core;

            this.XmlNode = xmlNode;

            // Set the on load event of the web control.
            this.Load += Workflow_Load;

            Parse();
        }
        public WeightingFilterCollection(BaseReportDefinition owner, DatabaseCore.Core core, XmlNode xmlNode)
        {
            this.Owner      = owner;
            this.Core       = core;
            this.XmlNode    = xmlNode;
            this.IsTaxonomy = true;
            this.Items      = new Dictionary <Guid, WeightingFilter>();

            if (this.XmlNode != null)
            {
                // Run through all weighting variable xml nodes.
                foreach (XmlNode xmlNodeWeightingVariable in this.XmlNode.SelectNodes("Operator"))
                {
                    // Create a new weighting filter by the xml node.
                    WeightingFilter weightingFilter = new WeightingFilter(this, xmlNodeWeightingVariable);

                    // Add the weighting filter to the collection's items
                    this.Items.Add(
                        weightingFilter.IdWeightingVariable,
                        weightingFilter
                        );

                    /*if (weightingFilter.IdCategory == new Guid())
                     *  this.DefaultWeighting = weightingFilter.WeightingVariable;*/
                }

                if (this.XmlNode.Attributes["DefaultWeighting"] != null &&
                    this.XmlNode.Attributes["DefaultWeighting"].Value != "")
                {
                    this._DefaultWeighting = Guid.Parse(this.XmlNode.Attributes["DefaultWeighting"].Value);
                }

                if (this.XmlNode.Attributes["IsTaxonomy"] != null)
                {
                    this.IsTaxonomy = bool.Parse(this.XmlNode.Attributes["IsTaxonomy"].Value);
                }
            }
        }
 public LinkBiDefinition(DatabaseCore.Core core, XmlDocument xmlDocument, HierarchyFilter hierarchyFilter)
     : base(core, xmlDocument, hierarchyFilter)
 {
 }
Ejemplo n.º 21
0
 public LdfReader(string fileName, DatabaseCore.Core core, Study project,
                  string createResponsesFile, int idLanguage)
     : base(fileName, core, project, createResponsesFile, idLanguage)
 {
 }
 /// <summary>
 /// Creates a new instance of a report definition.
 /// </summary>
 /// <param name="core">The used database core.</param>
 public ReportDefinition(DatabaseCore.Core core, XmlDocument document, HierarchyFilter hierarchyFilter)
     : base(core, document, hierarchyFilter)
 {
 }
Ejemplo n.º 23
0
 public LinkBiInterface(DatabaseCore.Core core, LinkBiDefinition definition)
     : this(core)
 {
     this.Definition = definition;
 }
 /// <summary>
 /// Creates a new instance of a report definition.
 /// </summary>
 /// <param name="core">The used database core.</param>
 private ReportDefinition(DatabaseCore.Core core, HierarchyFilter hierarchyFilter)
     : base(core, hierarchyFilter)
 {
 }
 public TempTableTest(DatabaseCore.Core core)
     : base(core)
 {
 }
 public TempTableTest(DatabaseCore.Core core, LinkBiDefinition definition)
     : base(core, definition)
 {
 }
Ejemplo n.º 27
0
 public Filter(DatabaseCore.Core core)
 {
     this.Core = core;
 }
 /// <summary>
 /// Creates a new instance of a report definition.
 /// </summary>
 /// <param name="core">The used database core.</param>
 /// <param name="fileName">The full path to the report definition xml file.</param>
 public ReportDefinition(DatabaseCore.Core core, string fileName, HierarchyFilter hierarchyFilter)
     : base(core, fileName, hierarchyFilter)
 {
 }
Ejemplo n.º 29
0
 public Filter(DatabaseCore.Core core, XmlNode xmlNode)
     : this(core)
 {
     // Parse all filter expressions of the filter definition.
     this.FilterExpressions = ParseFilterExpressions(xmlNode);
 }
Ejemplo n.º 30
0
 public LinkBiInterface(DatabaseCore.Core core)
 {
     this.Core = core;
 }