Exemple #1
0
        private void dgvViajes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                filaSeleccionada      = e.RowIndex;
                listBoxStatus.Visible = false;
                if (filaSeleccionada != -1)
                {
                    if (dgvViajes["idStatus", filaSeleccionada].Value.ToString() != "5")
                    {
                        openDashBoardForm(new FormAgregarViaje(user, "editar", int.Parse(dgvViajes["idViajeSci", filaSeleccionada].Value.ToString())));
                    }
                    else
                    {
                        FormPermiso  fp          = new FormPermiso();
                        DialogResult DialogForm2 = fp.ShowDialog();

                        if (fp.Valor == true)
                        {
                            openDashBoardForm(new FormAgregarViaje(user, "editar", int.Parse(dgvViajes["idViajeSci", filaSeleccionada].Value.ToString())));
                        }
                        else
                        {
                            MessageBox.Show("El usuario o la contraseña son incorrectos para poder editar el viaje cerrado.", "No se pudo editar viaje.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void btnEliminarEstado_Click(object sender, EventArgs e)
        {
            FormPermiso  fp          = new FormPermiso();
            DialogResult DialogForm2 = fp.ShowDialog();

            if (fp.Valor == true)
            {
                DialogResult dialogEliminar = new DialogResult();
                if (filaSeleccionadaStatus >= 0)
                {
                    string nombre = dgvStatus["nombre", filaSeleccionadaStatus].Value.ToString();
                    dialogEliminar = MessageBox.Show($"¿Esta seguro de eliminar el status: {nombre}?", "Eliminar Status.", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dialogEliminar == DialogResult.Yes)
                    {
                        try
                        {
                            if (managerStatus.Eliminar(int.Parse(dgvStatus["idStatus", filaSeleccionadaStatus].Value.ToString())))
                            {
                                log registro = new log
                                {
                                    Accion         = "eliminar",
                                    NombreUsuario  = user.NombreUsuario,
                                    Fecha          = DateTime.Now,
                                    ModuloAfectado = "statusviaje-id:" + dgvStatus["idStatus", filaSeleccionadaStatus].Value.ToString()
                                };
                                managerLog.Insertar(registro);

                                cargarTodosLosStatus();
                                mostrarLabelStatus("Se ha eliminado Correctamente el Status. " + nombre, true);
                            }
                            else
                            {
                                mostrarLabelStatus("No se ha podido Eliminar el status. " + managerStatus.Error, false);
                            }
                        }
                        catch (Exception ex)
                        {
                            mostrarLabelStatus("No se ha podido Eliminar el status. " + ex.Message, false);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("El usuario o la contraseña son incorrectos para poder editar el viaje cerrado.", "No se pudo editar viaje.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
        private void btnAgregarEstado_Click(object sender, EventArgs e)
        {
            FormPermiso  fp          = new FormPermiso();
            DialogResult DialogForm2 = fp.ShowDialog();

            if (fp.Valor == true)
            {
                FormAgregarStatus fm         = new FormAgregarStatus(user, "agregar", -1);
                DialogResult      DialogForm = fm.ShowDialog();
                if (fm.Valor != string.Empty)
                {
                    cargarTodosLosStatus();
                    mostrarLabelStatus(fm.Valor, true);
                }
            }
            else
            {
                MessageBox.Show("El usuario o la contraseña son incorrectos para poder editar el viaje cerrado.", "No se pudo editar viaje.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #4
0
        private void btnEditarEstado_Click(object sender, EventArgs e)
        {
            if (filaSeleccionadaGasto >= 0)
            {
                FormPermiso  fp          = new FormPermiso();
                DialogResult DialogForm2 = fp.ShowDialog();

                if (fp.Valor == true)
                {
                    FormAgregarStatus fm         = new FormAgregarStatus(user, "editar", int.Parse(dgvStatus["idStatus", filaSeleccionadaStatus].Value.ToString()));
                    DialogResult      DialogForm = fm.ShowDialog();
                    if (fm.Valor != string.Empty)
                    {
                        cargarTodosLosStatus();
                        mostrarLabelStatus(fm.Valor, true);
                    }
                }
                else
                {
                    MessageBox.Show("El usuario o la contraseña son incorrectos para poder editar el viaje cerrado.", "No se pudo editar viaje.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #5
0
        private void btnEditarViaje_Click(object sender, EventArgs e)
        {
            /*listBoxStatus.Visible = false;
             * if (filaSeleccionada != -1)
             * {
             *  if (dgvViajes["idStatus", filaSeleccionada].Value.ToString() != "5")
             *  {
             *
             *          FormAgregarViaje fm = new FormAgregarViaje(user, "editar", int.Parse(dgvViajes["idViajeSci", filaSeleccionada].Value.ToString()));
             *          DialogResult DialogForm = fm.ShowDialog();
             *          if (fm.Valor != string.Empty)
             *          {
             *              CargarTodosLosViajes(btnStatus.Text);
             *              mostrarLabelStatus(fm.Valor, true);
             *          }
             *          fm.Close();
             *
             *  }
             *  else
             *  {
             *      FormPermiso fp = new FormPermiso();
             *      DialogResult DialogForm2 = fp.ShowDialog();
             *
             *      if (fp.Valor == true)
             *      {
             *          FormAgregarViaje fm = new FormAgregarViaje(user, "editar", int.Parse(dgvViajes["idViajeSci", filaSeleccionada].Value.ToString()));
             *          DialogResult DialogForm = fm.ShowDialog();
             *          if (fm.Valor != string.Empty)
             *          {
             *              CargarTodosLosViajes(btnStatus.Text);
             *              mostrarLabelStatus(fm.Valor, true);
             *          }
             *      }
             *      else
             *      {
             *          MessageBox.Show("El usuario o la contraseña son incorrectos para poder editar el viaje cerrado.", "No se pudo editar viaje.", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *      }
             *  }
             *
             *
             * }*/


            listBoxStatus.Visible = false;
            if (filaSeleccionada != -1)
            {
                if (dgvViajes["idStatus", filaSeleccionada].Value.ToString() != "5")
                {
                    openDashBoardForm(new FormAgregarViaje(user, "editar", int.Parse(dgvViajes["idViajeSci", filaSeleccionada].Value.ToString())));
                }
                else
                {
                    FormPermiso  fp          = new FormPermiso();
                    DialogResult DialogForm2 = fp.ShowDialog();

                    if (fp.Valor == true)
                    {
                        openDashBoardForm(new FormAgregarViaje(user, "editar", int.Parse(dgvViajes["idViajeSci", filaSeleccionada].Value.ToString())));
                    }
                    else
                    {
                        MessageBox.Show("El usuario o la contraseña son incorrectos para poder editar el viaje cerrado.", "No se pudo editar viaje.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }