Пример #1
0
        private void button_Create_Group_Click(object sender, EventArgs e)
        {
            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Group Names.txt";

            FileReadWrite.WriteInFileTextBoxContent(textBox_Group_Name.Text);

            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Groups\\" + textBox_Group_Name.Text + ".txt";

            FileReadWrite.WriteInFileFromCheckListBox(checkedListBox_Group_Email_IDs.CheckedItems);

            MessageBox.Show("Group Created Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            comboBox_Group_Name.Items.Add(textBox_Group_Name.Text);
            checkedListBox_New_Group_ID_Collection.Items.Clear();
            textBox_Group_Name.Clear();
        }
Пример #2
0
        private void Save_Sent_Mail()
        {
            // Creating New Directory for last Sent Mail as named "Mail <mail number>"
            DirectoryInfo di = new DirectoryInfo(FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Sent Mails\\Mail " + ++Total_Mail_Sent);

            di.Create();

            // Setting Path for File to read where contacts are stored of last sent mail
            string path1 = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Groups\\" + comboBox_to.SelectedItem.ToString() + ".txt";

            // Setting Path for storing last mail sent reciepients ID
            string path2 = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Sent Mails\\Mail " + Total_Mail_Sent.ToString() + "\\To.txt";

            // Create a file to write to Reciepients of last mail.
            using (StreamWriter sw = File.CreateText(path2))
            {
                //Open the file to read from.
                using (StreamReader sr = File.OpenText(path1))
                {
                    string s = "";
                    while ((s = sr.ReadLine()) != null)
                    {
                        sw.WriteLine(s);
                    }
                }
            }


            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Sent Mails\\Mail " + Total_Mail_Sent.ToString() + "\\Subject.txt";
            FileReadWrite.WriteInFileTextBoxContent(textBox_subject.Text);

            FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Sent Mails\\Mail " + Total_Mail_Sent.ToString() + "\\Content.txt";
            FileReadWrite.WriteInFileFromRichTextBox(richTextBox_content.Lines);

            // Writing of Total Mails Sent in "Total Mail Sent Quota File"
            string path3 = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Total Mails Sent Quota.txt";

            // Create a file to write to.
            using (StreamWriter sw = File.CreateText(path3))
            {
                sw.WriteLine(Total_Mail_Sent.ToString());
            }
        }
Пример #3
0
        private void button_Add_Bulk_Email_IDs_Click(object sender, EventArgs e)
        {
            string path     = null;
            int    counter  = 0;
            int    counter2 = 0;

            string[] Mail_IDs_Collection = richTextBox_Bulk_Email_IDs.Lines;
            int      Total_Email_IDs     = Mail_IDs_Collection.Length;
            int      Total_Group         = 0;
            int      Mail_ID_Number      = 0;
            bool     Is_Last_Group_Have_Less_Than_90_Emails;

            progressBar1.Maximum = Total_Email_IDs - 1;

            if (Total_Email_IDs % 90 == 0)
            {
                Total_Group = Total_Email_IDs / 90;
                Is_Last_Group_Have_Less_Than_90_Emails = false;
            }
            else
            {
                Total_Group = (Total_Email_IDs / 90) + 1;
                Is_Last_Group_Have_Less_Than_90_Emails = true;
            }

            for (counter = 1; counter <= Total_Group; counter++)
            {
                if (counter == Total_Group && Is_Last_Group_Have_Less_Than_90_Emails)
                {
                    path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Groups\\" + textBox_Groups_Name.Text + " " + counter.ToString() + "_(Contains " + (Total_Email_IDs - Mail_ID_Number).ToString() + " Mail IDs).txt";

                    FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Group Names.txt";

                    FileReadWrite.WriteInFileTextBoxContent(textBox_Groups_Name.Text + " " + counter.ToString() + "_(Contains " + (Total_Email_IDs - Mail_ID_Number).ToString() + " Mail IDs)");
                }
                else
                {
                    path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Groups\\" + textBox_Groups_Name.Text + " " + counter.ToString() + ".txt";

                    FileReadWrite.path = FileReadWrite.GetCurrentDirectoryPath + "\\Data\\Group Names.txt";

                    FileReadWrite.WriteInFileTextBoxContent(textBox_Groups_Name.Text + " " + counter.ToString());
                }

                // Create a file to write to.
                using (StreamWriter sw = File.CreateText(path))
                {
                    for (counter2 = 1; counter2 <= 90; counter2++)
                    {
                        sw.WriteLine(Mail_IDs_Collection[Mail_ID_Number]);
                        Mail_ID_Number++;

                        progressBar1.PerformStep();
                        if (Mail_ID_Number == Total_Email_IDs)
                        {
                            break;
                        }
                    }
                }
            }

            MessageBox.Show("All Mail Ids Added Successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            textBox_Groups_Name.Clear();
            richTextBox_Bulk_Email_IDs.Clear();
            progressBar1.Value = 0;
        }