private Form CreateDialogForInteraction( int customerId, Interaction interaction ) { Form dialog = null; switch (interaction.InteractionType) { case InteractionType.Call: dialog = new CallDialog(customerId, interaction); break; case InteractionType.Email: dialog = new EmailDialog(customerId, interaction); break; } if (dialog == null) { throw new ArgumentException(String.Format("Cannot create dialog. Unknown interaction type: {0}", interaction.InteractionType)); } return(dialog); }
private void btnLogEmail_Click(object sender, EventArgs e) { if (!CheckCustomerSelected()) { return; } var dialog = new EmailDialog(((Customer)this.cboCustomer.SelectedItem).Id.Value); var result = dialog.ShowDialog(this); if (result == DialogResult.OK) { var interaction = dialog.Interaction; SupportService.Interactions.Add(interaction); AddInteractionToList(interaction); } }