Beispiel #1
0
        public void UploadPhoto(List <SDP> siteDetailFiles)
        {
            if (siteDetailFiles == null)
            {
                return;
            }

            var v = siteDetailFiles.Where(r => r.File != null).ToList().GroupBy(r => r.SiteDetailID);

            if (v.Count() == 0)
            {
                return;
            }

            foreach (var item in v)
            {
                if (item.Count() == 0)
                {
                    continue;
                }

                var siteDetail = Get(item.Key);
                var files      = item.Select(r => r.File);
                var notes      = item.Select(r => r.Note).ToArray();
                var l          = PicasaRepository.I.UploadPhoto2(files, notes);
                if (l != null)
                {
                    for (int i = 0; i < l.Count(); i++)
                    {
                        var entry = l[i];
                        if (entry != null)
                        {
                            SiteDetailPhoto photo = new SiteDetailPhoto();

                            Helper.UpdateIPhoto(files.ElementAt(i), notes[i], entry, photo);

                            siteDetail.SiteDetailPhotoes.Add(photo);

                            Save();

                            string title = string.Format("SDP_{0}_SD_{1}_S_{2}", photo.ID.ToString(), siteDetail.ID.ToString(), siteDetail.SiteID.ToString());

                            PicasaRepository.I.UpdateTitle(photo.AtomUrl, title);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the SiteDetailPhotoes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSiteDetailPhotoes(SiteDetailPhoto siteDetailPhoto)
 {
     base.AddObject("SiteDetailPhotoes", siteDetailPhoto);
 }
 /// <summary>
 /// Create a new SiteDetailPhoto object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 public static SiteDetailPhoto CreateSiteDetailPhoto(global::System.Int32 id)
 {
     SiteDetailPhoto siteDetailPhoto = new SiteDetailPhoto();
     siteDetailPhoto.ID = id;
     return siteDetailPhoto;
 }