Beispiel #1
0
 public void SubmitNormalReport(string version, string action, string mac,
     string ip, string os, string hostName)
 {
     // Add report
     var report = new NormalReport
     {
         Version = version,
         Action = action,
         Date = DateTime.Now,
         MAC = mac,
         IP = ip,
         OS = os,
         HostName = hostName
     };
     db.NormalReports.AddObject(report);
     
     // Update statistics
     var statisticsEntry = db.Statistics.FirstOrDefault(s => s.Version == version && s.Type == action);
     if (statisticsEntry != null)
     {
         statisticsEntry.Count++;
     }
     else
     {
         var statistic = new Statistic
         {
             Version = version,
             Type = action,
             Count = 1
         };
         db.Statistics.AddObject(statistic);
     }
     
     // Save changes
     try
     {
         db.SaveChanges();
     }
     catch { }
 }
Beispiel #2
0
        public void SubmitBugReport(string version, string mac,
            string ip, string os, string hostName, string bugStackTrace,
            string bugType, string bugMessage, string bugUserInput, string bugTargetSite,
            string bugSource)
        {
            // Add bug report
            var report = new BugReport
            {
                Version = version,
                Date = DateTime.Now,
                MAC = mac,
                IP = ip,
                OS = os,
                HostName = hostName,
                BugStackTrace = GZipStreamStringHelper.UnZip(bugStackTrace),
                BugType = bugType,
                BugMessage = bugMessage,
                BugUserInput = bugUserInput,
                BugTargetSite = bugTargetSite,
                BugSource = bugSource
            };
            db.BugReports.AddObject(report);

            // Update statistics
            var statisticsEntry = db.Statistics.FirstOrDefault(s => s.Version == version && s.Type == "Bug");
            if (statisticsEntry != null)
            {
                statisticsEntry.Count++;
            }
            else
            {
                var statistic = new Statistic
                {
                    Version = version,
                    Type = "Bug",
                    Count = 1
                };
                db.Statistics.AddObject(statistic);
            }

            // Save changes
            db.SaveChanges();
        }
Beispiel #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Statistics EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToStatistics(Statistic statistic)
 {
     base.AddObject("Statistics", statistic);
 }
Beispiel #4
0
 /// <summary>
 /// Create a new Statistic object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="version">Initial value of the Version property.</param>
 /// <param name="type">Initial value of the Type property.</param>
 /// <param name="count">Initial value of the Count property.</param>
 public static Statistic CreateStatistic(global::System.Int32 id, global::System.String version, global::System.String type, global::System.Int32 count)
 {
     Statistic statistic = new Statistic();
     statistic.Id = id;
     statistic.Version = version;
     statistic.Type = type;
     statistic.Count = count;
     return statistic;
 }