protected void btnConfirmar_Click(object sender, EventArgs e) { try { decimal saldoTotal = Convert.ToDecimal(txtSaldoHoy.Text) - Convert.ToDecimal(txtSaldoNuevo.Text); if (ddlUsuarios.Visible) { BIZCuentaCorriente.Insert(ddlUsuarios.SelectedValue, Convert.ToInt32(txtSaldoHoy.Text), Utils.GetDateTimeLocal()); BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "ALTA", "Cuenta Corriente"); } else { BIZCuentaCorriente.UpdateSaldo(Convert.ToInt32(txtNroCuenta.Text), saldoTotal); BIZOperacionesCtaCte.Insert(Convert.ToInt32(txtNroCuenta.Text), saldoTotal, Utils.GetDateTimeLocal(), "Actualización Saldo", "ACTUALIZACIÓN"); BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "MODIFICACIÓN", "Cuenta Corriente"); } txtNroCuenta.Text = ""; txtSaldoHoy.Text = ""; txtSaldoNuevo.Text = ""; txtTitular.Text = ""; pnlTab2.Visible = false; pnlTab1.Visible = true; cargarDatosCC(); } catch (Exception) { Response.Redirect("~/ErrorPage.aspx"); } }
protected void btnVerMovCC_Click(object sender, EventArgs e) { BIZReserva.ReservaUpdateCerrado(Context.User.Identity.GetUserId()); DataSet dsCuentaCorriente = BIZCuentaCorriente.Select(Context.User.Identity.GetUserId()); int nroCuenta = Convert.ToInt32(dsCuentaCorriente.Tables[0].Rows[0]["nroCuenta"]); BIZCuentaCorriente.UpdateSaldo(nroCuenta, SaldoTotal * (-1)); BIZOperacionesCtaCte.Insert(nroCuenta, SaldoTotal, Utils.GetDateTimeLocal(), "Acreditación en Cuenta Corriente", "CRÉDITO"); BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "MODIFICACIÓN", "Acreditación en Cuenta Corriente"); cargarGrillaCC(); }
protected void gvReclamo_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Rechazar") { int idReclamo = int.Parse(e.CommandArgument.ToString().Split(',')[0]); int idReserva = int.Parse(e.CommandArgument.ToString().Split(',')[1]); BIZReclamo.UpdateStatus(idReclamo, 3); BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "RECHAZO", "Reclamo"); if (Context.User.IsInRole("Administrador")) { gvReclamo.DataSource = BIZReclamo.SelectAll(); } else { gvReclamo.DataSource = BIZReclamo.SelectByIdUser(Context.User.Identity.GetUserId()); gvReclamo.Columns[gvReclamo.Columns.Count - 1].Visible = false; gvReclamo.Columns[gvReclamo.Columns.Count - 2].Visible = false; gvReclamo.Columns[2].Visible = false; } gvReclamo.DataBind(); } else if (e.CommandName == "Pagar") { int idReclamo = int.Parse(e.CommandArgument.ToString().Split(',')[0]); int idReserva = int.Parse(e.CommandArgument.ToString().Split(',')[1]); DataSet dsReserva = BIZReserva.MisReservasSelectByIdReserva(idReserva); DataSet dsCC = BIZCuentaCorriente.Select(User.Identity.GetUserId()); String nroCuenta = dsCC.Tables[0].Rows[0]["nroCuenta"].ToString(); String importe = dsReserva.Tables[0].Rows[0]["tarifa"].ToString(); BIZCuentaCorriente.UpdateSaldo(Convert.ToInt32(nroCuenta), Convert.ToDecimal(importe) * (-1)); BIZReclamo.UpdateStatus(idReclamo, 2); BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "CONFIRMACION", "Reclamo"); if (Context.User.IsInRole("Administrador")) { gvReclamo.DataSource = BIZReclamo.SelectAll(); } else { gvReclamo.DataSource = BIZReclamo.SelectByIdUser(Context.User.Identity.GetUserId()); gvReclamo.Columns[gvReclamo.Columns.Count - 1].Visible = false; gvReclamo.Columns[gvReclamo.Columns.Count - 2].Visible = false; } gvReclamo.DataBind(); } else if (e.CommandName == "Descargar") { string filePath = e.CommandArgument.ToString(); /*Response.ContentType = ContentType; * Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath)); * Response.TransmitFile(filePath); * Response.End();*/ /*byte[] Content = File.ReadAllBytes(filePath); //missing ; * Response.Clear(); * * Response.AddHeader("content-disposition", "attachment; filename=" + Path.GetFileName(filePath)); * Response.ContentType = "application/octet-stream"; * Response.WriteFile(filePath); * Response.End();*/ FileInfo ObjArchivo = new System.IO.FileInfo(filePath); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath)); Response.AddHeader("Content-Length", ObjArchivo.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(ObjArchivo.FullName); Response.End(); } }
protected void btnConfirmar_Click(object sender, EventArgs e) { lblErrorMensaje.Visible = false; try { bool pagoReserva = false; if (ddlFormaPago.SelectedValue == "0") { string message = "Debe seleccionar una forma de pago."; ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true); lblErrorMensaje.Text = message; lblErrorMensaje.Visible = true; panelTC.Visible = false; panelCC.Visible = false; } else { if (ddlFormaPago.SelectedValue == "ddlTC") { btnConfirmar.ValidationGroup = "ValTarjetaCredito"; //consumir servicio if (TarjetaValida()) { BIZOperacionesTC.Insert(txtNroTarjeta.Text, Convert.ToDateTime("01/" + txtMes.Text + "/" + txtAnio.Text), Convert.ToInt32(txtCodSeg.Text), Convert.ToInt32(Session["Nro_Reserva"].ToString()), DateTime.Now, "", User.Identity.GetUserId()); pagoReserva = true; } else { string message = "Verifique los datos de la tarjeta ingresada"; ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true); lblErrorMensaje.Text = message; lblErrorMensaje.Visible = true; } } else { btnConfirmar.ValidationGroup = "ValCuentaCorriente"; try { if (Convert.ToDecimal(Session["Importe_Reserva"].ToString()) < SaldoCuentaCorriente) { BIZCuentaCorriente.UpdateSaldo(Convert.ToInt32(lblCCNro.Text), Convert.ToDecimal(Session["Importe_Reserva"].ToString())); BIZOperacionesCtaCte.Insert(Convert.ToInt32(lblCCNro.Text), Convert.ToDecimal(Session["Importe_Reserva"].ToString()), Utils.GetDateTimeLocal(), "Pago de la reserva Nro: " + Session["Nro_Reserva"].ToString(), "DEBITO"); pagoReserva = true; } else { //string message = "El saldo de su cuenta no es suficiente para pagar la reserva."; //ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true); lblSaldoInsuficiente.Visible = true; } } catch (Exception ex) { lblPyEconfirmado.Text = ex.Message; } } } if (pagoReserva) { //BIZReserva.PlazaUpdateStatePayment(Convert.ToInt32(Session["Nro_Reserva"].ToString()), true); BIZReserva.ReservaUpdateStatePayment(Convert.ToInt32(Session["Nro_Reserva"].ToString()), Utils.GetDateTimeLocal(), true); panelTotal.Visible = false; lblPyEconfirmado.Visible = true; btnContinuar.Visible = true; btnMisReservas.Visible = true; lblErrorMensaje.Visible = true; lblErrorMensaje.Text = "Hemos registrado su pago. Le enviaremos el comprabante por email"; } } catch (Exception) { string message = "Se ha producido un error en la operatoria. Volvé a ingresar a Mis Reservas e intentalo nuevamente"; ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true); Response.Redirect("MisReservas.aspx"); } }