Exemplo n.º 1
0
        private async void AddMessage()
        {
            // #QUERY
            await UpdateMessageListAsync();

            // #WRITE
            if (anonymousCheckBox.Checked == false)
            {
                // create Message with email address, add to messages, upload to firebase
                FeedbackMessage tempMsg = new FeedbackMessage(feedbackBox.Text, DateTime.Now.ToString(), firebaseUser.Email, false);                 // Message that stores email
                if (msgList != null)
                {
                    msgList.Add(tempMsg);
                }
                await databaseHandler.Child("Messages").PutAsync(msgList);
            }
            else
            {
                // create Message without email address, add to messages, and upload to firebase.
                FeedbackMessage tempMsg = new FeedbackMessage(feedbackBox.Text, DateTime.Now.ToString(), firebaseUser.Email, true);
                if (msgList != null)
                {
                    msgList.Add(tempMsg);
                }
                await databaseHandler.Child("Messages").PutAsync(msgList);
            }

            MailMessage mailMessage = new MailMessage
            {
                From       = new MailAddress("*****@*****.**"),
                Subject    = "Message sent",
                IsBodyHtml = true,
            };

            if (anonymousCheckBox.Checked)
            {
                mailMessage.Body = "<body>Thank you for your input to the company! We can assure you your input was anonymous. Here is the message that you sent: <br>" +
                                   $"{feedbackBox.Text} <br> Sent {DateTime.Now.ToString()}</body>";
            }
            else
            {
                mailMessage.Body = "<body>Thank you for your input to the company! You chose to send it non-anonymously. Here is the message that you sent: <br>" +
                                   $"{feedbackBox.Text} <br> Sent {DateTime.Now.ToString()}</body>";
            }
            mailMessage.To.Add(firebaseUser.Email);
            feedbackBox.Text = "";
            userShowMsgs();
            if (anonymousCheckBox.Checked == false)
            {
                MessageBox.Show("Message sent");
            }
            else if (anonymousCheckBox.Checked == true)
            {
                MessageBox.Show("Anyonymous message sent");
            }


            smtpClient.Send(mailMessage);
            anonymousCheckBox.Checked = false;
        }
Exemplo n.º 2
0
        private void adminMsgsListBox_Click(object sender, EventArgs e)
        {
            try
            {
                adminChosenMsg           = msgList[adminMsgsListBox.SelectedIndex];
                this.Size                = new Size(859, 367);
                adminFeedbackBox.Visible = true;
                replyButton.Visible      = true;
                adminFeedbackBox.Text    = adminChosenMsg.message;

                adminFeedbackLabel.Visible = true;

                if (!adminChosenMsg.anonymous)
                {
                    adminFeedbackLabel.Text = $"Feedback from {adminChosenMsg.email} on {adminChosenMsg.dateCreated}";
                }
                else
                {
                    adminFeedbackLabel.Text = $"Feedback from anonymous user on {adminChosenMsg.dateCreated}";
                }
            }
            catch
            {
                return;
            }
        }
Exemplo n.º 3
0
        private void adminMsgsListBox_DoubleClick(object sender, EventArgs e)
        {
            FeedbackMessage chosenMsg = msgList[adminMsgsListBox.SelectedIndex];
            Form2           form2     = new Form2(chosenMsg);

            form2.ShowDialog();
        }
Exemplo n.º 4
0
 public Form2(FeedbackMessage msg)
 {
     InitializeComponent();
     message = msg;
     if (!message.anonymous)
     {
         msgInfoLabel.Text = $"{message.message}\nMessage created by {message.email}.\nCreated {message.dateCreated}";
     }
     else
     {
         msgInfoLabel.Text = $"{message.message}\nMessage created anonymously.\nCreated {message.dateCreated}";
     }
 }
Exemplo n.º 5
0
        private void userMsgListBox_Click(object sender, EventArgs e)
        {
            try
            {
                FeedbackMessage chosenMsg = userMsgList[userMsgsListBox.SelectedIndex];
                feedbackBox.Text          = chosenMsg.message;
                feedbackBox.Enabled       = false;
                sendMsgButton.Text        = "Create New Feedback";
                anonymousCheckBox.Visible = false;

                if (!chosenMsg.anonymous)
                {
                    enterMsgLabel.Text = $"Your feedback from {userMsgsListBox.SelectedItem}";
                }
                else
                {
                    enterMsgLabel.Text = $"Your anonymous feedback from {userMsgsListBox.SelectedItem}";
                }
            }
            catch
            {
                return;
            }
        }