Example #1
0
        public PSTutorialFlags(account account, IRepository<character_tutorial> characterTutorials)
            : base(WorldOpcodes.SMSG_TUTORIAL_FLAGS)
        {
            character_tutorial characterTutorial = characterTutorials.SingleOrDefault(ct => ct.account == account.id);

            if (characterTutorial == null)
            {
                characterTutorial = new character_tutorial()
                                        {
                                            account = account.id,
                                            tut0 = 0,
                                            tut1 = 0,
                                            tut2 = 0,
                                            tut3 = 0,
                                            tut4 = 0,
                                            tut5 = 0,
                                            tut6 = 0,
                                            tut7 = 0
                                        };
                characterTutorials.Add(characterTutorial);
            }

            this.Write((byte)characterTutorial.tut0);
            this.Write((byte)characterTutorial.tut1);
            this.Write((byte)characterTutorial.tut2);
            this.Write((byte)characterTutorial.tut3);
            this.Write((byte)characterTutorial.tut4);
            this.Write((byte)characterTutorial.tut5);
            this.Write((byte)characterTutorial.tut6);
            this.Write((byte)characterTutorial.tut7);
        }
 public void Delete(int id)
 {
     DAL.DataEntities.UITemplate template;
     using (_UITemplateRepository = new GenericRepository<DAL.DataEntities.UITemplate>())
     {
         template = _UITemplateRepository.SingleOrDefault(m => m.ID == id);
         _UITemplateRepository.Delete(template);
         _UITemplateRepository.SaveChanges();
     }
 }
 public void Delete(int id)
 {
     DAL.DataEntities.CompositionRule feature;
     using (_CompositionRuleRepository = new GenericRepository<DAL.DataEntities.CompositionRule>())
     {
         feature = _CompositionRuleRepository.SingleOrDefault(m => m.ID == id);
         _CompositionRuleRepository.Delete(feature);
         _CompositionRuleRepository.SaveChanges();
     }
 }
 public void Delete(int id)
 {
     DAL.DataEntities.Configuration DALConfiguration;
     using (_ConfigurationRepository = new GenericRepository<DAL.DataEntities.Configuration>())
     {
         DALConfiguration = _ConfigurationRepository.SingleOrDefault(m => m.ID == id);
         _ConfigurationRepository.Delete(DALConfiguration);
         _ConfigurationRepository.SaveChanges();
     }
 }
 public void Delete(int id)
 {
     DAL.DataEntities.Attribute attribute;
     using (_AttributeRepository = new GenericRepository<DAL.DataEntities.Attribute>())
     {
         attribute = _AttributeRepository.SingleOrDefault(m => m.ID == id);
         _AttributeRepository.Delete(attribute);
         _AttributeRepository.SaveChanges();
     }
 }
 public void Delete(int id)
 {
     DAL.DataEntities.CustomRule customRule;
     using (_CustomRuleRepository = new GenericRepository<DAL.DataEntities.CustomRule>())
     {
         customRule = _CustomRuleRepository.SingleOrDefault(m => m.ID == id);
         _CustomRuleRepository.Delete(customRule);
         _CustomRuleRepository.SaveChanges();
     }
 }
 public void Delete(int id)
 {
     DAL.DataEntities.Model model;
     using (_ModelRepository = new GenericRepository<DAL.DataEntities.Model>())
     {
         model = _ModelRepository.SingleOrDefault(m => m.ID == id);
         _ModelRepository.Delete(model);
         _ModelRepository.SaveChanges();
     }
 }
Example #8
0
 //Methods
 public BLL.BusinessObjects.User GetByEmailAndPassword(string email, string password)
 {
     DAL.DataEntities.User user;
     using (_UserRepository = new GenericRepository<DAL.DataEntities.User>())
     {
         user = _UserRepository.SingleOrDefault(u =>
             u.Email.Equals(email, StringComparison.InvariantCultureIgnoreCase) && u.Password.Equals(password, StringComparison.InvariantCultureIgnoreCase));
     }
     //
     if (user != null)
         return (BLL.BusinessObjects.User)BLL.BusinessObjects.User.CreateInstance(user);
     else
         return null;
 }
 public BusinessObjects.Configuration GetByID(int id)
 {
     BLL.BusinessObjects.Configuration BLLConfiguration;
     using (_ConfigurationRepository = new GenericRepository<DAL.DataEntities.Configuration>())
     {
         DAL.DataEntities.Configuration DALConfiguration = _ConfigurationRepository.SingleOrDefault(m => m.ID == id);
         BLLConfiguration = BLL.BusinessObjects.Configuration.CreateInstance(DALConfiguration);
     }
     //
     return BLLConfiguration;
 }
 public BusinessObjects.Attribute GetByID(int id)
 {
     DAL.DataEntities.Attribute attribute;
     using (_AttributeRepository = new GenericRepository<DAL.DataEntities.Attribute>())
     {
         attribute = _AttributeRepository.SingleOrDefault(m => m.ID == id);
     }
     //
     return new BLL.BusinessObjects.Attribute(attribute);
 }
 public BusinessObjects.CustomRule GetByID(int id)
 {
     DAL.DataEntities.CustomRule customRule;
     using (_CustomRuleRepository = new GenericRepository<DAL.DataEntities.CustomRule>())
     {
         customRule = _CustomRuleRepository.SingleOrDefault(m => m.ID == id);
     }
     //
     return new BLL.BusinessObjects.CustomRule(customRule);
 }
 public void Delete(int id)
 {
     DAL.DataEntities.Relation relation;
     using (_RelationRepository = new GenericRepository<DAL.DataEntities.Relation>())
     {
         relation = _RelationRepository.SingleOrDefault(m => m.ID == id);
         _RelationRepository.Delete(relation);
         _RelationRepository.SaveChanges();
     }
 }
 public BusinessObjects.Relation GetByID(int id)
 {
     DAL.DataEntities.Relation relation;
     using (_RelationRepository = new GenericRepository<DAL.DataEntities.Relation>())
     {
         relation = _RelationRepository.SingleOrDefault(r => r.ID == id);
     }
     //
     return new BLL.BusinessObjects.Relation(relation);
 }
        public void Delete(int id)
        {
            DAL.DataEntities.Feature feature;
            using (_FeatureRepository = new GenericRepository<DAL.DataEntities.Feature>())
            {
                feature = _FeatureRepository.SingleOrDefault(m => m.ID == id);

                //Cascade delete on all related FeatureSelections
                using (_FeatureSelectionRepository = new GenericRepository<DAL.DataEntities.FeatureSelection>())
                {
                    IEnumerable<DAL.DataEntities.FeatureSelection> featureSelections = _FeatureSelectionRepository.Find(k => k.FeatureID == feature.ID);
                    foreach (DAL.DataEntities.FeatureSelection featureSelection in featureSelections)
                    {
                        _FeatureSelectionRepository.Delete(featureSelection);
                    }

                    _FeatureSelectionRepository.SaveChanges();
                }

                //
                _FeatureRepository.Delete(feature);
                _FeatureRepository.SaveChanges();
            }
        }
 public void Delete(int id)
 {
     DAL.DataEntities.FeatureSelection feature;
     using (_FeatureSelectionRepository = new GenericRepository<DAL.DataEntities.FeatureSelection>())
     {
         feature = _FeatureSelectionRepository.SingleOrDefault(m => m.ID == id);
         _FeatureSelectionRepository.Delete(feature);
         _FeatureSelectionRepository.SaveChanges();
     }
 }
 public void Delete(int id)
 {
     //Delete GroupRelation
     DAL.DataEntities.GroupRelation groupRelation;
     using (_GroupRelationRepository = new GenericRepository<DAL.DataEntities.GroupRelation>())
     {
         groupRelation = _GroupRelationRepository.SingleOrDefault(m => m.ID == id);
         _GroupRelationRepository.Delete(groupRelation);
         _GroupRelationRepository.SaveChanges();
     }
 }
        public void UpdateName(int configurationID, string newName)
        {
            using (_ConfigurationRepository = new GenericRepository<DAL.DataEntities.Configuration>())
            {
                DAL.DataEntities.Configuration model = _ConfigurationRepository.SingleOrDefault(m => m.ID == configurationID);
                model.LastModifiedDate = DateTime.Now;
                model.Name = newName;

                _ConfigurationRepository.SaveChanges();
            }
        }
Example #18
0
 public BLL.BusinessObjects.User GetByID(int id)
 {
     DAL.DataEntities.User user;
     using (_UserRepository = new GenericRepository<DAL.DataEntities.User>())
     {
         user = _UserRepository.SingleOrDefault(u => u.ID == id);
     }
     //
     return new BLL.BusinessObjects.User(user);
 }
 public BLL.BusinessObjects.UITemplate GetByID(int id)
 {
     DAL.DataEntities.UITemplate uiTemplate;
     using (_UITemplateRepository = new GenericRepository<DAL.DataEntities.UITemplate>())
     {
         uiTemplate = _UITemplateRepository.SingleOrDefault(u => u.ID == id);
     }
     //
     return new BLL.BusinessObjects.UITemplate(uiTemplate);
 }
Example #20
0
        public void UpdateName(int modelID, string newName)
        {
            using (_ModelRepository = new GenericRepository<DAL.DataEntities.Model>())
            {
                DAL.DataEntities.Model model = _ModelRepository.SingleOrDefault(m => m.ID == modelID);
                model.LastModifiedDate = DateTime.Now;
                model.Name = newName;

                //_ModelRepository.Attach(model);
                _ModelRepository.SaveChanges();
            }
        }
 public BusinessObjects.Feature GetByID(int id)
 {
     DAL.DataEntities.Feature feature;
     using (_FeatureRepository = new GenericRepository<DAL.DataEntities.Feature>())
     {
         feature = _FeatureRepository.SingleOrDefault(m => m.ID == id);
     }
     //
     return new BLL.BusinessObjects.Feature(feature);
 }
Example #22
0
 public BusinessObjects.Model GetByID(int id)
 {
     BLL.BusinessObjects.Model BLLmodel;
     using (_ModelRepository = new GenericRepository<DAL.DataEntities.Model>())
     {
         DAL.DataEntities.Model DALmodel = _ModelRepository.SingleOrDefault(m => m.ID == id);
         BLLmodel = BLL.BusinessObjects.Model.CreateInstance(DALmodel);
     }
     //
     return BLLmodel;
 }
        public DocumentContext(int id, IRepository repository)
        {
            _repository = repository;

            _commentDocument = repository.SingleOrDefault<CommentDocument>(p => p.Id == id);
        }