• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Models.Organization类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AllReady.Models.Organization的典型用法代码示例。如果您正苦于以下问题:C# Organization类的具体用法?C# Organization怎么用?C# Organization使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Organization类属于AllReady.Models命名空间,在下文中一共展示了Organization类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ActivityDoesNotExist

        public void ActivityDoesNotExist()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            Organization htb = new Organization()
            {
                Id = 123,
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };
            Campaign firePrev = new Campaign()
            {
                Id = 1,
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb,
                TimeZoneId = "Central Standard Time"
            };
            htb.Campaigns.Add(firePrev);
            context.Organizations.Add(htb);
            context.SaveChanges();

            var vm = new ActivityDetailModel
            {
                CampaignId = 1,
                TimeZoneId = "Central Standard Time"
            };
            var query = new EditActivityCommand { Activity = vm };
            var handler = new EditActivityCommandHandler(context);
            var result = handler.Handle(query);
            Assert.True(result > 0);

            var data = context.Activities.Count(_ => _.Id == result);
            Assert.True(data == 1);
        }
开发者ID:weiplanet,项目名称:allReady,代码行数:35,代码来源:EditActivity.cs


示例2: LoadTestData

 protected override void LoadTestData()
 {
     var context = ServiceProvider.GetService<AllReadyContext>();
     Organization htb = new Organization()
     {
         Id = 1,
         Name = "Humanitarian Toolbox",
         LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
         WebUrl = "http://www.htbox.org",
         Campaigns = new List<Campaign>(),                
     };
     Organization other = new Organization()
     {
         Id = 2,
         Name = "Other Org",
         Campaigns = new List<Campaign>(),
     };
     Campaign firePrev = new Campaign()
     {
         Id = 1,
         Name = "Neighborhood Fire Prevention Days",
         ManagingOrganization = htb
     };
     Campaign otherCampaign = new Campaign()
     {
         Id = 2,
         Name = "Some other campaign",
         ManagingOrganization = other
     };
     htb.Campaigns.Add(firePrev);
     context.Organizations.Add(htb);
     other.Campaigns.Add(otherCampaign);
     context.Organizations.Add(other);
     context.SaveChanges();
 }
开发者ID:weiplanet,项目名称:allReady,代码行数:35,代码来源:GetCampaignList.cs


示例3: LoadTestData

 protected override void LoadTestData()
 {
     var context = ServiceProvider.GetService<AllReadyContext>();
     Organization htb = new Organization()
     {
         Name = "Humanitarian Toolbox",
         LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
         WebUrl = "http://www.htbox.org",
         Campaigns = new List<Campaign>()
     };
     Campaign firePrev = new Campaign()
     {
         Name = "Neighborhood Fire Prevention Days",
         ManagingOrganization = htb
     };
     htb.Campaigns.Add(firePrev);
     Activity queenAnne = new Activity()
     {
         Id = 1,
         Name = "Queen Anne Fire Prevention Day",
         Campaign = firePrev,
         CampaignId = firePrev.Id,
         StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
         EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
         Location = new Location { Id = 1 },
         RequiredSkills = new List<ActivitySkill>()
     };
     context.Organizations.Add(htb);
     context.Activities.Add(queenAnne);
     context.SaveChanges();
 }
开发者ID:weiplanet,项目名称:allReady,代码行数:31,代码来源:DeleteActivity.cs


示例4: ExistingCampaign

        public void ExistingCampaign()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            Organization htb = new Organization()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };
            Campaign firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb,
                TimeZoneId = "Eastern Standard Time"
            };
            htb.Campaigns.Add(firePrev);
            context.Organizations.Add(htb);
            context.SaveChanges();

            const string NEW_NAME = "Some new name value";

            var startDate = new DateTime(2014, 12, 10);
            var endDate = new DateTime(2015, 7, 3);
            var vm = new CampaignSummaryModel
            {
                Description = firePrev.Description,
                EndDate = endDate,
                FullDescription = firePrev.FullDescription,
                StartDate = startDate,
                Id = firePrev.Id,
                ImageUrl = firePrev.ImageUrl,
                Name = NEW_NAME,
                OrganizationId = firePrev.ManagingOrganizationId,
                OrganizationName = firePrev.ManagingOrganization.Name,
                TimeZoneId = "Eastern Standard Time"
            };
            var query = new EditCampaignCommand { Campaign = vm };
            var handler = new EditCampaignCommandHandler(context);
            var result = handler.Handle(query);
            Assert.Equal(1, result); // should get back the Campaign id

            var data = context.Campaigns.Single(_ => _.Id == 1);
            Assert.Equal(NEW_NAME, data.Name);

            Assert.Equal(2014, data.StartDateTime.Year);
            Assert.Equal(12, data.StartDateTime.Month);
            Assert.Equal(10, data.StartDateTime.Day);
            Assert.Equal(00, data.StartDateTime.Hour);
            Assert.Equal(00, data.StartDateTime.Minute);
            Assert.Equal(-5, data.StartDateTime.Offset.TotalHours);

            Assert.Equal(2015, data.EndDateTime.Year);
            Assert.Equal(7, data.EndDateTime.Month);
            Assert.Equal(3, data.EndDateTime.Day);
            Assert.Equal(23, data.EndDateTime.Hour);
            Assert.Equal(59, data.EndDateTime.Minute);
            Assert.Equal(-4, data.EndDateTime.Offset.TotalHours);
            
        }
开发者ID:weiplanet,项目名称:allReady,代码行数:60,代码来源:EditCampaign.cs


示例5: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            Organization htb = new Organization()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };
            Campaign firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };
            Activity queenAnne = new Activity()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<ActivitySkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);

            htb.Campaigns.Add(firePrev);
            context.Organizations.Add(htb);
            context.Activities.Add(queenAnne);

            var activitySignups = new List<ActivitySignup>();
            activitySignups.Add(new ActivitySignup { Activity = queenAnne, User = user1, SignupDateTime = DateTime.UtcNow });

            context.ActivitySignup.AddRange(activitySignups);

            var newTask = new AllReadyTask()
            {
                Activity = queenAnne,
                Description = "Description of a very important task",
                Name = "Task # 1",
                EndDateTime = DateTime.Now.AddDays(5),
                StartDateTime = DateTime.Now.AddDays(3),
                Organization = htb
            };
            newTask.AssignedVolunteers.Add(new TaskSignup()
            {
                Task = newTask,
                User = user1
            });
            context.Tasks.Add(newTask);

            context.SaveChanges();
        }
开发者ID:weiplanet,项目名称:allReady,代码行数:60,代码来源:SignupStatusChange.cs


示例6: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            var htb = new Organization
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Event
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            context.Users.Add(user2);

            htb.Campaigns.Add(firePrev);            
            context.Organizations.Add(htb);
            
            var task = new AllReadyTask
            {
                Event = queenAnne,
                Description = "Description of a very important task",
                Name = "Task # ",
                EndDateTime = DateTime.Now.AddDays(1),
                StartDateTime = DateTime.Now.AddDays(-3)
            };
            queenAnne.Tasks.Add(task);
            context.Events.Add(queenAnne);

            var taskSignups = new List<TaskSignup>
            {
                new TaskSignup { Task = task, User = user1 },
                new TaskSignup { Task = task, User = user2 }
            };
            context.TaskSignups.AddRange(taskSignups);

            context.SaveChanges();
        }
开发者ID:codethug,项目名称:allReady,代码行数:60,代码来源:MessageTaskVolunteersCommandHandlerAsyncTests.cs


示例7: ReturnNullIfFeaturedCampaignIsNotMarkedAsPublished

        public async Task ReturnNullIfFeaturedCampaignIsNotMarkedAsPublished()
        {
            // clear the test data of all campaigns
            var allCampaigns = Context.Campaigns.ToList();
            Context.RemoveRange(allCampaigns);
            Context.SaveChanges();

            var org = new Organization
            {
                Name = "Some Organization"
            };

            Context.Campaigns.Add(new Campaign
            {
                Name = "This is featured but not published",
                Featured = true,
                ManagingOrganization = org,
                Published = false
            });



            // Arrange
            var handler = new FeaturedCampaignQueryHandler(Context);

            // Act
            var result = await handler.Handle(new FeaturedCampaignQuery());

            // Assert
            Assert.Null(result);
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:31,代码来源:FeaturedCampaignQueryHandlerShould.cs


示例8: LoadTestData

        protected override void LoadTestData()
        {
            var org = new Organization
            {
                Name = "Some Organization"
            };

            Context.Organizations.Add(org);

            Context.Campaigns.Add(new Campaign
            {
                Name = "This is featured",
                Featured = true,
                ManagingOrganization = org                
            });

            Context.Campaigns.Add(new Campaign
            {
                Name = "This is not featured",
                Featured = false,
                ManagingOrganization = org
            });

            Context.Campaigns.Add(new Campaign
            {
                Name = "This is also featured",
                Featured = true,
                ManagingOrganization = org
            });

            Context.SaveChanges();
        }
开发者ID:HTBox,项目名称:allReady,代码行数:32,代码来源:FeaturedCampaignQueryHandlerShould.cs


示例9: LoadTestData

        protected override void LoadTestData()
        {
            var htb = new Organization()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Event()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            Context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            Context.Users.Add(user2);

            var task = new AllReadyTask
            {
                Id = 1,
                Name = "Task 1",
                Event = queenAnne,
            };

            var taskSignup = new TaskSignup
            {
                Id = 1,
                User = user1,
                Task = task
            };

            htb.Campaigns.Add(firePrev);            
            Context.Organizations.Add(htb);
            Context.Events.Add(queenAnne);
            Context.Tasks.Add(task);
            Context.TaskSignups.Add(taskSignup);

            Context.SaveChanges();
        }
开发者ID:ChrisDobby,项目名称:allReady,代码行数:58,代码来源:MessageEventVolunteersCommandHandlerTests.cs


示例10: UpdateExistingTaskSuccessfully

        public async Task UpdateExistingTaskSuccessfully()
        {
            var @event = new Event { Id = 3 };
            var organization = new Organization { Id = 4 };
            var task = new AllReadyTask
            {
                Id = 2,
                Name = "TaskName",
                Description = "TaskDescription",
                Event = @event,
                Organization = organization,
                StartDateTime = DateTimeOffset.Now,
                EndDateTime = DateTimeOffset.Now,
                NumberOfVolunteersRequired = 5,
                RequiredSkills = new List<TaskSkill> { new TaskSkill { SkillId = 5, Skill = new Skill { Id = 5, Name = "SkillName", Description = "SkillDescription" } } }
            };

            Context.Database.EnsureDeleted();
            Context.Events.Add(@event);
            Context.Organizations.Add(organization);
            Context.Tasks.Add(task);
            Context.SaveChanges();

            var message = new EditTaskCommandAsync
            {
                Task = new EditViewModel
                {
                    Id = task.Id,
                    Name = "TaskNameUpdated",
                    Description = "TaskDescriptionUpdated",
                    EventId = @event.Id,
                    OrganizationId = organization.Id,
                    TimeZoneId = "Central Standard Time",
                    StartDateTime = DateTimeOffset.Now.AddDays(1),
                    EndDateTime = DateTimeOffset.Now.AddDays(2),
                    NumberOfVolunteersRequired = 6,
                    RequiredSkills = new List<TaskSkill> { new TaskSkill { SkillId = 6, Skill = new Skill { Id = 6, Name = "SkillNameOnMessage", Description = "SkillDescriptionOnMessage" } } }
                }
            };

            var sut = new EditTaskCommandHandlerAsync(Context);
            var taskId = await sut.Handle(message);
            var result = Context.Tasks.Single(x => x.Id == taskId);

            //can't test start and end date as they're tied to static classes
            Assert.Equal(taskId, message.Task.Id);
            Assert.Equal(result.Name, message.Task.Name);
            Assert.Equal(result.Description, message.Task.Description);
            Assert.Equal(result.Event, @event);
            Assert.Equal(result.Organization, organization);
            Assert.Equal(result.NumberOfVolunteersRequired, message.Task.NumberOfVolunteersRequired);
            Assert.Equal(result.IsLimitVolunteers, @event.IsLimitVolunteers);
            Assert.Equal(result.IsAllowWaitList, @event.IsAllowWaitList);
            Assert.Equal(result.RequiredSkills, message.Task.RequiredSkills);
        }
开发者ID:mheggeseth,项目名称:allReady,代码行数:55,代码来源:EditTaskCommandHandlerAsyncShould.cs


示例11:

        Task IAllReadyDataAccess.UpdateOrganization(Organization value)
        {
            var organization = _dbContext.Organizations.SingleOrDefault(c => c.Id == value.Id);

            if (organization != null)
            {
                _dbContext.Organizations.Update(organization);
                return _dbContext.SaveChangesAsync();
            }
            return null;
        }
开发者ID:ultrabert,项目名称:allReady,代码行数:11,代码来源:AllReadyDataAccessEF7.Organization.cs


示例12: ReturnOrganziationNameWhenThereIsAMatchingOrganizationId

        public async Task ReturnOrganziationNameWhenThereIsAMatchingOrganizationId()
        {
            var organization = new Organization { Id = 1, Name = "OrganizationName" };
            var context = Context;
            context.Organizations.Add(organization);
            context.SaveChanges();

            var sut = new OrganizationNameQueryHandler(context);
            var result = await sut.Handle(new OrganizationNameQuery { Id = organization.Id });

            Assert.Equal(result, organization.Name);
        }
开发者ID:nicolastarzia,项目名称:allReady,代码行数:12,代码来源:OrganizationNameQueryHandlerShould.cs


示例13: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();

            var seattlePostalCode = new PostalCodeGeo { City = "Seattle", PostalCode = "98117", State = "WA" };
            var seattle = new Location
            {
                Id = 1,
                Address1 = "123 Main Street",
                Address2 = "Unit 2",
                City = "Seattle",
                PostalCode = seattlePostalCode,
                Country = "USA",
                State = "WA",
                Name = "Organizer name",
                PhoneNumber = "555-555-5555"                            
            };
         

            var htb = new Organization
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };
            htb.Campaigns.Add(firePrev);

            var queenAnne = new Event
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>()
            };

            context.PostalCodes.Add(seattlePostalCode);
            context.Locations.Add(seattle);
            context.Organizations.Add(htb);
            context.Events.Add(queenAnne);
            context.SaveChanges();
        }
开发者ID:pottereric,项目名称:allReady,代码行数:52,代码来源:EventDetailQueryHandlerTests.cs


示例14: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            var htb = new Organization()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Activity()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<ActivitySkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            context.Users.Add(user2);

            htb.Campaigns.Add(firePrev);            
            context.Organizations.Add(htb);
            context.Activities.Add(queenAnne);

            var activitySignups = new List<ActivitySignup>
            {
                new ActivitySignup { Activity = queenAnne, User = user1, SignupDateTime = DateTime.UtcNow },
                new ActivitySignup { Activity = queenAnne, User = user2, SignupDateTime = DateTime.UtcNow }
            };

            context.ActivitySignup.AddRange(activitySignups);
            context.SaveChanges();
        }
开发者ID:ultrabert,项目名称:allReady,代码行数:50,代码来源:MessageVolunteers.cs


示例15: LoadTestData

        protected override void LoadTestData()
        {
            var htb = new Organization
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };
            htb.Campaigns.Add(firePrev);

            var queenAnne = new Event
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>(),
                EventType = EventType.Itinerary
            };

            var itinerary = new Itinerary
            {
                Event = queenAnne,
                Name = "1st Itinerary",
                Id = 1,
                Date = new DateTime(2016, 07, 01)
            };

            var taskSignUp = new TaskSignup { Id = 1, ItineraryId = 2, TaskId = 1 };

            Context.Organizations.Add(htb);
            Context.Campaigns.Add(firePrev);
            Context.Events.Add(queenAnne);
            Context.Itineraries.Add(itinerary);
            Context.TaskSignups.Add(taskSignUp);

            Context.SaveChanges();
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:48,代码来源:AddTeamMemberCommandHandlerShould.cs


示例16: OrganizationViewModel

        public OrganizationViewModel(Organization organization)
        {
            Id = organization.Id;
            Name = organization.Name;
            LogoUrl = organization.LogoUrl;
            WebUrl = organization.WebUrl;

            if (organization.Campaigns != null)
            {
                Campaigns = organization.Campaigns.ToViewModel().ToList();
            }
            else
            {
                Campaigns = new List<CampaignViewModel>();
            }
        }
开发者ID:weiplanet,项目名称:allReady,代码行数:16,代码来源:OrganizationViewModel.cs


示例17: LoadTestData

        protected override void LoadTestData()
        {
            var organization = new Organization
            {
                Id = 1,
                Name = "Org 1",
                WebUrl = "http://www.org1.org",
                LogoUrl = "http://www.org1Logo.org",
                Location = new Location { Id = 1, Country="USA" },
                Campaigns = new List<Campaign>(),
                Users = new List<ApplicationUser>(),
                OrganizationContacts = new List<OrganizationContact>()
            };
            var campaign = new Campaign
            {
                Id = 1,
                Name = "Campaign 1",
                ManagingOrganizationId = 1
            };
            var user = new ApplicationUser
            {
                Id = Guid.NewGuid().ToString(),
                Email = "[email protected]"

            };
            var organizationContact = new OrganizationContact
            {
                OrganizationId = 1,
                ContactType = (int)ContactTypes.Primary,
                Contact = new Contact
                {
                    Id = 1,
                    Email = "[email protected]",
                    FirstName = "firstName",
                    LastName = "lastName",
                    PhoneNumber = "123"
                }
            };

            Context.Organizations.Add(organization);
            Context.Campaigns.Add(campaign);
            Context.Users.Add(user);
            Context.OrganizationContacts.Add(organizationContact);
            Context.SaveChanges();
        }
开发者ID:nicolastarzia,项目名称:allReady,代码行数:45,代码来源:OrganizationDetailQueryHandlerShould.cs


示例18: ToEditModel_Organization

        /// <summary>
        /// Creates an OrganizationEditModel from an existing Organization 
        /// </summary>
        /// <param name="organization">An Organization that will be supply the initial values for editing.</param>
        /// <returns>An OrganizationEditModel that can be used to capture the fields for an Organization
        /// and it's location and primary contact built from values from the supplied organization. </returns>
        public static OrganizationEditModel ToEditModel_Organization(Organization organization)
        {
            OrganizationEditModel ret = new OrganizationEditModel()
            {
                Id = organization.Id,
                Name = organization.Name,
                Location = organization.Location.ToEditModel(),
                LogoUrl = organization.LogoUrl,
                WebUrl = organization.WebUrl,
                PrivacyPolicy = organization.PrivacyPolicy
            };
            if (organization.OrganizationContacts?.SingleOrDefault(tc => tc.ContactType == (int)ContactTypes.Primary)?.Contact != null)
            {
                ret = (OrganizationEditModel)organization.OrganizationContacts?.SingleOrDefault(tc => tc.ContactType == (int)ContactTypes.Primary)?.Contact.ToEditModel(ret);
            }

            return ret;
        }
开发者ID:pottereric,项目名称:allReady,代码行数:24,代码来源:OrganizationEditCommandHandlerTests.cs


示例19: OrganizationViewModel

        public OrganizationViewModel(Organization organization)
        {
            Id = organization.Id;
            Name = organization.Name;
            LogoUrl = organization.LogoUrl;
            WebUrl = organization.WebUrl;

            if (organization.Campaigns != null)
            {
                Campaigns = organization.Campaigns.ToViewModel().ToList();
            }
            else
            {
                Campaigns = new List<CampaignViewModel>();
            }

            HasPrivacyPolicy = !string.IsNullOrEmpty(organization.PrivacyPolicy);
        }
开发者ID:mmoore99,项目名称:allReady,代码行数:18,代码来源:OrganizationViewModel.cs


示例20: LoadTestData

        protected override void LoadTestData()
        {
            var htb = new Organization
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign
            {
                Id = 1,
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };
            htb.Campaigns.Add(firePrev);
            Context.Organizations.Add(htb);
            Context.SaveChanges();
        }
开发者ID:gftrader,项目名称:allReady,代码行数:20,代码来源:DeleteCampaignCommandHandlerTests.cs



注:本文中的AllReady.Models.Organization类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WinShooterServerRemoting.Structs类代码示例发布时间:2022-05-24
下一篇:
C# Models.Event类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap