Example #1
0
        public Incident(string parentIncidentId, string pageName, string title, DateTime incidentDateTime, 
                        string currentDOM, string originalErrorMessage, string notes,
                        IncidentType incidentType, List<string> relatedIncidents, 
                                bool resolved, bool catalogged, string userSessionGuid, string clientData)
        {
            this.PageName = pageName;
            this.ParentIncidentId = parentIncidentId;
            this.Title = title;
            this.IncidentDateTime = incidentDateTime;
            this.OriginalErrorMessage = originalErrorMessage;
            this.CurrentDOM = currentDOM;
            this.Notes = notes;

            this.IncidentType = incidentType;
            this.RelatedIncidents = RelatedIncidents;
            this.Resolved = resolved;
            this.Catalogged = catalogged;
            this.UserSessionGuid = userSessionGuid;
            this.ClientData = clientData;

            if (this.Title.Length > 0)
            {
                HashTitle();
            }
        }
        /// <summary>
        /// Accept an Incident object, locate a potential parent incident
        /// and related incidents, and save to document storeage 
        /// </summary>
        /// <param name="incident">The new Incident object</param>
        /// <param name="dataController">Document storeage as RavenDataController</param>
        /// <returns>Logged Incident Id as string</returns>
        public string LogIncident(Incident incident, RavenDataController dataController)
        {
            //  When the minimum data is missing catalog this as unserviceable then save
            if (incident.CanIncidentBeLogged() == false)
            {
                incident.Title = "Unspecified error!";
                incident.IncidentDateTime = DateTime.Now;
                incident.Catalogged = false;
                incident.PageName = "No page name!";

                var unspecifiedIncidentType = new IncidentType("Unspecified", DateTime.Now, "Error logging did not capture results",
                                                                        "Gather more data");
                incident.IncidentType = unspecifiedIncidentType;
            }

            //  Has this occurred before?  Associate to parent / primary occurence
            var parentIncident = FindParent(incident.HashedTitle, dataController);
            if (string.IsNullOrEmpty(parentIncident.Id) == false)
            {
                incident.ParentIncidentId = parentIncident.Id;
                incident.RelatedIncidents = parentIncident.RelatedIncidents;
                incident.Resolved = parentIncident.Resolved;
                incident.Catalogged = parentIncident.Catalogged;
            }

            dataController.Save<Incident>(incident);

            return incident.Id;
        }
Example #3
0
        private List<Incident> Create15Incidents()
        {
            var incidents = new List<Incident>();

            //  4 Database IncidentTypes
            var databaseType = new IncidentType("Database", new DateTime(2012, 3, 4), "Database offline", "reboot");

            int i;
            for (i = 0; i <= 3; i++)
            {
                var incident = CreateTransitionError();
                incident.IncidentType = databaseType;
                incidents.Add(incident);
            }

            //  6 Javascript
            var javascriptType = new IncidentType("Javascript", new DateTime(2012, 3, 4), "jQuery not loaded", "review script");

            for (i = 0; i <= 5; i++)
            {
                var incident = CreateTransitionError();
                incident.IncidentType = javascriptType;
                incident.Title = incident.Title + " - " + i.ToString();
                incidents.Add(incident);
            }

            //  2 Null Object Reference
            var nullObjectType = new IncidentType("Null Object Reference", new DateTime(2012, 3, 4), "Not record returned", "check database");

            for (i = 0; i <= 1; i++)
            {
                var incident = CreateTransitionError();
                incident.IncidentType = nullObjectType;
                incident.PageName = incident.PageName + " - " + i.ToString();
                incidents.Add(incident);
            }

            //  3 Page Not Found
            var pageNotFound = new IncidentType("Page Not Found", new DateTime(2012, 3, 4), "404", "check IIS");

            for (i = 0; i <= 2; i++)
            {
                var incident = CreateTransitionError();
                incident.IncidentType = pageNotFound;
                incident.PageName = incident.PageName + " - " + i.ToString() + " " + incident.Title;
                incidents.Add(incident);
            }

            return incidents;
        }
 /// <summary>
 /// When an update is performed against an IncidentType,
 /// propogate changes to all incidents with this type
 /// </summary>
 public void CascadeUpdateForIncidentType(IncidentType incidentType, 
                                                 RavenDataController dataController)
 {
 }
Example #5
0
        public void CreateIncidentTypes()
        {
            var docStore = GetDocStore();
            TruncateIncidentTypes(docStore);

            var dataController = new RavenDataController(docStore);

            var databaseType = new IncidentType("Database", new DateTime(2012, 3, 4), "Database offline", "reboot");
            dataController.Save<IncidentType>(databaseType);

            var javascriptType = new IncidentType("Javascript", new DateTime(2012, 3, 4), "jQuery not loaded", "review script");
            dataController.Save<IncidentType>(javascriptType);

            var nullObjectType = new IncidentType("Null Object Reference", new DateTime(2012, 3, 4), "Not record returned", "check database");
            dataController.Save<IncidentType>(nullObjectType);

            var pageNotFound = new IncidentType("Page Not Found", new DateTime(2012, 3, 4), "404", "check IIS");
            dataController.Save<IncidentType>(pageNotFound);
        }