Пример #1
0
 public void BindDownloadInfo(Release rel)
 {
     foreach (string plat in rel.PlatformsList)
     {
         // Make sure there is at least one ReleasePackage register for this platform
         string         fid = rel.GetReleasePackageId(plat);
         ReleasePackage rp  = db.SelectObjectWhere <ReleasePackage> ("FileId={0}", fid);
         if (rp == null)
         {
             rp                  = new ReleasePackage();
             rp.ReleaseId        = rel.Id;
             rp.FileId           = fid;
             rp.Date             = DateTime.Now;
             rp.TargetAppVersion = rel.TargetAppVersion;
             rp.Platform         = plat;
             rp.Downloads        = 0;
             db.InsertObject(rp);
         }
     }
 }
Пример #2
0
 public void IncDownloadCount(string file)
 {
     try {
         ReleasePackage rp = null;
         do
         {
             rp = db.SelectObjectWhere <ReleasePackage> ("FileId={0} AND Date={1}", file, DateTime.Now.Date);
             if (rp == null)
             {
                 rp = db.SelectObject <ReleasePackage> ("SELECT * FROM ReleasePackage WHERE FileId={0} ORDER BY Date DESC", file);
                 if (rp != null)
                 {
                     rp.Downloads = 1;
                     rp.Date      = DateTime.Now;
                     db.InsertObject(rp);
                 }
                 return;
             }
             rp.Downloads++;
         } while (!db.UpdateObject(rp));
     } catch (Exception ex) {
         Console.WriteLine(ex);
     }
 }
Пример #3
0
 public void BindDownloadInfo(Release rel)
 {
     foreach (string plat in rel.PlatformsList) {
         // Make sure there is at least one ReleasePackage register for this platform
         string fid = rel.GetReleasePackageId (plat);
         ReleasePackage rp = db.SelectObjectWhere<ReleasePackage> ("FileId={0}", fid);
         if (rp == null) {
             rp = new ReleasePackage ();
             rp.ReleaseId = rel.Id;
             rp.FileId = fid;
             rp.Date = DateTime.Now;
             rp.TargetAppVersion = rel.TargetAppVersion;
             rp.Platform = plat;
             rp.Downloads = 0;
             db.InsertObject (rp);
         }
     }
 }
Пример #4
0
 public void BindDownloadInfo(Release rel)
 {
     foreach (string plat in rel.PlatformsList) {
         string fid = rel.GetReleasePackageId (plat);
         ReleasePackage rp = db.SelectObjectWhere<ReleasePackage> ("FileId={0}", fid);
         if (rp != null) {
             rp.ReleaseId = rel.Id;
             db.UpdateObject (rp);
         } else {
             rp = new ReleasePackage ();
             rp.ReleaseId = rel.Id;
             rp.FileId = fid;
             rp.TargetAppVersion = rel.TargetAppVersion;
             rp.Platform = plat;
             rp.Downloads = 0;
             db.InsertObject (rp);
         }
     }
 }