예제 #1
0
        public RendicionViajes()
        {
            InitializeComponent();
            lblImporteTotal.Hide();
            lblImporteTotalTexto.Hide();
            lblNumeroRendicion.Hide();
            lblNumeroRendicionTexto.Hide();
            lblPrevisualizarImporte.Hide();
            lblPrevisualizarImporteTexto.Hide();
            lblDetalleRendicion.Hide();
            tablaRendicion.Hide();
            tablaPreviaRendicion.Hide();
            lblPrevisualizar.Hide();
            btnConfirmarRendicion.Hide();

            tablaTurnos = SQLTurno.obtenerTodosLosTurnos();

            foreach (DataRow row in tablaTurnos.Rows)
            {
                cmbTurno.Items.Add(row["descripcion"].ToString());
                cmbTurno.SelectedIndex = 0;
            }

            tablaChoferes = SQLChofer.obtenerTodosLosChoferes();

            foreach (DataRow row in tablaChoferes.Rows)
            {
                cmbChoferes.Items.Add(row["nombre"].ToString() + " " + row["apellido"].ToString());
                cmbChoferes.SelectedIndex = 0;
            }
        }
예제 #2
0
        public ModificacionAutomovil(Automovil auto)
        {
            InitializeComponent();
            cargarForm();

            idautomovil     = auto.idautomovil;
            txtPatente.Text = auto.patente;
            txtModelo.Text  = auto.modelo;

            string nombreYApellido = obtenerNombreYApellidoChofer(auto.idchofer);

            cmbChofer.SelectedIndex = cmbChofer.FindStringExact(nombreYApellido);

            tablaTurnos = SQLTurno.obtenerTodosLosTurnosHabilitados();

            turnosSeleccionados = SQLAutomovil.obtenerTurnosDefinidosAuto(auto.idautomovil);
            checkListTurno.Items.Clear();
            foreach (DataRow row in tablaTurnos.Rows)
            {
                Boolean check = estaSeleccionadoTurno(row["id_turno"].ToString());
                checkListTurno.Items.Add(row["descripcion"].ToString(), check);
            }

            string nombreMarca = obtenerNombreMarca(auto.idmarca);

            selectMarca.SelectedIndex = selectMarca.FindStringExact(nombreMarca);

            ckbHabilitado.Checked = auto.habilitado == 1? true : false;

            //No se usa esto??
            txtLicencia.Text = auto.licencia;
            txtRodado.Text   = auto.rodado;
        }
예제 #3
0
 private void AltaAutomovil_Load(object sender, EventArgs e)
 {
     tablaTurnos = SQLTurno.obtenerTodosLosTurnosHabilitados();
     foreach (DataRow row in tablaTurnos.Rows)
     {
         checkListTurno.Items.Add(row["descripcion"].ToString());
     }
 }
예제 #4
0
 private void btnAlta_Click(object sender, EventArgs e)
 {
     if (verificarDatosTurno(txtDescripcion.Text, txtValorKm.Text, txtPrecioBase.Text))
     {
         Turno  nuevoTurno = new Turno(Int32.Parse(sacarHoraReal(cmbInicio.SelectedItem.ToString())), Int32.Parse(sacarHoraReal(cmbFinal.SelectedItem.ToString())), txtDescripcion.Text, decimal.Parse(txtValorKm.Text), decimal.Parse(txtPrecioBase.Text), ckbHabilitado.Checked);
         string response   = SQLTurno.insertarTurno(nuevoTurno);
         MessageBox.Show(response);
     }
 }
예제 #5
0
 private void btnModificacion_Click(object sender, EventArgs e)
 {
     if (verificarDatosTurno(txtDescripcion.Text, txtValorKm.Text, txtPrecioBase.Text))
     {
         Turno  nuevoTurno = new Turno(idTurno, Int32.Parse(sacarHoraReal(cmbInicio.Text)), Int32.Parse(sacarHoraReal(cmbFinal.Text)), txtDescripcion.Text, decimal.Parse(txtValorKm.Text), decimal.Parse(txtPrecioBase.Text), ckbHabilitado.Checked);
         string response   = SQLTurno.modificarTurno(nuevoTurno);
         this.DialogResult = DialogResult.OK;
         MessageBox.Show(response);
         this.Close();
     }
 }
예제 #6
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Esta seguro?", "Esta seguro que quiere dar de baja este Turno?", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                string response = SQLTurno.eliminarTurno(turnoSeleccionado);
                MessageBox.Show(response);
                tablaTurnos.DataSource = SQLTurno.obtenerTodosLosTurnosHabilitados();
            }
        }
예제 #7
0
        public static void eliminarTurno(int pId)
        {
            DataAccessLayerTurnos oDAL = new SQLTurno();

            try
            {
                oDAL.Delete(pId);
            }
            catch (SqlException)
            {
                throw new ConsultaVinculadaConExpediente();
            }
        }
예제 #8
0
        //TURNOS
        public static void guardarTurno(Turno pTurno, string pOperacion)
        {
            DataAccessLayerTurnos oDAL = new SQLTurno();

            if (pOperacion == "Insert")
            {
                oDAL.Insert(pTurno);
            }
            else if (pOperacion == "Update")
            {
                oDAL.Update(pTurno);
            }
            else
            {
                throw new Exception();
            }
        }
예제 #9
0
        private void cmbChoferes_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblTurno.Show();
            cmbTurnos.Show();

            cmbTurnos.Items.Clear();
            cmbTurnos.Text = "";

            cmbAutomovil.Items.Clear();
            cmbAutomovil.Text = "";

            tablaTurnos = SQLTurno.obtenerTodosLosTurnosDelChofer(obtenerIDChofer(cmbChoferes.SelectedItem.ToString()));

            foreach (DataRow row in tablaTurnos.Rows)
            {
                cmbTurnos.Items.Add(row["descripcion"].ToString());
            }
        }
예제 #10
0
 private void bnBuscar_Click(object sender, EventArgs e)
 {
     if (txtDescripcion.Text.Length == 0)
     {
         MessageBox.Show("Debe escribir algun campo para buscar", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Turno turnoABuscar = new Turno(txtDescripcion.Text);
         if (modificacion)
         {
             tablaTurnos.DataSource = SQLTurno.filtarTurnos(turnoABuscar);
         }
         else
         {
             tablaTurnos.DataSource = SQLTurno.filtarTurnosHabilitados(turnoABuscar);
         }
     }
 }
예제 #11
0
        private void recargar()
        {
            DataTable turnos;

            if (modificacion)
            {
                turnos = SQLTurno.obtenerTodosLosTurnos();
            }
            else
            {
                turnos = SQLTurno.obtenerTodosLosTurnosHabilitados();
            }
            tablaTurnos.DataSource = turnos;
            this.tablaTurnos.Columns[0].Visible = false; //turnoId
            DataGridViewRow turnoRow = tablaTurnos.Rows[0];

            turnoSeleccionado = new Turno(turnoRow);

            txtDescripcion.Text = "";
        }
예제 #12
0
        private bool verificarHoraConTurno()
        {
            DataTable turnoElegido;

            turnoElegido = SQLTurno.obtenerHoraInicioYFinDelTurno(obtenerIDTurno(cmbTurnos.SelectedItem.ToString()));
            DataRow row = turnoElegido.Rows[0];

            int hora_inicio       = int.Parse(row["hora_inicio"].ToString());
            int hora_fin          = int.Parse(row["hora_fin"].ToString());
            int hora_viaje_inicio = dataTimeInicio.Value.Hour;
            int hora_viaje_fin    = dateTimeFin.Value.Hour;

            if (hora_viaje_inicio < hora_inicio || hora_viaje_inicio > hora_fin)
            {
                return(false);
            }
            else if (hora_viaje_fin < hora_inicio || hora_viaje_fin > hora_fin)
            {
                return(false);
            }
            return(true);
        }
예제 #13
0
        public static List <Turno> traerTurnos(int pId)
        {
            DataAccessLayerTurnos oDAL = new SQLTurno();

            return(oDAL.GetAll(pId));
        }