private void BtAgregar_Click(object sender, RoutedEventArgs e) { try { string clave = Hash(TbClave.Text); CajerosTableAdapter cajeros = new CajerosTableAdapter(); cajeros.Insert(clave, TbCedula.Text, TbNombre.Text, DateTime.Now, (int)CbSucursal.SelectedValue); MessageBox.Show("Se creo el usuario de cajero exitosamente."); TbCedula.Text = ""; TbClave.Text = ""; TbNombre.Text = ""; } catch { MessageBox.Show("Ocurrio un problema durante la durante el proceso."); } }
private void BtLogin_Click(object sender, RoutedEventArgs e) { CajerosTableAdapter cajeros = new CajerosTableAdapter(); int id; if (int.TryParse(usuario.Text, out id)) { var datos = cajeros.GetDataByIdCajero(id).Rows; if (datos.Count == 1) { var user = (CajerosRow)datos[0]; if (user["Clave"].ToString() == Hash(clave.Password)) { var sucs = new SucursalesTableAdapter(); idCajeroInt = id; idCajero = "Cajero No.: " + id.ToString(); idSucursal = (int)user["IdSuc"]; suc = idSucursal.ToString() + " - " + sucs.GetNomSucById(idSucursal).ToString(); nomSucursal = "Sucursal: " + idSucursal.ToString() + " - " + sucs.GetNomSucById(idSucursal).ToString(); MainWindow.log.Info($"Inicio de sesion exitoso. Id: {usuario.Text}"); mainWin.menu = new Menu(mainWin); mainWin.Content = mainWin.menu; } else { MainWindow.log.Info($"Inicio de sesion fallido. Clave incorrecta. Id: {usuario.Text}"); MessageBox.Show("Credenciales invalidos."); } } else { MainWindow.log.Info($"Inicio de sesion fallido. Id invalido: {usuario.Text}"); MessageBox.Show("Credenciales invalidos."); } } else { MainWindow.log.Info($"Inicio de sesion fallido. Id no numerico: {usuario.Text}"); MessageBox.Show("Credenciales invalidos."); } }
private void ReportViewer1_Load(object sender, EventArgs e) { //this.ReportViewer1.LocalReport.ReportPath = "ReportInicioDia.rdlc"; //this.ReportViewer1.ProcessingMode = ProcessingMode.Local; ////tblCuentasTableAdapter cuentas = new tblCuentasTableAdapter(); //ReportDataSource source = new ReportDataSource("DataSet1", (DataTable)diasCaja.GetDataByLastIdCaja(1000)); //this.ReportViewer1.LocalReport.DataSources.Clear(); //this.ReportViewer1.LocalReport.DataSources.Add(source); //this.ReportViewer1.RefreshReport(); DiasCajaTableAdapter diasCaja = new DiasCajaTableAdapter(); EstadoCajaTableAdapter estadoCaja = new EstadoCajaTableAdapter(); CajerosTableAdapter cajeros = new CajerosTableAdapter(); SucursalesTableAdapter sucursales = new SucursalesTableAdapter(); MovimientosCajaTableAdapter movimientos = new MovimientosCajaTableAdapter(); int idCajero = mainWin.login.idCajeroInt; int idSuc = mainWin.login.idSucursal; int idDia = mainWin.menu.EfectivoCaja.IdDia; if (tipo == TiposReporte.CierreDia) { this.ReportViewer1.LocalReport.ReportPath = "ReportCierreDia.rdlc"; this.ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportDataSource Scajeros = new ReportDataSource("DScajeros", (DataTable)cajeros.GetDataByIdCajero(idCajero)); ReportDataSource Ssucursal = new ReportDataSource("DSsucursal", (DataTable)sucursales.GetDataById(idSuc)); ReportDataSource SdiasCaja = new ReportDataSource("DSdiasCaja", (DataTable)diasCaja.GetDataByIdDia(idDia)); ReportDataSource SestadoInicio = new ReportDataSource("DSestadocajainicio", (DataTable)estadoCaja.GetDataByIdDiaAndAccion(idDia, (int)TiposAccion.InicioDelDia)); ReportDataSource SestadoCierre = new ReportDataSource("DSestadocajacierre", (DataTable)estadoCaja.GetDataByIdDiaAndAccion(idDia, (int)TiposAccion.CierreDelDia)); ReportDataSource Smov = new ReportDataSource("DSMov", (DataTable)movimientos.GetDataByIdDia(mainWin.menu.EfectivoCaja.IdDia)); this.ReportViewer1.LocalReport.DataSources.Clear(); this.ReportViewer1.LocalReport.DataSources.Add(Scajeros); this.ReportViewer1.LocalReport.DataSources.Add(Ssucursal); this.ReportViewer1.LocalReport.DataSources.Add(SdiasCaja); this.ReportViewer1.LocalReport.DataSources.Add(SestadoInicio); this.ReportViewer1.LocalReport.DataSources.Add(SestadoCierre); this.ReportViewer1.LocalReport.DataSources.Add(Smov); this.ReportViewer1.RefreshReport(); } else if (tipo == TiposReporte.TransaccionBancaria) { DatosReporteTrans datos = mainWin.transaccion.datosRep; this.ReportViewer1.LocalReport.ReportPath = "ReportTransaccion.rdlc"; this.ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportParameter rp1 = new ReportParameter("TituloRecibo", datos.titulo); ReportParameter rp2 = new ReportParameter("NombreCliente", datos.nombre); ReportParameter rp3 = new ReportParameter("Sucursal", datos.sucursal); ReportParameter rp4 = new ReportParameter("idCajero", datos.idCajero.ToString()); ReportParameter rp5 = new ReportParameter("Cuenta", datos.cuenta.ToString()); ReportParameter rp6 = new ReportParameter("Monto", datos.monto); ReportParameter rp7 = new ReportParameter("TipoTotal", datos.tipototal); ReportParameter rp8 = new ReportParameter("Fecha", datos.fecha.ToString()); ReportParameter rp9 = new ReportParameter("IdNoTrans", datos.idNoTrans); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8, rp9 }); this.ReportViewer1.RefreshReport(); } }