public void mostrartiempos() { this.dataListTiempos.DataSource = NTiempo.mostrartiempos(); this.ocultarcolumnas(); this.btnEliminarTiempo.Visible = true; this.lblTotal.Text = "Número de registros: " + Convert.ToString(dataListTiempos.Rows.Count); }
public void botonEliminarTiempo() { if (!lEdicion.Text.Equals("")) { try { DialogResult opcion; opcion = MessageBox.Show("¿Desea continuar?", "Eliminar Registro", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opcion == DialogResult.OK) { string rpta = ""; rpta = NTiempo.eliminartiempo(Convert.ToInt32(txtId.Text)); if (rpta.Equals("OK")) { this.mensajeok("Registro eliminado"); FrmParent.frmparent.AbrirFormulario(new FrmTiempos()); } else { this.mensajeerror("¡Ups!, Algo ha salido mal..."); this.mensajeerror(rpta); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } } }
public void mostrarTareaCombobox() { comboboxTarea.Items.AddRange(NTiempo.mostrarTareaCombobox().ToArray()); comboboxTarea.SelectedIndex = 1; comboboxAccion.Items.Clear(); comboboxAccion.Items.AddRange(new string[] { "A", "D", "V", "DI" }); comboboxAccion.SelectedIndex = 1; }
private void btnGuardar_Click(object sender, EventArgs e) { try { //MessageBox.Show("En guardar"); string rpta = ""; if (this.txtTarea.Text == string.Empty) { mensajeerror("Formulario incompleto"); this.iconoerror.SetError(this.txtTarea, "Ingresar Tarea"); } else { if (esnuevo) { rpta = NTiempo.insertartiempo( this.txtTarea.Text.Trim().ToUpper(), Convert.ToDateTime(this.dtFechaInicio.Value), Convert.ToDateTime(this.dtFechaFin.Value), this.txtObservaciones.Text.Trim()); } else { MessageBox.Show("Entrando en else editar"); rpta = NTiempo.editartiempo(Convert.ToInt32(this.txtIdTiempo.Text), this.txtTarea.Text.Trim(), Convert.ToDateTime(this.dtFechaInicio.Value), Convert.ToDateTime(this.dtFechaFin.Value), this.txtObservaciones.Text.Trim()); } if (rpta.Equals("OK")) { if (esnuevo) { this.mensajeok("Se ha creado el Registro de tiempo satisfactoriamente"); } else { this.mensajeok("Se ha editado el Registro de tiempo satisfactoriamente"); } } else { this.mensajeerror(rpta); } this.esnuevo = false; this.eseditar = false; ModoVisualizar(); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.StackTrace); } }
private void btnEliminarTiempo_Click(object sender, EventArgs e) { try { DialogResult opcion; opcion = MessageBox.Show("¿Desea continuar?", "Eliminar Registro de tiempo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opcion == DialogResult.OK) { int aux = 0; int id; string rpta = ""; foreach (DataGridViewRow row in dataListTiempos.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { aux = 1; id = Convert.ToInt32(row.Cells[1].Value); rpta = NTiempo.eliminartiempo(id); if (rpta.Equals("OK")) { this.mensajeok("Registro eliminado"); } else { this.mensajeerror("¡Ups!, Algo ha salido mal..."); this.mensajeerror(rpta); } } } if (aux < 1) { MessageBox.Show("No haz seleccionado ningún proyecto", "Eliminar Proyecto", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } this.mostrartiempos(); } else { this.btnEliminarTiempo.Enabled = false; this.cbEliminar.Checked = false; } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnEditar_Click_1(object sender, EventArgs e) { try { string rpta = ""; //if (this.txtTarea.Text == string.Empty) //{ // mensajeerror("Formulario incompleto"); // this.iconoerror.SetError(this.txtTarea, "Ingresar Tarea"); //} rpta = NTiempo.buscarid( this.txtTarea.Text.Trim().ToUpper(), Convert.ToDateTime(this.dtFechaInicio.Value), Convert.ToDateTime(this.dtFechaFin.Value), this.txtObservaciones.Text.Trim()); if (rpta.Equals("OK")) { if (esnuevo) { this.mensajeok("Tenemos id"); } else { this.mensajeok("Fallo al encontrar id"); } } else { this.mensajeerror(rpta); } //this.esnuevo = false; //this.eseditar = false; //ModoVisualizar(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.StackTrace); } }
public void guardar() { string rpta = ""; if (esnuevo) { //Console.WriteLine(comboboxTareaPersonal.SelectedItem.ToString()+"console"); rpta = NTiempo.insertartiempo( dtFecha.Value.ToString(), dtFechaInicio.Value.ToString(), dtFechaFin.Value.ToString(), txtObservaciones.Text, comboboxAccion.SelectedItem.ToString(), comboboxTarea.SelectedItem.ToString(), getTareaPersonal(), DLoginStatico.usuario, booleanToInt(checkImputable.Checked), booleanToInt(checkImputado.Checked)); } else { rpta = NTiempo.editartiempo(txtId.Text, dtFecha.Value.ToString(), dtFechaInicio.Value.ToString(), dtFechaFin.Value.ToString(), txtObservaciones.Text, comboboxAccion.SelectedItem.ToString(), comboboxTarea.SelectedItem.ToString(), getTareaPersonal(), DLoginStatico.usuario, booleanToInt(checkImputable.Checked), booleanToInt(checkImputado.Checked)); } if (rpta.Equals("OK")) { if (esnuevo) { this.mensajeok("Se ha creado el Registro de tiempo satisfactoriamente"); } else { this.mensajeok("Se ha editado el Registro de tiempo satisfactoriamente"); } } else { this.mensajeerror(rpta); } FrmParent.frmparent.AbrirFormulario(new FrmTiempos()); }
public void botonEliminarTiempo() { try { DialogResult opcion; opcion = MessageBox.Show("¿Desea continuar?", "Eliminar Tiempo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opcion == DialogResult.OK) { int aux = 0; string rpta = ""; foreach (DataGridViewRow row in dataListTiempos.Rows) { if (Convert.ToBoolean(row.Selected)) { aux = 1; rpta = NTiempo.eliminartiempo(Convert.ToInt32(row.Cells[8].Value)); } } if (rpta.Equals("OK")) { this.mensajeok("Registro eliminado"); } else { this.mensajeerror("¡Ups!, No se ha podido eliminar el Tiempo"); this.mensajeerror(rpta); } if (aux < 1) { MessageBox.Show("No haz seleccionado ningún Tiempo", "Eliminar Tiempo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } this.mostrartiempos(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void buscarTiempo(string texto) { this.dataListTiempos.DataSource = NTiempo.buscartiempo(texto); this.ocultarcolumnas(); }
public void mostrarTareaPersonalCombobox(string usuario, string tarea) { comboboxTareaPersonal.Items.AddRange(NTiempo.mostrarTareaPersonalCombobox(usuario, tarea).ToArray()); //comboboxTareaPersonal.SelectedIndex = 0; }