Exemplo n.º 1
0
        private void CambiarEstado(EstadoMantenimiento estado)
        {
            this.mskDescripcion.Clear();
            this.mskCodigo.Clear();
            this.pbImagen.Tag          = null;
            this.chkDisponible.Checked = false;
            this.chkOcupado.Checked    = false;

            this.mskCodigo.Enabled      = false;
            this.mskDescripcion.Enabled = false;
            this.btnAceptar.Enabled     = false;
            this.btnCancelar.Enabled    = false;
            this.pbImagen.Enabled       = false;
            this.chkDisponible.Enabled  = false;
            this.chkOcupado.Enabled     = false;


            switch (estado)
            {
            case EstadoMantenimiento.Nuevo:
                this.mskDescripcion.Enabled = true;

                this.mskCodigo.Enabled = true;

                this.mskCodigo.Enabled = true;

                this.pbImagen.Enabled = true;

                this.btnAceptar.Enabled  = true;
                this.btnCancelar.Enabled = true;

                this.chkDisponible.Enabled = true;
                this.chkOcupado.Enabled    = true;

                this.txtPrecio.Text = "";
                mskCodigo.Focus();
                break;

            case EstadoMantenimiento.Editar:
                this.mskDescripcion.Enabled = true;

                this.mskCodigo.Enabled = false;


                this.pbImagen.Enabled = true;

                this.btnAceptar.Enabled  = true;
                this.btnCancelar.Enabled = true;

                this.chkDisponible.Enabled = true;
                this.chkOcupado.Enabled    = true;
                mskDescripcion.Focus();
                break;

            case EstadoMantenimiento.Borrar:
                break;

            case EstadoMantenimiento.Ninguno:
                break;
            }
        }
Exemplo n.º 2
0
        private void CambiarEstado(EstadoMantenimiento estado)
        {
            this.txtId.Clear();
            this.txtNombre.Clear();
            this.txtApellido1.Clear();
            this.txtApellido2.Clear();
            this.txtTelefono.Clear();
            this.txtCorreo.Clear();

            this.btnAceptar.Enabled   = false;
            this.btnCancelar.Enabled  = false;
            this.cmbPais.Enabled      = false;
            this.txtId.Enabled        = false;
            this.txtNombre.Enabled    = false;
            this.txtApellido1.Enabled = false;
            this.txtApellido2.Enabled = false;
            this.txtCorreo.Enabled    = false;
            this.txtTelefono.Enabled  = false;



            // Coloca el combo por defecto

            if (this.cmbPais.Items.Count > 0)
            {
                this.cmbPais.SelectedIndex = 0;
            }

            switch (estado)
            {
            case EstadoMantenimiento.Nuevo:
                this.txtId.Enabled        = true;
                this.txtNombre.Enabled    = true;
                this.txtApellido1.Enabled = true;
                this.txtApellido2.Enabled = true;
                this.txtTelefono.Enabled  = true;
                this.txtCorreo.Enabled    = true;
                this.btnAceptar.Enabled   = true;
                this.btnCancelar.Enabled  = true;
                this.cmbPais.Enabled      = true;
                this.txtId.Focus();
                break;

            case EstadoMantenimiento.Editar:
                this.txtId.Enabled        = false;
                this.txtNombre.Enabled    = true;
                this.txtApellido1.Enabled = true;
                this.txtApellido2.Enabled = true;
                this.txtTelefono.Enabled  = true;
                this.txtCorreo.Enabled    = true;
                this.btnAceptar.Enabled   = true;
                this.btnCancelar.Enabled  = true;
                this.cmbPais.Enabled      = true;
                this.txtNombre.Focus();
                break;

            case EstadoMantenimiento.Borrar:
                break;

            case EstadoMantenimiento.Ninguno:
                break;
            }
        }