Пример #1
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            String Name  = (String)Session["UserId"];
            String path  = Server.MapPath("~/images/Hostel");
            String upath = path + "\\" + Name;

            String[] arr = Directory.GetFiles(upath);
            foreach (String ipath in arr)
            {
                File.Delete(ipath);
            }
            Session.Remove("ContactNo1");
            Session.Remove("ContactNo2");
            Session.Remove("State");
            Session.Remove("City");
            Session.Remove("HostelLocation");
            Session.Remove("NearestLocation");
            Session.Remove("HostelGender");
            Session.Remove("MessFacility");
            Session.Remove("Scheme");
            Session.Remove("UploadPhoto1");
            Session.Remove("UploadPhoto2");
            Session.Remove("UploadPhoto3");
            Session.Remove("Counter");
            Session.Remove("Disable");
            Session.Remove("BathRoom");
            Session.Remove("HotWater");
            Session.Remove("Parking");
            Session.Remove("Wifi");
            Session.Remove("MoreAboutHostel");
            int n = SqlDeleteDetails.Delete();

            if (n == 1)
            {
                SqlDeleteDetails0.Delete();
                PanelUploadHostel1.Visible = true;
                PanelUploadHostel5.Visible = false;
                Response.Write("<script>alert('You Have to fill the Form again to edit your details..')</script>");
            }
        }
Пример #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            String Name  = (String)Session["UserId"];
            String path  = Server.MapPath("~/images/Hostel");
            String upath = path + "\\" + Name;

            String[] arr = Directory.GetFiles(upath);
            foreach (String ipath in arr)
            {
                File.Delete(ipath);
            }
            Session.Remove("ContactNo1");
            Session.Remove("ContactNo2");
            Session.Remove("State");
            Session.Remove("City");
            Session.Remove("HostelLocation");
            Session.Remove("NearestLocation");
            Session.Remove("HostelGender");
            Session.Remove("MessFacility");
            Session.Remove("Scheme");
            Session.Remove("UploadPhoto1");
            Session.Remove("UploadPhoto2");
            Session.Remove("UploadPhoto3");
            Session.Remove("Counter");
            Session.Remove("Disable");
            Session.Remove("BathRoom");
            Session.Remove("HotWater");
            Session.Remove("Parking");
            Session.Remove("Wifi");
            Session.Remove("MoreAboutHostel");
            int n = SqlDeleteDetails.Delete();

            if (n == 1)
            {
                SqlDeleteDetails0.Delete();
                Response.Write("<script>alert('Add Deleted..')</script>");
                Server.Transfer("~/Account/UserPanel.aspx");
            }
        }