protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { DataSet dataset = BIZCuentaCorriente.Select(User.Identity.GetUserId()); if (dataset != null && dataset.Tables.Count > 0 && dataset.Tables[0].Rows.Count > 0) { SaldoCuentaCorriente = decimal.Parse(dataset.Tables[0].Rows[0].ItemArray[1].ToString()); lblCCNro.Text = dataset.Tables[0].Rows[0].ItemArray[0].ToString(); lblTotalSaldo.Text = dataset.Tables[0].Rows[0].ItemArray[1].ToString(); /*if (SaldoCuentaCorriente > 180) * { * ddlFormaPago.Items.Add(new ListItem("Cuenta Corriente", "ddlCC")); * * lblCCNro.Text = dataset.Tables[0].Rows[0].ItemArray[0].ToString(); * lblTotalSaldo.Text = dataset.Tables[0].Rows[0].ItemArray[1].ToString(); * }*/ } lblAvisoPago2.Text = Session["Importe_Reserva"].ToString(); ImporteCompra = decimal.Parse(lblAvisoPago2.Text); } catch (Exception) { } } }
private void cargarGrillaCC() { try { gv_DatosCC.DataSource = BIZCuentaCorriente.Select(User.Identity.GetUserId()); gv_DatosCC.DataBind(); if (gv_DatosCC.Rows.Count > 0) { //Attribute to show the Plus Minus Button. gv_DatosCC.HeaderRow.Cells[0].Attributes["data-class"] = "expand"; //Attribute to hide column in Phone. gv_DatosCC.HeaderRow.Cells[1].Attributes["data-hide"] = "phone"; //Adds THEAD and TBODY to GridView. gv_DatosCC.HeaderRow.TableSection = TableRowSection.TableHeader; pnlTabcc.Visible = true; } else { pnlTabcc.Visible = false; } } catch (Exception) { Response.Redirect("ErrorDB.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(); }
private void cargarDatosCC() { try { ddlUsuarios.DataSource = BIZCuentaCorriente.SelectUsersSinCtaCte(); ddlUsuarios.DataTextField = "UserName"; ddlUsuarios.DataValueField = "id"; ddlUsuarios.DataBind(); if (Context.User.IsInRole("Administrador")) { gvCC.DataSource = BIZCuentaCorriente.SelectAll(); } else { gvCC.DataSource = BIZCuentaCorriente.Select(User.Identity.GetUserId()); } gvCC.DataBind(); if (gvCC.Rows.Count > 0) { //Attribute to show the Plus Minus Button. gvCC.HeaderRow.Cells[0].Attributes["data-class"] = "expand"; //Attribute to hide column in Phone. //gvCC.HeaderRow.Cells[1].Attributes["data-hide"] = "phone"; //gvCC.HeaderRow.Cells[2].Attributes["data-hide"] = "phone"; //gvCC.HeaderRow.Cells[3].Attributes["data-hide"] = "phone"; //gvCC.HeaderRow.Cells[4].Attributes["data-hide"] = "phone"; //Adds THEAD and TBODY to GridView. gvCC.HeaderRow.TableSection = TableRowSection.TableHeader; } } catch (Exception) { Response.Redirect("~/ErrorPage.aspx"); } }
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(); } }