protected void Page_Load(object sender, EventArgs e)
 {
     usuario = (Usuario)Session["Usuario"];
     if(!IsPostBack)
     {
         PrestamosServiceClient client = new PrestamosServiceClient();
         Prestamo[] prestamo = client.ListarHistorial(usuario.IdCli.ToString());
         if (prestamo == null || prestamo.Length == 0)
         {
             divPromo.InnerText = "Estimado Cliente, hasta la fecha Ud. no ha adquirido préstamos";
             divPromo.Visible = true;
         }
         else 
         {
             gvData.DataSource = prestamo;
             gvData.DataBind();
             divPromo.Visible = false;
         }
     }
 }
Пример #2
0
 protected void btnAceptar_Click(object sender, EventArgs e)
 {
     Campana campana = (Campana) Session["Campana"];
     DateTime fechayhora = DateTime.Now;
     double monto=0, tea=0, tcea=0, montoc=0;
     int cuotas=0;
     if (rbOpc1.Checked) 
     {
         monto = Convert.ToDouble(montotot1.Text);
         tea = Convert.ToDouble(tea1.Text);
         tcea = Convert.ToDouble(tcea1.Text);
         montoc = Convert.ToDouble(montoc1.Text);
         cuotas = Convert.ToInt32(cuotas1.Text);
     }
     else if (rbOpc2.Checked) 
     {
         monto = Convert.ToDouble(montotot2.Text);
         tea = Convert.ToDouble(tea2.Text);
         tcea = Convert.ToDouble(tcea2.Text);
         montoc = Convert.ToDouble(montoc2.Text);
         cuotas = Convert.ToInt32(cuotas2.Text);
     }
     else if (rbOpc3.Checked)
     {
         monto = Convert.ToDouble(montotot3.Text);
         tea = Convert.ToDouble(tea3.Text);
         tcea = Convert.ToDouble(tcea3.Text);
         montoc = Convert.ToDouble(montoc3.Text);
         cuotas = Convert.ToInt32(cuotas3.Text);
     }
     else
     {
         MostrarMensaje("Seleccione una opción");
         return;
     }
     int cuenta = Convert.ToInt32(cboCuenta.SelectedValue);
     if (cuenta == -1)
     {
         MostrarMensaje("Seleccione cuenta de abono");
         return;
     }
     PrestamosServiceClient client = new PrestamosServiceClient();
     try
     {
         Prestamo prestamo = client.CrearPrestamo(Convert.ToInt32(campana.tarjeta), Convert.ToInt32(campana.cuenta), campana.moneda, monto, cuotas, tea, tcea, montoc, fechayhora, usuario.IdCli, cuenta);
         if (prestamo != null)
         {
             Session["Prestamo"] = prestamo;
             Response.Redirect("ConfirmarPrestamo.aspx");
         }
     }
     catch (FaultException<ServiceException> ex)
     {
         MostrarMensaje(ex.Detail.mensaje);
     }
     
 }