Exemplo n.º 1
0
        private static FeatModifierModel Create(DbDataReader reader)
        {
            FeatModifierModel model;

            model = new FeatModifierModel();
            model.Load(reader);

            return(model);
        }
Exemplo n.º 2
0
        public void Delete()
        {
            QueryInformation query;

            if (this.Id == Guid.Empty)
            {
                Debug.WriteLine("Error: You can delete this record as an actual Database record doesn't exist for it. FeatModel : Delete()");
                return;
            }

            //We need to delete any associated records first before deleting this Feat record
            CharacterBonusFeatModel.DeleteAllbyFeatId(this.Id);
            ClassBonusFeatModel.DeleteAllbyFeatId(this.Id);
            //TODO: DestinySpherePastLifeFeatModel.DeleteAllByFeatId(this.Id);
            FeatFeatTypeModel.DeleteAllByFeatId(this.Id);
            FeatModifierModel.DeleteAllByFeatId(this.Id);
            FeatRequirementModel.DeleteAllByFeatId(this.Id);
            ModifierModel.DeleteAllByFeatId(this.Id);
            RaceBonusFeatModel.DeleteAllByFeatId(this.Id);
            RequirementModel.DeleteAllbyFeatId(this.Id);

            //We need to remove any feat entries in other tables for this Feat
            //Class - PastLifeFeatId
            ClassModel.UpdatePastLifeFeatIdWithNull(this.Id);
            //Feat - ParentFeat
            FeatModel.UpdatedParentFeatWithNull(this.Id);
            //Race - PastLifeFeatId
            RaceModel.UpdatePastLifeFeatIdWithNull(this.Id);



            query = QueryInformation.Create(FeatModel.DeleteQuery);

            query.CommandType = CommandType.Text;
            query.Parameters.Add(new QueryParameter("@" + FeatModel.IdField, DbType.Guid, this.Id));
            BaseModel.RunCommand(query);
            //lets reset the ID to empty so the model knows its a new record in case someone calls the save() method afterwards for some reason
            this.Id = Guid.Empty;
        }