예제 #1
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar editar la pantalla.");

                    if (string.IsNullOrEmpty(txtDescripcion.Text))
                    {
                        frmErrores.agregarError("Debe especificar una descripción para la pantalla.");
                    }

                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pPantallaID = new SqlParameter("@pPantallaID", SqlDbType.VarChar, 255);
                pPantallaID.Value = txtPantallaID.Text;
                SqlParameter pDescripcion = new SqlParameter("@pDescripcion", SqlDbType.VarChar, 255);
                pDescripcion.Value = txtDescripcion.Text;
                SqlParameter pRetCatchError = new SqlParameter("@pRetCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pPantallaID, pDescripcion, pRetCatchError };


                if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarPantalla", parametros))
                {
                    if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                    {
                        MessageBox.Show("La Pantalla: " + txtPantallaID.Text + " fue editada exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar crear el nuevo Turno.");

                    if (string.IsNullOrEmpty(txtDescripcion.Text))
                    {
                        frmErrores.agregarError("Debe completar la descripción.");
                    }
                    if (int.Parse(cmbHoraFin.Text) <= int.Parse(cmbHoraInicio.Text))
                    {
                        frmErrores.agregarError("La hora de Fin no puede ser menor o igual a la de Inicio.");
                    }
                    if (string.IsNullOrEmpty(txtValorFicha.Text))
                    {
                        frmErrores.agregarError("Debe especificar el valor de la ficha.");
                    }
                    if (string.IsNullOrEmpty(txtValorBandera.Text))
                    {
                        frmErrores.agregarError("Debe esepcificar el valor de bajada de bandera.");
                    }


                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pTurnoID = new SqlParameter("@pTurnoID", SqlDbType.Int);
                pTurnoID.Value = string.IsNullOrEmpty(turnoID) ? "0" : turnoID;
                SqlParameter pDescripcion = new SqlParameter("@pDescripcion", SqlDbType.VarChar, 255);
                pDescripcion.Value = txtDescripcion.Text;
                SqlParameter pHoraInicio = new SqlParameter("@pHoraInicio", SqlDbType.Int);
                pHoraInicio.Value = cmbHoraInicio.Text;
                SqlParameter pHoraFin = new SqlParameter("@pHoraFin", SqlDbType.Int);
                pHoraFin.Value = cmbHoraFin.Text;
                SqlParameter pValorFicha = new SqlParameter("@pValorFicha", SqlDbType.Float);
                pValorFicha.Value = txtValorFicha.Text.Replace(".", ",");
                SqlParameter pValorBandera = new SqlParameter("@pValorBandera", SqlDbType.Float);
                pValorBandera.Value = txtValorBandera.Text.Replace(".", ",");
                SqlParameter pAnulado = new SqlParameter("@pAnulado", SqlDbType.Bit);
                if (chkDeshabilitado.Checked)
                {
                    pAnulado.Value = 1;
                }
                else
                {
                    pAnulado.Value = 0;
                }
                SqlParameter pRetCatchError = new SqlParameter("@pRetCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pTurnoID, pDescripcion, pHoraInicio, pHoraFin, pValorFicha, pValorBandera, pAnulado, pRetCatchError };

                if (modoAbm == "Nuevo")
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.crearTurno", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El turno con descripción: " + txtDescripcion.Text + " fue dato de alta exitosamente.", "Alta exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarTurno", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El turno con descripción: " + txtDescripcion.Text + " fue editado exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar crear el nuevo Usuario.");

                    if (string.IsNullOrEmpty(txtUsuarioID.Text))
                    {
                        frmErrores.agregarError("Debe completar el campo Usuario ID.");
                    }
                    if (string.IsNullOrEmpty(txtNombre.Text))
                    {
                        frmErrores.agregarError("Debe completar el Nombre.");
                    }
                    if (string.IsNullOrEmpty(txtApellido.Text))
                    {
                        frmErrores.agregarError("Debe completar el Apellido.");
                    }
                    if (string.IsNullOrEmpty(txtPassword.Text))
                    {
                        frmErrores.agregarError("Debe ingresar una contraseña.");
                    }
                    if (string.IsNullOrEmpty(txtMaxIntentos.Text))
                    {
                        frmErrores.agregarError("Debe especificar una cantidad máxima de intentos.");
                    }

                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pUsuarioID = new SqlParameter("@pUsuarioID", SqlDbType.VarChar, 20);
                pUsuarioID.Value = txtUsuarioID.Text;
                SqlParameter pNombre = new SqlParameter("@pNombre", SqlDbType.VarChar, 50);
                pNombre.Value = txtNombre.Text;
                SqlParameter pApellido = new SqlParameter("@pApellido", SqlDbType.VarChar, 50);
                pApellido.Value = txtApellido.Text;
                SqlParameter pEmail = new SqlParameter("@pEmail", SqlDbType.VarChar, 100);
                pEmail.Value = txtEmail.Text;
                SqlParameter pPassword = new SqlParameter("@pPassword", SqlDbType.VarChar, 64);
                pPassword.Value = GestorDeFlotasDesktop.BD.GD1C2012.encriptarStr(txtPassword.Text);
                SqlParameter pCantMaxIntentos = new SqlParameter("@pCantMaxIntentos", SqlDbType.Int);
                pCantMaxIntentos.Value = txtMaxIntentos.Text;
                SqlParameter pAnulado = new SqlParameter("@pAnulado", SqlDbType.Bit);
                if (chkDeshabilitado.Checked)
                {
                    pAnulado.Value = 1;
                }
                else
                {
                    pAnulado.Value = 0;
                }

                SqlParameter pRetCatchError = new SqlParameter("@pRetCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pUsuarioID, pNombre, pApellido, pEmail, pPassword, pCantMaxIntentos, pAnulado, pRetCatchError };

                if (modoAbm == "Nuevo")
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.crearUsuario", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El usuario ID: " + txtUsuarioID.Text + " fue dato de alta exitosamente.", "Alta exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarUsuario", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El usuario ID: " + txtUsuarioID.Text + " fue editado exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar dar de alta el Viaje");

                    if (string.IsNullOrEmpty(txtChofer.Text))
                    {
                        frmErrores.agregarError("Debe ingresar el DNI del Chofer.");
                    }
                    if (string.IsNullOrEmpty(txtTurno.Text))
                    {
                        frmErrores.agregarError("Debe ingresar el Id del Turno.");
                    }
                    if (string.IsNullOrEmpty(dtpFecha.Text))
                    {
                        frmErrores.agregarError("Debe especificar la Fecha del Viaje.");
                    }

                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pFecha = new SqlParameter("@pFecha", SqlDbType.DateTime);
                pFecha.Value = dtpFecha.Text;
                SqlParameter pChofer = new SqlParameter("@pDniChofer", SqlDbType.BigInt);
                pChofer.Value = txtChofer.Text;
                SqlParameter pTurno = new SqlParameter("@pTurnoID", SqlDbType.VarChar, 20); //TODO: revisar el tipo
                pTurno.Value = txtTurno.Text;

                SqlParameter pImporteTotal = new SqlParameter("@pImporteTotal", SqlDbType.Float);
                pImporteTotal.Direction = ParameterDirection.Output;
                SqlParameter pCodRendicion = new SqlParameter("@pCodRendicion", SqlDbType.Float);
                pCodRendicion.Direction = ParameterDirection.Output;
                SqlParameter pRetCatchError = new SqlParameter("@pRetCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pFecha, pChofer, pTurno, pImporteTotal, pCodRendicion, pRetCatchError };

                //if (modoAbm == "Nuevo")
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.crearRendicion", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            txtImporte.Text    = pImporteTotal.Value.ToString();
                            txtImporte.Visible = true;
                            codRendicion       = pCodRendicion.Value.ToString();
                            MessageBox.Show("Se dio de Alta La Rendicion correctamente", "OK!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                            this.codRendicion = pCodRendicion.Value.ToString();
                            cargarQuery();
                            dgRendicion.Visible = true;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            dgRendicion.Visible = false;
                        }
                    }
                }

                /* else
                 * {
                 *   if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarAuto", parametros))
                 *   {
                 *       if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                 *       {
                 *           MessageBox.Show("El auto con patente: " + mtxtPatente.Text + " fue editado exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 *           this.DialogResult = DialogResult.OK;
                 *       }
                 *       else
                 *           MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 *   }
                 * }*/
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #5
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar crear el nuevo Auto.");

                    if (string.IsNullOrEmpty(mtxtPatente.Text) | !mtxtPatente.MaskFull)
                    {
                        frmErrores.agregarError("Debe completar la patente de 6 caracteres/dígitos.");
                    }
                    if (string.IsNullOrEmpty(cmbMarca.Text))
                    {
                        frmErrores.agregarError("Debe seleccionar la marca del auto.");
                    }
                    if (string.IsNullOrEmpty(txtModelo.Text))
                    {
                        frmErrores.agregarError("Debe especificar el modelo del auto.");
                    }
                    if (string.IsNullOrEmpty(txtLicencia.Text))
                    {
                        frmErrores.agregarError("Debe ingresar la Licencia del auto.");
                    }
                    if (string.IsNullOrEmpty(txtRodado.Text))
                    {
                        frmErrores.agregarError("Debe especificar el rodado del auto.");
                    }
                    if (string.IsNullOrEmpty(txtReloj.Text))
                    {
                        frmErrores.agregarError("Debe especificar el reloj asociado al auto.");
                    }

                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pPatente = new SqlParameter("@pPatente", SqlDbType.VarChar, 18);
                pPatente.Value = mtxtPatente.Text;
                SqlParameter pMarca = new SqlParameter("@pMarca", SqlDbType.VarChar, 255);
                pMarca.Value = cmbMarca.Text;
                SqlParameter pModelo = new SqlParameter("@pModelo", SqlDbType.VarChar, 255);
                pModelo.Value = txtModelo.Text;
                SqlParameter pLicencia = new SqlParameter("@pLicencia", SqlDbType.VarChar, 26);
                pLicencia.Value = txtLicencia.Text;
                SqlParameter pRodado = new SqlParameter("@pRodado", SqlDbType.VarChar, 10);
                pRodado.Value = txtRodado.Text;
                SqlParameter pNroSerieReloj = new SqlParameter("@pNroSerieReloj", SqlDbType.VarChar, 18);
                pNroSerieReloj.Value = txtReloj.Text;
                SqlParameter pAnulado = new SqlParameter("@pAnulado", SqlDbType.Bit);
                if (chkDeshabilitado.Checked)
                {
                    pAnulado.Value = 1;
                }
                else
                {
                    pAnulado.Value = 0;
                }
                SqlParameter pRetCatchError = new SqlParameter("@pRetCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pPatente, pMarca, pModelo, pLicencia, pRodado, pNroSerieReloj, pAnulado, pRetCatchError };

                if (modoAbm == "Nuevo")
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.crearAuto", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El auto con patente: " + mtxtPatente.Text + " fue dato de alta exitosamente.", "Alta exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarAuto", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El auto con patente: " + mtxtPatente.Text + " fue editado exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #6
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar crear el nuevo Chofer.");

                    if (string.IsNullOrEmpty(txtDniChofer.Text))
                    {
                        frmErrores.agregarError("Debe completar el DNI del chofer.");
                    }
                    if (string.IsNullOrEmpty(txtNombre.Text))
                    {
                        frmErrores.agregarError("Debe completar el Nombre.");
                    }
                    if (string.IsNullOrEmpty(txtApellido.Text))
                    {
                        frmErrores.agregarError("Debe completar el apellido.");
                    }
                    if (string.IsNullOrEmpty(txtDireccion.Text))
                    {
                        frmErrores.agregarError("Debe completar la dirección.");
                    }
                    if (string.IsNullOrEmpty(txtTelefono.Text))
                    {
                        frmErrores.agregarError("Debe completar el teléfono.");
                    }
                    if (string.IsNullOrEmpty(txtEmail.Text))
                    {
                        frmErrores.agregarError("Debe completar el Email.");
                    }
                    if (dtpNacimiento.Value >= DateTime.Today)
                    {
                        frmErrores.agregarError("La fecha de nacimiento debe ser menor a hoy.");
                    }
                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pDniChofer = new SqlParameter("@pDniChofer", SqlDbType.BigInt);
                pDniChofer.Value = txtDniChofer.Text;
                SqlParameter pNombre = new SqlParameter("@pNombre", SqlDbType.VarChar, 255);
                pNombre.Value = txtNombre.Text;
                SqlParameter pApellido = new SqlParameter("@pApellido", SqlDbType.VarChar, 255);
                pApellido.Value = txtApellido.Text;
                SqlParameter pDireccion = new SqlParameter("@pDireccion", SqlDbType.VarChar, 255);
                pDireccion.Value = txtDireccion.Text;
                SqlParameter pTelefono = new SqlParameter("@pTelefono", SqlDbType.BigInt);
                pTelefono.Value = txtTelefono.Text;
                SqlParameter pEmail = new SqlParameter("@pEmail", SqlDbType.VarChar, 50);
                pEmail.Value = txtEmail.Text;
                SqlParameter pFechaNacimiento = new SqlParameter("@pFechaNacimiento", SqlDbType.DateTime);
                pFechaNacimiento.Value = dtpNacimiento.Value;
                SqlParameter pAnulado = new SqlParameter("@pAnulado", SqlDbType.Bit);
                if (chkDeshabilitado.Checked)
                {
                    pAnulado.Value = 1;
                }
                else
                {
                    pAnulado.Value = 0;
                }
                SqlParameter pRetCatchError = new SqlParameter("@pRetCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pDniChofer, pNombre, pApellido, pDireccion, pTelefono, pEmail, pFechaNacimiento, pAnulado, pRetCatchError };

                if (modoAbm == "Nuevo")
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.crearChofer", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El chofer con dni: " + txtDniChofer.Text + " fue dato de alta exitosamente.", "Alta exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarChofer", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El chofer con dni: " + txtDniChofer.Text + " fue editado exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #7
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar dar de alta el Viaje");

                    if (string.IsNullOrEmpty(cmbViaje.Text))
                    {
                        frmErrores.agregarError("Debe seleccionar el Tipo de Viaje");
                    }
                    if (string.IsNullOrEmpty(txtChofer.Text))
                    {
                        frmErrores.agregarError("Debe ingresar el DNI del Chofer.");
                    }
                    if (string.IsNullOrEmpty(txtTurno.Text))
                    {
                        frmErrores.agregarError("Debe ingresar el Id del Turno.");
                    }
                    if (string.IsNullOrEmpty(txtFichas.Text))
                    {
                        frmErrores.agregarError("Debe ingresar la Cantidad de Fichas");
                    }
                    if (string.IsNullOrEmpty(dtpFecha.Text))
                    {
                        frmErrores.agregarError("Debe especificar la Fecha del Viaje.");
                    }
                    if (string.IsNullOrEmpty(dtHora.Text))
                    {
                        frmErrores.agregarError("Debe especificar la Hora del Viaje.");
                    }
                    if (cmbViaje.Text == "registrado")
                    {
                        if (string.IsNullOrEmpty(txtCliente.Text))
                        {
                            frmErrores.agregarError("Debe especificar el DNI del Cliente.");
                        }
                    }

                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pTipo = new SqlParameter("@pTipoViaje", SqlDbType.VarChar, 10);
                pTipo.Value = cmbViaje.Text;
                SqlParameter pChofer = new SqlParameter("@pDniChofer", SqlDbType.BigInt);
                pChofer.Value = txtChofer.Text;
                SqlParameter pTurno = new SqlParameter("@pTurnoID", SqlDbType.BigInt);
                pTurno.Value = txtTurno.Text;
                SqlParameter pCantFichas = new SqlParameter("@pCantFichas", SqlDbType.BigInt);
                pCantFichas.Value = txtFichas.Text;
                SqlParameter pFchHora = new SqlParameter("@pFecha", SqlDbType.DateTime);
                pFchHora.Value = dtpFecha.Text + " " + dtHora.Value.ToString("HH:mm");
                SqlParameter pCliente = new SqlParameter("@pDniCliente", SqlDbType.BigInt);
                pCliente.Value = txtCliente.Text;
                if (txtCliente.Text == "")
                {
                    pCliente.Value = 0;
                }

                SqlParameter pRetCatchError = new SqlParameter("@pRetCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pTipo, pChofer, pTurno, pCantFichas, pFchHora, pCliente, pRetCatchError };

                //if (modoAbm == "Nuevo")
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.crearViaje", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("Se dio de Alta al Viaje correctamente", "OK!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                            cmbViaje.Text     = "";
                            txtChofer.Text    = "";
                            txtCliente.Text   = "";
                            txtFichas.Text    = "";
                            txtTurno.Text     = "";
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }

                /* else
                 * {
                 *   if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarAuto", parametros))
                 *   {
                 *       if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                 *       {
                 *           MessageBox.Show("El auto con patente: " + mtxtPatente.Text + " fue editado exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 *           this.DialogResult = DialogResult.OK;
                 *       }
                 *       else
                 *           MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 *   }
                 * }*/
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #8
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar crear el nuevo Chofer.");


                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pId_Asign = new SqlParameter("@pId_Asign", SqlDbType.Int);
                pId_Asign.Value = this.asignacionID;

                SqlParameter pNombre = new SqlParameter("@pFecha", SqlDbType.DateTime);
                pNombre.Value = dtpNacimiento.Text;
                SqlParameter pApellido = new SqlParameter("@pDniChofer", SqlDbType.Int);
                pApellido.Value = textChofer.Text;
                SqlParameter pDireccion = new SqlParameter("@pTurnoID", SqlDbType.Int);
                pDireccion.Value = txtTurno.Text;
                SqlParameter pTurno = new SqlParameter("@pPatente", SqlDbType.VarChar, 10);
                pTurno.Value = txtAuto.Text;

                /*SqlParameter pAnulado = new SqlParameter("@pAnulado", SqlDbType.Bit);
                 * pAnulado.Value = 0;*/
                SqlParameter pRetCatchError = new SqlParameter("@retCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pNombre, pApellido, pDireccion, pTurno, pRetCatchError };

                if (modoAbm == "Nuevo")
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.crearChoferAutoTurno", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("Fue dato de alta exitosamente.", "Alta exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    SqlParameter[] parametros2 = { pId_Asign, pNombre, pApellido, pTurno, pDireccion, pRetCatchError };
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarChoferAutoTurno", parametros2))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("Fue dado de alta exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #9
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar crear el nuevo Rol.");

                    if (string.IsNullOrEmpty(txtRolId.Text))
                    {
                        frmErrores.agregarError("Debe completar el campo Rol ID.");
                    }
                    if (string.IsNullOrEmpty(txtDescripcion.Text))
                    {
                        frmErrores.agregarError("Debe completar el Descripcion.");
                    }

                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pRolID = new SqlParameter("@pRolID", SqlDbType.VarChar, 20);
                pRolID.Value = txtRolId.Text;
                SqlParameter pDescripcion = new SqlParameter("@pDescripcion", SqlDbType.VarChar, 50);
                pDescripcion.Value = txtDescripcion.Text;
                SqlParameter pAnulado = new SqlParameter("@pAnulado", SqlDbType.Bit);
                if (chkDeshabilitado.Checked)
                {
                    pAnulado.Value = 1;
                }
                else
                {
                    pAnulado.Value = 0;
                }

                SqlParameter pRetCatchError = new SqlParameter("@pRetCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pRolID, pDescripcion, pAnulado, pRetCatchError };

                if (modoAbm == "Nuevo")
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.crearRol", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El Rol: " + txtRolId.Text + " fue dato de alta exitosamente.", "Alta exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarRol", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El Rol: " + txtRolId.Text + " fue editado exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #10
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validaCamposRequeridos())
                {
                    GestorDeFlotasDesktop.ListaErrores.ListaErrores frmErrores = new GestorDeFlotasDesktop.ListaErrores.ListaErrores();

                    frmErrores.setTitulo("Ocurrieron algunos errores al intentar crear el nuevo Reloj.");

                    if (string.IsNullOrEmpty(txtNroSerieReloj.Text))
                    {
                        frmErrores.agregarError("Debe completar el Número de Serie del Reloj.");
                    }
                    if (string.IsNullOrEmpty(txtMarca.Text))
                    {
                        frmErrores.agregarError("Debe completar la marca del reloj.");
                    }
                    if (string.IsNullOrEmpty(txtModelo.Text))
                    {
                        frmErrores.agregarError("Debe completar el modelo del reloj.");
                    }
                    if (dtpVersion.Value > DateTime.Today)
                    {
                        frmErrores.agregarError("Debe ingresar una fecha menor o igual a hoy.");
                    }

                    frmErrores.ShowDialog();
                    frmErrores.Dispose();

                    return;
                }

                string retCatchError = string.Empty;

                SqlParameter pNroSerieReloj = new SqlParameter("@pNroSerieReloj", SqlDbType.VarChar, 255);
                pNroSerieReloj.Value = txtNroSerieReloj.Text;
                SqlParameter pMarca = new SqlParameter("@pMarca", SqlDbType.VarChar, 255);
                pMarca.Value = txtMarca.Text;
                SqlParameter pModelo = new SqlParameter("@pModelo", SqlDbType.VarChar, 255);
                pModelo.Value = txtModelo.Text;
                SqlParameter pFechaVencimiento = new SqlParameter("@pFechaVersion", SqlDbType.DateTime);
                pFechaVencimiento.Value = dtpVersion.Value;
                SqlParameter pAnulado = new SqlParameter("@pAnulado", SqlDbType.Bit);
                if (chkDeshabilitado.Checked)
                {
                    pAnulado.Value = 1;
                }
                else
                {
                    pAnulado.Value = 0;
                }
                SqlParameter pRetCatchError = new SqlParameter("@pRetCatchError", SqlDbType.VarChar, 1000);
                pRetCatchError.Direction = ParameterDirection.Output;

                SqlParameter[] parametros = { pNroSerieReloj, pMarca, pModelo, pFechaVencimiento, pAnulado, pRetCatchError };

                if (modoAbm == "Nuevo")
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.crearReloj", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El reloj con la serie: " + txtNroSerieReloj.Text + " fue dato de alta exitosamente.", "Alta exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    if (GestorDeFlotasDesktop.BD.GD1C2012.ejecutarSP("FEMIG.editarReloj", parametros))
                    {
                        if (string.IsNullOrEmpty(pRetCatchError.Value.ToString()))
                        {
                            MessageBox.Show("El reloj con la serie: " + txtNroSerieReloj.Text + " fue editado exitosamente.", "Edición exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show(pRetCatchError.Value.ToString(), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }