Ejemplo n.º 1
0
        private void ReadDailyWiredUsage(string username, WiredDailyUsage usage, ref bool stop)
        {
            // Mettre à jours les données quotidienne
            if (usage.Day.Date == DateTime.Now.Date)
            {
                Account.Account.CurrentDayUpload = usage.Upload;
                Account.Account.CurrentDayDownload = usage.Download;
            }

            if (DataBaseFactory.Instance.IsAvailable)
            {
                DailyUsageBO dailyUsage = new DailyUsageBO()
                {
                    Day = usage.Day,
                    Download = usage.Download,
                    Month = usage.Month,
                    Total = usage.Total,
                    Upload = usage.Upload,
                    Period = usage.Period
                };

                // Vérifier si le jours existe déjà dans la BD
                DailyUsageBO data;
                if (DailyUsageDAO.Instance.Exist(username, dailyUsage, out data))
                {
                    // Vérifier si les données sont différente
                    if (dailyUsage.Download != data.Download || dailyUsage.Upload != data.Upload || dailyUsage.Total != data.Total)
                        DailyUsageDAO.Instance.Update(username, dailyUsage);
                    else if (!_forceUsageRefresh)
                        stop = true;
                }
                else
                    DailyUsageDAO.Instance.Insert(username, dailyUsage);
            }
        }
Ejemplo n.º 2
0
 protected void DoReadDailyWiredUsage(string username, WiredDailyUsage usage, ref bool stop)
 {
     if (OnReadDailyWiredUsage != null)
         OnReadDailyWiredUsage(username, usage, ref stop);
 }