Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var model = new ManufacturerModel();

            model.MANUFACTURER_NAME = txtMANUFACTURER_NAME.Text;
            int.TryParse(txtID.Text, out int id);
            model.ID = id;

            if (model.Validate() == false)
            {
                MessageBox.Show(this, "All values are required", "Save Action failed !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            model.Save();

            txtID.Text = model.ID.ToString();
            txtMANUFACTURER_NAME.Focus();
            txtMANUFACTURER_NAME.Select();
        }