示例#1
0
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (objectListView1.SelectedObject != null)
     {
         CommunicationEntry ce = (CommunicationEntry)objectListView1.SelectedObject;
         if (ce.Tag != null)
         {
             if (ce.Tag is string)
             {
                 FileInfo fi = new FileInfo((string)ce.Tag);
                 if (fi.Exists)
                 {
                     if (MessageBox.Show(
                             "Are you sure you want to delete this file?  This is permanent and cannot be undone.\n" + fi.Name.ToString(), "Delete Document", MessageBoxButtons.OKCancel) == DialogResult.OK)
                     {
                         try
                         {
                             fi.Delete();
                             files.Remove(fi.FullName);
                             objectListView1.RemoveObject(ce);
                         }
                         catch
                         {
                             MessageBox.Show("An error occured while deleting this file, please make sure it is not open in another application and try again.");
                         }
                     }
                 }
             }
         }
     }
 }
示例#2
0
        private void DefaultOpenButton_Click(object sender, EventArgs e)
        {
            string name = "";

            if (objectListView1.SelectedObject != null)
            {
                CommunicationEntry ce = (CommunicationEntry)objectListView1.SelectedObject;
                if (ce.Tag != null)
                {
                    if (ce.Tag is string)
                    {
                        name = (string)ce.Tag;
                    }
                }
            }


            if (string.IsNullOrEmpty(name) == false)
            {
                switch (Path.GetExtension(name).ToLower())
                {
                case ".doc":
                case ".docx":
                    OpenWithWord(name);
                    break;

                case ".pdf":
                    OpenPDF(name);
                    break;

                default:
                    break;
                }
            }
        }
        public async Task <HttpResponseMessage> GetSmsStatusByMessageIDs(String MessageIDs)
        {
            String strreturn;
            String strAPI   = ConfigurationManager.AppSettings["OutboundSmsAPI"];
            String senderid = ConfigurationManager.AppSettings["OutboundSmsSenderID"];

            String         sURL    = "http://global.sinfini.com/api/v3/index.php?method=sms" + "&api_key=" + strAPI + "&format=json&id=" + MessageIDs + "&numberinfo=1";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sURL);

            try
            {
                WebResponse response = request.GetResponse();
                using (Stream responseStream = response.GetResponseStream())
                {
                    StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
                    // return reader.ReadToEnd();
                    strreturn = reader.ReadToEnd();
                }
            }
            catch (WebException ex)
            {
                WebResponse errorResponse = ex.Response;
                using (Stream responseStream = errorResponse.GetResponseStream())
                {
                    StreamReader reader    = new StreamReader(responseStream, Encoding.GetEncoding("utf-8"));
                    String       errorText = reader.ReadToEnd();
                    //log errorText
                }
                throw;
            }

            stranddContext context = new stranddContext();

            CommunicationEntry update = await context.CommunicationLog.Where(a => a.Source == MessageIDs).SingleOrDefaultAsync();

            String responseText = String.Empty;

            if (update != null)
            {
                JObject obj       = JObject.Parse(strreturn);
                string  Messageid = String.Empty;

                update.Source = obj["message"].ToString();

                await context.SaveChangesAsync();

                responseText = "Status Update MessgeId: " + MessageIDs;

                //Return Successful Response
                Services.Log.Info(responseText);
            }

            //string responseText = strreturn;

            return(this.Request.CreateResponse(HttpStatusCode.Created, responseText));
        }
示例#4
0
        /**************************************************************************************************/

        private void TaskChanged(object sender, HraModelChangedEventArgs e)
        {
            foreach (object o in objectListView1.Objects)
            {
                CommunicationEntry ce = (CommunicationEntry)o;
                if (ce.Tag == sender)
                {
                    ce.title = ((Task)ce.Tag).Task_Type;
                    objectListView1.RefreshObject(o);
                }
            }
        }
示例#5
0
 private void button5_Click(object sender, EventArgs e)
 {
     if (objectListView1.SelectedItem != null)
     {
         CommunicationEntry ce = (CommunicationEntry)objectListView1.SelectedObject;
         if (ce.Tag is string)
         {
             string name = (string)ce.Tag;
             OpenWithWord(name);
         }
     }
 }
示例#6
0
        public void FillControls()
        {
            if (loadingCircle1.InvokeRequired)
            {
                fillControlsCallback fcc = new fillControlsCallback(FillControls);
                this.Invoke(fcc, null);
            }
            else
            {
                foreach (Task theTask in proband.Tasks.OrderByDescending(t => ((Task)t).Task_Date))
                {
                    CommunicationEntry ce = new CommunicationEntry();
                    ce.title  = theTask.Task_Type;
                    ce.date   = theTask.Task_Date;
                    ce.Tag    = theTask;
                    ce.author = theTask.Task_AssignedBy;

                    bool add = true;
                    if (objectListView1.Objects != null)
                    {
                        foreach (object o in objectListView1.Objects)
                        {
                            if (o is CommunicationEntry)
                            {
                                CommunicationEntry ce2 = (CommunicationEntry)o;
                                if (ce2.Tag is Task)
                                {
                                    if (ce2.Tag == theTask)
                                    {
                                        add = false;
                                    }
                                }
                            }
                        }
                    }
                    if (add)
                    {
                        objectListView1.AddObject(ce);
                    }
                    if (theTask == InitialTask)
                    {
                        objectListView1.SelectedObject = ce;
                    }
                }

                loadingCircle1.Visible = false;
                loadingCircle1.Enabled = false;
            }
        }
        public async Task <HttpResponseMessage> CustomerClientExceptionContact(ExceptionContactRequest contactRequest)
        {
            Services.Log.Warn("Mobile Customer Client Exception Contact Request [API]");
            string responseText = "";

            IHubContext hubContext = Services.GetRealtime <IncidentHub>();

            CommunicationEntry newCommunication = new CommunicationEntry()
            {
                Id         = Guid.NewGuid().ToString(),
                Tag        = contactRequest.ContactPhone,
                IncidentID = contactRequest.IncidentGUID,
                Type       = "MOBILE CUSTOMER CLIENT EXCEPTION CONTACT REQUEST",
                Status     = "SUBMITTED",
                StartTime  = DateTime.Now
            };

            stranddContext context = new stranddContext();

            context.CommunicationLog.Add(newCommunication);

            await context.SaveChangesAsync();

            responseText = "Communication Logged in Service";
            Services.Log.Info(responseText);
            responseText = "";

            if (contactRequest.ContactPhone != null)
            {
                responseText += "CONTACT CUSTOMER on Phone [" + contactRequest.ContactPhone + "] ";
            }

            if (contactRequest.IncidentGUID != null)
            {
                responseText += " | Exception on Incident [" + contactRequest.IncidentGUID + "]";
                //hubContext.Clients.All.updateIncidentCustomerError(responseText);
            }

            Services.Log.Warn(responseText);

            hubContext.Clients.All.notifyCustomerClientExceptionContact(new CommunicationInfo(newCommunication));
            Services.Log.Info("Connected Clients Updated");

            //Return Successful Response
            return(this.Request.CreateResponse(HttpStatusCode.OK, responseText));

            //PENDING TO ADD: Incident Updation with Error
        }
        public async Task <HttpResponseMessage> OperatorConfirmCallRequest(OperatorCallRequestConfirmationRequest communicationRequest)
        {
            Services.Log.Info("Operator Call Request Confirmation Requested [API]");
            string responseText;

            // Get the logged-in user.
            var currentUser = this.User as ServiceUser;

            stranddContext context = new stranddContext();

            //Retrieve Communication
            CommunicationEntry updateCommunication = await(from r in context.CommunicationLog where (r.Id == communicationRequest.CommunicationGUID) select r).FirstOrDefaultAsync();

            if (updateCommunication != null)
            {
                if (updateCommunication.Status == "CONFIRMED")
                {
                    responseText = "Already Confirmed - Communication [" + communicationRequest.CommunicationGUID + "] ";
                    Services.Log.Info(responseText);
                    return(this.Request.CreateResponse(HttpStatusCode.OK, responseText));
                }

                else
                {
                    //Edit Communication
                    updateCommunication.OperatorID = currentUser.Id;
                    updateCommunication.Status     = "CONFIRMED";
                    updateCommunication.EndTime    = DateTime.Now;
                }
            }
            else
            {
                // Return Failed Response
                responseText = "Not Found - Communication [" + communicationRequest.CommunicationGUID + "] ";
                Services.Log.Warn(responseText);
                return(this.Request.CreateResponse(HttpStatusCode.NotFound, responseText));
            }

            //Save record
            await context.SaveChangesAsync();

            responseText = "Operator Confirmed - Communication [" + updateCommunication.Id + "] ";
            Services.Log.Info(responseText);

            //await HistoryEvent.logHistoryEventAsync("COMMUNICATION_REQUESTCONFIRMATION_OPERATOR", null, updateCommunication.Id, null, null, null);

            return(this.Request.CreateResponse(HttpStatusCode.OK, responseText));
        }
示例#9
0
        /**************************************************************************************************/

        private void TaskListChanged(HraListChangedEventArgs e)
        {
            if (e.hraOperand != null)
            {
                Task theTask = (Task)e.hraOperand;

                switch (e.hraListChangeType)
                {
                case HraListChangedEventArgs.HraListChangeType.ADD:
                    CommunicationEntry ce = new CommunicationEntry();
                    ce.title  = theTask.Task_Type;
                    ce.Tag    = theTask;
                    ce.author = theTask.Task_AssignedBy;
                    ce.date   = theTask.Task_Date;
                    objectListView1.AddObject(ce);
                    break;

                case HraListChangedEventArgs.HraListChangeType.DELETE:
                    object doomed = null;
                    ;
                    foreach (object o in objectListView1.Objects)
                    {
                        CommunicationEntry doomed_ce = (CommunicationEntry)o;
                        if (doomed_ce.Tag == theTask)
                        {
                            doomed = o;
                        }
                    }
                    if (doomed != null)
                    {
                        if (splitContainer1.Panel2.Controls.Contains(taskViewUC))
                        {
                            if (taskViewUC.Task == theTask)
                            {
                                taskViewUC.Release();
                                splitContainer1.Panel2.Controls.Remove(taskViewUC);
                            }
                        }
                        objectListView1.RemoveObject(doomed);
                    }
                    break;
                }
            }
        }
示例#10
0
 private void deleteTaskToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (objectListView1.SelectedObject != null)
     {
         CommunicationEntry ce = (CommunicationEntry)objectListView1.SelectedObject;
         if (ce.Tag != null)
         {
             if (ce.Tag is Task)
             {
                 Task doomed = (Task)ce.Tag;
                 while (doomed.FollowUps.Count > 0)
                 {
                     doomed.FollowUps.RemoveFromList(doomed.FollowUps[0], SessionManager.Instance.securityContext);
                 }
                 proband.Tasks.RemoveFromList(doomed, SessionManager.Instance.securityContext);
             }
         }
     }
 }
示例#11
0
        private void addFileToList(String fullFileName)
        {
            FileInfo f = new FileInfo(fullFileName);

            if (f.Extension.Length > 0)
            {
                if (fullFileName.Contains('~') == false && files.Contains(fullFileName) == false)
                {
                    files.Add(fullFileName);
                    CommunicationEntry ce = new CommunicationEntry();
                    ce.title = Path.GetFileName(fullFileName);
                    ce.Tag   = fullFileName;
                    FileInfo fi = new FileInfo(fullFileName);
                    ce.date = fi.LastWriteTime;
                    objectListView1.AddObject(ce);
                    objectListView1.Columns[1].Width = -1;
                }
            }
        }
        private void LogOutboundMessageToDB(String ID, String Type, String Tag, String Status, String Source, String Text)
        {
            CommunicationEntry newCommlog = new CommunicationEntry()
            {
                Id        = ID,
                Type      = Type,
                Tag       = Tag,
                Status    = "SUBMITTED",
                Source    = Source,
                Text      = Text,
                StartTime = DateTime.Now
            };

            stranddContext context = new stranddContext();

            context.CommunicationLog.Add(newCommlog);

            //Save record
            context.SaveChangesAsync();
        }
示例#13
0
        private void WriteCommunicationLogEntry(NewAnnouncementRequest request, int nodeId, string user)
        {
            var newEntry = new CommunicationEntry
            {
                Title    = request.Heading,
                SentDate = DateTime.Now,
                NodeId   = nodeId,
                User     = user
            };

            var filePath    = Path.Combine(TempFolderPath, LogFileName);
            var existingLog = GetHistoryLog(filePath);

            existingLog.Add(newEntry);

            try
            {
                File.WriteAllText(filePath, JsonConvert.SerializeObject(existingLog.OrderByDescending(x => x.SentDate).ToList()));
            }
            catch (Exception e)
            {
                LogHelper.Error <Exception>("Error serialising communication log", e);
            }
        }
示例#14
0
 private void objectListView1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         if (objectListView1.SelectedObject != null)
         {
             CommunicationEntry ce = (CommunicationEntry)objectListView1.SelectedObject;
             if (ce.Tag != null)
             {
                 if (ce.Tag is Task)
                 {
                     deleteTaskToolStripMenuItem.Visible = true;
                     deleteToolStripMenuItem.Visible     = false;
                 }
                 else if (ce.Tag is string)
                 {
                     deleteTaskToolStripMenuItem.Visible = false;
                     deleteToolStripMenuItem.Visible     = true;
                 }
                 contextMenuStrip1.Show(objectListView1.PointToScreen(e.Location));
             }
         }
     }
 }
        public async Task <HttpResponseMessage> inboundSms()
        {
            Microsoft.AspNet.SignalR.IHubContext hubContext = Services.GetRealtime <IncidentHub>();
            Services.Log.Info("Inbound SMS Request");

            String Type = "INBOUND SMS";
            String ID   = Guid.NewGuid().ToString();

            var    queryStrings = Request.GetQueryNameValuePairs().ToDictionary(x => x.Key, x => x.Value);
            String from         = String.Empty;
            String message      = String.Empty;
            String ts           = String.Empty;


            if (queryStrings.ContainsKey("from"))
            {
                from = queryStrings["from"];
            }
            if (queryStrings.ContainsKey("message"))
            {
                message = queryStrings["message"];
            }
            if (queryStrings.ContainsKey("ts"))
            {
                ts = queryStrings["ts"];
            }


            //store at DB Level
            // LogInboundOutboundMessageToDB(ID, Type, from, "SUBMITTED", "Source", message);

            CommunicationEntry newCommunication = new CommunicationEntry()
            {
                Id        = ID,
                Type      = Type,
                Tag       = from,
                Status    = "SUBMITTED",
                Text      = message,
                StartTime = DateTime.Now
            };


            stranddContext context = new stranddContext();

            context.CommunicationLog.Add(newCommunication);

            await context.SaveChangesAsync();

            String responseText = ("New Communication Log Created #" + ID);

            Services.Log.Info(responseText);

            //  return this.Request.CreateResponse(HttpStatusCode.Created, responseText);


            //----------------------------NOTIFICATION INBOUND SMS CODE-------------------------------//
            responseText = "";

            if (from != null)
            {
                responseText += "Please call [" + from + "] ";
            }

            if (message != null)
            {
                responseText += "[" + message + "]";
                //hubContext.Clients.All.updateIncidentCustomerError(responseText);
            }

            Services.Log.Warn(responseText);

            // hubContext.Clients.All.notifyCustomerClientExceptionContact(new CommunicationInfo(newCommunication));
            hubContext.Clients.All.notifyCustomerNewInboundSmsContact(new InboundsmsInfo(newCommunication));
            Services.Log.Info("Inbound Notification Cerated.");


            // Outbound SMS triggered to above Number with following text from MM-STRNDD:
            String strdownloadlink = ConfigurationManager.AppSettings["Appdownloadlink"];

            strdownloadlink = "<" + "a href='" + strdownloadlink + "'>" + strdownloadlink + "<a>";

            CommunicationsLogOutboundRequest communicationRequest = new CommunicationsLogOutboundRequest();

            communicationRequest.MobileNo = from;
            communicationRequest.Message  = "Please download the StrandD App [" + strdownloadlink + "] so we can better assist you incase you need us again.";

            await OutboundSms(communicationRequest);

            //Return Successful Response
            return(this.Request.CreateResponse(HttpStatusCode.OK, responseText));

            //----------------------------NOTIFICATION INBOUND SMS CODE END-------------------------------//
        }
示例#16
0
        private void AddCommunicationView(CommunicationEntry ce)
        {
            FileNameLabel.Text = "";
            if (ce.Tag != null)
            {
                if (ce.Tag is Task)
                {
                    if (splitContainer1.Panel2.Controls.Contains(taskViewUC))
                    {
                        taskViewUC.Release();
                        splitContainer1.Panel2.Controls.Remove(taskViewUC);
                    }

                    htmlEditorPanel.Visible = false;
                    NoPreviewPanel.Visible  = false;

                    taskViewUC      = new TaskViewUC();
                    taskViewUC.Task = (Task)ce.Tag;
                    taskViewUC.Dock = DockStyle.Fill;

                    splitContainer1.Panel2.Controls.Add(taskViewUC);
                }

                else if (ce.Tag is string)
                {
                    //splitContainer1.Panel2.Controls.Clear();
                    //htmlEditorPanel.Visible = true;
                    splitContainer1.Panel2.Controls.Add(htmlEditorPanel);

                    string name = (string)ce.Tag;

                    if (string.IsNullOrEmpty(name) == false)
                    {
                        switch (Path.GetExtension(name).ToLower())
                        {
                        case ".html":
                        case ".htm":
                            htmlEditorPanel.Visible = true;
                            FileNameLabel.Text      = Path.GetFileName(name);
                            string s = File.ReadAllText(name);
                            winFormHtmlEditor1.DocumentHtml = s;
                            winFormHtmlEditor1.Tag          = name;
                            break;

                        case ".doc":
                        case ".docx":
                            NoPreviewPanel.Visible  = true;
                            htmlEditorPanel.Visible = false;
                            //OpenWithWord(name);
                            break;

                        case ".pdf":
                            NoPreviewPanel.Visible  = true;
                            htmlEditorPanel.Visible = false;
                            //OpenPDF(name);
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
示例#17
0
        public void FillControls()
        {
            if (loadingCircle1.InvokeRequired)
            {
                fillControlsCallback fcc = new fillControlsCallback(FillControls);
                this.Invoke(fcc, null);
            }
            else
            {
                foreach (Task theTask in proband.Tasks.OrderByDescending(t => ((Task)t).Task_Date))
                {
                    CommunicationEntry ce = new CommunicationEntry();
                    ce.title = theTask.Task_Type;
                    ce.date = theTask.Task_Date;
                    ce.Tag = theTask;
                    ce.author = theTask.Task_AssignedBy;

                    bool add = true;
                    if (objectListView1.Objects != null)
                    {
                        foreach (object o in objectListView1.Objects)
                        {
                            if (o is CommunicationEntry)
                            {
                                CommunicationEntry ce2 = (CommunicationEntry) o;
                                if (ce2.Tag is Task)
                                {
                                    if (ce2.Tag == theTask)
                                    {
                                        add = false;
                                    }
                                }
                            }
                        }
                    }
                    if (add)
                    {
                        objectListView1.AddObject(ce);
                    }
                    if (theTask == InitialTask)
                    {
                        objectListView1.SelectedObject = ce;
                    }
                }

                loadingCircle1.Visible = false;
                loadingCircle1.Enabled = false;
            }
        }
示例#18
0
        private void AddCommunicationView(CommunicationEntry ce)
        {
            FileNameLabel.Text = "";
            if (ce.Tag != null)
            {
                if (ce.Tag is Task)
                {
                    if (splitContainer1.Panel2.Controls.Contains(taskViewUC))
                    {
                        taskViewUC.Release();
                        splitContainer1.Panel2.Controls.Remove(taskViewUC);
                    }

                    htmlEditorPanel.Visible = false;
                    NoPreviewPanel.Visible = false;

                    taskViewUC = new TaskViewUC();
                    taskViewUC.Task = (Task)ce.Tag;
                    taskViewUC.Dock = DockStyle.Fill;

                    splitContainer1.Panel2.Controls.Add(taskViewUC);
                }

                else if (ce.Tag is string)
                {
                    //splitContainer1.Panel2.Controls.Clear();
                    //htmlEditorPanel.Visible = true;
                    splitContainer1.Panel2.Controls.Add(htmlEditorPanel);

                    string name = (string) ce.Tag;

                    if (string.IsNullOrEmpty(name) == false)
                    {
                        switch (Path.GetExtension(name).ToLower())
                        {
                            case ".html":
                            case ".htm":
                                htmlEditorPanel.Visible = true;
                                FileNameLabel.Text = Path.GetFileName(name);
                                string s = File.ReadAllText(name);
                                winFormHtmlEditor1.DocumentHtml = s;
                                winFormHtmlEditor1.Tag = name;
                                break;
                            case ".doc":
                            case ".docx":
                                NoPreviewPanel.Visible = true;
                                htmlEditorPanel.Visible = false;
                                //OpenWithWord(name);
                                break;
                            case ".pdf":
                                NoPreviewPanel.Visible = true;
                                htmlEditorPanel.Visible = false;
                                //OpenPDF(name);
                                break;
                            default:
                                break;

                        }
                    }
                }
            }
        }
示例#19
0
        /**************************************************************************************************/
        private void TaskListChanged(HraListChangedEventArgs e)
        {
            if (e.hraOperand != null)
            {
                Task theTask = (Task) e.hraOperand;

                switch (e.hraListChangeType)
                {
                    case HraListChangedEventArgs.HraListChangeType.ADD:
                        CommunicationEntry ce = new CommunicationEntry();
                        ce.title = theTask.Task_Type;
                        ce.Tag = theTask;
                        ce.author = theTask.Task_AssignedBy;
                        ce.date = theTask.Task_Date;
                        objectListView1.AddObject(ce);
                        break;
                    case HraListChangedEventArgs.HraListChangeType.DELETE:
                        object doomed = null;
                        ;
                        foreach (object o in objectListView1.Objects)
                        {
                            CommunicationEntry doomed_ce = (CommunicationEntry) o;
                            if (doomed_ce.Tag == theTask)
                            {
                                doomed = o;
                            }
                        }
                        if (doomed != null)
                        {
                            if (splitContainer1.Panel2.Controls.Contains(taskViewUC))
                            {
                                if (taskViewUC.Task == theTask)
                                {
                                    taskViewUC.Release();
                                    splitContainer1.Panel2.Controls.Remove(taskViewUC);

                                }

                            }
                            objectListView1.RemoveObject(doomed);

                        }
                        break;
                }
            }
        }
示例#20
0
        private void addFileToList(String fullFileName)
        {
            FileInfo f = new FileInfo(fullFileName);
            if (f.Extension.Length > 0)
            {
                if (fullFileName.Contains('~') == false && files.Contains(fullFileName) == false)
                {
                    files.Add(fullFileName);
                    CommunicationEntry ce = new CommunicationEntry();
                    ce.title = Path.GetFileName(fullFileName);
                    ce.Tag = fullFileName;
                    FileInfo fi = new FileInfo(fullFileName);
                    ce.date = fi.LastWriteTime;
                    objectListView1.AddObject(ce);
                    objectListView1.Columns[1].Width = -1;

                }
            }
        }