コード例 #1
0
        private void SendEvent(WarningMessage warning)
        {
            Console.WriteLine("发送报警事件,{0}", warning.Message);
            DevOpsEvent opsEvent = new DevOpsEvent();

            opsEvent.EventType     = (int)warning.WarningType;
            opsEvent.OperatorDate  = DateTime.Now;
            opsEvent.RemoteAccount = "123456789";
            opsEvent.ContactPhone  = string.Empty;
            opsEvent.ContactName   = string.Empty;

            try
            {
                var returnData = HttpHelper.PostAsync <ReturnData>("http://localhost:8080/devops/reportDevOpsEvent", opsEvent).Result;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
コード例 #2
0
        private void SendEvent(WarningMessage warning)
        {
            Console.WriteLine("发送报警事件,{0}", warning.Message);
            DevOpsEvent opsEvent = new DevOpsEvent();

            opsEvent.EventType      = (int)warning.WarningType;
            opsEvent.OperatorDate   = DateTime.Now;
            opsEvent.ProjectNo      = EnvironmentInfo.ProjectNo ?? string.Empty;
            opsEvent.RemoteAccount  = EnvironmentInfo.ProjectNo ?? string.Empty;
            opsEvent.RemotePassword = EnvironmentInfo.RemotePassword ?? string.Empty;
            opsEvent.ContactPhone   = EnvironmentInfo.ContactPhone ?? string.Empty;
            opsEvent.ContactName    = EnvironmentInfo.ContactName ?? string.Empty;

            try
            {
                string url        = string.Format("{0}/devops/reportDevOpsEvent", EnvironmentInfo.ServerUrl);
                var    returnData = HttpHelper.Post <ReturnData>(url, opsEvent, 3000);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }