// singleton pattern


        public void OnSystemRestart()
        {
            CleanupTempDir();

            FI.Common.DataAccess.IOlapSystemDA dac = DataAccessFactory.Instance.GetOlapSystemDA();
            dac.ResetOlapSystem();
        }
Пример #2
0
        public XmlElement GetMemberGrandParent(string HierUniqueName, string MemUniqueName)
        {
            FI.Common.DataAccess.IOlapSystemDA dacObj = DataAccessFactory.Instance.GetOlapSystemDA();
            string xml = dacObj.GetMemberGrandParent(Server, Database, Cube, HierUniqueName, MemUniqueName);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            return((XmlElement)doc.FirstChild);
        }
Пример #3
0
        public XmlElement GetMemberChildren(string UniqueName, bool IfLeafAddItself)
        {
            FI.Common.DataAccess.IOlapSystemDA dacObj = DataAccessFactory.Instance.GetOlapSystemDA();
            string xml = dacObj.GetMemberChildren(Server, Database, Cube, UniqueName, IfLeafAddItself);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            return((XmlElement)doc.FirstChild);
        }
Пример #4
0
        public XmlElement GetSchemaMembers(string[] UniqueNames)
        {
            FI.Common.DataAccess.IOlapSystemDA dacObj = DataAccessFactory.Instance.GetOlapSystemDA();
            string xml = dacObj.GetSchemaMembers(Server, Database, Cube, UniqueNames);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            return((XmlElement)doc.FirstChild);
        }
        // singleton pattern


        public void OnSystemRestart()
        {
            System.Diagnostics.StackTrace stack = new System.Diagnostics.StackTrace();
            Common.LogWriter.Instance.WriteEventLogEntry("DistributionManager OnSystemRestart\r\n" + stack.ToString(),
                                                         System.Diagnostics.EventLogEntryType.Warning);

            CleanupTempDir();

            FI.Common.DataAccess.IOlapSystemDA dac = DataAccessFactory.Instance.GetOlapSystemDA();
            dac.ResetOlapSystem();
        }
Пример #6
0
        protected internal override void _CancelExecute()
        {
            if (_asyncResult == null || _asyncResult.IsCompleted == true)
            {
                return;                 // nothing to cancel
            }
            if (_olapTaskGuid == Guid.Empty)
            {
                return;
            }

            FI.Common.DataAccess.IOlapSystemDA dacOlapSystem = DataAccessFactory.Instance.GetOlapSystemDA();
            dacOlapSystem.CancelOlapCommand(_olapTaskGuid.ToString());

            _asyncResult  = null;
            _olapTaskGuid = Guid.Empty;
        }
Пример #7
0
        protected internal override void _BeginExecute()
        {
            if (_mdx == "")
            {
                BuildMdx();
            }

            if (_olapTaskGuid == Guid.Empty)
            {
                _olapTaskGuid = System.Guid.NewGuid();
            }
            string taskTag = string.Format("User: {0} ({1}), OlapReport: {2} ({3})",
                                           this._owner.Name, this._owner.ID, this.Name, this.ID);

            FI.Common.DataAccess.IOlapSystemDA dacOlapSystem = DataAccessFactory.Instance.GetOlapSystemDA();
            _asyncDelegate = new ExecuteDelegate(dacOlapSystem.BuildCellset);
            _asyncResult   = _asyncDelegate.BeginInvoke(Schema.Server, Schema.Database, _mdx, _olapTaskGuid.ToString(), taskTag, null, null);
        }
        override protected internal void _Execute()
        {
            try
            {
                string taskGuid        = Guid.NewGuid().ToString();
                string taskDescription = string.Format("User: {0} ({1}), CustomMdxReport: {2} ({3})",
                                                       this._owner.Name, this._owner.ID, this.Name, this.ID);

                FI.Common.DataAccess.IOlapSystemDA dacOlapSystem = DataAccessFactory.Instance.GetOlapSystemDA();
                string data = dacOlapSystem.BuildCellset(this.SchemaServer, this.SchemaDatabase, null, this.Mdx, taskGuid, taskDescription, "CustomMdx", this.ID);

                this._cellset.LoadCellset(data);

                _error = "";
            }
            catch (Exception exc)
            {
                _error = exc.Message;
                throw exc;
            }
        }
        public void PingOlapSystem(string Mdx, string MailTo)
        {
            bool failure = false;

            System.IO.StringWriter sw = new System.IO.StringWriter();

            // get all companies
            FI.Common.DataAccess.IUsersDA usersDac = DataAccessFactory.Instance.GetUsersDA();
            System.Data.DataTable         table    = usersDac.ReadCompanies();
            if (table == null || table.Rows.Count == 0)
            {
                return;
            }

            sw.WriteLine("<html>");
            sw.WriteLine("Failed Ping Queries (" + System.DateTime.Today.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString() + ")");
            sw.WriteLine("<br><br>");
            sw.WriteLine("<table border=1 width=100%>");

            try
            {
                foreach (System.Data.DataRow row in table.Rows)
                {
                    if ((bool)row["Ping"] == true)
                    {
                        string company  = row["ShortName"].ToString();
                        string server   = row["OlapServer"].ToString();
                        string database = row["OlapDatabase"].ToString();

                        try
                        {
                            string taskGuid = Guid.NewGuid().ToString();
                            string taskTag  = string.Format("Ping");

                            FI.Common.DataAccess.IOlapSystemDA olapDac = DataAccessFactory.Instance.GetOlapSystemDA();
                            olapDac.BuildCellset(Mdx, server, database, taskGuid, taskTag);
                        }
                        catch (Exception exc)
                        {
                            failure = true;

                            sw.Write("<tr>");
                            sw.Write("<td>");
                            sw.Write(company);
                            sw.Write("</td><td>");
                            sw.Write(exc.Message);
                            sw.Write("</td>");
                            sw.WriteLine("</tr>");

                            Common.LogWriter.Instance.WriteEventLogEntry(exc);
                        }
                    }
                }
            }
            catch (Exception exc)            //more common exception
            {
                failure = true;

                sw.Write("<tr>");
                sw.Write(exc.Message);
                sw.Write("</td>");
                sw.WriteLine("</tr>");

                Common.LogWriter.Instance.WriteEventLogEntry(exc);
            }

            sw.WriteLine("</table></html>");


            //send via email
            if (failure)
            {
                try
                {
                    // message
                    OpenSmtp.Mail.MailMessage msg = new OpenSmtp.Mail.MailMessage();
                    msg.From = new OpenSmtp.Mail.EmailAddress(FI.Common.AppConfig.SmtpSender);
                    msg.To.Add(new OpenSmtp.Mail.EmailAddress(MailTo));
                    msg.Subject  = "Failed Ping Queries";
                    msg.Priority = "High";
                    msg.HtmlBody = sw.ToString();

                    // smtp host
                    OpenSmtp.Mail.Smtp smtp = new OpenSmtp.Mail.Smtp();
                    smtp.Host = FI.Common.AppConfig.SmtpServer;
                    if (FI.Common.AppConfig.SmtpUserName != null && FI.Common.AppConfig.SmtpUserName != "")
                    {
                        smtp.Username = FI.Common.AppConfig.SmtpUserName;
                        smtp.Password = FI.Common.AppConfig.SmtpPassword;
                    }
                    smtp.SendMail(msg);
                }
                catch (Exception exc)
                {
                    // because real exception is inside:
                    while (exc.InnerException != null)
                    {
                        exc = exc.InnerException;
                    }

                    throw exc;
                }
            }
        }
Пример #10
0
        // singleton pattern


        public FI.Common.Data.FIDataTable GetOlapProcessorInfo()
        {
            FI.Common.DataAccess.IOlapSystemDA olapDao = DataAccessFactory.Instance.GetOlapSystemDA();
            return(olapDao.GetOlapProcessorInfo());
        }