Ejemplo n.º 1
0
 // Token: 0x060002D4 RID: 724 RVA: 0x000118B4 File Offset: 0x0000FAB4
 internal static void CheckLicenseSaturation()
 {
     try
     {
         LicenseSaturationHelper.Log.Debug("Checking license saturation");
         List <ModuleLicenseSaturationInfo> modulesSaturationInfo = LicenseSaturationLogic.GetModulesSaturationInfo(new int?(LicenseSaturationHelper.SaturationLimit));
         if (modulesSaturationInfo.Count == 0)
         {
             LicenseSaturationHelper.Log.DebugFormat("All modules below {0}% of their license", LicenseSaturationHelper.SaturationLimit);
             LicenseSaturationNotificationItemDAL.Hide();
             LicensePreSaturationNotificationItemDAL.Hide();
         }
         else
         {
             List <ModuleLicenseSaturationInfo> list = (from q in modulesSaturationInfo
                                                        where q.ElementList.Any((ElementLicenseSaturationInfo l) => l.Saturation > 99.0)
                                                        select q).ToList <ModuleLicenseSaturationInfo>();
             List <ModuleLicenseSaturationInfo> list2 = (from q in modulesSaturationInfo
                                                         where q.ElementList.Any((ElementLicenseSaturationInfo l) => l.Saturation > (double)LicenseSaturationHelper.SaturationLimit && l.Saturation < 100.0)
                                                         select q).ToList <ModuleLicenseSaturationInfo>();
             List <ElementLicenseSaturationInfo> overUsedElements = new List <ElementLicenseSaturationInfo>();
             list.ForEach(delegate(ModuleLicenseSaturationInfo l)
             {
                 overUsedElements.AddRange(l.ElementList.ToArray());
             });
             if (LicenseSaturationHelper.Log.IsInfoEnabled)
             {
                 LicenseSaturationHelper.Log.InfoFormat("These elements are at 100% of their license: {0}", string.Join(";", from q in overUsedElements
                                                                                                                        select q.ElementType));
             }
             LicenseSaturationNotificationItemDAL.Show(from q in overUsedElements
                                                       select q.ElementType);
             List <ElementLicenseSaturationInfo> warningElements = new List <ElementLicenseSaturationInfo>();
             list2.ForEach(delegate(ModuleLicenseSaturationInfo l)
             {
                 warningElements.AddRange(l.ElementList.ToArray());
             });
             if (LicenseSaturationHelper.Log.IsInfoEnabled)
             {
                 LicenseSaturationHelper.Log.InfoFormat("These elements are above {0}% of their license: {1}", LicenseSaturationHelper.SaturationLimit, string.Join(";", from q in warningElements
                                                                                                                                                                    select q.ElementType));
             }
             LicensePreSaturationNotificationItemDAL.Show();
         }
     }
     catch (Exception ex)
     {
         LicenseSaturationHelper.Log.Error("Exception running CheckLicenseSaturation:", ex);
     }
 }
 internal static void CheckLicenseSaturation()
 {
     try
     {
         LicenseSaturationHelper.Log.Debug((object)"Checking license saturation");
         List <ModuleLicenseSaturationInfo> modulesSaturationInfo = LicenseSaturationLogic.GetModulesSaturationInfo(new int?(LicenseSaturationHelper.SaturationLimit));
         if (modulesSaturationInfo.Count == 0)
         {
             LicenseSaturationHelper.Log.DebugFormat("All modules below {0}% of their license", (object)LicenseSaturationHelper.SaturationLimit);
             LicenseSaturationNotificationItemDAL.Hide();
             LicensePreSaturationNotificationItemDAL.Hide();
         }
         else
         {
             List <ModuleLicenseSaturationInfo>  list1            = ((IEnumerable <ModuleLicenseSaturationInfo>)modulesSaturationInfo).Where <ModuleLicenseSaturationInfo>((Func <ModuleLicenseSaturationInfo, bool>)(q => ((IEnumerable <ElementLicenseSaturationInfo>)q.get_ElementList()).Any <ElementLicenseSaturationInfo>((Func <ElementLicenseSaturationInfo, bool>)(l => l.get_Saturation() > 99.0)))).ToList <ModuleLicenseSaturationInfo>();
             List <ModuleLicenseSaturationInfo>  list2            = ((IEnumerable <ModuleLicenseSaturationInfo>)modulesSaturationInfo).Where <ModuleLicenseSaturationInfo>((Func <ModuleLicenseSaturationInfo, bool>)(q => ((IEnumerable <ElementLicenseSaturationInfo>)q.get_ElementList()).Any <ElementLicenseSaturationInfo>((Func <ElementLicenseSaturationInfo, bool>)(l => l.get_Saturation() > (double)LicenseSaturationHelper.SaturationLimit && l.get_Saturation() < 100.0)))).ToList <ModuleLicenseSaturationInfo>();
             List <ElementLicenseSaturationInfo> overUsedElements = new List <ElementLicenseSaturationInfo>();
             list1.ForEach((Action <ModuleLicenseSaturationInfo>)(l => overUsedElements.AddRange((IEnumerable <ElementLicenseSaturationInfo>)l.get_ElementList().ToArray())));
             if (LicenseSaturationHelper.Log.get_IsInfoEnabled())
             {
                 LicenseSaturationHelper.Log.InfoFormat("These elements are at 100% of their license: {0}", (object)string.Join(";", ((IEnumerable <ElementLicenseSaturationInfo>)overUsedElements).Select <ElementLicenseSaturationInfo, string>((Func <ElementLicenseSaturationInfo, string>)(q => q.get_ElementType()))));
             }
             LicenseSaturationNotificationItemDAL.Show(((IEnumerable <ElementLicenseSaturationInfo>)overUsedElements).Select <ElementLicenseSaturationInfo, string>((Func <ElementLicenseSaturationInfo, string>)(q => q.get_ElementType())));
             List <ElementLicenseSaturationInfo>  warningElements = new List <ElementLicenseSaturationInfo>();
             Action <ModuleLicenseSaturationInfo> action          = (Action <ModuleLicenseSaturationInfo>)(l => warningElements.AddRange((IEnumerable <ElementLicenseSaturationInfo>)l.get_ElementList().ToArray()));
             list2.ForEach(action);
             if (LicenseSaturationHelper.Log.get_IsInfoEnabled())
             {
                 LicenseSaturationHelper.Log.InfoFormat("These elements are above {0}% of their license: {1}", (object)LicenseSaturationHelper.SaturationLimit, (object)string.Join(";", ((IEnumerable <ElementLicenseSaturationInfo>)warningElements).Select <ElementLicenseSaturationInfo, string>((Func <ElementLicenseSaturationInfo, string>)(q => q.get_ElementType()))));
             }
             LicensePreSaturationNotificationItemDAL.Show();
         }
     }
     catch (Exception ex)
     {
         LicenseSaturationHelper.Log.Error((object)"Exception running CheckLicenseSaturation:", ex);
     }
 }