public static DataTable AllMyFavsDTP() { commonfunctions cf = new commonfunctions(); return cf.AllmyFavoritesDT(); }
public static string getMyFavIcons(string contentId, string ResourceContentType, string title, string collection = "0", string Url = "", string Date = "", string Author = "") { commonfunctions cf = new commonfunctions(); DataTable AllMyFavsDT = cf.AllmyFavoritesDT(); string ouptput = ""; string notFav = string.Empty; string myFav = string.Empty; title = new string(title.Where(c => !char.IsPunctuation(c)).ToArray()); // ; title.Replace("'", "").Replace(".", ""); DataRow[] foundRows; // Use the Select method to find all rows matching the filter. // foundRows = resourcesDt.Select(filter); string filter = " FavoriteURL='" + contentId + "' and ResourceContentType = '" + ResourceContentType + "' "; foundRows = AllMyFavsDT.Select(filter); string coo = AllMyFavsDT.Rows.Count.ToString(); if (foundRows.Length > 0) { notFav = " style=\"display:none\""; } else { myFav = " style=\"display:none\""; } string ResourceContentTypeU = "\"" + ResourceContentType + "\""; collection = "\"" + collection + "\""; ouptput += " <span id='removeFavDiv" + contentId + "' " + myFav + " > "; string acontentId = "\"" + contentId + "\""; // @""" + contentId + """; ouptput += @" <a style='cursor:pointer' title='Remove " + title + " from My Resources' href='#' onclick='javascript:deleteFavorite(" + acontentId + "," + ResourceContentTypeU + "," + collection + ");return false;' onkeypress='javascript:deleteFavoriteKP(event," + acontentId + "," + ResourceContentTypeU + "," + collection + ");return false;' class='favorite favorite_on' > Remove "; ouptput += "<span class='favorite-id-title'>" + title + "</span> to My Resources</a></span>"; string Url1 = "\"" + Url + "\""; string Date1 = "\"" + Date + "\""; string Author1 = "\"" + Author + "\""; string title1 = "\"" + title + "\""; ouptput += "<span id='addFavDiv" + contentId + "' " + notFav + " >"; ouptput += @" <a style='cursor:pointer' href='#' onclick='javascript:addToFavorite(" + acontentId + "," + ResourceContentTypeU + "," + collection + " , " + title1 + " , " + Url1 + " , " + Date1 + " , " + Author1 + ");return false;' onkeypress='javascript:addToFavoriteKP(event," + acontentId + "," + ResourceContentTypeU + "," + collection + " , " + title1 + " , " + Url1 + " , " + Date1 + " , " + Author1 + ");return false;' class='favorite' title='Add " + title + " to My Resources'> Add "; ouptput += " <span class='favorite-id-title'>" + title + "</span> to My Resources</a>"; ouptput += " </span>"; return ouptput; }