/// <summary> /// Sends email to Web Support if an event failure occurs /// </summary> public static void SendEmailToWebSupport(string sessionKey, string privateKey, string Note, TraceLog t) { try { using (var ConfigurationClientWS = new SelcommWSsvc.SelcommWSAll.ConfigurationClient(GetSelcommWsEndpointName())) { string body = $"Provider Code : {privateKey} <br />" + $"Server Environment : {Utility.ServerEnvironment}<br />" + $"{Note}"; string subject = "THIS IS JUST FOR TEST ";//$"SelcommOSS - Attention required for TrustPower event processing. Server : {Utility.ServerEnvironment}"; string emailTo = ConfigurationClientWS.GetConfigValue(sessionKey, "TPOWER_WEBSUPPORT_EMAIL", null, null, null, null, null, null); if (string.IsNullOrWhiteSpace(emailTo)) { emailTo = "*****@*****.**"; t.CreateLog($"To email is not configured in the system. The email address [{emailTo}] is assigned as To email on the fly to send email."); } EmailHelper.SendEmail("*****@*****.**", emailTo, subject, body, true); t.CreateLog($"Email has been sent to {emailTo} to notify the action."); } } catch (Exception ex) { t.CreateLog("Email to websupport is unsuccessful"); t.CreateLog(getExceptionString(ex).Replace("<br/>", Environment.NewLine).Replace("<br />", Environment.NewLine)); t.CreateLog("==================The email was supposed to be sent to notify the following issue.==============================="); t.CreateLog(Note.Replace("<br/>", Environment.NewLine).Replace("<br />", Environment.NewLine)); } }
public static void UpdateEventNote(string sessionKey, long eventID, string note, TraceLog t) { using (var EventClientWS = new SelcommWSsvc.SelcommWSAll.EventClient(GetSelcommWsEndpointName())) { EventClientWS.EventNoteUpdate(sessionKey, eventID, note); t.CreateLog(note); } }
public static void ActionResponse(string SessionKey, EventDisplay targetEvent, string AttribId, string AttribValue, string targetActionCode, TraceLog t) { t.CreateLog("---START OF ACTION_RESPONSE---"); try { using (var ServiceClientWS = new SelcommWSsvc.SelcommWSAll.ServiceClient(GetSelcommWsEndpointName())) { var serviceAttribute = new ServiceAttribute { AttributeTemplate = new AttributeTemplate { Id = Convert.ToInt64(AttribId) }, Key = targetEvent.ServiceId, Value = AttribValue, Event = new Event() { Id = targetEvent.EventId } }; t.CreateLog($"Creating service attribute for service id:{targetEvent.ServiceId}"); ServiceClientWS.ServiceAttributeUpdate(SessionKey, serviceAttribute); t.CreateLog($"Service attribute for {targetActionCode} with Attribute ID: {serviceAttribute.AttributeTemplate.Id} and Attribute value: {AttribValue} created against service id {targetEvent.ServiceId}"); } } catch (Exception ex) { throw ex; } }
//TODO: uncomment below methods public static void updateEventStatus(string sessionKey, long eventRef, string schedStatCode, TraceLog t, string eventNote = null) { Event NewEvent = new Event(); NewEvent = new Event { Id = eventRef }; EventSchedule Schedule = new EventSchedule { EventScheduleStatus = new EventScheduleStatus { Code = schedStatCode }, Event = NewEvent, DueDate = DateTime.Now }; using (var EventClientWS = new SelcommWSsvc.SelcommWSAll.EventClient(Helpers.GetSelcommWsEndpointName())) { EventClientWS.EventScheduleUpdate(sessionKey, Schedule, eventNote); string reason = string.IsNullOrWhiteSpace(eventNote) ? null : $"Reason : {eventNote}"; t.CreateLog($"Event {eventRef} is updated to the status {schedStatCode}. {reason}"); } }