private Govbody AddGovbody(string name, GovLocation loc, string recordingsUrl = null) { Govbody gov = new Govbody(name, loc) { RecordingsUrl = recordingsUrl }; _context.Govbodies.Add(gov); _context.SaveChanges(); return(gov); }
public async Task <GovbodyDetails_Dto> Handle(GetGovbody_Query request, CancellationToken cancellationToken) { var result = new GovbodyDetails_Dto(); Govbody govbody = await _context.Govbodies .Where(l => l.Id == request.GovbodyId) .Include(l => l.ElectedOfficials) .Include(l => l.AppointedOfficials) .FirstOrDefaultAsync(); if (govbody == null) { return(null); } result = _mapper.Map <GovbodyDetails_Dto>(govbody); return(result); }
private void DoWork(Govbody govBody) { //List<ScheduledMeeting> scheduled = govBody.ScheduledMeetings; IReadOnlyCollection <ScheduledMeeting> scheduled = govBody.ScheduledMeetings; // Get all meetings that have should occured IEnumerable <ScheduledMeeting> results = scheduled.Where( s => s.Date < (DateTime.Now)); foreach (ScheduledMeeting result in results) { DateTime actualDate; SourceType type; // Do actual retrieval string retrievedFile = retrieveNewFiles.RetrieveFile(govBody, result.Date, out actualDate, out type); // create a work folder for this meeting string workfolderName = govBody.LongName + "_" + actualDate.ToString("yyyy-MM-dd"); string workFolderPath = Path.Combine(config.DatafilesPath, workfolderName); string extension = Path.GetExtension(retrievedFile); string sourceFilename = "source" + extension; string sourceFilePath = Path.Combine(workFolderPath, sourceFilename); // Create the meeting record Meeting meeting = new Meeting(actualDate, type, sourceFilename); meeting.WorkStatus = WorkStatus.Received; meeting.Approved = false; TxFileManager fileMgr = new TxFileManager(); using (TransactionScope scope = new TransactionScope()) { Directory.CreateDirectory(workFolderPath); fileMgr.Copy(retrievedFile, sourceFilePath, true); //// TODO - implement ////dBOperations.Add(meeting); ////dBOperations.WriteChanges(); scope.Complete(); } } }
private static void AddAppointedOfficials(List <AppointedOfficial> officials, Govbody loc) { foreach (AppointedOfficial official in officials) { official.GovbodyId = loc.Id; _context.AppointedOfficials.Add(official); } _context.SaveChanges(); }
public static void Seed() { using (_context = GetLocalDbProvider()) { // Check if the DB was already seeded. var query = from g in _context.GovLocations where g.Name == "United States" select g; var checkLoc = query.FirstOrDefault <GovLocation>(); if (checkLoc != null) { return; } GovLocation country = null; GovLocation state = null; // state or province GovLocation county = null; GovLocation local = null; Govbody council = null; List <ElectedOfficial> electedOfficials = null; List <AppointedOfficial> appointedOfficials = null; ////////////////// Little Falls, NJ USA //////////////////////////// country = AddLocation("United States", GovlocTypes.Country, null); state = AddLocation("New Jersey", GovlocTypes.StateOrProvince, country); county = AddLocation("Passaic County", GovlocTypes.County, state); AddGovbody("Board of Freeholders", county); local = AddLocation("Little Falls", GovlocTypes.Township, county, "https://www.youtube.com/channel/UCnXmZfXIxB9n_b6PMoh0kmA/videos"); council = AddGovbody("City Council", local); electedOfficials = new List <ElectedOfficial>() { new ElectedOfficial() { Name = "James Damiano", Title = "Mayor" }, new ElectedOfficial() { Name = "Anthony Sgobba", Title = "President, Councilman" }, new ElectedOfficial() { Name = "Albert Kahwaty", Title = "Councilman" }, new ElectedOfficial() { Name = "Christopher Vancheri", Title = "Councilman" }, new ElectedOfficial() { Name = "Christine Hablitz", Title = "Councilwoman" }, new ElectedOfficial() { Name = "Tanya Seber", Title = "Councilwoman" } }; AddElectedOfficials(electedOfficials, council); appointedOfficials = new List <AppointedOfficial>() { new AppointedOfficial() { Name = "Charles Cuccia", Title = "Township Administrator" }, new AppointedOfficial() { Name = "Cynthia Kraus, RMC", Title = "Township Clerk" }, new AppointedOfficial() { Name = "Steven Post", Title = "Chief of Police" }, new AppointedOfficial() { Name = "Richard Hamilton", Title = "Tax Assessor" }, new AppointedOfficial() { Name = "James Di Maria", Title = "Construction Official" }, new AppointedOfficial() { Name = "Charles Cuccia", Title = "CMFO/Treasurer" }, new AppointedOfficial() { Name = "John E. Biegel III", Title = "Health Officer" }, new AppointedOfficial() { Name = "Ronald Campbell", Title = "DPW Superintendent" }, }; AddAppointedOfficials(appointedOfficials, council); AddGovbody("Zoning Board", local); /////////////////// City of Whittlesea & City of Greater Bebdingo, Victoria, AU /////////////////// state = AddLocation("Pennsylvania", GovlocTypes.StateOrProvince, country); county = AddLocation("Philadelphia County", GovlocTypes.County, state); local = AddLocation("Philadelphia", GovlocTypes.City, county); AddGovbody("City Council", local); country = AddLocation("Australia", GovlocTypes.Country, null); state = AddLocation("Victoria", GovlocTypes.StateOrProvince, country); local = AddLocation("City of Whittlesea", GovlocTypes.City, state); AddGovbody("City Council", local); local = AddLocation("City of Greater Bebdingo", GovlocTypes.City, state, "https://www.youtube.com/user/CityOfGreaterBendigo/videos"); AddGovbody("City Council", local); } }
public void Seed() { // Check if the DB was already seeded. var query = from g in _context.GovLocations where g.Name == "United States" select g; var checkLoc = query.FirstOrDefault <GovLocation>(); if (checkLoc != null) { return; } GovLocation country = null; GovLocation state = null; // state or province GovLocation county = null; GovLocation local = null; Govbody council = null; List <ElectedOfficial> electedOfficials = null; List <AppointedOfficial> appointedOfficials = null; ////////////////// Little Falls, NJ USA //////////////////////////// country = AddLocation("United States", GovlocTypes.Country, null); state = AddLocation("New Jersey", GovlocTypes.StateOrProvince, country); county = AddLocation("Passaic County", GovlocTypes.County, state); AddGovbody("Board of Freeholders", county); local = AddLocation("Little Falls", GovlocTypes.Township, county, "https://www.lfnj.com/"); council = AddGovbody("City Council", local, "https://www.youtube.com/channel/UCnXmZfXIxB9n_b6PMoh0kmA/videos"); electedOfficials = new List <ElectedOfficial>() { new ElectedOfficial() { Name = "James Damiano", Title = "Mayor" }, new ElectedOfficial() { Name = "Anthony Sgobba", Title = "President, Councilman" }, new ElectedOfficial() { Name = "Albert Kahwaty", Title = "Councilman" }, new ElectedOfficial() { Name = "Christopher Vancheri", Title = "Councilman" }, new ElectedOfficial() { Name = "Christine Hablitz", Title = "Councilwoman" }, new ElectedOfficial() { Name = "Tanya Seber", Title = "Councilwoman" } }; AddElectedOfficials(electedOfficials, council); appointedOfficials = new List <AppointedOfficial>() { new AppointedOfficial() { Name = "Charles Cuccia", Title = "Township Administrator" }, new AppointedOfficial() { Name = "Cynthia Kraus, RMC", Title = "Township Clerk" }, new AppointedOfficial() { Name = "Steven Post", Title = "Chief of Police" }, new AppointedOfficial() { Name = "Richard Hamilton", Title = "Tax Assessor" }, new AppointedOfficial() { Name = "James Di Maria", Title = "Construction Official" }, new AppointedOfficial() { Name = "Charles Cuccia", Title = "CMFO/Treasurer" }, new AppointedOfficial() { Name = "John E. Biegel III", Title = "Health Officer" }, new AppointedOfficial() { Name = "Ronald Campbell", Title = "DPW Superintendent" }, }; AddAppointedOfficials(appointedOfficials, council); AddGovbody("Zoning Board", local); ////////////////// Boothbay Harbor, ME USA //////////////////////////// country = AddLocation("United States", GovlocTypes.Country, null); state = AddLocation("Maine", GovlocTypes.StateOrProvince, country); county = AddLocation("Lincoln County", GovlocTypes.County, state); local = AddLocation("Boothbay Harbor", GovlocTypes.Township, county, "https://www.boothbayharbor.org/"); council = AddGovbody("Board of Selectmen", local, "https://www.boothbaytv.com/on-demand"); electedOfficials = new List <ElectedOfficial>() { new ElectedOfficial() { Name = "Wendy Wolf", Title = "Selectperson" }, new ElectedOfficial() { Name = "Michael Tomko", Title = "Chair" }, new ElectedOfficial() { Name = "Denise Griffin ", Title = "Councilman" }, new ElectedOfficial() { Name = "Tricia Warren ", Title = "Vice Chair" } }; AddElectedOfficials(electedOfficials, council); appointedOfficials = new List <AppointedOfficial>() { new AppointedOfficial() { Name = "Michelle Farnham", Title = "Town Clerk" }, new AppointedOfficial() { Name = "Robert Hasch", Title = "Police Chief" }, new AppointedOfficial() { Name = "Julia Latter", Title = "Town Manager" }, new AppointedOfficial() { Name = "Jeff Lowell", Title = "Harbor Master" }, new AppointedOfficial() { Name = "Geoff Smith", Title = "Code Enforcement Officer" } }; AddAppointedOfficials(appointedOfficials, council); AddGovbody("Planning Board", local); /////////////////// City of Whittlesea & City of Greater Bebdingo, Victoria, AU /////////////////// state = AddLocation("Pennsylvania", GovlocTypes.StateOrProvince, country); county = AddLocation("Philadelphia County", GovlocTypes.County, state); local = AddLocation("Philadelphia", GovlocTypes.City, county); AddGovbody("City Council", local); country = AddLocation("Australia", GovlocTypes.Country, null); state = AddLocation("Victoria", GovlocTypes.StateOrProvince, country); local = AddLocation("City of Whittlesea", GovlocTypes.City, state); AddGovbody("City Council", local); local = AddLocation("City of Greater Bebdingo", GovlocTypes.City, state, "https://www.bendigo.vic.gov.au/"); AddGovbody("City Council", local, "https://www.youtube.com/user/CityOfGreaterBendigo/videos"); }