Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            bool check;

            Proveder _proveder = new Proveder
            {
                Name       = txtName.Text,
                TelfNumber = txtTelfNumber.Text,
                Email      = txtEmail.Text
            };

            ProvederController controller = new ProvederController();

            if (txtId.Text != "")
            {
                _proveder.Id = int.Parse(txtId.Text);
                check        = controller.upDate(_proveder);
            }
            else
            {
                check = controller.insert(_proveder);
            }

            if (check)
            {
                MessageBox.Show("Registro Guardado");
                cleanTxt();
                LoadDataGrid(null);
            }
        }
Example #2
0
        private void addToDB()
        {
            bool check = false;

            Proveder _proveder = new Proveder();

            _proveder.Name       = txtName.Text;
            _proveder.TelfNumber = txtTelfNumber.Text;
            _proveder.Email      = txtEmail.Text;

            ProvederController controller = new ProvederController();

            if (txtName.Text != "")
            {
                _proveder.Name = txtName.Text;
                check          = controller.upDate(_proveder);
            }
            else
            {
                check = controller.insert(_proveder);
            }

            if (check)
            {
                MessageBox.Show("Registro Guardado");
                cleanTxt();
            }
        }