Ejemplo n.º 1
0
    protected void btnEliminar_Click2(object sender, EventArgs e)
    {
        if (gvInmuebles.SelectedIndex != -1)
        {
            string num;
            InmueblesBLL bllInmuebles = new InmueblesBLL();
            ProyectoInmoBLL.InmobiliariasBLL inmobll = new ProyectoInmoBLL.InmobiliariasBLL();

            if (rblDelete.SelectedValue == "2")
            {
                string g = cboInmobiliarias.SelectedIndex.ToString();

                bllInmuebles.Shared(gvInmuebles.SelectedValue.ToString(), cboInmobiliarias.SelectedValue.ToString(), cboInmobiliarias2.SelectedValue.ToString(), inmobll.SelectNombreInmobiliaria(Membership.GetUser().ProviderUserKey.ToString()));
            }

            bllInmuebles.Delete(gvInmuebles.SelectedValue.ToString());

            for (int i = 1; i <= 10; i++)
            {
                try
                {
                    if (i < 10)
                    {
                        num = 0 + i.ToString();
                    }
                    else
                    {
                        num = i.ToString();
                    }
                    File.Delete(Server.MapPath("~\\Image_Upload\\" + gvInmuebles.SelectedValue.ToString() + "-" + num + ".jpg"));
                    File.Delete(Server.MapPath("~\\Image_Upload\\" + gvInmuebles.SelectedValue.ToString() + "-" + num + "_thumb.jpg"));

                }
                catch
                {
                }
            }

            IniciaGridView();

            Page.Response.Redirect(Page.Request.Url.ToString(), true);
        }
    }