Example #1
0
        private void LoadDataGrid(string data)
        {
            List <Proveder>    list = new List <Proveder>();
            ProvederController _provederController = new ProvederController();

            provederDataGrid.DataSource = _provederController.Query(data);
        }
Example #2
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 #3
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();
            }
        }
Example #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool check;

            if (warning() == DialogResult.Yes)
            {
                string name = provederDataGrid.CurrentRow.Cells[1].Value.ToString();

                ProvederController _controller = new ProvederController();
                check = _controller.delete(name);

                if (check)
                {
                    MessageBox.Show("Registro Eliminado");
                    cleanTxt();
                    LoadDataGrid(null);
                }
            }
        }