public static List <Announcement> QueryLatestAnnouncementsForXml(int amount)
        {
            try
            {
                List <Announcement>   anns = new List <Announcement>();
                SP.ListItemCollection coll = DAT.DataQuery.QueryListItems(AnnouncementModel.announcementsSiteUrl, AnnouncementModel.sayfalarListName, string.Format(AnnouncementModel.announcementsCamlQuery, amount));
                if (coll.Count > 0)
                {
                    foreach (SP.ListItem item in coll)
                    {
                        Announcement ann = new Announcement();
                        ann.ID      = Convert.ToInt32(item["ID"]);
                        ann.Created = Convert.ToDateTime(item["Created"]);
                        ann.Title   = item["Title"].ToString();
                        string imgUrl = HLP.GetImageUrlFromImgTag(item["ListImage"].ToString());
                        //string imgFileName = HLP.SaveFileToTempFolder(HLP.GetNetworkCredential(), DAT.DataStatics.saportHostURL+ imgUrl,  System.Web.HttpContext.Current.Session.SessionID);
                        //ann.ListImage = HLP.CreateImgTag(imgFileName);
                        //ann.ListImage = HLP.TransformHtmlString(item["ListImage"].ToString());
                        ann.ListImage = HLP.RemoteImageUrlToBase64Converter(imgUrl, true);
                        anns.Add(ann);
                    }
                }

                return(anns);
            }
            catch (Exception ex)
            {
                EXP.RedirectToErrorPage(ex.Message);
                return(null);
            }
        }
Exemple #2
0
 public static string SaveRemoteImageToTemp(string imageUrl)
 {
     try
     {
         string imageBase64 = HLP.RemoteImageUrlToBase64Converter(imageUrl, false);
         return(imageBase64);
     }
     catch (Exception ex)
     {
         EXP.RedirectToErrorPage(ex.Message);
         return(null);
     }
 }
        public static List <Advert> QueryLatestCategoryAdvertsForXml(int amount, string category)
        {
            try
            {
                List <Advert>         adverts = new List <Advert>();
                SP.ListItemCollection coll    = DAT.DataQuery.QueryListItems(BillBoardModel.advertsSiteUrl, BillBoardModel.sayfalarListName, string.Format(BillBoardModel.categoryAdvertsLimitedCamlQuery, category, amount));
                if (coll.Count > 0)
                {
                    foreach (SP.ListItem item in coll)
                    {
                        Advert adv = new Advert();

                        adv.Category = category;
                        adv.ID       = Convert.ToInt32(item["ID"]);
                        adv.Title    = item["Title"].ToString();
                        string imgUrl = item["DefaultImage"] != null ?  item["DefaultImage"].ToString() : "";

                        if (imgUrl == string.Empty)
                        {
                            adv.DefaultImage = BillBoardModel.defaultImageBase64;
                        }
                        else if (imgUrl.Contains("/tr-tr/ilanpanosu/") && !imgUrl.Contains("x.com"))
                        {
                            adv.DefaultImage = HLP.RemoteImageUrlToBase64Converter(Data.DataStatics.saportHostURL + imgUrl, true);
                        }
                        else if (imgUrl.Contains("x.com"))
                        {
                            adv.DefaultImage = HLP.RemoteImageUrlToBase64Converter(imgUrl, true);
                        }
                        else
                        {
                            adv.DefaultImage = HLP.RemoteImageUrlToBase64Converter(string.Format(BillBoardModel.thumbnailImageRemoteUrl, Convert.ToInt32(item["ID"]), imgUrl), true);
                        }

                        if (adv.DefaultImage.Length == 0 || adv.DefaultImage == null)
                        {
                            adv.DefaultImage = BillBoardModel.defaultImageBase64;
                        }

                        adverts.Add(adv);
                    }
                }

                return(adverts);
            }
            catch (Exception ex)
            {
                EXP.RedirectToErrorPage(ex.Message);
                return(null);
            }
        }
Exemple #4
0
        //public static string GetMobileImageUrl(string imageUrl, string context)
        //{
        //    try
        //    {
        //        imageUrl = bannersListUrl + imageUrl;
        //        imageUrl = "/mobile/" + HLP.SaveFileForMobile(HLP.GetNetworkCredential(), imageUrl, context );
        //        return imageUrl;
        //    }
        //    catch (Exception ex)
        //    {
        //        EXP.RedirectToErrorPage(ex.Message);
        //        return null;
        //    }
        //}

        public static string GetImageUrl(string imageUrl)
        {
            try
            {
                //imageUrl = "/temp/" + HLP.SaveFileToTempFolderForBanners(HLP.GetNetworkCredential(), imageUrl);
                imageUrl = HLP.RemoteImageUrlToBase64Converter(imageUrl, false);
                return(imageUrl);
            }
            catch (Exception ex)
            {
                EXP.RedirectToErrorPage(ex.Message);
                return(null);
            }
        }