Beispiel #1
0
        private void cargarEstacionamientos()
        {
            ddlReserva.DataSource     = BIZReserva.ReservaPagaSelectByIdUsuario(Context.User.Identity.GetUserId());
            ddlReserva.DataValueField = "idReserva";
            ddlReserva.DataTextField  = "descripcion";
            ddlReserva.DataBind();

            ddlTipoReclamo.DataSource     = BIZTipoReclamo.SelectAll();
            ddlTipoReclamo.DataValueField = "idTipoReclamo";
            ddlTipoReclamo.DataTextField  = "descripcion";
            ddlTipoReclamo.DataBind();

            try
            {
                CultureInfo us = new CultureInfo("es-ES");
                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();

                if (gvReclamo.Rows.Count > 0)
                {
                    //Attribute to show the Plus Minus Button.
                    gvReclamo.HeaderRow.Cells[0].Attributes["data-class"] = "expand";

                    //Attribute to hide column in Phone.
                    gvReclamo.HeaderRow.Cells[1].Attributes["data-hide"] = "phone";

                    //Adds THEAD and TBODY to GridView.
                    gvReclamo.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
            }
            catch (Exception)
            {
                Response.Redirect("ErrorPage.aspx");
            }
        }
Beispiel #2
0
        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();
            }
        }