/// <summary> /// Allows to know what are the availables seats of a bus /// </summary> /// <param name="num">text of the seat</param> /// <returns>true if is available otherwise false</returns> private bool disponibilidadAsientos(int num) { TiquetesBOL x = new TiquetesBOL(); List <int> z = x.camposDisponiblesInter(dateTimePicker1.Value.ToString("dd/MM/yyyy"), dtHorarios.CurrentRow.Cells[4].Value.ToString()); bool encontrado = true; int cap = Convert.ToInt32(dtUnidaes.CurrentRow.Cells[4].Value.ToString()); if (num <= cap) { if (z.Count == 0) { encontrado = true; } for (int i = 0; i <= z.Count - 1; i++) { if (z[i] == num) { encontrado = false; } } } else { encontrado = false; } return(encontrado); }
private void BtnRegistrar_Click(object sender, EventArgs e) { if (Convert.ToDouble(txtMonSis.Text.Trim()) == Convert.ToDouble(txtMonUser.Text.Trim())) { TiquetesBOL x = new TiquetesBOL(); CierreCaja d = new CierreCaja(); d.GSUsuario = txtUsuario.Text.Trim(); DateTime fecha = DateTime.Now; string Text = fecha.ToString("dd/MM/yyyy"); d.GSMonto = Convert.ToDouble(txtMonUser.Text.Trim()); d.GSFecha = Text; x.registrarCierreCaja(d); MessageBox.Show("Cierre de Caja Realizado", "Caja", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { TiquetesBOL x = new TiquetesBOL(); CierreCaja d = new CierreCaja(); d.GSUsuario = txtUsuario.Text.Trim(); DateTime fecha = DateTime.Now; string Text = fecha.ToString("dd/MM/yyyy"); d.GSMonto = Convert.ToDouble(txtMonUser.Text.Trim()); d.GSFecha = Text; x.arqueoDeCaja(d); MessageBox.Show("El monto no coincide con los cortes de caja\nSe realizara un Arqueo de la caja ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Allows to register a new Cash Register /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button1_Click(object sender, EventArgs e) { try { if (existeTiquetero(txtUser.Text.ToString().Trim())) { TiquetesBOL x = new TiquetesBOL(); CorteCaja d = new CorteCaja(); d.NumCorte = Convert.ToInt32(txtCorte.Text.ToString().Trim()); d.CodUser = txtUser.Text.ToString().Trim(); d.Hora = txtHora.Text.ToString().Trim(); d.Fecha = dtFecha.Value.ToString("dd/MM/yyyy"); d.CanTiquetes = Convert.ToInt32(txtVendidos.Text.ToString().Trim()); d.MontoVendido = Convert.ToDouble(txtMonto.Text.ToString().Trim()); x.registrarCorteCaja(d); MessageBox.Show("Corte Registrado", "Cortes", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("El Usuario No Existe", "Cortes", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception be) { MessageBox.Show(be.Message); } }
/// <summary> /// Allows to do visible or invisible a matriz buttom /// </summary> /// <param name="num">text of the button</param> /// <returns> true if is free otherwise false</returns> private bool disponibilidadAsientos(int num) { TiquetesBOL x = new TiquetesBOL(); int cap = Convert.ToInt32(tdUni.CurrentRow.Cells[4].Value.ToString()); bool encontrado = true; List <int> z = x.camposDisponibles(dateTimePicker1.Value.ToString("dd/MM/yyyy"), tabla.CurrentRow.Cells[4].Value.ToString()); //txtMonto.Text = Convert.ToString(z[1]); if (num <= cap) { if (z.Count == 0) { encontrado = true; } for (int i = 0; i <= z.Count - 1; i++) { if (z[i] == num) { encontrado = false; } //encontrado = true; } } else { encontrado = false; } return(encontrado); }
private void BtnBuscar_Click(object sender, EventArgs e) { TiquetesBOL x = new TiquetesBOL(); string user = txtUsuario.Text.Trim(); double monto = x.CierreCaja(user); txtMonSis.Text = Convert.ToString(monto); }
/// <summary> /// Allows to register a new ticket /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnRegistrar_Click(object sender, EventArgs e) { try { TiquetesBOL x = new TiquetesBOL(); Pasajero d = new Pasajero(); TiqueteInternacional z = new TiqueteInternacional(); TiqueteInternacional q = new TiqueteInternacional(); d.Passport = txtPassport.Text.Trim(); d.Nombre = txtNombre.Text.Trim(); d.Vigencia = dtVigencia.Value.ToString("dd/MM/yyyy"); d.FecViaje = dtFechaViaje.Value.ToString("dd/MM/yyyy"); d.FecRegreso = dtFechaRegreso.Value.ToString("dd/MM/yyyy"); d.MotivoViaje = cbxMotVia.SelectedItem.ToString(); d.HoraSalida = txtHoraSalida.Text.Trim(); d.LugarSalida = cbxTerSalida.SelectedItem.ToString(); d.Destino = cbxTerSalida.SelectedItem.ToString(); x.registrarPasajero(d); z.Asiento = txtAsiento.Text.ToString().Trim(); z.Equipaje = Convert.ToBoolean(chkEquipaje.Checked); z.NumEquipaje = Convert.ToInt32(txtNumEqui.Text.ToString().Trim()); z.NumTiquete = Convert.ToInt32(txtNumTiq.Text.ToString().Trim()); z.Horasalida = dtHorarios.CurrentRow.Cells[4].Value.ToString(); z.TerminalSalida = dtHorarios.CurrentRow.Cells[2].Value.ToString(); z.Monto = Convert.ToDouble(txtMonto.Text.ToString().Trim()); z.TerminalLLegada = cbxTerDes.SelectedItem.ToString(); z.Fecha = dateTimePicker1.Value.ToString("dd/MM/yyyy"); z.Vendedor = logueado.Codigo.ToString(); DateTime fecha = DateTime.Now; string Text = fecha.ToString("dd/MM/yyyy"); z.FechaVenta = Text; z.CodUnidad = dtUnidaes.CurrentRow.Cells[0].Value.ToString(); z.NumPassport = txtPas.Text.Trim(); x.registrarTiqInt(z); q.Asiento = txtAsiento2.Text.ToString().Trim(); q.Equipaje = Convert.ToBoolean(chkEquipaje2.Checked); q.NumEquipaje = Convert.ToInt32(txtNumEqui2.Text.ToString().Trim()); q.NumTiquete = Convert.ToInt32(txtNumTiq2.Text.ToString().Trim()); q.Horasalida = tabla.CurrentRow.Cells[4].Value.ToString(); q.TerminalSalida = tabla.CurrentRow.Cells[2].Value.ToString(); q.Monto = Convert.ToDouble(txtMonto2.Text.ToString().Trim()); q.TerminalLLegada = cbxTerDes2.SelectedItem.ToString(); q.Fecha = dtFec2.Value.ToString("dd/MM/yyyy"); q.Vendedor = logueado.Codigo.ToString(); DateTime fech = DateTime.Now; string text = fech.ToString("dd/MM/yyyy"); q.FechaVenta = text; q.CodUnidad = dtRegreso.CurrentRow.Cells[0].Value.ToString(); q.NumPassport = txtPas2.Text.Trim(); x.registrarTiqInt(q); MessageBox.Show("Registrado con exito", "Tiquetes", MessageBoxButtons.OK, MessageBoxIcon.Information); }catch (Exception be) { MessageBox.Show(be.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Allows to remove the seats not availables of a bus /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DateTimePicker1_ValueChanged(object sender, EventArgs e) { TiquetesBOL x = new TiquetesBOL(); string fec = dateTimePicker1.Value.ToString("dd/MM/yyyy"); if (dtHorarios.CurrentRow.Cells[3].Value.ToString().ToLower().Equals(dateTimePicker1.Value.ToString("dddd", new CultureInfo("es-ES")))) { dtFechaViaje.Value = dateTimePicker1.Value; List <int> z = x.camposDisponiblesInter(fec, dtHorarios.CurrentRow.Cells[4].Value.ToString()); quitarAsiento(); } else { MessageBox.Show("Seleccione un dia que corresponda al del horario"); } }
/// <summary> /// Allows to register a new Passenger /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnRegistrar_Click(object sender, EventArgs e) { TiquetesBOL x = new TiquetesBOL(); Pasajero d = new Pasajero(); d.Passport = txtPassport.Text.Trim(); d.Nombre = txtNombre.Text.Trim(); d.Vigencia = dtVigencia.Value.ToString("dd/MM/yyyy"); d.FecViaje = dtFechaViaje.Value.ToString("dd/MM/yyyy"); d.FecRegreso = dtFechaRegreso.Value.ToString("dd/MM/yyyy"); d.MotivoViaje = txtMotViaje.Text.Trim(); d.HoraSalida = txtHoraSalida.Text.Trim(); d.LugarSalida = cbxTerSalida.SelectedItem.ToString(); d.Destino = cbxTerSalida.SelectedItem.ToString(); x.registrarPasajero(d); }
/// <summary> /// Allows to register a new ticket /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button1_Click(object sender, EventArgs e) { try { if (tabla.CurrentRow.Cells[3].Value.ToString().ToLower().Equals(dateTimePicker1.Value.ToString("dddd", new CultureInfo("es-ES")))) { string fec = tdUni.CurrentRow.Cells[8].Value.ToString(); DateTime userDate = DateTime.ParseExact(fec, "dd/MM/yyyy", null); if ((userDate >= dateTimePicker1.Value || dateTimePicker1.Value < DateTime.Now) && tdUni.CurrentRow != null) { TiquetesBOL c = new TiquetesBOL(); TiqueteNacional d = new TiqueteNacional(); d.GSAsiento = txtAsiento.Text.ToString().Trim(); d.GSEquipaje = Convert.ToBoolean(chkEquipaje.Checked); d.GSNumEquipaje = Convert.ToInt32(txtNumEqui.Text.ToString().Trim()); d.GSNumTiquete = Convert.ToInt32(txtNumTiq.Text.ToString().Trim()); d.GSHorasalida = tabla.CurrentRow.Cells[4].Value.ToString(); d.GSTerminalSalida = tabla.CurrentRow.Cells[2].Value.ToString(); d.Monto = Convert.ToDouble(txtMonto.Text.ToString().Trim()); d.GSTerminalLLegada = cbxDestino.SelectedItem.ToString(); d.GSFecha = dateTimePicker1.Value.ToString("dd/MM/yyyy"); d.Vendedor = vende.Codigo.ToString(); DateTime fecha = DateTime.Now; string Text = fecha.ToString("dd/MM/yyyy"); d.FechaVenta = Text; c.registrarTiqueteNac(d); MessageBox.Show("Registrado con Exito", "Tiquetes Nacionales", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("El Bus no cuenta con permiso para la fecha seleccionada\n" + "O la fecha seleccionada no es Vigente"); } } else { MessageBox.Show("Seleccione una fecha con el mismo dia del horario"); } } catch (Exception be) { MessageBox.Show(be.Message); } }
/// <summary> /// Allows to charge the available seats for a specific date /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DateTimePicker1_ValueChanged(object sender, EventArgs e) { TiquetesBOL x = new TiquetesBOL(); string fec = dateTimePicker1.Value.ToString("dd/MM/yyyy"); if (tabla.CurrentRow.Cells[3].Value.ToString().ToLower().Equals(dateTimePicker1.Value.ToString("dddd", new CultureInfo("es-ES")))) { List <int> z = x.camposDisponibles(fec, tabla.CurrentRow.Cells[4].Value.ToString()); quitarAsiento(); } else { MessageBox.Show("Seleccione un dia d que corresponda al del horario"); } // x.camposDisponibles(fec); //string ds = "27/04/1999"; // MessageBox.Show(dateTimePicker1.Value.ToString("dddd", new CultureInfo("es-ES"))); // DateTime userDate = DateTime.ParseExact(ds, "dd/MM/yyyy", null); //MessageBox.Show(userDate.ToString("dddd",new CultureInfo("es-ES"))); }
/// <summary> /// Allows to put the consecutive number of cash register number in the txtCorte /// </summary> public void numCorte() { TiquetesBOL x = new TiquetesBOL(); txtCorte.Text = Convert.ToString(x.numeroCorte()); }
/// <summary> /// Allows to charge all the tickets or packages that represents the cash register /// </summary> /// <param name="info"></param> public void cargarArqueoUsuario(CierreCaja info) { if (info.GSUsuario.Contains("ENC")) { EncomiendaBOL us = new EncomiendaBOL(); List <Encomienda> lst = us.cargarEncomiendasArq(info); DataTable Tabla = new DataTable(); //Declaramos una variable de tipo DataTable y a su vez la inicializamos para usarla mas tarde. DataRow Renglon; //Le agregamos columnas a la variable Tabla que es de tipo DataTable Tabla.Columns.Add(new DataColumn("# Encomienda", typeof(string))); Tabla.Columns.Add(new DataColumn("Usuario", typeof(string))); Tabla.Columns.Add(new DataColumn("Fecha", typeof(string))); Tabla.Columns.Add(new DataColumn("Receptor", typeof(string))); Tabla.Columns.Add(new DataColumn("Terminal", typeof(string))); Tabla.Columns.Add(new DataColumn("Unidad", typeof(string))); Tabla.Columns.Add(new DataColumn("Precio", typeof(double))); Tabla.Columns.Add(new DataColumn("Entregado", typeof(bool))); //Aqui es cuando hacemos uso de la variable renglon, la inicializamos diciendole que va a ser un nuevo renglon de la Tabla que es de tipo DataTable Renglon = Tabla.NewRow(); //Aqui simplemente le agregamos el renglon nuevo con los valores que nosotros querramos, para hacer referencia a cada columna podemos utilizar los indices de cada columna /* * Renglon[0] = "Judis"; * Renglon[1] = "othis"; * Renglon[2] = 12; * Renglon[3] = "Maxa"; */ //Aqui simplemente le agregamos el renglon nuevo a la tabla //Tabla.Rows.Add("luis"); //Tabla.Rows.Add("pepe"); foreach (Encomienda a in lst) { Tabla.Rows.Add(a.GSNumEncomienda, a.GSCodUser, a.GSFecha, a.GSNomReceptor, a.GSCodTerminal, a.GSCodUnidad, a.GSPrecio, a.GSEntregado); } //Aqui le decimos al dataGridView que tome la tabla y la muestre y Fin dtDatos.DataSource = Tabla; } else { TiquetesBOL us = new TiquetesBOL(); List <TiqueteNacional> lst = us.cargarTiquetesArq(info); DataTable Tabla = new DataTable(); //Declaramos una variable de tipo DataTable y a su vez la inicializamos para usarla mas tarde. DataRow Renglon; //Le agregamos columnas a la variable Tabla que es de tipo DataTable Tabla.Columns.Add(new DataColumn("#Tiquete", typeof(int))); Tabla.Columns.Add(new DataColumn("FechaViaje", typeof(string))); Tabla.Columns.Add(new DataColumn("Asiento", typeof(string))); Tabla.Columns.Add(new DataColumn("HoraSalida", typeof(string))); Tabla.Columns.Add(new DataColumn("TerminalSalida", typeof(string))); Tabla.Columns.Add(new DataColumn("TerminalLlegada", typeof(string))); Tabla.Columns.Add(new DataColumn("Equipaje", typeof(bool))); Tabla.Columns.Add(new DataColumn("#Equipaje", typeof(int))); Tabla.Columns.Add(new DataColumn("Monto", typeof(double))); Tabla.Columns.Add(new DataColumn("Vendedor", typeof(string))); Tabla.Columns.Add(new DataColumn("FechaDeCompra", typeof(string))); //Aqui es cuando hacemos uso de la variable renglon, la inicializamos diciendole que va a ser un nuevo renglon de la Tabla que es de tipo DataTable Renglon = Tabla.NewRow(); //Aqui simplemente le agregamos el renglon nuevo con los valores que nosotros querramos, para hacer referencia a cada columna podemos utilizar los indices de cada columna /* * Renglon[0] = "Judis"; * Renglon[1] = "othis"; * Renglon[2] = 12; * Renglon[3] = "Maxa"; */ //Aqui simplemente le agregamos el renglon nuevo a la tabla //Tabla.Rows.Add("luis"); //Tabla.Rows.Add("pepe"); foreach (TiqueteNacional a in lst) { Tabla.Rows.Add(a.GSNumTiquete, a.GSFecha, a.GSAsiento, a.GSHorasalida, a.GSTerminalSalida, a.GSTerminalLLegada, a.GSEquipaje, a.GSNumEquipaje, a.Monto, a.Vendedor, a.FechaVenta); } //Aqui le decimos al dataGridView que tome la tabla y la muestre y Fin dtDatos.DataSource = Tabla; List <TiqueteInternacional> ls = us.cargarTiquetesInterArq(info); DataTable Tables = new DataTable(); //Declaramos una variable de tipo DataTable y a su vez la inicializamos para usarla mas tarde. DataRow Renglo; //Le agregamos columnas a la variable Tabla que es de tipo DataTable Tables.Columns.Add(new DataColumn("#Tiquete", typeof(int))); Tables.Columns.Add(new DataColumn("#Pasaporte", typeof(string))); Tables.Columns.Add(new DataColumn("FechaViaje", typeof(string))); Tables.Columns.Add(new DataColumn("Asiento", typeof(string))); Tables.Columns.Add(new DataColumn("Unidad", typeof(string))); Tables.Columns.Add(new DataColumn("HoraSalida", typeof(string))); Tables.Columns.Add(new DataColumn("TerminalSalida", typeof(string))); Tables.Columns.Add(new DataColumn("TerminalLlegada", typeof(string))); Tables.Columns.Add(new DataColumn("Equipaje", typeof(bool))); Tables.Columns.Add(new DataColumn("#Equipaje", typeof(int))); Tables.Columns.Add(new DataColumn("Monto", typeof(double))); Tables.Columns.Add(new DataColumn("Vendedor", typeof(string))); Tables.Columns.Add(new DataColumn("FechaDeCompra", typeof(string))); //Aqui es cuando hacemos uso de la variable renglon, la inicializamos diciendole que va a ser un nuevo renglon de la Tabla que es de tipo DataTable Renglo = Tables.NewRow(); //Aqui simplemente le agregamos el renglon nuevo con los valores que nosotros querramos, para hacer referencia a cada columna podemos utilizar los indices de cada columna /* * Renglon[0] = "Judis"; * Renglon[1] = "othis"; * Renglon[2] = 12; * Renglon[3] = "Maxa"; */ //Aqui simplemente le agregamos el renglon nuevo a la tabla //Tabla.Rows.Add("luis"); //Tabla.Rows.Add("pepe"); foreach (TiqueteInternacional a in ls) { Tables.Rows.Add(a.NumTiquete, a.NumPassport, a.Fecha, a.Asiento, a.CodUnidad, a.Horasalida, a.TerminalSalida, a.TerminalLLegada, a.Equipaje, a.NumEquipaje, a.Monto, a.Vendedor, a.FechaVenta); } //Aqui le decimos al dataGridView que tome la tabla y la muestre y Fin dtInter.DataSource = Tables; } }