Esempio n. 1
0
        public override void RaiseCallbackEvent(string eventArgument)
        {
            statusServiceBinding ss = null;
            ajaxdata = "";
            try
            {
                ss = ProxyLoader.GetSSProxy(this.ssurl, username, password, authMode, pkiinfo);
                if (authMode == ConfigLoader.AuthMode.PKI)
                {
                    ss.useDoubleHopAuthWithPKI = true;
                    ss.actual_username = HttpContext.Current.User.Identity.Name;
                }
                GetStatusRequestMsg req = new GetStatusRequestMsg();

                req.classification = new SecurityWrapper();
                req.classification.caveats = "none";
                req.classification.classification = ClassificationType.U;
                GetStatusResponseMsg[] res = ss.GetAllStatus(req);
                if (res != null && res!= null && res.Length > 0)
                {
                    ajaxdata += "<table><th>Status</th><th>URI</th><th>Detail</th><th>Last Check In</th></tr>";
                    for (int i = 0; i < res.Length; i++)
                    {
                        TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - res[i].TimeStamp.Ticks);
                        ajaxdata += "<tr><td>";
                        if (res[i].Operational)
                        {
                            if (ts.TotalHours > 1.0)
                                ajaxdata += "<img src=\"" + redlight + "\">";
                            else if (ts.TotalMinutes > 10)
                            {
                                ajaxdata += "<img src=\"" + orangelight + "\">";
                            }
                            else
                            {
                                ajaxdata += "<img src=\"" + greenlight + "\">";
                            }
                        }
                        else
                        {
                            ajaxdata += "<img src=\"" + redlight + "\">";
                        }
                        ajaxdata += "</td><td>";
                        ajaxdata += System.Web.HttpUtility.HtmlEncode(res[i].URI) +
                            //"</td><td>" + (res.GetStatusResponseResult[i].Operational ? "OK" : "NG") +
                            "</td><td>" + System.Web.HttpUtility.HtmlEncode(res[i].Message) +
                            "</td><td>";

                        if (ts.TotalHours > 1.0)

                            ajaxdata += "<font color=\"red\">" +
                                 DurationToString(ts)// res.GetStatusResponseResult[i].TimeStamp.ToString("o")
                                + "</font></td></tr>";
                        else if (ts.TotalMinutes > 10)
                        {
                            ajaxdata += "<font color=\"#FF7D40\">" +
                             DurationToString(ts)//res.GetStatusResponseResult[i].TimeStamp.ToString("o")
                             + "</font></td></tr>";
                        }
                        else ajaxdata += DurationToString(ts) +
                                //res.GetStatusResponseResult[i].TimeStamp.ToString("o") +
                            "</td></tr>";

                    }
                    ajaxdata += "</table>";
                }
            }
            catch (Exception ex)
            {
                HandleError(ex, true);
            }
            finally
            {

            }
        }
Esempio n. 2
0
        void getStatusData()
        {
            while (running)
            {
                Thread.Sleep(1000);
                if (!running)
                    return;
                if (lastranat.AddMilliseconds(interval) < DateTime.Now)
                {
                    notifyIcon1.ShowBalloonTip(1000, "Requesting status info", "working", ToolTipIcon.Info);
                    lastranat = DateTime.Now;
                    CheckForIllegalCrossThreadCalls = false;
                    GetStatusRequestMsg req = new GetStatusRequestMsg();
                    req.classification = new SecurityWrapper();
                    req.classification.classification = ClassificationType.U;

                    GetStatusResponseMsg[] status = null;
                    try
                    {
                        status = ss.GetAllStatus(req);
                    }
                    catch (Exception ex)
                    {
                        notifyIcon1.ShowBalloonTip(10000, "Oh Uh", "Unable to contact FGSMS " + Environment.NewLine + ex.Message, ToolTipIcon.Error);
                        lastofflinecount = 0;
                        return;
                    }

                    if (status != null)
                    {
                        listBox1.Items.Clear();
                        String msg = "";
                        int count = 0;
                        for (int i = 0; i < status.Length; i++)
                        {
                            listBox1.Items.Add(status[i]);
                            //textBox1.Text +=status[i].Operational + " " + status[i].TimeStamp.ToString("o") + " " + status[i].URI + " " + status[i].Message + Environment.NewLine;
                            if (!status[i].Operational)
                            {

                                msg += status[i].URI + Environment.NewLine;
                                count++;
                            }
                        }
                        if (!String.IsNullOrEmpty(msg))
                        {
                            if (count != lastofflinecount)
                            {
                                notifyIcon1.Text = "FGSMS - There are " + count + " services offline!";
                                lastofflinecount = count;
                                notifyIcon1.ShowBalloonTip(10000, "Oh Uh", "The following services are offline" + Environment.NewLine + msg, ToolTipIcon.Warning);
                            }
                        }
                        else
                            notifyIcon1.ShowBalloonTip(10000, "A-OK", "All Services are Online", ToolTipIcon.Info);

                    }
                }
            }
        }
Esempio n. 3
0
        public override void RaiseCallbackEvent(string eventArgument)
        {
            statusServiceBinding ss = null;

            ajaxdata = "";
            try
            {
                ss = ProxyLoader.GetSSProxy(this.ssurl, username, password, authMode, pkiinfo);
                if (authMode == ConfigLoader.AuthMode.PKI)
                {
                    ss.useDoubleHopAuthWithPKI = true;
                    ss.actual_username         = HttpContext.Current.User.Identity.Name;
                }
                GetStatusRequestMsg req = new GetStatusRequestMsg();

                req.classification                = new SecurityWrapper();
                req.classification.caveats        = "none";
                req.classification.classification = ClassificationType.U;
                GetStatusResponseMsg[] res = ss.GetAllStatus(req);
                if (res != null && res != null && res.Length > 0)
                {
                    ajaxdata += "<table><th>Status</th><th>URI</th><th>Detail</th><th>Last Check In</th></tr>";
                    for (int i = 0; i < res.Length; i++)
                    {
                        TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - res[i].TimeStamp.Ticks);
                        ajaxdata += "<tr><td>";
                        if (res[i].Operational)
                        {
                            if (ts.TotalHours > 1.0)
                            {
                                ajaxdata += "<img src=\"" + redlight + "\">";
                            }
                            else if (ts.TotalMinutes > 10)
                            {
                                ajaxdata += "<img src=\"" + orangelight + "\">";
                            }
                            else
                            {
                                ajaxdata += "<img src=\"" + greenlight + "\">";
                            }
                        }
                        else
                        {
                            ajaxdata += "<img src=\"" + redlight + "\">";
                        }
                        ajaxdata += "</td><td>";
                        ajaxdata += System.Web.HttpUtility.HtmlEncode(res[i].URI) +
                                    //"</td><td>" + (res.GetStatusResponseResult[i].Operational ? "OK" : "NG") +
                                    "</td><td>" + System.Web.HttpUtility.HtmlEncode(res[i].Message) +
                                    "</td><td>";

                        if (ts.TotalHours > 1.0)
                        {
                            ajaxdata += "<font color=\"red\">" +
                                        DurationToString(ts)// res.GetStatusResponseResult[i].TimeStamp.ToString("o")
                                        + "</font></td></tr>";
                        }
                        else if (ts.TotalMinutes > 10)
                        {
                            ajaxdata += "<font color=\"#FF7D40\">" +
                                        DurationToString(ts)//res.GetStatusResponseResult[i].TimeStamp.ToString("o")
                                        + "</font></td></tr>";
                        }
                        else
                        {
                            ajaxdata += DurationToString(ts) +
                                        //res.GetStatusResponseResult[i].TimeStamp.ToString("o") +
                                        "</td></tr>";
                        }
                    }
                    ajaxdata += "</table>";
                }
            }
            catch (Exception ex)
            {
                HandleError(ex, true);
            }
            finally
            {
            }
        }
Esempio n. 4
0
        void getStatusData()
        {
            while (running)
            {
                Thread.Sleep(1000);
                if (!running)
                {
                    return;
                }
                if (lastranat.AddMilliseconds(interval) < DateTime.Now)
                {
                    notifyIcon1.ShowBalloonTip(1000, "Requesting status info", "working", ToolTipIcon.Info);
                    lastranat = DateTime.Now;
                    CheckForIllegalCrossThreadCalls = false;
                    GetStatusRequestMsg req = new GetStatusRequestMsg();
                    req.classification = new SecurityWrapper();
                    req.classification.classification = ClassificationType.U;

                    GetStatusResponseMsg[] status = null;
                    try
                    {
                        status = ss.GetAllStatus(req);
                    }
                    catch (Exception ex)
                    {
                        notifyIcon1.ShowBalloonTip(10000, "Oh Uh", "Unable to contact FGSMS " + Environment.NewLine + ex.Message, ToolTipIcon.Error);
                        lastofflinecount = 0;
                        return;
                    }

                    if (status != null)
                    {
                        listBox1.Items.Clear();
                        String msg   = "";
                        int    count = 0;
                        for (int i = 0; i < status.Length; i++)
                        {
                            listBox1.Items.Add(status[i]);
                            //textBox1.Text +=status[i].Operational + " " + status[i].TimeStamp.ToString("o") + " " + status[i].URI + " " + status[i].Message + Environment.NewLine;
                            if (!status[i].Operational)
                            {
                                msg += status[i].URI + Environment.NewLine;
                                count++;
                            }
                        }
                        if (!String.IsNullOrEmpty(msg))
                        {
                            if (count != lastofflinecount)
                            {
                                notifyIcon1.Text = "FGSMS - There are " + count + " services offline!";
                                lastofflinecount = count;
                                notifyIcon1.ShowBalloonTip(10000, "Oh Uh", "The following services are offline" + Environment.NewLine + msg, ToolTipIcon.Warning);
                            }
                        }
                        else
                        {
                            notifyIcon1.ShowBalloonTip(10000, "A-OK", "All Services are Online", ToolTipIcon.Info);
                        }
                    }
                }
            }
        }