예제 #1
0
        private static EnhancementModel Create(DbDataReader reader)
        {
            EnhancementModel model;

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

            return(model);
        }
예제 #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. EnhancementSlotModel : Delete()");
                return;
            }

            //We need to delete any associated records before deleting this one
            EnhancementModel.DeleteAllByEnhancementSlotId(this.Id);

            //we need to remove any Enhancement entries in other tables for this feat

            query = QueryInformation.Create(EnhancementSlotModel.DeleteQuery);

            query.CommandType = CommandType.Text;
            query.Parameters.Add(new QueryParameter("@" + EnhancementSlotModel.IdField, DbType.Guid, this.Id));
            BaseModel.RunCommand(query);

            //lets rest the id to empty so that the model knows it is now a new record if the save method is called.
            this.Id = Guid.Empty;
        }