protected void RowDeletingEvent(object sender, GridViewDeleteEventArgs e) { Bibliotecas.Negocio.Usuario us = new Bibliotecas.Negocio.Usuario(); string valor = GbUser.Rows[e.RowIndex].Cells[0].Text; us.EliminarUsuario(valor); }
public void SaldoActual() { string rut = Session["CLAVE"].ToString(); Bibliotecas.Negocio.Usuario us = new Bibliotecas.Negocio.Usuario(); us.Rut1 = rut; us.Read(); lbSaldo.Text = "Su saldo actual es: $" + us.Saldo.ToString(); }
public void Bienvenido() { string mensaje = string.Empty;; Bibliotecas.Negocio.Usuario us = new Bibliotecas.Negocio.Usuario(); us.Rut1 = Convert.ToString(Session["CLAVE"]); us.Read(); mensaje = "BIENVENIDO A SU CUENTA SMART PAY " + us.Nombre1.ToUpper(); lbBienvenida.Text = mensaje; }
protected void GbUser_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = (GridViewRow)GbUser.Rows[e.RowIndex]; TextBox tnom = (TextBox)row.FindControl("txtnombre2"); TextBox tdirec = (TextBox)row.FindControl("txtdireccion2"); TextBox tel = (TextBox)row.FindControl("txtTelefono2"); TextBox tcon = (TextBox)row.FindControl("txtcontra"); TextBox tsaldo = (TextBox)row.FindControl("txtsaldo2"); TextBox tfecha = (TextBox)row.FindControl("txtFecha2"); TextBox tActivo = (TextBox)row.FindControl("txtactivo2"); #region CodigoVaLidacion Bibliotecas.Negocio.Usuario us = new Bibliotecas.Negocio.Usuario(); string rut = GbUser.Rows[e.RowIndex].Cells[0].Text; if (vacio(tnom.Text, tdirec.Text, tel.Text, tcon.Text, tfecha.Text, tActivo.Text, tsaldo.Text)) { if (ValidarActivo(tActivo.Text)) { us.Rut1 = rut; us.Nombre1 = tnom.Text; us.Telefono = tel.Text; us.Direccion = tdirec.Text; us.Fecha = Convert.ToDateTime(tfecha.Text); us.Password1 = tcon.Text; us.Saldo = Convert.ToSingle(tsaldo.Text); us.Activo = tActivo.Text; } else { e.Cancel = true; string script = @"<script type='text/javascript'> alerta('El valor de activo debe ser Si o No'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } } else { e.Cancel = true; string script = @"<script type='text/javascript'> alerta('Ningun campo puede estar vacio'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } #endregion }
protected void btnPagar_Click(object sender, EventArgs e) { string rut = Session["CLAVE"].ToString(); Bibliotecas.Negocio.Usuario user = new Bibliotecas.Negocio.Usuario(); user.Rut1 = rut; float total = Convert.ToSingle(txtTotal.Text); if (ValidarCampos()) { if (user.SaldoSuficiente(rut, total)) { Bibliotecas.Negocio.Viaje ve = new Bibliotecas.Negocio.Viaje(); user.Read(); int saldo = Convert.ToInt32(user.Saldo); ve.Rut = rut; ve.Fecha = CLFecha.SelectedDate; ve.Patente = DLPatente.SelectedValue; ve.Ruta = DLruta.SelectedValue; ve.Precio = Convert.ToDecimal(txtTotal.Text); ve.Create(); Bibliotecas.Negocio.Peaje pe = new Bibliotecas.Negocio.Peaje(); pe.Ruta = DLruta.SelectedValue; pe.Read(); user.Saldo = saldo - Convert.ToSingle(txtTotal.Text); user.UpdateSaldo(); Bibliotecas.Negocio.RegistroDescuento re = new Bibliotecas.Negocio.RegistroDescuento(); re.Rut = rut; re.Fecha = DateTime.Now; re.Peaje = pe.Cantidad_portico; re.Ruta = DLruta.SelectedValue; re.Porcentaje = Convert.ToDecimal(pe.Descuento); re.Create(); SaldoActual(); string script = @"<script type='text/javascript'> alerta('Viaje realizado'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } else { string script = @"<script type='text/javascript'> alerta('No tiene saldo suficiente'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } } else { string script = @"<script type='text/javascript'> alerta('Campo patente o fecha no validos'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); } }