public InspectionDeficiency Copy()
        {
            InspectionDeficiency copiedInspectionDeficiency = new InspectionDeficiency();

            foreach (decimal action in this.ActionsTaken)
            {
                copiedInspectionDeficiency.ActionsTaken.Add(action);
            }

            foreach (decimal observation in this.Observations)
            {
                copiedInspectionDeficiency.Observations.Add(observation);
            }
            copiedInspectionDeficiency.ActionHistory             = this.ActionHistory;
            copiedInspectionDeficiency.ARClosedDate              = this.ARClosedDate;
            copiedInspectionDeficiency.ClosedByUser              = this.ClosedByUser;
            copiedInspectionDeficiency.Comments                  = this.Comments;
            copiedInspectionDeficiency.ComplianceDueDate         = this.ComplianceDueDate;
            copiedInspectionDeficiency.DateCompleted             = this.DateCompleted;
            copiedInspectionDeficiency.DateDeficiencyCreated     = this.DateDeficiencyCreated;
            copiedInspectionDeficiency.DeficiencyCD              = this.DeficiencyCD;
            copiedInspectionDeficiency.ExtendedComplianceDueDate = this.ExtendedComplianceDueDate;
            copiedInspectionDeficiency.HasChanged                = false;
            copiedInspectionDeficiency.InspectionID              = this.InspectionID;
            copiedInspectionDeficiency.IsNew                = this.IsNew;
            copiedInspectionDeficiency.ItemNo               = this.ItemNo;
            copiedInspectionDeficiency.ROClosedDate         = this.ROClosedDate;
            copiedInspectionDeficiency.SelectedDeficiencyCD = this.SelectedDeficiencyCD;
            copiedInspectionDeficiency.SuggestedReference   = this.SuggestedReference;
            copiedInspectionDeficiency.Reference            = this.Reference;
            return(copiedInspectionDeficiency);
        }
        public bool HasChangedCheck(InspectionDeficiency copiedInspectionDeficiency)
        {
            bool hasChanged = false;

            if (IsNew)
            {
                HasChanged = true;
                return(HasChanged);
            }
            if (copiedInspectionDeficiency == null)
            {
                HasChanged = false;
                return(HasChanged);
            }

            if (ActionsTaken.Count == copiedInspectionDeficiency.ActionsTaken.Count)
            {
                foreach (decimal action in this.ActionsTaken)
                {
                    var found = copiedInspectionDeficiency.ActionsTaken.FirstOrDefault(i => i == action);
                    if (found == 0)
                    {
                        hasChanged = true;
                    }
                }
            }
            else
            {
                hasChanged = true;
            }

            if (Observations.Count == copiedInspectionDeficiency.Observations.Count)
            {
                foreach (decimal observation in this.Observations)
                {
                    var found = copiedInspectionDeficiency.Observations.FirstOrDefault(i => i == observation);
                    if (found == 0)
                    {
                        hasChanged = true;
                    }
                }
            }
            else
            {
                hasChanged = true;
            }

            if (
                copiedInspectionDeficiency.ActionHistory != this.ActionHistory ||
                copiedInspectionDeficiency.ARClosedDate != this.ARClosedDate ||
                copiedInspectionDeficiency.ClosedByUser != this.ClosedByUser ||
                copiedInspectionDeficiency.Comments != this.Comments ||
                copiedInspectionDeficiency.ComplianceDueDate != this.ComplianceDueDate ||
                copiedInspectionDeficiency.DateCompleted != this.DateCompleted ||
                copiedInspectionDeficiency.DateDeficiencyCreated != this.DateDeficiencyCreated ||
                copiedInspectionDeficiency.DeficiencyCD != this.DeficiencyCD ||
                copiedInspectionDeficiency.ExtendedComplianceDueDate != this.ExtendedComplianceDueDate ||
                copiedInspectionDeficiency.InspectionID != this.InspectionID ||
                copiedInspectionDeficiency.IsNew != this.IsNew ||
                copiedInspectionDeficiency.ItemNo != this.ItemNo ||
                copiedInspectionDeficiency.Reference != this.Reference ||
                copiedInspectionDeficiency.ROClosedDate != this.ROClosedDate ||
                copiedInspectionDeficiency.SelectedDeficiencyCD != this.SelectedDeficiencyCD ||
                copiedInspectionDeficiency.SuggestedReference != this.SuggestedReference
                )
            {
                hasChanged = true;
            }

            HasChanged = hasChanged;
            return(hasChanged);
        }