예제 #1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(dgMozo.CurrentRow.Cells["id_mozo"].Value);

            if (id > 0)
            {
                if (Mozo.Eliminar(id))
                {
                    Funciones.mOk(this, "Registro eliminado correctamente");
                }
                else
                {
                    Funciones.mError(this, "Error al eliminar registro");
                }
            }
            dgMozo.DataSource = Mozo.getAll();
        }
예제 #2
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            string dni      = tbDNI.Text.Trim();
            string nombre   = tbNombre.Text.Trim();
            string apellido = tbApellido.Text.Trim();
            string calle    = tbCalle.Text.Trim();
            int    nro      = 0;
            int    id       = Convert.ToInt32(tbID.Text);

            try
            {
                nro = Convert.ToInt32(tbNumero.Text);
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error en el número", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            string telefono = tbTelefono.Text.Trim();

            Mozo moz = new Mozo(id, dni, nombre, apellido, calle, nro, telefono);

            if (moz.Error)
            {
                Funciones.mError(this, moz.Mensaje);
            }
            else
            {
                moz.Actualizar();
                MessageBox.Show(this, "Registro actualizado correctamente");
                tbNombre.Text   = "";
                tbDNI.Text      = "";
                tbCalle.Text    = "";
                tbApellido.Text = "";
                tbNumero.Text   = "";
                tbTelefono.Text = "";
            }
            dgMozo.DataSource = Mozo.getAll();
        }
예제 #3
0
        public Frm_Mozo()
        {
            InitializeComponent();

            dgMozo.DataSource = Mozo.getAll();
        }