private void OnAdd() { dlgAddMailTemplate dlg = new dlgAddMailTemplate(); if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { AddTemplateToDataGrid(dlg.Template); } }
private void OnEdit() { if (dgTemplates.SelectedRows == null || dgTemplates.SelectedRows.Count <= 0) { MessageBox.Show("Please select one template.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataGridViewRow row = dgTemplates.SelectedRows[0]; MailTemplate template = row.Tag as MailTemplate; dlgAddMailTemplate dlg = new dlgAddMailTemplate(template); if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { row.Tag = dlg.Template; row.Cells[2].Value = dlg.Template.TemplateName; } }