Exemplo n.º 1
0
        internal static void FillDiscoveryLogEntity(
            DiscoveryLogs discoveryLog,
            DiscoveryResultBase result,
            StartImportStatus status)
        {
            DateTime utcNow = DateTime.UtcNow;

            discoveryLog.set_FinishedTimeStamp(utcNow.AddTicks(-(utcNow.Ticks % 10000000L)));
            discoveryLog.set_BatchID(new Guid?(result.get_BatchID()));
            discoveryLog.set_ProfileID(result.get_ProfileID());
            switch (status - 4)
            {
            case 0:
                discoveryLog.set_Result(3);
                discoveryLog.set_ResultDescription(Resources2.get_DiscoveryLogResult_ImportFailed());
                discoveryLog.set_ErrorMessage(Resources2.get_DiscoveryLogError_UnknownError());
                break;

            case 1:
                discoveryLog.set_Result(4);
                discoveryLog.set_ResultDescription(Resources2.get_DiscoveryLogResult_ImportFailedLicenseExceeded());
                break;

            case 2:
                discoveryLog.set_Result(2);
                discoveryLog.set_ResultDescription(Resources2.get_DiscoveryLogResult_ImportFinished());
                break;
            }
        }
        public void FillIncidentInfo(ActiveAlert activeAlert)
        {
            if (activeAlert == null)
            {
                throw new ArgumentNullException(nameof(activeAlert));
            }
            List <AlertIncidentCache.IncidentInfo> source;

            if (!this.incidentInfoByAlertObjectId.TryGetValue(activeAlert.get_Id(), out source) || source.Count == 0)
            {
                return;
            }
            if (source.Count == 1)
            {
                activeAlert.set_IncidentNumber(source[0].Number);
                activeAlert.set_IncidentUrl(source[0].Url);
                activeAlert.set_AssignedTo(source[0].AssignedTo);
            }
            else
            {
                activeAlert.set_IncidentNumber(string.Format((IFormatProvider)CultureInfo.InvariantCulture, Resources2.get_ActiveAlertsGrid_IncidentsClomun_ValueFormat(), (object)source.Count));
                activeAlert.set_IncidentUrl(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "/Orion/View.aspx?NetObject=AAT:{0}", (object)activeAlert.get_Id()));
                List <string> list = source.Select <AlertIncidentCache.IncidentInfo, string>((Func <AlertIncidentCache.IncidentInfo, string>)(i => i.AssignedTo)).Where <string>((Func <string, bool>)(u => !string.IsNullOrEmpty(u))).Distinct <string>().ToList <string>();
                if (list.Count == 1)
                {
                    activeAlert.set_AssignedTo(list.First <string>());
                }
                else
                {
                    activeAlert.set_AssignedTo(Resources2.get_ActiveAlertsGrid_IncidentAssignee_MultiUser());
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Dispose method
 /// </summary>
 /// <param name="disposing"><c>true</c> if called by <see cref="Dispose()"/></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
     {
         return;
     }
     foreach (var resource in Resources2.GetInitializedElements())
     {
         if (resource != null)
         {
             resource.Dispose();
         }
     }
     Resources.Clear();
     if (typeDefFinder != null)
     {
         typeDefFinder.Dispose();
         typeDefFinder = null;
     }
 }
        public static void Show(DiscoveryResultBase result, StartImportStatus status)
        {
            DiscoveryAutoImportNotificationItemDAL notificationItemDal = DiscoveryAutoImportNotificationItemDAL.GetItem();
            string description = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "DiscoveryImportStatus:{0}", (object)status);
            string empty       = string.Empty;
            string title;

            switch (status - 4)
            {
            case 0:
                title = Resources2.get_Notification_DiscoveryAutoImport_Failed();
                break;

            case 1:
                title = Resources2.get_Notification_DiscoveryAutoImport_LicenseExceeded();
                break;

            case 2:
                title = Resources2.get_Notification_DiscoveryAutoImport_Succeeded();
                break;

            default:
                return;
            }
            if (notificationItemDal == null)
            {
                NotificationItemDAL.Insert(DiscoveryAutoImportNotificationItemDAL.DiscoveryAutoImportNotificationItemId, DiscoveryAutoImportNotificationItemDAL.DiscoveryAutoImportNotificationTypeGuid, title, description, false, DiscoveryAutoImportNotificationItemDAL.NetworkSonarDiscoveryURL, new DateTime?(), (string)null);
            }
            else
            {
                notificationItemDal.SetNotAcknowledged();
                notificationItemDal.Title       = title;
                notificationItemDal.Description = description;
                notificationItemDal.Update();
            }
        }