Ejemplo n.º 1
0
        private bool HasDataChanged()
        {
            if (NewRecord == true)
            {
                return(true);
            }

            if (RecordChanged == true)
            {
                return(true);
            }

            if (FeatRequirementsRP2.HaveRecordsChanged() == true)
            {
                return(true);
            }

            if (MP2Modifiers.HaveRecordsChanged() == true)
            {
                return(true);
            }

            //no data has changed, so return false
            return(false);
        }
Ejemplo n.º 2
0
        private void SaveRecord()
        {
            if (NewRecord == true || RecordChanged == true)
            {
                Model.Save();
            }

            //lets update the feattypes that need updating
            foreach (FeatTypeSelection selection in FeatTypesSelected)
            {
                //See if we need to delete a record
                if (selection.DeleteRecord == true && selection.Model.Id != Guid.Empty)
                {
                    selection.Model.Delete();
                }
                //see if we need to add a record
                if (selection.DeleteRecord == false && selection.Model.Id == Guid.Empty)
                {
                    selection.Model.FeatId = Model.Id;
                    selection.Model.Save();
                }
            }

            //lets update the Feat Targets that need updating
            foreach (FeatTargetSelection selection in FeatTargetsSelected)
            {
                //see if we need to delete a record
                if (selection.DeleteRecord == true && selection.Model.Id != Guid.Empty)
                {
                    selection.Model.Delete();
                }

                //see if we need to add a record
                if (selection.DeleteRecord == false && selection.Model.Id == Guid.Empty)
                {
                    selection.Model.FeatId = Model.Id;
                    selection.Model.Save();
                }
            }

            //See if we need save records for Requirements Panels
            if (NewRecord == true)
            {
                FeatRequirementsRP2.RecordId = Model.Id;
            }
            if (FeatRequirementsRP2.HaveRecordsChanged() == true)
            {
                FeatRequirementsRP2.SaveRecords();
            }

            //See if we need to save records for the Modifiers panel
            if (NewRecord == true)
            {
                MP2Modifiers.RecordId = Model.Id;
            }
            if (MP2Modifiers.HaveRecordsChanged() == true)
            {
                MP2Modifiers.SaveRecords();
            }

            //cache the name strings for later comparison since we have updated the database
            DatabaseName = Model.Name;
        }