Exemple #1
0
        private void EditDraftButtonClick(object sender, EventArgs e)
        {
            Button           clickedButton = (Button)sender;
            ConversationItem item          = (ConversationItem)clickedButton.Parent;
            DataTable        _messageForID = messageTableAdapter.GetDataByMessageIDNumber(item.MessageID, RecipientID);



            NewMessageItem draftToEdit = new NewMessageItem(_conversationID, MessageTitleLabel)
            {
                Subject        = (String)_messageForID.Rows[0]["MessageTitle"],
                SenderName     = (String)_messageForID.Rows[0]["SenderName"],
                SenderID       = (String)_messageForID.Rows[0]["SenderID"],
                ReceiverName   = (String)_messageForID.Rows[0]["RecipientName"],
                ReceiverID     = (String)_messageForID.Rows[0]["RecipientID"],
                MessageContent = (String)_messageForID.Rows[0]["MessageContent"],
                Width          = ConversationFlowPanel.Width - 10
            };

            ConversationFlowPanel.Controls.Add(draftToEdit);
            draftToEdit.Width = ConversationFlowPanel.Width - 10;



            item.Dispose();
        }
Exemple #2
0
        private void ListItemDeleteButtonClick(object sender, EventArgs e)
        {
            Button          thisDeleteButton = (Button)sender;
            MessageListItem listItem         = (MessageListItem)thisDeleteButton.Parent;
            string          conversationID   = listItem.ConversationID;

            doAction.deleteConversation(conversationID);


            for (int i = 0; i < ConversationFlowPanel.Controls.Count; i++)
            {
                if (ConversationFlowPanel.Controls[i].GetType() == typeof(ConversationItem))
                {
                    ConversationItem item = (ConversationItem)ConversationFlowPanel.Controls[i];
                    item.Hide();
                    item.Dispose();
                }
                else
                {
                    NewMessageItem item = (NewMessageItem)ConversationFlowPanel.Controls[i];
                    item.Hide();
                    item.Dispose();
                }
            }
        }
Exemple #3
0
        private void ContactDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Console.WriteLine("clicked");
            if (ContactListView.Rows.Count > 0)
            {
                string employeeID = (String)ContactListView["EmployeeID", e.RowIndex].Value;
                if (this.Controls["NewMessageItem"] as NewMessageItem == null)
                {
                    Label  l            = new Label();
                    string employeeName = "";
                    ISingleResult <getEmployeeNameByIDResult> result = doAction.getEmployeeNameByID(thisEmployeeID);
                    foreach (getEmployeeNameByIDResult r in result)
                    {
                        employeeName = r.EmployeeName;
                    }


                    globalNewMessage = new NewMessageItem(l)
                    {
                        SenderID   = thisEmployeeID,
                        SenderName = employeeName
                    };


                    panel1.Show();
                    panel1.Controls.Add(globalNewMessage);
                    globalNewMessage.Show();
                    globalNewMessage.ReceiverComboBox.SelectedValue = employeeID;
                }
            }
        }
Exemple #4
0
        private void PopulateMessageConversation(string conversationID)
        {
            ConversationFlowPanel.Controls.Clear();

            _conversationTable = messageTableAdapter.GetDataByConversationID(conversationID, RecipientID, RecipientID);
            if (TypeLabel.Text == "Inbox")
            {
                _conversationTable = messageTableAdapter.GetDataForInbox(conversationID, RecipientID, RecipientID);
            }
            _conversationID = conversationID;
            Console.WriteLine("Populate message convo ID is" + _conversationID);
            for (int i = _conversationTable.Rows.Count - 1; i >= 0; i--)
            {
                if ((String)_conversationTable.Rows[i]["Status"] == "Sent")
                {
                    Console.WriteLine(i);
                    ConversationItem conversationItem = new ConversationItem(conversationID, (int)_conversationTable.Rows[i]["MessageIDNumber"])
                    {
                        Subject        = (String)_conversationTable.Rows[i]["MessageTitle"],
                        MessageContent = (String)_conversationTable.Rows[i]["MessageContent"],
                        ReadOrNotRead  = (String)_conversationTable.Rows[i]["ReadOrNotRead"],

                        Date   = (DateTime)_conversationTable.Rows[i]["DateTime"],
                        Status = (String)_conversationTable.Rows[i]["Status"],
                        Width  = ConversationFlowPanel.Width - 10
                    };

                    conversationItem.SenderName   = (String)_conversationTable.Rows[i]["SenderName"];
                    conversationItem.SenderID     = (String)_conversationTable.Rows[i]["SenderID"];
                    conversationItem.ReceiverName = (String)_conversationTable.Rows[i]["RecipientName"];
                    conversationItem.ReceiverID   = (String)_conversationTable.Rows[i]["RecipientID"];



                    conversationItem.EditDraftButton.Click += new EventHandler(EditDraftButtonClick);
                    conversationItem.ReplyButton.Click     += new EventHandler(ReplyButtonClick);
                    conversationItem.ForwardButton.Click   += new EventHandler(ForwardButtonClick);
                    ConversationFlowPanel.Controls.Add(conversationItem);
                }
                else
                {
                    NewMessageItem newMessage = new NewMessageItem(conversationID, (int)_conversationTable.Rows[i]["MessageIDNumber"], MessageTitleLabel)
                    {
                        SenderName     = (String)_conversationTable.Rows[i]["SenderName"],
                        SenderID       = (String)_conversationTable.Rows[i]["SenderID"],
                        Subject        = (String)_conversationTable.Rows[i]["MessageTitle"],
                        MessageContent = (String)_conversationTable.Rows[i]["MessageContent"],
                        ReceiverName   = (String)_conversationTable.Rows[i]["RecipientName"],
                        ReceiverID     = (String)_conversationTable.Rows[i]["RecipientID"],
                        Date           = (DateTime)_conversationTable.Rows[i]["DateTime"],
                        Width          = ConversationFlowPanel.Width - 10
                    };

                    ConversationFlowPanel.Controls.Add(newMessage);
                }
            }
        }
Exemple #5
0
        private void NewMessageButton_Click(object sender, EventArgs e)
        {
            Console.WriteLine(RecipientName);
            ConversationFlowPanel.Controls.Clear();
            NewMessageItem newMessage = new NewMessageItem(MessageTitleLabel)
            {
                SenderID   = this.RecipientID,
                SenderName = RecipientName,
                Width      = ConversationFlowPanel.Width
            };


            ConversationFlowPanel.Controls.Add(newMessage);
            ConversationFlowPanel.ScrollControlIntoView(newMessage);
        }
Exemple #6
0
        private void ReplyButtonClick(object sender, EventArgs e)
        {
            Button           replyButton  = (Button)sender;
            ConversationItem priorMessage = (ConversationItem)replyButton.Parent;


            NewMessageItem replyMessage = new NewMessageItem(_conversationID, MessageTitleLabel)
            {
                ReceiverName = priorMessage.SenderName,
                ReceiverID   = priorMessage.SenderID,
                SenderID     = this.RecipientID,
                SenderName   = this.RecipientName,
                Width        = ConversationFlowPanel.Width
            };


            int prevIndex = ConversationFlowPanel.Controls.IndexOf(priorMessage);

            ConversationFlowPanel.Controls.Add(replyMessage);
            ConversationFlowPanel.Controls.SetChildIndex(replyMessage, prevIndex + 1);
            ConversationFlowPanel.ScrollControlIntoView(replyMessage);
        }