コード例 #1
0
        /// <summary>
        /// Enter a new Client entry
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void newClientToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var client = new Client();
            var addClientForm = new AddClientFrm(client)
                {
                    Text = Resources.CreateNewClientDialogText
                };

            if (addClientForm.ShowDialog() == DialogResult.OK)
            {
                using (var db = new AwesomeContext())
                {
                    db.Clients.Add(client);
                    db.SaveChanges();
                }
                InitializeClientList();
            }
        }
コード例 #2
0
 public AddClientFrm(Client model)
 {
     InitializeComponent();
     btnCreateClient.Text = model.Id > 0 ? Resources.EditButtonText : Resources.CreateButtonText;
     this.clientBindingSource.Add(model);
 }