コード例 #1
0
        public static void Seed(IRepository<Hub> hubRepository, IRepository<Channel> channelRepository, IRepository<ChatMessage> messageRepository)
        {
            hubRepository.Insert(new Hub("scottlogic", "Scott Logic", new List<Channel>()));

            channelRepository.Insert(new Channel("bristol", "scottlogic", "Bristol", DateTime.Now));
            channelRepository.Insert(new Channel("edinburgh", "scottlogic", "Edinburgh", DateTime.Now));
            channelRepository.Insert(new Channel("newcastle", "scottlogic", "Newcastle", DateTime.Now));

            messageRepository.Insert(new ChatMessage("nico", "bristol", "Bristol message", DateTime.Now));
            messageRepository.Insert(new ChatMessage("nico", "edinburgh", "Edinburgh message", DateTime.Now));
            messageRepository.Insert(new ChatMessage("nico", "newcastle", "Newcastle message", DateTime.Now));
        }
コード例 #2
0
        public MemoryRepositorySimpleTests()
        {
            _database = new MemoryDatabase();
            var databaseProvider = Substitute.For<IMemoryDatabaseProvider>();
            databaseProvider.Database.Returns(_database);

            _repository = new MemoryRepository<TestEntity>(databaseProvider);

            // Testing Insert by creating initial data
            _repository.Insert(new TestEntity("test1"));
            _repository.Insert(new TestEntity("test2"));
            _database.Set<TestEntity>().Count.ShouldBe(2);
        }
コード例 #3
0
        public MemoryRepository_Simple_Tests()
        {
            _database = new MemoryDatabase();

            var databaseProvider = Substitute.For<IMemoryDatabaseProvider<int, long>>();
            databaseProvider.Database.Returns(_database);

            _repository = new MemoryRepository<MyEntity, int, long>(databaseProvider);

            //Testing Insert by creating initial data
            _repository.Insert(new MyEntity("test-1"));
            _repository.Insert(new MyEntity("test-2"));
            _database.Set<MyEntity>().Count.ShouldBe(2);
        }
コード例 #4
0
        public static async Task Seed(IRepository<Hub> hubRepository, IRepository<Channel> channelRepository, IRepository<ChatMessage> messageRepository)
        {
            var bristol = new Channel("bristol", "scottlogic", "Bristol", DateTime.Now);
            var edinburgh = new Channel("edinburgh", "scottlogic", "Edinburgh", DateTime.Now);
            var newcastle = new Channel("newcastle", "scottlogic", "Newcastle", DateTime.Now);

            await channelRepository.Insert(bristol);
            await channelRepository.Insert(edinburgh);
            await channelRepository.Insert(newcastle);

            var scottlogic = new Hub("scottlogic", "Scott Logic", new List<Channel>() {
                bristol,
                edinburgh,
                newcastle
            });
            
            await hubRepository.Insert(scottlogic);
        }
コード例 #5
0
 public void AddDepartment(Department d)
 {
     _departmentRepository.Insert(d);
 }
コード例 #6
0
        private static bool AddOrUpdateSetting(IRepository<SettingData> repository, SettingKey key, IProxyType<string> value)
        {
            SettingData setting = repository.Query.FirstOrDefault(_ => _.Identifier == key.Identifier && _.Name == key.Name);

            if (setting == null)
            {
                setting = new SettingData();
                setting.Identifier = key.Identifier;
                setting.Name = key.Name;

                repository.Insert(setting);
            }

            string valueToPersist = value.ProxiedValue;
            if (!string.Equals(setting.Value, valueToPersist, StringComparison.Ordinal))
            {
                setting.Value = valueToPersist;

                return true;
            }

            return false;
        }
コード例 #7
0
 public void Insert(PolicyHolder model)
 {
     _PolicyHolderRepository.Insert(model);
     _datacontext.SaveChanges();
 }
コード例 #8
0
        public void InsertCategory(string name, decimal price)
        {
            Category ctgry = new Category(name, price);

            _repository.Insert(ctgry, list);
        }
コード例 #9
0
        public void TestInitialize()
        {
            _securitySettings = new SecuritySettings
            {
                EncryptionKey = "273ece6f97dd844d97dd8f4d"
            };
            _rewardPointsSettings = new RewardPointsSettings
            {
                Enabled = false,
            };

            _encryptionService = new EncryptionService(_securitySettings);

            var customer1 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Hashed,
                Active         = true
            };

            string saltKey  = _encryptionService.CreateSaltKey(5);
            string password = _encryptionService.CreatePasswordHash("password", saltKey);

            customer1.PasswordSalt = saltKey;
            customer1.Password     = password;
            AddCustomerToRegisteredRole(customer1);

            var customer2 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer2);

            var customer3 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                Active         = true
            };

            AddCustomerToRegisteredRole(customer3);

            var customer4 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer4);

            var customer5 = new Customer
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            //trying to recreate

            var eventPublisher = new Mock <IMediator>();

            //eventPublisher.Setup(x => x.PublishAsync(new object()));
            _eventPublisher = eventPublisher.Object;

            _storeService = new Mock <IStoreService>().Object;

            _customerRepo = new Grand.Services.Tests.MongoDBRepositoryTest <Customer>();
            _customerRepo.Insert(customer1);
            _customerRepo.Insert(customer2);
            _customerRepo.Insert(customer3);
            _customerRepo.Insert(customer4);
            _customerRepo.Insert(customer5);

            _customerRoleRepo         = new Mock <IRepository <CustomerRole> >().Object;
            _orderRepo                = new Mock <IRepository <Order> >().Object;
            _forumPostRepo            = new Mock <IRepository <ForumPost> >().Object;
            _forumTopicRepo           = new Mock <IRepository <ForumTopic> >().Object;
            _customerProductPriceRepo = new Mock <IRepository <CustomerProductPrice> >().Object;
            _customerProductRepo      = new Mock <IRepository <CustomerProduct> >().Object;
            _customerHistoryRepo      = new Mock <IRepository <CustomerHistoryPassword> >().Object;
            _customerNoteRepo         = new Mock <IRepository <CustomerNote> >().Object;

            _genericAttributeService       = new Mock <IGenericAttributeService>().Object;
            _newsLetterSubscriptionService = new Mock <INewsLetterSubscriptionService>().Object;
            _localizationService           = new Mock <ILocalizationService>().Object;
            _rewardPointsService           = new Mock <IRewardPointsService>().Object;
            _customerRoleProductRepo       = new Mock <IRepository <CustomerRoleProduct> >().Object;
            _serviceProvider  = new Mock <IServiceProvider>().Object;
            _customerSettings = new CustomerSettings();
            _commonSettings   = new CommonSettings();
            _customerService  = new CustomerService(new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher), _customerRepo, _customerRoleRepo, _customerProductRepo, _customerProductPriceRepo,
                                                    _customerHistoryRepo, _customerRoleProductRepo, _customerNoteRepo, null, _eventPublisher);

            _customerRegistrationService = new CustomerRegistrationService(
                _customerService,
                _encryptionService,
                _newsLetterSubscriptionService,
                _localizationService,
                _storeService,
                _eventPublisher,
                _rewardPointsSettings,
                _customerSettings,
                _rewardPointsService);
        }
コード例 #10
0
 public void Insert(Employee employee)
 {
     employeeRepository.Insert(employee);
     unitOfWork.SaveChanges();
 }
コード例 #11
0
        public void TestInitialize()
        {
            var eventPublisher = new Mock <IMediator>();

            _eventPublisher = eventPublisher.Object;

            _customerActionRepository        = new MongoDBRepositoryTest <CustomerAction>();
            _customerActionTypeRepository    = new MongoDBRepositoryTest <CustomerActionType>();
            _customerActionHistoryRepository = new MongoDBRepositoryTest <CustomerActionHistory>();

            _Id_CustomerActionType = MongoDB.Bson.ObjectId.GenerateNewId().ToString();
            var customerActionType = new List <CustomerActionType>()
            {
                new CustomerActionType()
                {
                    Id            = _Id_CustomerActionType,
                    Name          = "Add to cart",
                    SystemKeyword = "AddToCart",
                    Enabled       = true,
                    ConditionType = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
                },
                new CustomerActionType()
                {
                    Name          = "Add order",
                    SystemKeyword = "AddOrder",
                    Enabled       = true,
                    ConditionType = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
                },
                new CustomerActionType()
                {
                    Name          = "Viewed",
                    SystemKeyword = "Viewed",
                    Enabled       = false,
                    ConditionType = { 1, 2, 3, 7, 8, 9, 10 }
                },
                new CustomerActionType()
                {
                    Name          = "Url",
                    SystemKeyword = "Url",
                    Enabled       = false,
                    ConditionType = { 7, 8, 9, 10, 11, 12 }
                },
                new CustomerActionType()
                {
                    Name          = "Customer Registration",
                    SystemKeyword = "Registration",
                    Enabled       = false,
                    ConditionType = { 7, 8, 9, 10 }
                }
            };

            _customerActionTypeRepository.Insert(customerActionType);
            _Id_CustomerAction = MongoDB.Bson.ObjectId.GenerateNewId().ToString();
            var customerActions = new List <CustomerAction>()
            {
                new CustomerAction()
                {
                    Id               = _Id_CustomerAction,
                    Active           = true,
                    StartDateTimeUtc = DateTime.UtcNow,
                    EndDateTimeUtc   = DateTime.UtcNow.AddMonths(1),
                    Name             = "Test action",
                    ReactionTypeId   = (int)CustomerReactionTypeEnum.AssignToCustomerTag,
                    Condition        = CustomerActionConditionEnum.OneOfThem,
                    ActionTypeId     = _Id_CustomerActionType
                },
            };

            _customerActionRepository.Insert(customerActions);
            _customerActionService = new CustomerActionService(_customerActionRepository, _customerActionTypeRepository,
                                                               _customerActionHistoryRepository, _eventPublisher, new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher));
        }
コード例 #12
0
 public void Add(TEntity entity)
 {
     _repository.Insert(entity);
     UnitOfWork.SaveChanges();
 }
コード例 #13
0
        protected virtual void InstallCountryWithProvince()
        {
            var country = new Core.Domain.Directory.Country()
            {
                Name               = "Polska",
                AllowsBilling      = true,
                AllowsShipping     = true,
                TwoLetterIsoCode   = "PL",
                ThreeLetterIsoCode = "POL",
                NumericIsoCode     = 616,
                SubjectToVat       = false,
                DisplayOrder       = 100,
                Published          = true
            };

            _countryRepository.Insert(country);

            //poland state province
            var provinces = new List <StateProvince>()
            {
                new StateProvince()
                {
                    Name         = "Dolnośląskie",
                    Abbreviation = "D",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Kujawsko-pomorskie",
                    Abbreviation = "C",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Lubelskie",
                    Abbreviation = "L",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Łódzkie",
                    Abbreviation = "E",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1
                },
                new StateProvince()
                {
                    Name         = "Lubuskie",
                    Abbreviation = "F",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Małopolskie",
                    Abbreviation = "K",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Mazowieckie",
                    Abbreviation = "W",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Opolskie",
                    Abbreviation = "O",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Podkarpackie",
                    Abbreviation = "R",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Podlaskie",
                    Abbreviation = "B",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Pomorskie",
                    Abbreviation = "G",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Śląskie",
                    Abbreviation = "S",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Świętokrzyskie",
                    Abbreviation = "T",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Warmińsko-mazurskie",
                    Abbreviation = "N",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Wielkopolskie",
                    Abbreviation = "P",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                },
                new StateProvince()
                {
                    Name         = "Zachodniopomorskie",
                    Abbreviation = "Z",
                    CountryId    = country.Id,
                    Published    = true,
                    DisplayOrder = 1,
                }
            };

            _stateProvinceRepository.Insert(provinces);
        }
コード例 #14
0
 public void Insert(LeadStatus leadStatus)
 {
     leadStatusRepository.Insert(leadStatus);
     unitOfWork.SaveChanges();
 }
コード例 #15
0
 public bool Insert(T_Cod_StandardToLimit p)
 {
     return(_repository.Insert(p));
 }
コード例 #16
0
        public ResponseHelper MarkAsLearned(int courseId, int lessonId, string userId)
        {
            var rh = new ResponseHelper();

            try
            {
                using (var ctx = _dbContextScopeFactory.Create())
                {
                    // Verificamos si existe en la base de datos
                    var originalEntry = _lessonLearnedRepo.SingleOrDefault(x =>
                                                                           x.LessonId == lessonId &&
                                                                           x.UserId == userId
                                                                           );

                    // Quiere decir que no existe, por lo tanto lo registramos
                    if (originalEntry == null)
                    {
                        _lessonLearnedRepo.Insert(new CourseLessonLearnedsPerStudent
                        {
                            UserId   = userId,
                            LessonId = lessonId
                        });

                        rh.SetResponse(true);
                    }
                    // Por lo tanto ya existe
                    else
                    {
                        rh.SetResponse(false, "Usted ya marcó esta lección como aprendida");
                    }

                    ctx.SaveChanges();
                }

                #region Marcar como finalizado el curso
                using (var ctx = _dbContextScopeFactory.Create())
                {
                    // Obtiene la relación entre el usuario y el curso
                    var coursePerUser = _userPerCourseRepo.Find(x =>
                                                                x.CourseId == courseId && x.UserId == userId
                                                                ).Single();

                    // Obtiene el total de lecciones para el curso
                    var totalLessons = _lessonPerCourseRepo.Find(x => x.CourseId == courseId)
                                       .Count();

                    // Obtiene el total de lecciones aprendidas para el curso y por el usuario
                    var totalLearneds = _lessonLearnedRepo.Find(x =>
                                                                x.Lesson.CourseId == courseId &&
                                                                x.UserId == userId
                                                                ).Count();

                    /*
                     * Si los cursos aprendidos con los que hay en total son la misma cantidad, entonces
                     * lo seteamos como finalizado
                     */
                    coursePerUser.Completed = totalLessons == totalLearneds;
                    _userPerCourseRepo.Update(coursePerUser);

                    ctx.SaveChanges();
                }
                #endregion
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                rh.SetResponse(false, e.Message);
            }

            return(rh);
        }
コード例 #17
0
        public override async Task <dynamic> HandleAsync(Commands.AddFile command)
        {
            Result result;

            // validate the command
            if (string.IsNullOrWhiteSpace(command.Name))
            {
                result = new Result(false, command.Name, "Ad gereklidir.", true, null);
                return(await Task.FromResult(result));
            }
            if (command.Name.Length > 200)
            {
                result = new Result(false, command.Name, "Ad 200 karakterden uzun olamaz.", true, null);
                return(await Task.FromResult(result));
            }
            if (string.IsNullOrWhiteSpace(command.OriginalName))
            {
                result = new Result(false, command.OriginalName, "Dosya Adı gereklidir.", true, null);
                return(await Task.FromResult(result));
            }
            if (command.OriginalName.Length > 200)
            {
                result = new Result(false, command.OriginalName, "Dosya Adı 200 karakterden uzun olamaz.", true, null);
                return(await Task.FromResult(result));
            }
            if (string.IsNullOrWhiteSpace(command.Alt))
            {
                result = new Result(false, command.Alt, "Açıklama gereklidir.", true, null);
                return(await Task.FromResult(result));
            }
            if (command.Alt.Length > 4000)
            {
                result = new Result(false, command.Alt, "Açıklama 4000 karakterden uzun olamaz.", true, null);
                return(await Task.FromResult(result));
            }
            if (string.IsNullOrWhiteSpace(command.Category))
            {
                result = new Result(false, command.Category, "Kategori gereklidir.", true, null);
                return(await Task.FromResult(result));
            }
            if (command.Category.Length > 200)
            {
                result = new Result(false, command.Category, "Kategori 200 karakterden uzun olamaz.", true, null);
                return(await Task.FromResult(result));
            }
            if (string.IsNullOrWhiteSpace(command.Type))
            {
                result = new Result(false, command.Type, "Tür gereklidir.", true, null);
                return(await Task.FromResult(result));
            }
            if (command.Type.Length > 200)
            {
                result = new Result(false, command.Type, "Tür 200 karakterden uzun olamaz.", true, null);
                return(await Task.FromResult(result));
            }
            if (string.IsNullOrWhiteSpace(command.Extension))
            {
                result = new Result(false, command.Extension, "Uzantı gereklidir.", true, null);
                return(await Task.FromResult(result));
            }
            if (command.Extension.Length > 200)
            {
                result = new Result(false, command.Extension, "Uzantı 200 karakterden uzun olamaz.", true, null);
                return(await Task.FromResult(result));
            }


            // map command to the model
            var model = Mapper.Map <Model.Entities.File>(command);

            // mark the model to insert
            fileRepository.Insert(model);

            // save changes to database
            await unitOfWork.SaveChangesAsync();

            // return the result
            result = new Result(true, model.Id, "Dosya başarıyla eklendi.", true, 1);
            return(await Task.FromResult(result));
        }
コード例 #18
0
        public HomeViewModel(ILog log, IAccount account, ILocalize localize, IApplication application, IHistory history,
                             INavigationService navigationService, IUser user, IRepository repository,
                             IList<IExerciseType> exerciseTypes, ISettings settings)
        {
            _log = log;
            _localize = localize;
            _application = application;
            Account = account;

            _history = history;
            _history.OnHistoryItemsChanged += _history_OnHistoryItemsChanged;
            _NavigationService = navigationService;
            User = user;
            ExerciseTypes = exerciseTypes;
            _repository = repository;
            _settings = settings;
            _settings.OnSettingsChanged += _settings_OnSettingsChanged;
            _settings.Load();
            _history.Load();

            _repository.Single<User>(1).ContinueWith(t =>
                {
                    var foundUser = t.Result;
                    if (foundUser == null)
                    {
                        //this is first load of the app, set it up
                        _repository.Insert<User>(this.User).ContinueWith(task =>
                            {
                                this.User = this.User;
                                Account.AccessToken = this.User.RunkeeperToken;

                            });
                    }
                    else
                    {
                        User = foundUser;
                        Account.AccessToken = foundUser.RunkeeperToken;
                    }
                });

            if (_exerciseTypes == null || _exerciseTypes.Count == 0 ||
                (_exerciseTypes.Count == 1 && _exerciseTypes[0].Id == 0))
            {
                if (HomeViewModel.cachedTypes != null)
                {
                    this.ExerciseTypes = HomeViewModel.cachedTypes;
                    _log.Info("cache hit");
                }
                else
                {
                    _log.Info("cache miss");
                    this.ExerciseTypes = DefaultTypes;
                    _log.Info("default types set, querying");
                    _repository.Query<ExerciseType>("select * from ExerciseType").ContinueWith(t =>
                        {
                            _log.Info("query complete");
                            var types = t.Result;
                            if (types == null || types.Count == 0)
                            {

                                _log.Info("db does not have Exercise types, loading default items");
                                foreach (var e in from tt in this.ExerciseTypes orderby tt.Id select tt)
                                {
                                    _repository.Insert<ExerciseType>(e);
                                }
                            }
                            else
                            {
                                _log.Info("all excecise types retreived from the db, update local data store");
                                this.ExerciseTypes = (from tt in types select tt).ToArray();
                            }
                            _log.Info("cache extypes to static var");
                            HomeViewModel.cachedTypes = ExerciseTypes;

                        });
                }
            }
        }
コード例 #19
0
 /// <summary>
 /// Inserts a queued email
 /// </summary>
 /// <param name="queuedEmail">Queued email</param>
 public virtual void InsertQueuedEmail(QueuedEmail queuedEmail)
 {
     _queuedEmailRepository.Insert(queuedEmail);
 }
コード例 #20
0
        /// <summary>
        /// The create new tags.
        /// </summary>
        /// <param name="tags">
        /// The tags.
        /// </param>
        /// <param name="tagRepository">
        /// The tag repository.
        /// </param>
        /// <returns>
        /// The <see cref="IList"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// </exception>
        private IList<Tag> CreateNewTags(IList<Tag> tags, IRepository<Tag, int> tagRepository)
        {
            if (tags == null)
            {
                throw new ArgumentNullException("tags");
            }

            IList<Tag> result = new List<Tag>(tags.Count);
            for (int i = 0; i < tags.Count; ++i)
            {
                string content = tags[i].Content;
                Tag temp =
                    tagRepository.Query()
                                 .Filter(p => p.Content.Equals(content, StringComparison.Ordinal))
                                 .Get()
                                 .FirstOrDefault();
                if (temp == null)
                {
                    tagRepository.Insert(tags[i]);
                    result.Add(tags[i]);
                }
                else
                {
                    result.Add(temp);
                }
            }

            return result;
        }
コード例 #21
0
 public void Insert(Clinic model)
 {
     _clinicRepository.Insert(model);
 }
コード例 #22
0
 public virtual void Insert(Post item)
 {
     _postRepository.Insert(item);
 }
コード例 #23
0
        private void Questions()
        {
            var m = _questionType.FirstOrDefault(n => n.Name == "多选");
            var r = _questionType.FirstOrDefault(n => n.Name == "单选");
            var q = _questionType.FirstOrDefault(n => n.Name == "判断");

            new List <Question>()
            {
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "党的十九大报告提出的三大攻坚战是指(    )",
                    Options        = "{" +
                                     "\"A\":\"精准脱贫、风险防控、污染防治\"," +
                                     "\"B\":\"防范化解重大风险、精准脱贫、污染防治\"," +
                                     "\"C\":\"污染防控、扶贫攻坚、风险治理\"," +
                                     "\"D\":\"反腐倡廉、精准脱贫、污染防控\"}",
                    Answer           = "B",
                    AnswerNote       = "突出抓重点、补短板、强弱项,特别是要坚决打好防范化解重大风险、精准脱贫、污染防治的攻坚战,使全面建成小康社会得到人民认可、经得起历史检验。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "我国每年将(    )设立为“扶贫日”。",
                    Options        = "{" +
                                     "\"A\":\"10月17日\"," +
                                     "\"B\":\"3月12日\"," +
                                     "\"C\":\"3月15日\"," +
                                     "\"D\":\"10月10日\"}",
                    Answer           = "A",
                    AnswerNote       = "《国务院关于同意设立“扶贫日”的批复》同意自2014年起,将每年的10月17日 设立为“扶贫日”,具体工作由国务院扶贫办商有关部门组织实施。",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "习近平总书记在中共十八届二中全会第二次全体会议上指出,做好民生工作的工作思路是(    )",
                    Options        = "{" +
                                     "\"A\":\"守住底线、突出重点、完善制度、引导舆论\"," +
                                     "\"B\":\"守住底线、突出重点、完善制度、引导预期\"," +
                                     "\"C\":\"兜底线  织密网  建机制\"," +
                                     "\"D\":\"把握大局  围绕中心 突出重点  形成合力\"}",
                    Answer           = "A",
                    AnswerNote       = "要按照“守住底线、突出重点、完善制度、引导舆论”的思路做好民生工作,采取有力措施解决好群众生活中的实际困难和问题。(习近平总书记在中共十八届二中全会第二次全体会议上的讲话2013年2月28日)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "2015年6月,在部分省区市扶贫攻坚与“十三五”时期经济社会发展座谈会上,习近平总书记提出了扶贫开发工作的管理体制。其准确表述是(    )",
                    Options        = "{" +
                                     "\"A\":\"中央统筹、省负总责、市(地)县抓落实\"," +
                                     "\"B\":\"中央统筹、东西协作、精准扶贫脱贫\"," +
                                     "\"C\":\"中央统筹、省负总责、市县抓落实\"," +
                                     "\"D\":\"中央统筹、东西协作、精准滴灌\"}",
                    Answer           = "A",
                    AnswerNote       = "要强化扶贫开发工作领导责任制,把中央统筹、省负总责、市(地)县抓落实的管理体制,片为重点、工作到村、扶贫到户的工作机制,党政一把手负总责的扶贫开发工作责任制,真正落到实处。(《在部分省区市扶贫攻坚与“十三五”时期经济社会发展座谈会上的讲话》(2015年6月18日))。",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "“十三五”期间脱贫攻坚的目标是,到2020年实现“两不愁、三保障”。它们分别是指:到2020年,稳定实现农村贫困人口(    )。",
                    Options        = "{" +
                                     "\"A\":\"不愁吃、不愁穿,住房、生活、医疗有保障\"," +
                                     "\"B\":\"不愁吃、不愁喝,住房、养老、医疗有保障\"," +
                                     "\"C\":\"不愁吃、不愁穿,义务教育、基本医疗和住房安全有保障\"," +
                                     "\"D\":\"不愁吃、不愁穿,基本医疗、安全住房和死亡安葬有保障\"}",
                    Answer           = "C",
                    AnswerNote       = "“十三五”期间脱贫攻坚的目标是,到2020年实现“两不愁、三保障”。“两不愁”,就是稳定实现农村贫困人口不愁吃、不愁穿; “三保障”,就是农村贫困人口义务教育、基本医疗和住房安全有保障。(《在中央扶贫开发工作会议上的讲话》(2015年11月27日))",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "新时期脱贫攻坚的目标,集中到一点,就是到2020年实现“两个确保”,即是,确保(    )。",
                    Options        = "{" +
                                     "\"A\":\"农村贫困人口实现脱贫,贫困县全部脱贫摘帽。\"," +
                                     "\"B\":\"贫困人口实现脱贫,贫困县全部摘帽。\"," +
                                     "\"C\":\"农村人口实现脱贫,贫困县全部摘帽。\"," +
                                     "\"D\":\"全国人民实现脱贫,贫困县全部摘帽。\"}",
                    Answer           = "A",
                    AnswerNote       = "新时期脱贫攻坚的目标,集中到一点,就是到2020年实现“两个确保”:农村贫困人口实现脱贫,贫困县全部脱贫摘帽。(《在中央扶贫开发工作会议上的讲话》(2015年11月27日))",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "党的十九大的主题是:不忘初心,牢记使命,高举中国特色社会主义伟大旗帜,决胜全面建成小康社会,夺取新时代中国特色社会主义伟大胜利,(    )。 ",
                    Options        = "{" +
                                     "\"A\":\"为实现四个现代化不懈奋斗\"," +
                                     "\"B\":\"为实现改革开放总目标不懈奋斗\"," +
                                     "\"C\":\"为实现经济体制改革总目标不懈奋斗\"," +
                                     "\"D\":\"为实现中华民族伟大复兴的中国梦不懈奋斗\"}",
                    Answer           = "D",
                    AnswerNote       = "大会的主题是:不忘初心,牢记使命,高举中国特色社会主义伟大旗帜,决胜全面建成小康社会,夺取新时代中国特色社会主义伟大胜利,为实现中华民族伟大复兴的中国梦不懈奋斗。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "(    )是近代以来中华民族最伟大的梦想",
                    Options        = "{" +
                                     "\"A\":\"富国强兵\"," +
                                     "\"B\":\"民族独立\"," +
                                     "\"C\":\"实现中华民族伟大复兴\"," +
                                     "\"D\":\"全面建成小康社会\"}",
                    Answer           = "C",
                    AnswerNote       = "实现中华民族伟大复兴是近代以来中华民族最伟大的梦想。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "当前,国内外形势正在发生深刻复杂变化,我国发展仍处于重要(    ),前景十分光明,挑战也十分严峻。",
                    Options        = "{" +
                                     "\"A\":\"战略发展期\"," +
                                     "\"B\":\"战略机遇期\"," +
                                     "\"C\":\"战略调整期\"," +
                                     "\"D\":\"战略规划期\"}",
                    Answer           = "B",
                    AnswerNote       = "当前,国内外形势正在发生深刻复杂变化,我国发展仍处于重要战略机遇期,前景十分光明,挑战也十分严峻。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "新时代中国特色社会主义思想,明确中国特色社会主义事业总体布局是(    )。",
                    Options        = "{" +
                                     "\"A\":\"“五位一体”\"," +
                                     "\"B\":\"“四个全面”\"," +
                                     "\"C\":\"“四个自信”\"," +
                                     "\"D\":\"两步走战略\"}",
                    Answer           = "A",
                    AnswerNote       = "明确中国特色社会主义事业总体布局是“五位一体”、战略布局是“四个全面”,强调坚定道路自信、理论自信、制度自信、文化自信。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "中国特色社会主义进入新时代,我国社会主要矛盾已经转化为(   )。",
                    Options        = "{" +
                                     "\"A\":\"人民日益增长的物质生活需要和落后的社会生产之间的矛盾\"," +
                                     "\"B\":\"人民日益增长的美好生活需要和不平衡不充分的发展之间的矛盾\"," +
                                     "\"C\":\"生产力和生产关系之间的矛盾\"," +
                                     "\"D\":\"人民日益增长的美好生活需要和落后的社会生产之间的矛盾\"}",
                    Answer           = "B",
                    AnswerNote       = "中国特色社会主义进入新时代,我国社会主要矛盾已经转化为人民日益增长的美好生活需要和不平衡不充分的发展之间的矛盾。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                },
                new Question()
                {
                    QuestionTypeId = r.Id,
                    Content        = "新时代中国特色社会主义思想,明确全面深化改革总目标是(   )。",
                    Options        = "{" +
                                     "\"A\":\"完善和发展中国特色社会主义制度\"," +
                                     "\"B\":\"完善和发展中国特色社会主义制度、推进国家治理体系和治理能力现代化\"," +
                                     "\"C\":\"推进国家治理体系和治理能力现代化\"," +
                                     "\"D\":\"建设社会主义现代化强国\"}",
                    Answer           = "B",
                    AnswerNote       = "明确全面深化改革总目标是完善和发展中国特色社会主义制度、推进国家治理体系和治理能力现代化。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }
            }.ForEach(item =>
            {
                _question.Insert(item);
            });

            new List <Question>()
            {
                new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "中国梦的本质是(    )。",
                    Options        = "{" +
                                     "\"A\":\"国家富强\"," +
                                     "\"B\":\"民族振兴\"," +
                                     "\"C\":\"人民幸福\"," +
                                     "\"D\":\"世界团结\"}",
                    Answer           = "ABC",
                    AnswerNote       = "中国梦视野宽广、内涵丰富、意蕴深远。习近平总书记多次强调,中国梦的本质是国家富强、民族振兴、人民幸福。(《习近平新时代中国特色社会主义思想三十讲》)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "中国共产党是代表最广大人民利益的政党,一切工作成败得失必然要由人民群众来检验,以人民(    )作为根本标准。",
                    Options        = "{" +
                                     "\"A\":\"拥护不拥护\"," +
                                     "\"B\":\"赞成不赞成\"," +
                                     "\"C\":\"高兴不高兴\"," +
                                     "\"D\":\"答应不答应\"}",
                    Answer           = "ABCD",
                    AnswerNote       = "我们党是代表最广大人民利益的政党,一切工作成败得失必然要由人民群众来检验,以人民拥护不拥护、赞成不赞成、高兴不高兴、答应不答应作为根本标准。(《习近平新时代中国特色社会主义思想三十讲》)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "供给侧结构改革的重点是(    )",
                    Options        = "{" +
                                     "\"A\":\"解放和发展社会生产力,用改革的办法推进结构调整\"," +
                                     "\"B\":\"减少无效和低端供给,扩大有效和中高端供给\"," +
                                     "\"C\":\"增强供给结构对需求变化的适应性和灵活性\"," +
                                     "\"D\":\"提高全要素生产率\"}",
                    Answer           = "ABCD",
                    AnswerNote       = "供给侧结构改革的重点是,解放和发展社会生产力,用改革的办法推进结构调整,减少无效和低端供给,扩大有效和中高端供给,增强供给结构对需求变化的适应性和灵活性,提高全要素生产率。(《习近平新时代中国特色社会主义思想三十讲》)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "党的十九大报告提出,全面推进依法治国总目标是(    )",
                    Options        = "{" +
                                     "\"A\":\"建设中国特色社会主义法制体系\"," +
                                     "\"B\":\"建设社会主义法治国家\"," +
                                     "\"C\":\"有法可依 有法必依 执法必须 违法必究\"," +
                                     "\"D\":\"科学立法  严格执法 公正司法 全民守法\"}",
                    Answer           = "AB",
                    AnswerNote       = "明确全面推进依法治国总目标是建设中国特色社会主义法制体系、建设社会主义法治国家。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "党的十九大的主题是:不忘初心,牢记使命,(    )。",
                    Options        = "{" +
                                     "\"A\":\"高举中国特色社会主义伟大旗帜\"," +
                                     "\"B\":\"决胜全面建成小康社会\"," +
                                     "\"C\":\"夺取新时代中国特色社会主义伟大胜利\"," +
                                     "\"D\":\"为实现中华民族伟大复兴的中国梦不懈奋斗\"}",
                    Answer           = "ABCD",
                    AnswerNote       = "大会的主题是:不忘初心,牢记使命,高举中国特色社会主义伟大旗帜,决胜全面建成小康社会,夺取新时代中国特色社会主义伟大胜利,为实现中华民族伟大复兴的中国梦不懈奋斗。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "统筹推进“五位一体”总体布局,协调推进“四个全面”战略布局,提高党(    )的能力和定力,确保党始终总揽全局、协调各方。",
                    Options        = "{" +
                                     "\"A\":\"把方向\"," +
                                     "\"B\":\"谋大局\"," +
                                     "\"C\":\"定政策\"," +
                                     "\"D\":\"促改革\"}",
                    Answer           = "ABCD",
                    AnswerNote       = "坚持稳中求进工作总基调,统筹推进“五位一体”总体布局,协调推进“四个全面”战略布局,提高党把方向、谋大局、定政策、促改革的能力和定力,确保党始终总揽全局、协调各方。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "出台中央八项规定,严厉整治(    )和奢靡之风,坚决反对特权。",
                    Options        = "{" +
                                     "\"A\":\"形式主义\"," +
                                     "\"B\":\"官僚主义\"," +
                                     "\"C\":\"享乐主义\"," +
                                     "\"D\":\"自由主义\"}",
                    Answer           = "ABC",
                    AnswerNote       = "出台中央八项规定,严厉整治形式主义、官僚主义、享乐主义和奢靡之风,坚决反对特权。巡视利剑作用彰显,实现中央和省级党委巡视全覆盖。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "党政军民学,东西南北中,党是领导一切的。必须增强(    ),自觉维护党中央权威和集中统一领导,自觉在思想上政治上行动上同党中央保持高度一致。",
                    Options        = "{" +
                                     "\"A\":\"政治意识\"," +
                                     "\"B\":\"大局意识\"," +
                                     "\"C\":\"核心意识\"," +
                                     "\"D\":\"看齐意识\"}",
                    Answer           = "ABCD",
                    AnswerNote       = "坚持党对一切工作的领导。党政军民学,东西南北中,党是领导一切的。必须增强政治意识、大局意识、核心意识、看齐意识,自觉维护党中央权威和集中统一领导,自觉在思想上政治上行动上同党中央保持高度一致。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "(    ),紧密联系、相互贯通、相互作用,其中起决定性作用的是党的建设新的伟大工程。",
                    Options        = "{" +
                                     "\"A\":\"伟大斗争\"," +
                                     "\"B\":\"伟大工程\"," +
                                     "\"C\":\"伟大事业\"," +
                                     "\"D\":\"伟大梦想\"}",
                    Answer           = "ABCD",
                    AnswerNote       = "伟大斗争,伟大工程,伟大事业,伟大梦想,紧密联系、相互贯通、相互作用,其中起决定性作用的是党的建设新的伟大工程。推进伟大工程,要结合伟大斗争、伟大事业、伟大梦想的实践来进行,确保党在世界形势深刻变化的历史进程中始终走在时代前列。(习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "要加快建设创新型国家,就必须培养造就一大批具有国际水平的(    )和高水平创新团队。",
                    Options        = "{" +
                                     "\"A\":\"战略科技人才\"," +
                                     "\"B\":\"科技领军人才\"," +
                                     "\"C\":\"青年科技人才\"," +
                                     "\"D\":\"国际视野人才\"}",
                    Answer           = "ABC",
                    AnswerNote       = "加快建设创新型国家。倡导创新文化,强化知识产权创造、保护、运用。培养造就一大批具有国际水平的战略科技人才、科技领军人才、青年科技人才和高水平创新团队。 (习近平:决胜全面建成小康社会 夺取新时代中国特色社会主义伟大胜利——在中国共产党第十九次全国代表大会上的报告)",
                    QuestionTypeName = "习近平新时代中国特色社会主义思想、党的十九大精神"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "就业促进法的立法目的是:(    )",
                    Options        = "{" +
                                     "\"A\":\"促进就业\"," +
                                     "\"B\":\"促进经济发展与扩大就业相协调\"," +
                                     "\"C\":\"促进社会和谐稳定\"," +
                                     "\"D\":\"构建和发展和谐稳定的劳动关系\"}",
                    Answer           = "ABC",
                    AnswerNote       = "《就业促进法》第一条规定,为了促进就业,促进经济发展与扩大就业相协调,促进社会和谐稳定,制定本法。",
                    QuestionTypeName = "就业创业"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "地方各级人民政府和有关部门应当加强对失业人员从事个体经营的指导,提供(    )等服务。",
                    Options        = "{" +
                                     "\"A\":\"政策咨询\"," +
                                     "\"B\":\"就业培训\"," +
                                     "\"C\":\"开业指导\"," +
                                     "\"D\":\"业务信息\"}",
                    Answer           = "ABC",
                    AnswerNote       = "《就业促进法》第二十四条规定,地方各级人民政府和有关部门应当加强对失业人员从事个体经营的指导,提供政策咨询、就业培训和开业指导等服务。",
                    QuestionTypeName = "就业创业"
                }, new Question()
                {
                    QuestionTypeId = m.Id,
                    Content        = "劳动者就业,不因(    )等不同而受歧视。",
                    Options        = "{" +
                                     "\"A\":\"民族\"," +
                                     "\"B\":\"种族\"," +
                                     "\"C\":\"性别\"," +
                                     "\"D\":\"宗教信仰\"}",
                    Answer           = "ABCD",
                    AnswerNote       = "《就业促进法》第三条规定,劳动者依法享有平等就业和自主择业的权利。劳动者就业,不因民族、种族、性别、宗教信仰等不同而受歧视。",
                    QuestionTypeName = "就业创业"
                }
            }.ForEach(item =>
            {
                _question.Insert(item);
            });
        }
コード例 #24
0
ファイル: CartService.cs プロジェクト: FurkanCetin1/C2C
 public async Task InsertAsync(Product entity)
 {
     productRepository.Insert(entity);
     await unitOfWork.SaveChangesAsync();
 }
コード例 #25
0
 public void Insert(HIVPatientFile model)
 {
     _HIVTestUploadRepository.Insert(model);
 }
コード例 #26
0
 public void InsertDonor(Donor donor)
 {
     donorRepository.Insert(donor);
 }
コード例 #27
0
 public void Insert(EF.Core.Data.File files)
 {
     _fileRepository.Insert(files);
 }
コード例 #28
0
 public void InsertSearchHistory(AuthorSearchHistory _SerachHistory)
 {
     _AuthorSearchHistory.Insert(_SerachHistory);
 }
コード例 #29
0
 public StockHeader Create(StockHeader s)
 {
     s.ObjectState = ObjectState.Added;
     _stockHeaderRepository.Insert(s);
     return(s);
 }
コード例 #30
0
        /// <summary>
        /// Insert new widget zone in database
        /// </summary>
        /// <param name="widgetZone">Widget zone entity</param>
        public virtual void InsertWidgetZone(WidgetZone widgetZone)
        {
            _widgetZoneRepository.Insert(widgetZone);

            _eventPublisher.EntityInserted(widgetZone);
        }
コード例 #31
0
 public void CreateCategory(CategoryViewModel category)
 {
     _categoryRepository.Insert(_mapper.Map <Category>(category));;
 }
コード例 #32
0
 public void Insert(Video videos)
 {
     _videoRepository.Insert(videos);
 }
コード例 #33
0
 public void InsertNewsVideo(NewsVideo newsVideo)
 {
     _newsVideoRepository.Insert(newsVideo);
 }
コード例 #34
0
ファイル: Util.cs プロジェクト: andy-thomas/Trails2010
        internal static void SeedData(IRepository repository)
        {
            Console.WriteLine("Seeding data...");

            // Seed Persons
            var persons = new List<Person>
                              {
                                  new Person {FirstName = "Arthur", LastName = "Smith", Gender = "M"},
                                  new Person {FirstName = "Bert", LastName = "Jones", Gender = "M"},
                                  new Person {FirstName = "Charlie", LastName = "Robertson", Gender = "M"}
                              };

            persons.ForEach(p => repository.Insert(p));

            // Seed Regions
            var regions = new List<Region>
                              {
                                  new Region {Name = "Banff National Park - South", Description = "Banff National Park"},
                                  new Region {Name = "Jasper National Park"},
                                  new Region {Name = "Kootenay National Park"},
                                  new Region {Name = "Banff National Park - North"},
                                  new Region {Name = "Kananaskis Country"}
                              };
            regions.ForEach(r => repository.Insert(r));

            // Seed Locations
            var locations = new List<Location>
                                {
                                    new Location
                                        {
                                            Name = "Bow Valley Parkway",
                                            Description = "Road from Banff to Lake Louise",
                                            Directions = "Turn left off main highway 2km north of Banff",
                                            Region = regions[0]
                                        },
                                    new Location {Name = "Banff Townsite area", Region = regions[0]},
                                    new Location
                                        {
                                            Name = "Bow Lake area",
                                            Description = "20 minutes north of Lake Louise on IceField Parkway",
                                            Region = regions[3]
                                        },
                                    new Location {Name = "Smith Dorrien Highway", Region = regions[4]}
                                };
            locations.ForEach(l => repository.Insert(l));

            // Seed Difficulty Levels
            var difficulties = new List<Difficulty>
                                   {
                                       new Difficulty {DifficultyType = "Easy"},
                                       new Difficulty {DifficultyType = "Moderate"},
                                       new Difficulty {DifficultyType = "Challenging"},
                                       new Difficulty {DifficultyType = "Difficult"}
                                   };
            difficulties.ForEach(d => repository.Insert(d));

            // Seed TrailType Levels
            var trailTypes = new List<TrailType>
                                 {
                                     new TrailType {TrailTypeName = "Land"},
                                     new TrailType {TrailTypeName = "Air"},
                                     new TrailType {TrailTypeName = "Water"}
                                 };
            trailTypes.ForEach(t => repository.Insert(t));

            // Seed TransportType Levels
            var transportTypes = new List<TransportType>
                                     {
                                         new TransportType {TransportTypeName = "Hike"},
                                         new TransportType {TransportTypeName = "Cycle"},
                                         new TransportType {TransportTypeName = "Canoe"},
                                         new TransportType {TransportTypeName = "Ski"},
                                         new TransportType {TransportTypeName = "Snowshoe"},
                                         new TransportType {TransportTypeName = "Aeroplane"}
                                     };
            transportTypes.ForEach(t => repository.Insert(t));

            // Seed Trails
            var trails = new List<Trail>
                             {
                                 new Trail
                                     {
                                         Name = "Johnstone Canyon",
                                         Description = "Johnstone Canyon",
                                         Distance = 4.8M,
                                         ElevationGain = 200,
                                         EstimatedTime = 2,
                                         Location = locations[0],
                                         TrailType = trailTypes[0],
                                         Difficulty = difficulties[0],
                                         ReturnOnEffort = 9.2M,
                                         OverallGrade = 7.2M,
                                         Notes =
                                             "Good Waterfalls scenery. Good in all seasons. Take crampons in winter/spring",
                                         Longitude = -102,
                                         Latitude = 50
                                     },
                                 new Trail
                                     {
                                         Name = "Burstall Pass",
                                         Description = "Burstall Pass",
                                         Distance = 8.53M,
                                         ElevationGain = 390,
                                         EstimatedTime = 4,
                                         Location = locations[1],
                                         TrailType = trailTypes[0],
                                         Difficulty = difficulties[0],
                                         ReturnOnEffort = 8.1M,
                                         OverallGrade = 8.1M,
                                         Notes = "Excellent view from the pass"
                                     },
                                 new Trail
                                     {
                                         Name = "Helen Lake",
                                         Description = "Helen Lake",
                                         Distance = 8M,
                                         ElevationGain = 480,
                                         EstimatedTime = 4.5M,
                                         Location = locations[2],
                                         TrailType = trailTypes[0],
                                         Difficulty = difficulties[3],
                                         ReturnOnEffort = 7.8M,
                                         OverallGrade = 7.8M,
                                         Notes = "Views across to the Dolomite range."
                                     },
                                 new Trail
                                     {
                                         Name = "Chester Lake",
                                         Description = "Chester Lake",
                                         Distance = 8.11M,
                                         ElevationGain = 520,
                                         EstimatedTime = 4.5M,
                                         Location = locations[2],
                                         TrailType = trailTypes[0],
                                         Difficulty = difficulties[1],
                                         ReturnOnEffort = 6.9M,
                                         OverallGrade = 6.9M,
                                         Notes = "Don't stop at Chester Lake - go on to Three Lake Valley"
                                     }
                             };

            trails.ForEach(t => repository.Insert(t));

            // Seed Trips
            var trips = new List<Trip>
                            {
                                new Trip
                                    {
                                        Date = new DateTime(2001, 9, 1),
                                        TransportType = transportTypes[0],
                                        Trail = trails[0],
                                        Weather = "Cloudy",
                                        TimeTaken = 3.3M,
                                        Notes = "Very slippery - cramps needed.",
                                        Persons = new List<Person>
                                        {
                                            persons[0], persons[1],persons[2]
                                        }
                                    },
                                new Trip
                                    {
                                        Date = new DateTime(2004, 7, 31),
                                        TransportType = transportTypes[1],
                                        Trail = trails[0],
                                        Weather = "Sunny",
                                        TimeTaken = 2.3M,
                                        Notes = "First time on this trail."

                                    }
                            };
            trips.ForEach(t => repository.Insert(t));

            repository.SaveChanges();
        }
コード例 #35
0
 public void Insert(PolicyDocument model)
 {
     _PolicyDocumentRepository.Insert(model);
     _datacontext.SaveChanges();
 }
コード例 #36
0
        private Profile GetProfile(string username, bool isAnonymous, IRepository<Profile> profiles)
        {
            var profile = profiles
                .FirstOrDefault(p =>
                          p.User.UserName == username
                          && p.ApplicationName == ApplicationName
                          && p.IsAnonymous == isAnonymous);

            if (profile == null)
            {
                var membershipUser = UnitOfWork.Current.CreateRepository<User>()
                    .FirstOrDefault(p => p.UserName == username
                    && p.ApplicationName == ApplicationName);

                if (membershipUser == null)
                    throw new ProviderException("Profile cannot be created. There is no membership user");

                profile = new Profile();
                profile.IsAnonymous = isAnonymous;
                profile.LastUpdatedDate = System.DateTime.Now;
                profile.LastActivityDate = System.DateTime.Now;
                profile.ApplicationName = this.ApplicationName;
                profile.UserId = membershipUser.Id;

                profiles.Insert(profile);
            }
            return profile;
        }
コード例 #37
0
        public void Flush()
        {
            if (_entries.Count == 0)
            {
                return;
            }

            string ipAddress   = "";
            string pageUrl     = "";
            string referrerUrl = "";

            try
            {
                ipAddress   = _webHelper.GetCurrentIpAddress();
                pageUrl     = _webHelper.GetThisPageUrl(true);
                referrerUrl = _webHelper.GetUrlReferrer();
            }
            catch { }

            _logRepository.AutoCommitEnabled = false;

            using (var scope = new DbContextScope(autoDetectChanges: false, proxyCreation: false, validateOnSave: false))
            {
                foreach (var context in _entries)
                {
                    if (context.ShortMessage.IsEmpty() && context.FullMessage.IsEmpty())
                    {
                        continue;
                    }

                    Log log = null;

                    try
                    {
                        string shortMessage = context.ShortMessage.NaIfEmpty();
                        string fullMessage  = context.FullMessage.EmptyNull();
                        string contentHash  = null;

                        if (context.HashNotFullMessage || context.HashIpAddress)
                        {
                            contentHash = (shortMessage
                                           + (context.HashNotFullMessage ? "" : fullMessage)
                                           + (context.HashIpAddress ? ipAddress.EmptyNull() : "")
                                           ).Hash(Encoding.Unicode, true);
                        }
                        else
                        {
                            contentHash = (shortMessage + fullMessage).Hash(Encoding.Unicode, true);
                        }

                        log = _logRepository.Table.OrderByDescending(x => x.CreatedOnUtc).FirstOrDefault(x => x.ContentHash == contentHash);

                        if (log == null)
                        {
                            log = new Log
                            {
                                Frequency    = 1,
                                LogLevel     = context.LogLevel,
                                ShortMessage = shortMessage,
                                FullMessage  = fullMessage,
                                IpAddress    = ipAddress,
                                Customer     = context.Customer,
                                PageUrl      = pageUrl,
                                ReferrerUrl  = referrerUrl,
                                CreatedOnUtc = DateTime.UtcNow,
                                ContentHash  = contentHash
                            };

                            _logRepository.Insert(log);
                        }
                        else
                        {
                            if (log.Frequency < 2147483647)
                            {
                                log.Frequency = log.Frequency + 1;
                            }

                            log.LogLevel     = context.LogLevel;
                            log.IpAddress    = ipAddress;
                            log.Customer     = context.Customer;
                            log.PageUrl      = pageUrl;
                            log.ReferrerUrl  = referrerUrl;
                            log.UpdatedOnUtc = DateTime.UtcNow;

                            _logRepository.Update(log);
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.Dump();
                    }
                }

                try
                {
                    // FIRE!
                    _logRepository.Context.SaveChanges();
                }
                catch { }
            }

            _logRepository.AutoCommitEnabled = true;

            _entries.Clear();
        }
コード例 #38
0
ファイル: EventService.cs プロジェクト: quanb/PlanAndSchedule
 public void InsertEvent(Event ev)
 {
     _eventRepository.Insert(ev);
 }
コード例 #39
0
 public void InsertBlogVideo(BlogVideo blogVideo)
 {
     _blogVideoRepository.Insert(blogVideo);
 }