Пример #1
0
        public Interaction CreateInteraction(Interaction interaction, int _logIncidentId = 0, int _logContactId = 0)
        {

            if (String.IsNullOrWhiteSpace(InteractionURL) || String.IsNullOrWhiteSpace(InteractionUsername) || String.IsNullOrWhiteSpace(InteractionPassword))
            {
                throw new Exception("Provider's InitForSR not run.");
            }

            Interaction result = new Interaction();
            string request = "";
            string response = "";
            string logMessage, logNote;

            NOTE.JTF_NOTES_PUB_Service client = EBSProxyFactory.GetNoteInstance(InteractionURL, InteractionUsername, InteractionPassword, InteractionServiceTimeout);

            NOTE.SOAHeader hdr = new NOTE.SOAHeader();
            hdr.Responsibility = "SERVICE";
            hdr.RespApplication = "CS";
            hdr.Org_Id = "204";
            hdr.SecurityGroup = "STANDARD";
            hdr.NLSLanguage = "AMERICAN";

            client.SOAHeaderValue = hdr;


            // Now to set the values for the request            

            if (interaction.SrID.HasValue)
            {
                NOTE_CREATE ip_create_note = new NOTE_CREATE();
                // SR.APPSCS_SERVICEREQUEST_PUB_SERVIC7 req_info = new SR.APPSCS_SERVICEREQUEST_PUB_SERVIC7();
                ip_create_note.P_API_VERSION = 1;
                ip_create_note.P_API_VERSIONSpecified = true;
                ip_create_note.P_ORG_ID = 204;
                ip_create_note.P_ORG_IDSpecified = true;
                ip_create_note.P_SOURCE_OBJECT_ID = interaction.SrID;
                ip_create_note.P_SOURCE_OBJECT_IDSpecified = true;
                ip_create_note.P_SOURCE_OBJECT_CODE = "SR";
                //ip.P_NOTES = "This is test.";

                ip_create_note.P_NOTES = interaction.Summary;
                ip_create_note.P_NOTES_DETAIL = interaction.Content;
                ip_create_note.P_NOTE_STATUS = interaction.Status;
                ip_create_note.P_LAST_UPDATE_DATE = interaction.Created;
                ip_create_note.P_LAST_UPDATE_DATESpecified = true;
                ip_create_note.P_CREATION_DATE = interaction.Created;
                ip_create_note.P_CREATION_DATESpecified = true;
                ip_create_note.P_ENTERED_DATE = interaction.Created;
                ip_create_note.P_ENTERED_DATESpecified = true;

                if (interaction.CreatedByID.HasValue)
                {
                    ip_create_note.P_CREATED_BY = interaction.CreatedByID;
                    ip_create_note.P_CREATED_BYSpecified = true;
                    ip_create_note.P_ENTERED_BY = interaction.CreatedByID;
                    ip_create_note.P_ENTERED_BYSpecified = true;
                    ip_create_note.P_LAST_UPDATED_BY = interaction.CreatedByID;
                    ip_create_note.P_LAST_UPDATED_BYSpecified = true;
                }
                else
                {
                    ip_create_note.P_CREATED_BY = 0;
                    ip_create_note.P_CREATED_BYSpecified = true;
                    ip_create_note.P_ENTERED_BY = 0;
                    ip_create_note.P_ENTERED_BYSpecified = true;
                    ip_create_note.P_LAST_UPDATED_BY = 0;
                    ip_create_note.P_LAST_UPDATED_BYSpecified = true;
                }

                ip_create_note.P_NOTE_TYPE = "CS_PROBLEM";

                ip_create_note.P_ATTRIBUTE1 = String.Empty;
                ip_create_note.P_ATTRIBUTE2 = String.Empty;
                ip_create_note.P_ATTRIBUTE3 = String.Empty;
                ip_create_note.P_ATTRIBUTE4 = String.Empty;
                ip_create_note.P_ATTRIBUTE5 = String.Empty;
                ip_create_note.P_ATTRIBUTE6 = String.Empty;
                ip_create_note.P_ATTRIBUTE7 = String.Empty;
                ip_create_note.P_ATTRIBUTE8 = String.Empty;
                ip_create_note.P_ATTRIBUTE9 = String.Empty;
                ip_create_note.P_ATTRIBUTE10 = String.Empty;
                ip_create_note.P_ATTRIBUTE11 = String.Empty;
                ip_create_note.P_ATTRIBUTE12 = String.Empty;
                ip_create_note.P_ATTRIBUTE13 = String.Empty;
                ip_create_note.P_ATTRIBUTE14 = String.Empty;
                ip_create_note.P_ATTRIBUTE15 = String.Empty;
                ip_create_note.P_PARENT_NOTE_ID = null;
                ip_create_note.P_INIT_MSG_LIST = String.Empty;
                ip_create_note.P_COMMIT = String.Empty;
                ip_create_note.P_USE_AOL_SECURITY = String.Empty;

                //ip.P_NOTES_DETAIL = String.Empty;
                //ip.P_JTF_NOTE_CONTEXTS_TAB = new NOTE.APPSJTF_NOTES_PUB_JX227585X15X42();
                List<NOTE.APPSJTF_NOTES_PUB_JX227585X15X42> notes = new List<NOTE.APPSJTF_NOTES_PUB_JX227585X15X42>();

                ip_create_note.P_JTF_NOTE_CONTEXTS_TAB = notes.ToArray();
                Stopwatch stopwatch = new Stopwatch();
                try
                {
                    request = serializer.Serialize(ip_create_note);
                    stopwatch.Start();
                    NOTE.OutputParameters op_create_note = client.SECURE_CREATE_NOTE(ip_create_note);
                    stopwatch.Stop();
                    response = serializer.Serialize(op_create_note);

                    if (op_create_note.X_RETURN_STATUS == "S")
                    {
                        result.InteractionID = op_create_note.X_JTF_NOTE_ID;

                        logMessage = "Request of creating Note (Success). Created Note ID = " + result.InteractionID;
                        logNote = "Request Payload: " + request;
                        log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote);

                        logMessage = "Response of creating Note(Success). Created Note ID = " + result.InteractionID;
                        logNote = "Response Payload: " + response;
                        log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote, (int)stopwatch.ElapsedMilliseconds);
                    }
                    else
                    {
                        result.ErrorMessage = "There has been an error communicating with EBS. Please check log for detail.";

                        logMessage = "Request of creating Note (Failure). " + op_create_note.X_MSG_DATA;
                        logNote = "Request Payload: " + request;
                        log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);

                        logMessage = "Response of creating Note(Failure). " + op_create_note.X_MSG_DATA;
                        logNote = "Response Payload: " + response;
                        log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);
                    }

                }
                catch (Exception ex)
                {
                    result.ErrorMessage = "There has been an error communicating with EBS. Please check log for detail.";

                    logMessage = "Request of creating Note (Failure). " + ex.Message;
                    logNote = "Request Payload: " + request;
                    log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);

                    logMessage = "Response of creating Note(Failure). " + ex.Message;
                    logNote = "Response Payload: " + response;
                    log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);

                    handleEBSException(ex, "Create Note of Service Request", _logIncidentId, _logContactId);
                }
            }

            return result;

        }
 /// <remarks/>
 public void SECURE_CREATE_NOTEAsync(InputParameters InputParameters) {
     this.SECURE_CREATE_NOTEAsync(InputParameters, null);
 }
 /// <remarks/>
 public void SECURE_CREATE_NOTEAsync(InputParameters InputParameters, object userState) {
     if ((this.SECURE_CREATE_NOTEOperationCompleted == null)) {
         this.SECURE_CREATE_NOTEOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSECURE_CREATE_NOTEOperationCompleted);
     }
     this.InvokeAsync("SECURE_CREATE_NOTE", new object[] {
                 InputParameters}, this.SECURE_CREATE_NOTEOperationCompleted, userState);
 }
 /// <remarks/>
 public System.IAsyncResult BeginSECURE_CREATE_NOTE(InputParameters InputParameters, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("SECURE_CREATE_NOTE", new object[] {
                 InputParameters}, callback, asyncState);
 }