Esempio n. 1
0
        // GET: /Monitoring/ActionProfile/List/
        public ActionResult List(bool?activeList)
        {
            try
            {
                var service = new ActionProfileService().actionProfileService;

                var result = service.List(activeList);

                var ret = new
                {
                    ddlActionProfiles = result.ListActionProfiles,

                    status = (result.IsSuccess) ? 1 : 0,
                    error  = result.ErrorMessage
                };

                return(Json(ret));
            }
            catch (Exception ex)
            {
                var ret = new
                {
                    status = -1,
                    error  = ex.Message
                };
                new RMSWebException(this, "0500", "Get failed. " + ex.Message, ex, true);

                return(Json(ret));
            }
        }
Esempio n. 2
0
        //
        // GET: /Monitoring/ActionProfile/SearchActionList/
        public ActionResult SearchActionList(JQueryDataTableParamModel param, string txtActionProfile, string txtEmail, string txtSms)
        {
            //JQueryDataTableParamModel param = new JQueryDataTableParamModel();
            //param.sEcho = String.IsNullOrEmpty(Context.Request["sEcho"]) ? "0" : Context.Request["sEcho"];
            //param.sSearch = String.IsNullOrEmpty(Context.Request["sSearch"]) ? "" : Context.Request["sSearch"];
            //param.iDisplayStart = String.IsNullOrEmpty(Context.Request["iDisplayStart"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayStart"]);
            //param.iDisplayLength = String.IsNullOrEmpty(Context.Request["iDisplayLength"]) ? 0 : Convert.ToInt32(Context.Request["iDisplayLength"]);

            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            var sortDirection   = Request["sSortDir_0"]; // asc or desc

            param.iSortColumn = (Request["mDataProp_" + sortColumnIndex] + "_" + sortDirection).ToLower();

            try
            {
                var apClient = new ActionProfileService().actionProfileService;

                var searchResult = apClient.Search(param, txtActionProfile, txtEmail, txtSms);

                int?totalRecords = 0;
                totalRecords = searchResult.TotalRecords;

                var data = new
                {
                    sEcho                = param.sEcho,
                    iTotalRecords        = totalRecords,
                    iTotalDisplayRecords = totalRecords,
                    aaData               = searchResult.ListActionProfiles,
                    status               = (searchResult.IsSuccess) ? 1 : 0,
                    error                = searchResult.ErrorMessage
                };

                return(Json(data));
            }
            catch (Exception ex)
            {
                var data = new
                {
                    status = 0,
                    error  = ex.Message
                };

                new RMSWebException(this, "0500", "SearchActionList failed. " + ex.Message, ex, true);

                return(Json(data));
            }
        }
Esempio n. 3
0
        // GET: /Monitoring/ActionProfile/UpdateActionProfile/
        public ActionResult UpdateActionProfile(int?id, string m, string ActionProfileName, string Email, string SMS, bool ActiveList)
        {
            if (string.IsNullOrEmpty(ActionProfileName))
            {
                throw new ArgumentNullException("ActionProfileName");
            }

            if (m == "e" && id == null)
            {
                throw new ArgumentNullException("id");
            }

            try
            {
                var apClient = new ActionProfileService().actionProfileService;
                var result   = apClient.Update(id, m, ActionProfileName, Email, SMS, ActiveList);

                var ret = new
                {
                    status = (result.IsSuccess) ? 1 : 0,
                    error  = (result.IsSuccess) ? "" : result.ErrorMessage
                };

                return(Json(ret));
            }
            catch (Exception ex)
            {
                var ret = new
                {
                    status = 0,
                    error  = ex.Message
                };

                new RMSWebException(this, "0500", "UpdateActionProfile failed. " + ex.Message, ex, true);

                return(Json(ret));
            }
        }
Esempio n. 4
0
        private void DoChecking()
        {
            string ret = "";

            #region Check Web Server - Web.config

            try
            {
                /*
                 *  <add key="RMS.OverrideProxy" value="false" />
                 *  <add key="RMS.WebServicURL_ActionProfileService" value="http://localhost/RMS.Centralize.WebService/ActionProfileService.svc" />
                 *  <add key="RMS.WebServicURL_MessageActionService" value="http://localhost/RMS.Centralize.WebService/MessageActionService.svc" />
                 *  <add key="RMS.WebServicURL_ClientService" value="http://localhost/RMS.Centralize.WebService/ClientService.svc" />
                 *  <add key="RMS.WebServicURL_MonitoringService" value="http://localhost/RMS.Centralize.WebService/MonitoringService.svc" />
                 *  <add key="RMS.WebServicURL_SummaryReportService" value="http://localhost/RMS.Centralize.WebService/SummaryReportService.svc" />
                 *  <add key="RMS.WebServicURL_SelfTestingService" value="http://localhost/RMS.Centralize.WebService/SelfTestingService.svc" />
                 *
                 */
                var nameValueCollection = ConfigurationManager.AppSettings;
                foreach (string s in nameValueCollection.AllKeys)
                {
                    var value = ConfigurationManager.AppSettings[s];
                    ret += "<b>" + s + "</b> = " + value + "<br/>";
                }
                rWebConfig.InnerHtml = ret;

                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.OverrideProxy"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.OverrideProxy\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_ActionProfileService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_ActionProfileService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_MessageActionService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_MessageActionService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_ClientService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_ClientService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_MonitoringService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_MonitoringService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_SummaryReportService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_SummaryReportService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_SelfTestingService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_SelfTestingService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_LocationService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_LocationService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_ClientMonitoringService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_ClientMonitoringService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_MonitoringProfileService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_MonitoringProfileService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_SeverityLevelService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_SeverityLevelService\"] not found or empty.";
                //}
                //if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["RMS.WebServicURL_MasterTableService"]))
                //{
                //    ret += "<br/>AppSettings[\"RMS.WebServicURL_MasterTableService\"] not found or empty.";
                //}

                //if (ret == "")
                //{
                //    rWebConfig.InnerHtml = "<span class=\"txt-green\">Passed</span>";
                //}
                //else
                //{
                //    rWebConfig.InnerHtml = "<span class=\"txt-red\">Failed</span>" + ret;
                //}
            }
            catch (Exception ex)
            {
                rWebConfig.InnerHtml = "Internal error while checking Web.config. " + ex.Message;
            }

            #endregion

            #region Check Web Server -> Web Service Server Connection

            ret = "";

            try
            {
                var service = new ActionProfileService();
                service.actionProfileService.TestConnection();
            }
            catch (Exception ex)
            {
                ret += "<br/>ActionProfileService failed. " + ex.Message;
            }
            try
            {
                var service = new ClientService();
                service.clientService.TestConnection();
            }
            catch (Exception ex)
            {
                ret += "<br/>ClientService failed. " + ex.Message;
            }
            try
            {
                var service = new MessageActionService();
                service.messsageActionService.TestConnection();
            }
            catch (Exception ex)
            {
                ret += "<br/>MessageActionService failed. " + ex.Message;
            }
            try
            {
                var service = new MonitoringService();
                service.monitoringService.TestConnection();
            }
            catch (Exception ex)
            {
                ret += "<br/>MonitoringService failed. " + ex.Message;
            }
            try
            {
                var service = new SummaryReportService();
                service.summaryReportService.TestConnection();
            }
            catch (Exception ex)
            {
                ret += "<br/>SummaryReportService failed. " + ex.Message;
            }
            try
            {
                var service = new SelfTestingService();
                service.selfTestingService.TestConnection();
            }
            catch (Exception ex)
            {
                ret += "<br/>SelfTestingService failed. " + ex.Message;
            }
            if (ret == "")
            {
                rWebToWsConnection.InnerHtml = "<span class=\"txt-green\">Passed</span>";
            }
            else
            {
                rWebToWsConnection.InnerHtml = "<span class=\"txt-red\">Failed</span>" + ret;
            }


            #endregion

            #region Check Web Service Server - Web.Config

            ret = "";

            try
            {
                var service = new SelfTestingService();
                ret = service.selfTestingService.TestWebConfig();
                rWebServiceConfig.InnerHtml = ret;
                //if (ret == "")
                //{
                //    rWebServiceConfig.InnerHtml = "<span class=\"txt-green\">Passed</span>";
                //}
                //else
                //{
                //    rWebServiceConfig.InnerHtml = "<span class=\"txt-red\">Failed</span>" + ret;
                //}
            }
            catch (Exception ex)
            {
                rWebServiceConfig.InnerHtml = "Internal error while checking Web Service Web.config. " + ex.Message;
            }

            #endregion

            #region Check Web Service Server -> Database Server Connection

            ret = "";

            try
            {
                var service = new SelfTestingService();
                ret = service.selfTestingService.TestDatabaseConnection();

                if (ret == "")
                {
                    rWSToDbConnection.InnerHtml = "<span class=\"txt-green\">Passed</span>";
                }
                else
                {
                    rWSToDbConnection.InnerHtml = "<span class=\"txt-red\">Failed</span>" + ret;
                }
            }
            catch (Exception ex)
            {
                rWSToDbConnection.InnerHtml = "Internal error while checking Database Connection. " + ex.Message;
            }

            #endregion

            #region Check Web Service Server -> Monitoring Agent Connection

            ret = "";

            try
            {
                var ipAddress = Request["ipAddress"];

                if (string.IsNullOrEmpty(ipAddress))
                {
                    rWsToAgentConnection.InnerHtml = "Please specify agent IP address via URL.<br/>eg. SelfTesting.aspx?ipaddress=127.0.0.1&[email protected]&sms=0812345678";
                }
                else
                {
                    var service = new SelfTestingService();
                    ret = service.selfTestingService.TestAgentConnection(ipAddress);

                    if (ret == "")
                    {
                        rWsToAgentConnection.InnerHtml = "<span class=\"txt-green\">Passed</span>";
                    }
                    else
                    {
                        rWsToAgentConnection.InnerHtml = "<span class=\"txt-red\">Failed</span>" + ret;
                    }
                }
            }
            catch (Exception ex)
            {
                rWsToAgentConnection.InnerHtml = "Internal error while checking Monitoring Agent Connection. " + ex.Message;
            }

            #endregion

            #region Check Web Service Server -> Email & SMS Server Connection

            ret = "";

            try
            {
                var email = Request["email"];
                var sms   = Request["sms"];

                if (string.IsNullOrEmpty(email))
                {
                    rWsToEmailConnection.InnerHtml = "Please specify email via URL.";
                }

                if (string.IsNullOrEmpty(sms))
                {
                    if (rWsToEmailConnection.InnerText != "")
                    {
                        rWsToEmailConnection.InnerHtml += "<br/>";
                    }
                    rWsToEmailConnection.InnerHtml += "Please specify sms via URL.";
                }

                if (rWsToEmailConnection.InnerText != "")
                {
                    rWsToEmailConnection.InnerHtml += "<br/>eg. SelfTesting.aspx?ipaddress=127.0.0.1&[email protected]&sms=0812345678";
                }

                else
                {
                    var service = new SelfTestingService();
                    ret = service.selfTestingService.TestEmailSmsConnection(email, sms);

                    if (ret == "")
                    {
                        rWsToEmailConnection.InnerHtml = "<span class=\"txt-green\">Passed</span>";
                    }
                    else
                    {
                        rWsToEmailConnection.InnerHtml = "<span class=\"txt-red\">Failed</span>" + ret;
                    }
                }
            }
            catch (Exception ex)
            {
                rWsToEmailConnection.InnerHtml = "Internal error while checking Email & SMS Server Connection. " + ex.Message;
            }

            #endregion
        }