예제 #1
0
        //GUARDAR
        private void btnguardar_Click(object sender, EventArgs e)
        {
            if (Validar())
            {
                return;
            }
            using (nc)
            {
                nc.nombre_cargo = txtnom_cargo.Text.Trim().ToUpper();
                nc.descripcion  = txtdescrip.Text.Trim().ToUpper();

                result = nc.SaveChanges();
                ShowCargo();
                limpiar();
                Messages.M_info(result);
            }
        }
예제 #2
0
 private void totxtcargo_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (!String.IsNullOrWhiteSpace(totxtcargo.Text))
     {
         if (e.KeyChar == Convert.ToChar(Keys.Enter))
         {
             using (Ncargo nca = new Ncargo())
             {
                 nca.state        = EntityState.Guardar;
                 nca.nombre_cargo = totxtcargo.Text.Trim();
                 nca.descripcion  = "";
                 nca.SaveChanges();
             }
             totxtcargo.Text = "";
             contextmenu.Close();
             Mostrar_cargo();
         }
     }
 }