Example #1
0
        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            try
            {
                // reset system
                FI.DataAccess.OlapSystem sys = new FI.DataAccess.OlapSystem();
                sys.ResetOlapSystem();

                // set realtime priority
                System.Diagnostics.Process proc = System.Diagnostics.Process.GetCurrentProcess();
                proc.PriorityClass = System.Diagnostics.ProcessPriorityClass.RealTime;

                // config file
                System.Runtime.Remoting.RemotingConfiguration.Configure(System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);

                // db schema
                FI.DataAccess.DataBase.Instance.VerifyDbSchema();

                // event logs
                FI.Common.LogWriter.InitCommonEventLogs();
            }
            catch (Exception exc)
            {
                FI.Common.LogWriter.Instance.WriteException(exc);
                throw exc;
            }
        }
Example #2
0
//		GenuineChannelsServer _remotingServer;
        private void Form1_Load(object sender, System.EventArgs e)
        {
            try
            {
                // reset system
                FI.DataAccess.OlapSystem sys = new FI.DataAccess.OlapSystem();
                sys.ResetOlapSystem();

                // set realtime priority
                System.Diagnostics.Process proc = System.Diagnostics.Process.GetCurrentProcess();
                proc.PriorityClass = System.Diagnostics.ProcessPriorityClass.RealTime;


                // remoting init
//				_remotingServer=new GenuineChannelsServer();
//				_remotingServer.Initialize();
                System.Runtime.Remoting.RemotingConfiguration.Configure(System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);

                // db schema
                FI.DataAccess.DataBase.Instance.VerifyDbSchema();

                // event logs
                FI.Common.LogWriter.InitCommonEventLogs();
            }
            catch (Exception exc)
            {
                FI.Common.LogWriter.Instance.WriteException(exc);
                throw exc;
            }
        }
        // singleton pattern


        public void OnSystemRestart()
        {
            CleanupTempDir();

            FI.DataAccess.OlapSystem dac = DataAccessFactory.Instance.GetOlapSystemDA();
            dac.ResetOlapSystem();
        }
Example #4
0
        public XmlElement GetMemberGrandParent(string HierUniqueName, string MemUniqueName)
        {
            FI.DataAccess.OlapSystem dacObj = DataAccessFactory.Instance.GetOlapSystemDA();
            string xml = dacObj.GetMemberGrandParent(Server, Database, Cube, HierUniqueName, MemUniqueName);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            return((XmlElement)doc.FirstChild);
        }
Example #5
0
        public XmlElement GetMemberChildren(string UniqueName, bool IfLeafAddItself)
        {
            FI.DataAccess.OlapSystem dacObj = DataAccessFactory.Instance.GetOlapSystemDA();
            string xml = dacObj.GetMemberChildren(Server, Database, Cube, UniqueName, IfLeafAddItself);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            return((XmlElement)doc.FirstChild);
        }
Example #6
0
        public XmlElement GetSchemaMembers(string[] UniqueNames)
        {
            FI.DataAccess.OlapSystem dacObj = DataAccessFactory.Instance.GetOlapSystemDA();
            string xml = dacObj.GetSchemaMembers(Server, Database, Cube, UniqueNames);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            return((XmlElement)doc.FirstChild);
        }
Example #7
0
        internal XmlElement GetMeasuresHierarchy()
        {
            FI.DataAccess.OlapSystem dacObj = DataAccessFactory.Instance.GetOlapSystemDA();
            string xml = dacObj.GetMeasuresHierarchyXml(Server, Database, Cube);

            if (xml == null || xml == "")
            {
                return(null);
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            return((XmlElement)doc.FirstChild);
        }
Example #8
0
        protected internal override void _CancelExecute()
        {
            if (_asyncResult == null || _asyncResult.IsCompleted == true)
            {
                return;                 // nothing to cancel
            }
            if (_olapTaskGuid == Guid.Empty)
            {
                return;
            }

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

            _asyncResult  = null;
            _olapTaskGuid = Guid.Empty;
        }
Example #9
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.DataAccess.OlapSystem dacOlapSystem = DataAccessFactory.Instance.GetOlapSystemDA();
            _asyncDelegate = new ExecuteDelegate(dacOlapSystem.BuildCellset);
            _asyncResult   = _asyncDelegate.BeginInvoke(Schema.Server, Schema.Database, _mdx, _olapTaskGuid.ToString(), taskTag, null, null);
        }
Example #10
0
        override protected internal void _Execute()
        {
            try
            {
                string taskGuid = Guid.NewGuid().ToString();
                string taskTag  = string.Format("User: {0} ({1}), CustomMdxReport: {2} ({3})",
                                                this._owner.Name, this._owner.ID, this.Name, this.ID);

                FI.DataAccess.OlapSystem dacOlapSystem = DataAccessFactory.Instance.GetOlapSystemDA();
                string data = dacOlapSystem.BuildCellset(this.SchemaServer, this.SchemaDatabase, this.Mdx, taskGuid, taskTag);

                this._cellset.LoadCellset(data);

                _error = "";
            }
            catch (Exception exc)
            {
                _error = exc.Message;
                throw exc;
            }
        }
Example #11
0
 /// <summary>
 /// Stop this service.
 /// </summary>
 protected override void OnStop()
 {
     FI.DataAccess.OlapSystem sys = new FI.DataAccess.OlapSystem();
     sys.ResetOlapSystem();
 }
Example #12
0
        //        GenuineChannelsServer _remotingServer;
        private void Form1_Load(object sender, System.EventArgs e)
        {
            try
            {
                // db schema
                FI.DataAccess.DataBase.Instance.VerifyDbSchema();

                // reset system
                FI.DataAccess.OlapSystem sys = new FI.DataAccess.OlapSystem();
                sys.ResetOlapSystem();

                // set realtime priority
                System.Diagnostics.Process proc=System.Diagnostics.Process.GetCurrentProcess();
                proc.PriorityClass=System.Diagnostics.ProcessPriorityClass.RealTime;

                // remoting init
            //				_remotingServer=new GenuineChannelsServer();
            //				_remotingServer.Initialize();
                System.Runtime.Remoting.RemotingConfiguration.Configure(System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);

                // event logs
                FI.Common.LogWriter.InitCommonEventLogs();

            }
            catch(Exception exc)
            {
                FI.Common.LogWriter.Instance.WriteException(exc);
                throw exc;
            }
        }
Example #13
0
        public void PingOlapSystem(string Mdx, string MailTo)
        {
            bool failure = false;

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

            // get all companies
            FI.DataAccess.Users   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.DataAccess.OlapSystem 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;
                }
            }
        }
Example #14
0
        // singleton pattern


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