protected void Page_Load(object sender, EventArgs e) { var Ten = Request["Ten"]; var NoiDung = Request["NoiDung"]; var P_ID = Request["P_ID"]; var Anh = Request["Anh"]; var HoatDong_ID = Request["HoatDong_ID"]; var NgayViet = Request["NgayViet"]; CapNhat Item; switch (subAct) { case "add": #region add Item = new CapNhat(); Item.ID = Guid.NewGuid(); Item.Ten = Ten; Item.NoiDung = NoiDung; Item.NgayTao = DateTime.Now; Item.Username = Security.Username; if (!string.IsNullOrEmpty(P_ID)) { Item.P_ID = new Guid(P_ID); } if (!string.IsNullOrEmpty(HoatDong_ID)) { Item.HoatDong_ID = new Guid(HoatDong_ID); } if (!string.IsNullOrEmpty(NgayViet)) { Item.NgayViet = Convert.ToDateTime(NgayViet, new CultureInfo("vi-Vn")); } Item.Anh = Anh; Item.Loai = 2;// Su kien Item = CapNhatDal.Insert(Item); rendertext(Item.ID.ToString()); break; #endregion case "upload": #region upload if (Security.IsAuthenticated()) { var key = Guid.NewGuid().ToString(); var img = new linh.controls.ImageProcess(Request.Files[0].InputStream, key); if (img.Width < 300) rendertext("300"); img.Resize(520); img.Save(Server.MapPath("~/lib/up/i/") + key + img.Ext); rendertext(key + img.Ext); } break; #endregion default: break; } }
protected void Page_Load(object sender, EventArgs e) { Id = Request["ID"]; if (string.IsNullOrEmpty(Id)) return; using (var con = DAL.con()) { Item = CapNhatDal.SelectById(con, new Guid(Id)); Post_ViewTemplate1.Item = Item; Title = string.Format("{0} - Rek.vn", Item.Ten); var list = CapNhatDal.Newest(con, "10", Security.Username, null).ToList().Where(p => p.ID != new Guid(Id)).ToList(); Post_ViewTemplate1.List = list; } }
protected void Page_Load(object sender, EventArgs e) { var Ten = Request["Ten"]; var Url = Request["Url"]; var P_ID = Request["P_ID"]; var Anh = Request["Anh"]; var Yid = Request["Yid"]; var NgayViet = Request["NgayViet"]; CapNhat Item; switch (subAct) { case "add": #region add Item = new CapNhat(); Item.ID = Guid.NewGuid(); Item.Ten = Ten; Item.NgayTao = DateTime.Now; Item.Username = Security.Username; if (!string.IsNullOrEmpty(P_ID)) { Item.P_ID = new Guid(P_ID); } if (!string.IsNullOrEmpty(NgayViet)) { Item.NgayViet = Convert.ToDateTime(NgayViet, new CultureInfo("vi-Vn")); } Item.Anh = Anh; Item.Loai = 3;// Video Item.VideoUrl = Yid; Item = CapNhatDal.Insert(Item); rendertext(Item.ID.ToString()); break; #endregion case "wrappUrl": #region wrappUrl: Đọc url if (!string.IsNullOrEmpty(Url)) { youTubeVideo vd = Lib.YouTubeCode(Url); rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(vd))); } break; #endregion case "upload": #region upload if (Security.IsAuthenticated()) { var key = Guid.NewGuid().ToString(); var img = new linh.controls.ImageProcess(Request.Files[0].InputStream, key); if (img.Width < 300) rendertext("300"); img.Resize(520); img.Save(Server.MapPath("~/lib/up/i/") + key + img.Ext); rendertext(key + img.Ext); } break; #endregion default: break; } }
protected void Page_Load(object sender, EventArgs e) { var Ten = Request["Ten"]; var NoiDung = Request["NoiDung"]; var P_ID = Request["P_ID"]; var Anh = Request["Anh"]; var NgayViet = Request["NgayViet"]; var FromDate = Request["FromDate"]; ID = Request["ID"]; switch (subAct) { case "add": #region add Item = new CapNhat(); Item.ID = Guid.NewGuid(); Item.Ten = Ten; Item.NoiDung = NoiDung; Item.NgayTao = DateTime.Now; Item.Username = Security.Username; if(!string.IsNullOrEmpty(P_ID)) { Item.P_ID = new Guid(P_ID); } if (!string.IsNullOrEmpty(NgayViet)) { Item.NgayViet = Convert.ToDateTime(NgayViet, new CultureInfo("vi-Vn")); } Item.Anh = Anh; Item.Loai = 1;// Blog Item = CapNhatDal.Insert(Item); rendertext(Item.ID.ToString()); break; #endregion case "remove": #region remove if(Security.IsAuthenticated()) { if(!string.IsNullOrEmpty(ID)) { var item = CapNhatDal.SelectById(new Guid(ID)); if(item.Username==Security.Username) { CapNhatDal.DeleteById(item.ID); } } } break; #endregion case "more": #region more using(var con = DAL.con()) { var BeItem = BeDal.SelectById(con, new Guid(ID), Security.Username); List = CapNhatDal.WallById(con, "10", ID, Security.Username, FromDate); var _postList = new List<CapNhat>(); foreach (var post in List) { post.BeItem = BeItem; _postList.Add(post); } postList.DataSource = _postList; postList.DataBind(); postList.Visible = true; } break; #endregion case "upload": #region upload if (Security.IsAuthenticated()) { var key = Guid.NewGuid().ToString(); var img = new linh.controls.ImageProcess(Request.Files[0].InputStream, key); if (img.Width < 300) rendertext("300"); img.Resize(520); img.Save(Server.MapPath("~/lib/up/i/") + key + img.Ext); rendertext(key + img.Ext); } break; #endregion default: break; } switch (act) { case "view": #region xem post using(var con=DAL.con()) { var Item = CapNhatDal.SelectById(con, new Guid(ID)); Item.BeItem = BeDal.SelectById(con, new Guid(ID)); Post_PureTemplate1.Visible = true; Post_PureTemplate1.Item = Item; } break; #endregion default: break; } }
protected void Page_Load(object sender, EventArgs e) { var ID = Request["ID"]; var P_ID = Request["P_ID"]; var Ten = Request["Ten"]; var location = Server.MapPath("~/lib/up/anh/"); CapNhat Item; switch (subAct) { case "upload": #region upload anh Response.ContentType = "text/plain";//"application/json"; var r = new List<ViewDataUploadFilesResult>(); var js = new JavaScriptSerializer(); foreach (string file in Request.Files) { var hpf = Request.Files[file] as HttpPostedFile; var key = Guid.NewGuid().ToString(); var img = new linh.controls.ImageProcess(hpf.InputStream, key); var fileName = key + img.Ext; var item = new Anh(); if(!string.IsNullOrEmpty(ID)) { item.AB_ID = new Guid(ID); } item.FileAnh = fileName; item.ID = Guid.NewGuid(); item.NgayTao = DateTime.Now; if(!string.IsNullOrEmpty(P_ID)) { item.P_ID = new Guid(P_ID); } item = AnhDal.Insert(item); if(img.Width > 1000) { img.Resize(1000); } img.Save(location + key + "full" + img.Ext); img.Resize(520); img.Save(location + key + img.Ext); r.Add(new ViewDataUploadFilesResult() { Id = item.ID.ToString(), Thumbnail_url = key + img.Ext, Name = key, Length = hpf.ContentLength, Type = hpf.ContentType }); var uploadedFiles = new { files = r.ToArray() }; var jsonObj = js.Serialize(uploadedFiles); Response.Write( jsonObj.ToString()); } ; break; #endregion case "xoaAnh": #region Xoa anh if (Security.IsAuthenticated()) { var item = AnhDal.SelectById(new Guid(ID)); AnhDal.DeleteById(new Guid(ID)); try { File.Delete(location + item.FileAnh); File.Delete(location + Lib.imgSize(item.FileAnh,"full")); } catch { } } break; #endregion case "editCaption": #region Sua tieu de if (Security.IsAuthenticated()) { var item = AnhDal.SelectById(new Guid(ID)); item.Ten = Ten; AnhDal.Update(item); } break; #endregion case "addAlbum": #region Them moi album if (Security.IsAuthenticated()) { var item = new Album(); item.ID = new Guid(ID); item.Ten = Ten; item.NgayTao = DateTime.Now; item.NguoiTao = Security.Username; item.P_RowId = new Guid(P_ID); item.Active = true; item = AlbumDal.Insert(item); Item = new CapNhat(); Item.ID = Guid.NewGuid(); Item.Ten = Ten; Item.NgayTao = DateTime.Now; Item.Username = Security.Username; Item.NgayViet = DateTime.Now; if (!string.IsNullOrEmpty(P_ID)) { Item.P_ID = new Guid(P_ID); } Item.Loai = 4;// Album Item.AB_ID = item.ID; Item = CapNhatDal.Insert(Item); rendertext(Item.ID.ToString()); } break; #endregion case "updateAlbum": #region Cap nhat album if (Security.IsAuthenticated()) { var item = AlbumDal.SelectById(new Guid(ID)); item.Ten = Ten; item = AlbumDal.Update(item); } break; #endregion case "xoaAlbum": #region Cap nhat album if (Security.IsAuthenticated()) { AlbumDal.DeleteById(new Guid(ID)); } break; #endregion default: Response.Write("s"); break; } }
protected void Page_Load(object sender, EventArgs e) { var Id = Request["ID"]; var Url = Request["Url"]; var login = Security.IsAuthenticated(); var email = Request["email"]; var name = Request["name"]; var VideoUrl = Request["VideoUrl"]; var Ten = Request["Ten"]; var Anh = Request["Anh"]; var Txt = Request["Txt"]; var Tags = Request["Tags"]; var NoiDung = Request["NoiDung"]; var FromDate = Request["FromDate"]; //if (HttpContext.Current.Request.HttpMethod.ToUpper() != "POST") //{ // rendertext("Method is not allowed"); //} switch (subAct) { case "login": #region Login if(!string.IsNullOrEmpty(email)) { var u = MemberDal.SelectByUser(email); if(u.ID==0) { u = MemberDal.Insert(new Member() { Username = email ,Email = email ,Ten = name ,NgayTao = DateTime.Now , NgayCapNhat = DateTime.Now }); } Security.Login(email, "true"); } break; #endregion case "more": #region more using (var con = DAL.con()) { var List = CapNhatDal.Newest(con, "10", Security.Username, FromDate); Newest1.List = List; Newest1.Visible = true; } break; #endregion case "logout": #region logout this system Security.LogOut(); break; #endregion case "removePost": #region removePost if (Security.IsAuthenticated()) { if (!string.IsNullOrEmpty(Id)) { var item = CapNhatDal.SelectById(new Guid(Id)); if (item.Username == Security.Username) { CapNhatDal.DeleteById(item.ID); } } } break; #endregion case "wrappUrl": #region wrappUrl: Đọc url if (!string.IsNullOrEmpty(Url)) { youTubeVideo vd = Lib.YouTubeCode(Url); rendertext(string.Format("({0})", JavaScriptConvert.SerializeObject(vd))); } break; #endregion case "savePost": #region Add or Save Post if(Security.IsAuthenticated()) { CapNhat Item; if (string.IsNullOrEmpty(Id)) { Item=new CapNhat { ID = Guid.NewGuid(), NgayTao = DateTime.Now, Username = Security.Username, NgayViet = DateTime.Now }; } else { Item = CapNhatDal.SelectById(new Guid(Id)); } Item.Tags = Tags; Item.NoiDung = NoiDung; Item.Ten = Ten; Item.Anh = Anh; Item.Loai = 3;// Video Item.VideoUrl = VideoUrl; Item = string.IsNullOrEmpty(Id) ? CapNhatDal.Insert(Item) : CapNhatDal.Update(Item); rendertext(Item.ID.ToString()); } break; #endregion case "addComment": #region Add comment to post if (Security.IsAuthenticated()) { var Item = new BinhLuan(); if (!string.IsNullOrEmpty(Id)) { Item.P_RowId = new Guid(Id); } if (!string.IsNullOrEmpty(Txt)) { Txt = Giga.Common.Lib._string.getHTML(Txt); } Item.ID = Guid.NewGuid(); Item.NoiDung = Txt; Item.Username = Security.Username; Item.NgayTao = DateTime.Now; Item.Url = Url; Item = BinhLuanDal.Insert(Item); rendertext(Item.ID.ToString()); } break; #endregion default: break; } }