示例#1
0
        /// <summary>
        /// Gets the buglist in application datatype (without any references).
        /// </summary>
        /// <returns>Buglist (Application Datatype)</returns>
        public List <Application.BuglistView.Buglist> GetApplicationBuglist()
        {
            List <EntityFramework.Buglist>         buglistDatabase = this.GetEntityFrameworkBuglist();
            List <Application.BuglistView.Buglist> buglist         = new List <Application.BuglistView.Buglist>();

            Application.BuglistView.Buglist emptyBuglist;

            foreach (var buglistItemDatabase in buglistDatabase)
            {
                emptyBuglist = new Application.BuglistView.Buglist()
                {
                    Id = default(int), FailureType = default(string), StatusType = default(string), ControllerType = default(string), HardwareIdentificationLevel1 = default(string),
                    HardwareIdentificationLevel2 = default(string), Bug = default(string), Comment = default(string), Priority = default(string), DateFound = default(DateTime), DateFixed = default(DateTime)
                };
                emptyBuglist.Id             = buglistItemDatabase.Id;
                emptyBuglist.FailureType    = this.GetFailureType((int)buglistItemDatabase.FailureType_Id);
                emptyBuglist.StatusType     = this.GetStatusType((int)buglistItemDatabase.StatusType_Id);
                emptyBuglist.ControllerType = this.GetControllerTyp((int)buglistItemDatabase.ControllerType_Id);
                emptyBuglist.HardwareIdentificationLevel1 = this.GetHardwareIdentificationLevel1((int)buglistItemDatabase.HardwareIdentificationLevel1_Id);
                emptyBuglist.HardwareIdentificationLevel2 = this.GetHardwareIdentificationLevel2((int)buglistItemDatabase.HardwareIdentificationLevel2_Id);
                emptyBuglist.Bug       = buglistItemDatabase.Bug;
                emptyBuglist.Comment   = buglistItemDatabase.Comment;
                emptyBuglist.Priority  = this.GetPriority((int)buglistItemDatabase.Priority_Id);
                emptyBuglist.DateFound = buglistItemDatabase.DateFound;
                emptyBuglist.DateFixed = buglistItemDatabase.DateFixed;

                buglist.Add(emptyBuglist);
            }

            return(buglist);
        }
示例#2
0
        /// <summary>
        /// Adds a buglist item in the database.
        /// </summary>
        /// <param name="buglistItem">The buglist item.</param>
        public void AddBuglistItem(Application.BuglistView.Buglist buglistItem)
        {
            EntityFramework.Buglist buglistDatabase = new Buglist();
            buglistDatabase.Id                = buglistItem.Id;
            buglistDatabase.FailureType_Id    = this.GetFailureTypId(buglistItem.FailureType);
            buglistDatabase.StatusType_Id     = this.GetStatusTypeId(buglistItem.StatusType);
            buglistDatabase.ControllerType_Id = this.GetControllerTypId(buglistItem.ControllerType);
            buglistDatabase.HardwareIdentificationLevel1_Id = this.GetHardwareIdentificationLevel1Id(buglistItem.HardwareIdentificationLevel1);
            buglistDatabase.HardwareIdentificationLevel2_Id = this.GetHardwareIdentificationLevel2Id(buglistItem.HardwareIdentificationLevel2);
            buglistDatabase.Bug         = buglistItem.Bug;
            buglistDatabase.Comment     = buglistItem.Comment;
            buglistDatabase.Priority_Id = this.GetPriorityId(buglistItem.Priority);
            buglistDatabase.DateFound   = buglistItem.DateFound;
            buglistDatabase.DateFixed   = buglistItem.DateFixed;

            databaseContext.Buglist.Add(buglistDatabase);
            databaseContext.SaveChanges();
        }
示例#3
0
        /// <summary>
        /// Updates the buglist item in database.
        /// </summary>
        /// <param name="buglistItem">The buglist item.</param>
        public void UpdateBuglistItemInDatabase(Application.BuglistView.Buglist buglistItem)
        {
            Buglist buglistItemToUpdate = databaseContext.Buglist.Where(x => x.Id == buglistItem.Id).FirstOrDefault();

            if (buglistItemToUpdate != null)
            {
                buglistItemToUpdate.FailureType_Id    = this.GetFailureTypId(buglistItem.FailureType);
                buglistItemToUpdate.StatusType_Id     = this.GetStatusTypeId(buglistItem.StatusType);
                buglistItemToUpdate.ControllerType_Id = this.GetControllerTypId(buglistItem.ControllerType);
                buglistItemToUpdate.HardwareIdentificationLevel1_Id = this.GetHardwareIdentificationLevel1Id(buglistItem.HardwareIdentificationLevel1);
                buglistItemToUpdate.HardwareIdentificationLevel2_Id = this.GetHardwareIdentificationLevel2Id(buglistItem.HardwareIdentificationLevel2);
                buglistItemToUpdate.Bug         = buglistItem.Bug;
                buglistItemToUpdate.Comment     = buglistItem.Comment;
                buglistItemToUpdate.Priority_Id = this.GetPriorityId(buglistItem.Priority);
                buglistItemToUpdate.DateFound   = buglistItem.DateFound;
                buglistItemToUpdate.DateFixed   = buglistItem.DateFixed;
            }

            databaseContext.SaveChanges();
        }
示例#4
0
        /// <summary>
        /// Gets the application buglist item. (based on the bug and date found information)
        /// </summary>
        /// <param name="bug">The bug.</param>
        /// <param name="dateFound">The date found.</param>
        /// <returns>Buglist item which has the same Bug description and date found entry</returns>
        public Application.BuglistView.Buglist GetApplicationBuglistItem(string bug)
        {
            Application.BuglistView.Buglist emptyBuglist;
            EntityFramework.Buglist         buglistItemDatabase = databaseContext.Buglist.Where(x => x.Bug == bug).FirstOrDefault();

            emptyBuglist = new Application.BuglistView.Buglist()
            {
                Id = default(int), FailureType = default(string), StatusType = default(string), ControllerType = default(string), HardwareIdentificationLevel1 = default(string),
                HardwareIdentificationLevel2 = default(string), Bug = default(string), Comment = default(string), Priority = default(string), DateFound = default(DateTime), DateFixed = default(DateTime)
            };
            emptyBuglist.Id             = buglistItemDatabase.Id;
            emptyBuglist.FailureType    = this.GetFailureType((int)buglistItemDatabase.FailureType_Id);
            emptyBuglist.StatusType     = this.GetStatusType((int)buglistItemDatabase.StatusType_Id);
            emptyBuglist.ControllerType = this.GetControllerTyp((int)buglistItemDatabase.ControllerType_Id);
            emptyBuglist.HardwareIdentificationLevel1 = this.GetHardwareIdentificationLevel1((int)buglistItemDatabase.HardwareIdentificationLevel1_Id);
            emptyBuglist.HardwareIdentificationLevel2 = this.GetHardwareIdentificationLevel2((int)buglistItemDatabase.HardwareIdentificationLevel2_Id);
            emptyBuglist.DateFound = buglistItemDatabase.DateFound;
            emptyBuglist.DateFixed = buglistItemDatabase.DateFixed;
            emptyBuglist.Bug       = buglistItemDatabase.Bug;
            emptyBuglist.Comment   = buglistItemDatabase.Comment;
            emptyBuglist.Priority  = this.GetPriority((int)buglistItemDatabase.Priority_Id);

            return(emptyBuglist);
        }