public bool fUpdateGallery(mGallery pGallery) { try { tbl_gallery g = new tbl_gallery(); g.gallery_id = pGallery.gallery_id; g.gallery_image = pGallery.gallery_image; g.gallery_date = pGallery.gallery_date; g.gallery_title = pGallery.gallery_title; g.gallery_title_en = pGallery.gallery_title_en; g.gallery_alt = pGallery.gallery_alt; g.gallery_summery = pGallery.gallery_summery; g.gallery_summery_en = pGallery.gallery_summery_en; g.gallery_exp = pGallery.gallery_exp; g.gallery_is_fa = pGallery.gallery_is_fa; g.gallery_exp_en = pGallery.gallery_exp_en; g.gallery_cat = pGallery.gallery_cat; Db.tbl_gallery.Attach(g); Db.Entry(g).State = System.Data.Entity.EntityState.Modified; return(Convert.ToBoolean(Db.SaveChanges())); } catch (Exception) { return(false); } }
public bool InsertGallery(mGallery pGallery) { try { tbl_gallery vGallery = new tbl_gallery(); var query = from b in Db.tbl_gallery orderby b.gallery_id descending select b; vGallery = query.FirstOrDefault(); tbl_gallery g = new tbl_gallery(); g.gallery_title = pGallery.gallery_title; g.gallery_title_en = pGallery.gallery_title_en; g.gallery_image = pGallery.gallery_image; g.gallery_alt = pGallery.gallery_alt; g.gallery_date = pGallery.gallery_date; g.gallery_summery = pGallery.gallery_summery; g.gallery_summery_en = pGallery.gallery_summery_en; g.gallery_exp = pGallery.gallery_exp; g.gallery_exp_en = pGallery.gallery_exp_en; g.gallery_is_fa = pGallery.gallery_is_fa; g.gallery_cat = pGallery.gallery_cat; g.gallery_id = vGallery.gallery_id + 1; Db.tbl_gallery.Add(g); return(Convert.ToBoolean(Db.SaveChanges())); } catch (Exception) { return(false); } }
public ActionResult SaveGallery(tbl_gallery model) { if (model.id == 0) { string filename = Path.GetFileNameWithoutExtension(model.imagefile.FileName); string extension = Path.GetExtension(model.imagefile.FileName); filename = filename + DateTime.Now.ToString("yymmssfff") + extension; model.imagepath = "~/Gallery/" + filename; filename = Path.Combine(Server.MapPath("~/Gallery/"), filename); model.imagefile.SaveAs(filename); model.date = DateTime.Now; _con.Gallery.Add(model); } else { var data = _con.Gallery.SingleOrDefault(c => c.id == model.id); if (data == null) { return(HttpNotFound()); } string filename = Path.GetFileNameWithoutExtension(model.imagefile.FileName); string extension = Path.GetExtension(model.imagefile.FileName); filename = filename + DateTime.Now.ToString("yymmssfff") + extension; model.imagepath = "~/Gallery/" + filename; filename = Path.Combine(Server.MapPath("~/Gallery/"), filename); model.imagefile.SaveAs(filename); data.desc = model.desc; data.date = DateTime.Now; data.imagepath = model.imagepath; data.title = model.title; } _con.SaveChanges(); return(RedirectToAction("Index", "ManageGallery")); }
public ActionResult Upload(tbl_gallery glry) { tbl_dispImg dsply = new tbl_dispImg(); System.Web.HttpFileCollection files = System.Web.HttpContext.Current.Request.Files; for (int i = 0; i < files.Count; i++) { System.Web.HttpPostedFile file = files[i]; string extension = Path.GetExtension(file.FileName); string location = "/Uploads/" + file.FileName.Replace(" ", ""); file.SaveAs(Server.MapPath(location)); glry.FileName = location; db.tbl_gallery.Add(glry); db.SaveChanges(); } System.Web.HttpPostedFile filex = files[0]; string extensionx = Path.GetExtension(filex.FileName); string locationx = "/Uploads/" + filex.FileName.Replace(" ", ""); filex.SaveAs(Server.MapPath(locationx)); dsply.FilePath = locationx; dsply.CompanyID = glry.CompanyID; db.tbl_dispImg.Add(dsply); db.SaveChanges(); return(Json("1", JsonRequestBehavior.AllowGet)); }
protected void Button2_Click(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["rowenref"];//declaration of cookie user usrtrash = db.users.First(use => use.username == cookie["username"]); post Pstid = db.posts.First(use => use.user_id == Convert.ToInt16(cookie["userid"])); tbl_gallery gll = db.tbl_galleries.First(use => use.pst_id == Pstid.pst_id); string file_name = Pstid.Image; string Username = usrtrash.Image; string userpaths = Server.MapPath("../profilepic/oreginal/" + Username); string paths = Server.MapPath("../images/oreginal/" + file_name); FileInfo userfiles = new FileInfo(userpaths); FileInfo files = new FileInfo(paths); if (files.Exists) { files.Delete(); } else if (userfiles.Exists) { userfiles.Delete(); } else { } db.sp_DELETE_tbl_commentuser(Convert.ToInt16(cookie["userid"])); //delete user comment db.sp_DELETE_tbl_postuser(Convert.ToInt16(cookie["userid"])); //delete user post db.tbl_galleries.DeleteOnSubmit(gll); db.users.DeleteOnSubmit(usrtrash); db.SubmitChanges(); // cookie distroy cookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(cookie); Response.Redirect("home.aspx"); }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = new HttpCookie("rowenref"); try { category(); string frm = Request.QueryString["qZcZSFkBxBw"].ToString(); switch (frm) { case "iQkJHCUtPcA=": MultiView1.ActiveViewIndex = 0; MultiView2.ActiveViewIndex = 0; lblslct_title.Text = "Gallery"; lblsitemap.Text = " <ol class='breadcrumb'><li><a href='home.aspx'>Home</a></li><li class='active'>Gallery</li></ol>"; Panelsidebar.Visible = false; viewgallery(); break; //selected gallery case "Fa7v03FdlaUM7Tb4YLoWLg=": string id = Request.QueryString["3FE8tKkfmgY"].ToString(); tbl_gallery gall = db.tbl_galleries.First(use => use.gallery_id == Convert.ToInt16(id)); MultiView1.ActiveViewIndex = 0; MultiView2.ActiveViewIndex = 1; lblslct_title.Text = "Gallery"; Label1.Text = "<a target='_blank' href='../images/goreginal/" + gall.filename + "'><img class='img-responsive' src='../images/gthumbs/" + gall.filename + "'</a>"; lblsitemap.Text = "<ol class='breadcrumb'><li><a href='home.aspx'>Home</a></li><li><a href='request.aspx?qZcZSFkBxBw=iQkJHCUtPcA='>Gallery</a></li><li class='active'>" + gall.title + "</li></ol>"; lblselectedgallery.Text = id.ToString(); var galleryselected = from pst in db.gallerylists where pst.gallery_id == Convert.ToInt16(id) orderby pst.gallery_id ascending select pst; listgalleryslcted.DataSource = galleryselected; listgalleryslcted.DataBind(); Panelsidebar.Visible = false; break; case "ZFyBy4NRXDY=": MultiView1.ActiveViewIndex = 1; lblslct_title.Text = "Contact"; lblsitemap.Text = " <ol class='breadcrumb'><li><a href='home.aspx'>Home</a></li><li class='active'>Contact</li></ol>"; user User = db.users.First(use => use.id == Convert.ToInt16(cookie["userid"])); break; case "6V8tKqNxDZg=": MultiView1.ActiveViewIndex = 2; lblslct_title.Text = "FAQ"; smltooltip.Text = "<small>Frequently Asked Questions</small>"; lblsitemap.Text = " <ol class='breadcrumb'><li><a href='home.aspx'>Home</a></li><li class='active'>FAQ</li></ol>"; Panelsidebar.Visible = false; sitename Stename = db.sitenames.First(); lblfaq.Text = Stename.faq.ToString(); break; case "Fcl56ePHIPM=": MultiView1.ActiveViewIndex = 3; lblslct_title.Text = "Account"; lblsitemap.Text = " <ol class='breadcrumb'><li><a href='home.aspx'>Home</a></li><li class='active'>Account</li></ol>"; break; case "M/P0MxbAsE8=": MultiView1.ActiveViewIndex = 4; cookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(cookie); Response.Redirect("home.aspx"); break; case "qIV2NKe/Bco=": MultiView1.ActiveViewIndex = 5; lblslct_title.Text = "About us"; lblsitemap.Text = " <ol class='breadcrumb'><li><a href='home.aspx'>Home</a></li><li class='active'>About us</li></ol>"; Panelsidebar.Visible = false; sitename Stname = db.sitenames.First(p => p.id == 1); lblaboutus.Text = Stname.about.ToString(); break; case "psQKgMQTuHo=": MultiView1.ActiveViewIndex = 5; string otherpage = Request.QueryString["D/OTj7WyY5Y"].ToString(); otherpage other = db.otherpages.First(use => use.Pagetitle == otherpage); lblslct_title.Text = other.Pagetitle; lblsitemap.Text = " <ol class='breadcrumb'><li><a href='home.aspx'>Home</a></li><li class='active'>dfsf</li></ol>"; lblaboutus.Text = other.body; Panelsidebar.Visible = false; break; } } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { this.blogss(); this.sitemap(); try { string frm = Request.QueryString["frm"].ToString(); switch (frm) { case "read": read = Request.QueryString["id"].ToString(); viewpost vPost = db.viewposts.First(use => use.pst_id == Convert.ToInt16(read)); lblsitemap.Text = " <ol class='breadcrumb'><li><a href='home.aspx'>Home</a></li><li><a href='Destination.aspx'>Destination</a></li><li class='active'>" + vPost.pst_title + "</li></ol>"; lbldate.Text = Convert.ToString(vPost.dte); lbltitle.Text = vPost.pst_title; lblrestitle.Text = vPost.pst_title; lblcontent.Text = vPost.pst_content; lblauthor.Text = vPost.Username; lblpostimage.Text = "<a href='../images/oreginal/" + vPost.Image + "'><img class='img-responsive' src='../images/oreginal/" + vPost.Image + "'/></a>"; HttpCookie cookie = Request.Cookies["rowenref"]; // declaration cookie if (cookie == null) { // imguser.ImageUrl = "../profilepic/thumb/default.png"; Panel1.Visible = true; Panel2.Visible = false; } else { user User = db.users.First(use => use.username == cookie["username"]); imguserlogin.ImageUrl = "../profilepic/thumb/" + User.Image; Panel1.Visible = false; Panel2.Visible = true; } //sider tbl_gallery gall = db.tbl_galleries.First(use => use.pst_id == Convert.ToInt16(read)); lblgallerytitle.Text = gall.title + " Gallery"; var slider = from slide in db.gallerylists where slide.gallery_id == gall.gallery_id select slide; listslider.DataSource = slider; listslider.DataBind(); ////end slider //var con = db.sp_selected_tbl_comment(Convert.ToInt16(read), Convert.ToInt16(13)); var con = from pst in db.view_comments where pst.pst_id == Convert.ToInt16(read) where pst.c_status == "Approved" select pst; //view_comment vComment = db.view_comments.First(use => use.pst_id == Convert.ToInt16(read)); ListView1.DataSource = con; ListView1.DataBind(); MultiView1.ActiveViewIndex = 1; comment Cmt = db.comments.First(use => use.c_status == Convert.ToInt16(13)); if (db.f_countcomment(Convert.ToInt16(read)) != 0) { Label1.Text = Convert.ToString((db.f_countcomment(Convert.ToInt16(read)))) + " Comment"; lblres.Text = Convert.ToString((db.f_countcomment(Convert.ToInt16(read)))); } else { Label1.Text = "0 Comment"; lblres.Text = "No "; } break; case "srh": string srcs = Request.QueryString["cn"].ToString(); var viewsearch = db.sp_search_post(srcs.ToString()); ListView_blog.DataSource = viewsearch; ListView_blog.DataBind(); break; } } catch (Exception ex) { } }
public ActionResult AddGallery() { tbl_gallery obj = new tbl_gallery(); return(View(obj)); }