Exemplo n.º 1
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            try
            {
                lblMensaje.Text = string.Empty;
                int reserva;
                if (!int.TryParse(ddlReserva.SelectedValue, out reserva) || reserva <= 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "mostrar();", true);
                    lblMensaje.Text    = "Ingrese una reserva.";
                    lblMensaje.Visible = true;
                    return;
                }
                if (string.IsNullOrEmpty(Path.GetFileName(FileUpload1.PostedFile.FileName)))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "mostrar();", true);
                    lblMensaje.Text    = "Ingrese una imagen.";
                    lblMensaje.Visible = true;
                    return;
                }
                if (txtIdReclamo.Text == string.Empty)
                {
                    int idReclamo = BIZReclamo.Insert(int.Parse(ddlReserva.SelectedValue), txtPatenteInfractor.Text, Context.User.Identity.GetUserId(), Convert.ToInt32(ddlTipoReclamo.SelectedValue), txtDetalle.Text.Trim());

                    BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "ALTA", "Reclamo");

                    /*string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
                     * string filePath = Server.MapPath("~/Uploads/") + fileName;
                     * FileUpload1.SaveAs(filePath);
                     */
                    string fileName   = Path.GetFileName(FileUpload1.PostedFile.FileName);
                    string pathImagen = Server.MapPath("~/Uploads/") + "Reclamo" + idReclamo + "_" + fileName;
                    FileUpload1.SaveAs(pathImagen);

                    BIZReclamo.Update(idReclamo, pathImagen);

                    //BIZPlaza.Insert(idEstacionamiento, Context.User.Identity.GetUserId(), Convert.ToInt32(ddlTipoAlquiler.SelectedValue), true);
                }


                txtIdReclamo.Text        = "";
                txtPatenteInfractor.Text = "";


                txtIdReclamo.Visible = true;
                lblIdReclamo.Visible = true;

                pnlTab2.Visible = false;
                pnlTab1.Visible = true;
                //divPrecio.Visible = false;
                lblMensaje.Text = string.Empty;
                cargarEstacionamientos();
            }
            catch (Exception ex)
            {
                string m = ex.Message;

                Response.Redirect("~/ErrorPage.aspx");
            }
        }
Exemplo n.º 2
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");
            }
        }
Exemplo n.º 3
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();
            }
        }