protected void Page_Load(object sender, EventArgs e) { ltrSocial.Text = Utility.ReadTemplateFromFile("pathSocial"); var promoId = Request.GetFriendlyUrlSegments()[0]; var taPromo = new DataSetVepAdminTableAdapters.NewsTableAdapter(); DataTable dtPromo = taPromo.GetDataByID(int.Parse(promoId)); var imagePath = Url + dtPromo.Rows[0]["UrlFotoHome"]; var fbMetaTagsTemplate = ReadTemplateFromFile("template_tagFb.htm"); CreateFacebookMetaTags(fbMetaTagsTemplate, imagePath, String.Format("{0}PromoDettaglio/{1}/{2}", Url, dtPromo.Rows[0]["News_ID"], dtPromo.Rows[0]["Titolo"])); }
protected void Page_Load(object sender, EventArgs e) { ltrSocial.Text = Utility.ReadTemplateFromFile("pathSocial"); string id = Request.QueryString["Id"]; DataSetVepAdminTableAdapters.NewsTableAdapter taN = new DataSetVepAdminTableAdapters.NewsTableAdapter(); DataTable dtArticolo = taN.GetDataByID(int.Parse(id)); string url = Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/");//Page.Request.Url.ToString(); string imagePath = url + "img/logo_w.png"; //BlogPost.aspx?Id string templateHtml = readTemplateFromFile("template_tagFb.htm"); string replaceImage_p = templateHtml.Replace("##image##", imagePath); string replaceUrl_p = replaceImage_p.Replace("##url##", url + "SuggDettaglio.aspx?Id=" + dtArticolo.Rows[0]["News_ID"].ToString()); string replaceTitle_p = replaceUrl_p.Replace("##titolo##", dtArticolo.Rows[0]["Titolo"].ToString()); string replaceDesc_p = replaceTitle_p.Replace("##caption##", Helper.GetShortStringAndCleanTags(Utility.CleanHtmlTagsFromString(dtArticolo.Rows[0]["Testo"].ToString()), 200)); Session["metatagFB"] = replaceDesc_p; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) //check if the webpage is loaded for the first time. { ViewState["PreviousPage"] = Request.UrlReferrer; //Saves the Previous page url in ViewState } int AlbumID = int.Parse((string)Request.QueryString["AlbumID"]); DataSetVepAdminTableAdapters.NewsTableAdapter taNews = new DataSetVepAdminTableAdapters.NewsTableAdapter(); DataSetVepAdminTableAdapters.AlbumsTableAdapter taAlb = new DataSetVepAdminTableAdapters.AlbumsTableAdapter(); DataTable dtAlb = taAlb.GetInfoAlbumbyID(AlbumID); if (!string.IsNullOrEmpty(dtAlb.Rows[0]["NewsEventoID"].ToString())) { DataTable dtNews = taNews.GetDataByID(int.Parse(dtAlb.Rows[0]["NewsEventoID"].ToString())); // lblArticolo.Text = dtNews.Rows[0]["Titolo"].ToString(); } lblNomeAlb.Text = PhotoManager.GetNomeAlbum(AlbumID); }
protected void _OnItemCommand(object sender, ListViewCommandEventArgs e) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; string newsID = ListViewNews.DataKeys[dataItem.DisplayIndex].Value.ToString(); if (e.CommandName == "cancella") { DataSetMateraArredamentiTableAdapters.NewsTableAdapter taNews = new DataSetMateraArredamentiTableAdapters.NewsTableAdapter(); taNews.DeleteNewsEventi(int.Parse(newsID)); } else if (e.CommandName == "modifica") { Response.Redirect("AddModNews.aspx?tipo=" + ddlTipo.SelectedValue + "&NewsID=" + newsID); } else if (e.CommandName == "fotoGallery") { DataSetVepAdminTableAdapters.NewsTableAdapter taNews = new DataSetVepAdminTableAdapters.NewsTableAdapter(); int idNews = int.Parse(newsID); DataSetVepAdminTableAdapters.AlbumsTableAdapter taAlbums = new DataSetVepAdminTableAdapters.AlbumsTableAdapter(); int albumID = 0; DataTable dtAlbum = taAlbums.GetIdAlbum(idNews); DataTable dtNews = taNews.GetDataByID(idNews); string idScuola = (string)Session["ddlScuola"]; if (dtAlbum.Rows.Count == 0) { albumID = Convert.ToInt32(taAlbums.InsertAlbumRetID(dtNews.Rows[0]["Descrizione"].ToString(), true, idNews)); //nuova news inserita faccio una redirect e nella sessione ho giĆ l'id_news! Response.Redirect("~/Admin/Photos.aspx?AlbumID=" + albumID.ToString()); } else { Response.Redirect("~/Admin/Photos.aspx?AlbumID=" + dtAlbum.Rows[0]["AlbumID"].ToString()); } } ListViewNews.DataBind(); }
protected void _OnCreated(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType.ToString() != "EmptyItem") { DataSetVepAdminTableAdapters.NewsTableAdapter taNews = new DataSetVepAdminTableAdapters.NewsTableAdapter(); ListViewDataItem dataItem = (ListViewDataItem)e.Item; string newsID = ListViewNews.DataKeys[dataItem.DisplayIndex].Value.ToString(); DataTable dtNews = taNews.GetDataByID(int.Parse(newsID)); Label lblAllegato = (Label)(e.Item.FindControl("lblAllAss")); Label lbllinkGall = (Label)(e.Item.FindControl("lbllinkGall")); Label lblVideo = (Label)(e.Item.FindControl("lblVideoAss")); Label lblriga = (Label)(e.Item.FindControl("lblriga")); lblriga.Text = (dataItem.DataItemIndex + 1).ToString(); Image imgPhoto = (Image)(e.Item.FindControl("imgPhoto")); Image imgVideo = (Image)(e.Item.FindControl("imgVideo")); Image imgAllegato = (Image)(e.Item.FindControl("imgAllegato")); if (dtNews.Rows[0]["Allegati"].ToString() != "") { imgAllegato.Visible = true; //lblAllegato.Text = "Si"; //imgAllegato.ImageUrl = "~/Admin/images/ball_blue_16.png"; } } }
protected void Page_Load(object sender, EventArgs e) { DivError.Visible = false; string idNews = Request.QueryString["NewsID"]; idTipo = Request.QueryString["tipo"]; if (idNews != null) { Session["NewsIDInserita"] = int.Parse(idNews); // si tratta di una modifica if ((txtTitoloNews.Text == "") && (txtData.Text == "") && (FCKeditor1.Value == "")) { //sto caricando una news da modificare DataSetVepAdminTableAdapters.NewsTableAdapter taNews = new DataSetVepAdminTableAdapters.NewsTableAdapter(); DataTable dtNews = taNews.GetDataByID(int.Parse(idNews)); News_ID.Text = idNews; txtTitoloNews.Text = dtNews.Rows[0]["Titolo"].ToString(); txtData.Text = dtNews.Rows[0]["Data"].ToString(); //txtAutore.Text = dtNews.Rows[0]["Autore"].ToString(); // txtFonte.Text = dtNews.Rows[0]["Fonte"].ToString(); txtDescrizione.Text = dtNews.Rows[0]["Descrizione"].ToString(); imgFotoArticolo.ImageUrl = "~/" + dtNews.Rows[0]["UrlFotoHome"].ToString(); if ((imgFotoArticolo.ImageUrl != "") && (imgFotoArticolo.ImageUrl != "~/") && (imgFotoArticolo.ImageUrl != "~/img/Foto/standard.jpg")) { lnkCancFoto.Visible = true; imgFotoArticolo.Visible = true; FileUploadFoto.Visible = false; ButtonUploadFoto.Visible = false; } else { imgFotoArticolo.Visible = false; FileUploadFoto.Visible = true; ButtonUploadFoto.Visible = true; } //Fotogallery if (PhotoManager.isNewsLinked(int.Parse(idNews))) { imgCancFotoG.Visible = true; txtFotoGallery.Text = "FotoAlbum associato"; btnFotoAlbum.Text = "MODIFICA FotoAlbum"; btnFotoAlbum.CssClass = "button blue"; } else { imgCancFotoG.Visible = false; txtFotoGallery.Text = "Nessun FotoAlbum associato"; btnFotoAlbum.Text = "ASSOCIA FotoAlbum"; btnFotoAlbum.CssClass = "button green"; } txtNomeFile.Text = dtNews.Rows[0]["Allegati"].ToString().Replace("public/allegati/", ""); if ((txtNomeFile.Text != "Nessun file allegato") && (txtNomeFile.Text != "")) { lnkCancAllegato.Visible = true; FileUploadAllegati.Visible = false; ButtonUploadAllegati.Visible = false; } else { txtNomeFile.Text = "Nessun file allegato"; lnkCancAllegato.Visible = false; FileUploadAllegati.Visible = true; ButtonUploadAllegati.Visible = true; } FCKeditor1.Value = dtNews.Rows[0]["Testo"].ToString(); //uso il campo autore per ved. se visualizzare la news in homepage chkboxPrjHome.Checked = false;// (bool.Parse(dtNews.Rows[0]["Autore"].ToString())); // devo prendermi anche i path degli allegati e delle foto e salvare queste info nel var di sessione Session["UrlFotoHome"] = dtNews.Rows[0]["UrlFotoHome"].ToString(); Session["UrlAllegato"] = dtNews.Rows[0]["Allegati"].ToString(); Session["DataInserimento"] = dtNews.Rows[0]["Data"].ToString(); } ButtonAgg.Visible = true; ButtonInsert.Visible = false; trFotoGallery.Visible = true; } else { if (txtTitoloNews.Text == "") //si tratta del pageload di una nuova news { string allegati = (string)Session["UrlAllegato"]; string PathStdFotoHome = Utility.SearchConfigValue("pathFotoNews") + Utility.SearchConfigValue("standardFotoName"); ButtonAgg.Visible = false; ButtonInsert.Visible = true; Session["UrlFotoHome"] = PathStdFotoHome.Remove(0, 2); imgFotoArticolo.ImageUrl = PathStdFotoHome; previewFoto.HRef = PathStdFotoHome; lnkCancFoto.Visible = false; imgFotoArticolo.Visible = false; FileUploadFoto.Visible = true; ButtonUploadFoto.Visible = true; lnkCancAllegato.Visible = false; } } }