Example #1
0
        /// <summary>
        /// Triggers when user leaves the email address textbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbEmailAddress_Leave(object sender, EventArgs e)
        {
            //Sets the template path from the textbox
            clsEmailAddr.SetDataValue("EmailAddress", tbTemplatePath.Text);

            //Update the database
            clsEmailAddr.update();

            //Fill the form
            fillRecipients(false);
        }
Example #2
0
        /// <summary>
        /// Updates the database when a cell in the reipients dataGridView is edited
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridViewReicpitents_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            //If cell is not the checkbox cell
            if (dataGridViewReicpitents.Columns[e.ColumnIndex].Tag.ToString() != "ActiveReportRecipeint")
            {
                //Set value
                clsEmailAddr.SetDataValue(dataGridViewReicpitents.Columns[e.ColumnIndex].Tag.ToString(),
                                          dataGridViewReicpitents.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());

                //Update database
                clsEmailAddr.update();
            }
            else
            {
                //Create new holder for the concatenated email addresses
                string concatEmails = "";

                //Traverse the Recipients dataGridView
                for (int i = 0; i < dataGridViewReicpitents.Rows.Count; i++)
                {
                    //If checkbox is checked
                    if (dataGridViewReicpitents.Rows[i].Cells["clmAddRecpt"].Value.ToString()
                        == "True")
                    {
                        //Add the email address to the concatenated list
                        concatEmails += dataGridViewReicpitents.Rows[i].Cells["clmEmailAddress"].Value.ToString()
                                        + "|";
                    }
                }

                //Set new concatenated list in dataset
                clsMonthlyReports.SetDataValue("EmailAddresses", concatEmails);

                //Update database
                clsMonthlyReports.update();
            }
        }