private void retrivebutton_Click(object sender, EventArgs e) { string selectedHeader = headerComboBox.SelectedItem.ToString(); List <Message> selectedMessages = _emailLoadManager.GetSelectedMessages(allMessageInformation, selectedHeader); List <Email> messages = _emailLoadManager.GetMessagesInFormatedWay(selectedMessages); _emailLoadManager.ProduceExcelFile(messages); }
private void retrivebutton_Click(object sender, EventArgs e) { string userName = emailTextBox.Text.ToLower(); if (userName.Equals("")) { MessageBox.Show(@"Please give email address or username"); return; } if (_allMessageInformation == null) { MessageBox.Show(@"Please load the messages and dropdown first"); return; } if (headerComboBox.SelectedItem == null) { MessageBox.Show(@"Please select a Subject of Message First"); return; } string[] tokens = userName.Split('@'); userName = tokens[0] + "@gmail.com"; if (!userName.Equals(_userName)) { MessageBox.Show(@"User name or Email address does not match with dropdown loaded user name or email address"); return; } string notificationMessage = ""; string selectedHeader = headerComboBox.SelectedItem.ToString(); List <Message> selectedMessages = _emailLoadManager.GetSelectedMessages(_allMessageInformation, selectedHeader); string status = "AllMessages"; if (readRadioButton.Checked) { selectedMessages = _emailLoadManager.GetOnlyReadMessages(selectedMessages); status = "OnlyReadMessages"; } else if (unreadRadioButton.Checked) { selectedMessages = _emailLoadManager.GetOnlyUnreadMessages(selectedMessages); status = "OnlyUnreadMessages"; } if (selectedMessages.Count == 0) { MessageBox.Show(@"All condition did not fulfill any message"); return; } List <Email> messages = _emailLoadManager.GetMessagesInFormatedWay(selectedMessages); MessageBox.Show(@"Give Location for saving Excel File."); folderBrowserDialog1.ShowDialog(); string dictonary = folderBrowserDialog1.SelectedPath; notificationMessage += _emailLoadManager.ProduceExcelFile(messages, status, dictonary); if (getAttachmentCheckBox.Checked) { MessageBox.Show(@"Give Location for saving Attactments."); folderBrowserDialog1.ShowDialog(); string attachmentDictonay = folderBrowserDialog1.SelectedPath; notificationMessage += _emailLoadManager.GetMessageAttacthment(_service, userName, selectedMessages, attachmentDictonay); } MessageBox.Show(notificationMessage); }