Ejemplo n.º 1
0
 private void BtnInsertar_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         if (TxtDescripcion.Text == string.Empty || DtpFechaInicio.Text == string.Empty || TxtDuracionDias.Text == string.Empty || CboFuncion.Text == string.Empty)
         {
             this.MensajeError("Se deben rellenar todos los datos obligatorios, seran remarcados.");
             ErrorIcono.SetError(TxtDescripcion, "Ingrese una descripcion.");
             ErrorIcono.SetError(DtpFechaInicio, "Ingrese una fecha de inicio.");
             ErrorIcono.SetError(TxtDuracionDias, "Ingrese una duracion de la tarea en dias.");
             ErrorIcono.SetError(CboFuncion, "Ingrese una funcion");
         }
         else
         {
             //string fecha = DtpFechaTermino.Value.ToShortTimeString();
             Rpta = NTarea.Insertar(TxtDescripcion.Text.Trim(), Convert.ToDateTime(DtpFechaInicio.Value.ToShortDateString()), Convert.ToInt32(TxtDuracionDias.Text.Trim()), Convert.ToInt32(CboFuncion.SelectedValue));
             //MessageBox.Show(fecha);
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOk("Se inserto de forma correcta el registro");
                 this.Limpiar();
                 this.Listar();
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Ejemplo n.º 2
0
 private void btnaceptar_Click(object sender, EventArgs e)
 {
     try
     {
         string rpta = "";
         if (txtdescrip.Text == string.Empty)
         {
             this.MensajeError("Ingrese la descripción para la Tarea");
         }
         else
         {
             rpta = NTarea.Insertar(Convert.ToInt32(txtorden.Text.Trim()), txtdescrip.Text.Trim(), txtobs.Text, Convert.ToInt32(cmbfabric.SelectedValue));
         }
         if (rpta.Equals("OK"))
         {
             this.MensajeOk("Nueva tarea cargada");
             cmbnuevafab.ValueMember = cmbnuevafab.ValueMember;
             Listar();
             ListarNueva();
         }
         else
         {
             this.MensajeError(rpta);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }