Example #1
0
        //ventana load
        private void ventanaABM_Servicio_Load(object sender, EventArgs e)
        {
            this.blanquear_objetos();
            this.txt_IdServicio.Enabled  = true;
            this.txt_Descripcion.Enabled = true;
            this.txt_ID_tipo.Enabled     = false;

            this.txt_IdServicio.Focus();


            //ComboBox
            this.cbo_tipoServicio.DataSource    = tipo.consultar_tipoServicios();
            this.cbo_tipoServicio.DisplayMember = "desc_tipo_servicio";
            this.cbo_tipoServicio.ValueMember   = "id_tipo_servicio";
            //esto sirve para resetear el cbo
            this.cbo_tipoServicio.SelectedIndex = -1;

            //con esto quito el mesaje del selectedItem
            if (cbo_tipoServicio.SelectedItem == null)
            {
                txt_ID_tipo.Text = "";
            }


            this.btn_Nuevo.Enabled       = true;
            this.btn_Guardar.Enabled     = false;
            this.btn_Actualizar.Enabled  = false;
            this.btn_Menu.Enabled        = true;
            this.btn_Limpiar.Enabled     = true;
            this.btn_Buscar_Logo.Enabled = true; this.btn_Buscar.Visible = false;
            this.btn_Consultar.Enabled   = true;
            this.btn_Eliminar.Enabled    = false;
        }
Example #2
0
        //guardar
        private void btn_Guardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (valida.ValidarCampoVacio(txt_ID_tipoServicio.Text) == true)
                {
                    valida.MensajeSalida("ID");
                }
                else

                if ((valida.ValidarCampoVacio(txt_descripcion.Text)) == true)
                {
                    valida.MensajeSalida("Descripcion");
                }
                else
                if ((valida.ValidarCampoVacio(txt_costo.Text)) == true)
                {
                    valida.MensajeSalida("Costo");
                }
                else
                {
                    tipo._Id = int.Parse(this.txt_ID_tipoServicio.Text);
                    tipo._Descripcion_tipo = this.txt_descripcion.Text;
                    tipo._Costo            = int.Parse(this.txt_costo.Text);
                    tipo.Grabar_tipoServicio();
                    MessageBox.Show("Se han ingresado los Datos del tipo Servicio correctamente", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.btn_Buscar_Logo.Enabled = true; this.btn_Buscar.Visible = false;
                    //actualiza
                    tabla = tipo.consultar_tipoServicios();
                    this.dgv_TipoServicio.DataSource = tabla;
                }
            }
            catch (Exception Error)
            {
                MessageBox.Show("Error al guardar los datos del Tipo de Servicio\n" + Error.Message, "Atencion", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
            }
        }