diff --git a/.gitignore b/.gitignore index ee9c7c4..8d4d72c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,14 @@ bin/ obj/ packages/ +*.user PublishProfiles/ # macOS vomit .DS_Store # IntelliJ/Rider files -.idea/ \ No newline at end of file +.idea/ + +# Other +Uploads/ \ No newline at end of file diff --git a/assets/DataModel_KD.png b/assets/DataModel_KD.png index 034a973..282cda0 100755 Binary files a/assets/DataModel_KD.png and b/assets/DataModel_KD.png differ diff --git a/assets/Software Architectuur Diagram Verbeterd.png b/assets/Software Architectuur Diagram Verbeterd.png new file mode 100644 index 0000000..05aad16 Binary files /dev/null and b/assets/Software Architectuur Diagram Verbeterd.png differ diff --git a/assets/Software Architectuur Diagram.png b/assets/Software Architectuur Diagram.png deleted file mode 100644 index ecaa7ce..0000000 Binary files a/assets/Software Architectuur Diagram.png and /dev/null differ diff --git a/src/DomainServices/DomainServices.csproj b/src/DomainServices/DomainServices.csproj index 50a19f0..6596b7d 100644 --- a/src/DomainServices/DomainServices.csproj +++ b/src/DomainServices/DomainServices.csproj @@ -20,6 +20,7 @@ + diff --git a/src/DomainServices/Enums/FestispecPaths.cs b/src/DomainServices/Enums/FestispecPaths.cs index 1aae1c1..6bb6c6d 100644 --- a/src/DomainServices/Enums/FestispecPaths.cs +++ b/src/DomainServices/Enums/FestispecPaths.cs @@ -1,8 +1,10 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.IO; namespace Festispec.DomainServices.Enums { + [ExcludeFromCodeCoverage] public static class FestispecPaths { // base %AppData% path. diff --git a/src/DomainServices/Factories/AnswerFactory.cs b/src/DomainServices/Factories/AnswerFactory.cs new file mode 100644 index 0000000..65d26e8 --- /dev/null +++ b/src/DomainServices/Factories/AnswerFactory.cs @@ -0,0 +1,27 @@ +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using Festispec.Models.Answers; +using Festispec.Models.Questions; + +namespace Festispec.DomainServices.Factories +{ + [ExcludeFromCodeCoverage] + public class AnswerFactory + { + public Answer GetAnswer(Question question) + { + return question switch + { + NumericQuestion _ => new NumericAnswer(), + RatingQuestion _ => new NumericAnswer(), + MultipleChoiceQuestion _ => new MultipleChoiceAnswer(), + StringQuestion _ => new StringAnswer(), + DrawQuestion _ => new FileAnswer(), + UploadPictureQuestion _ => new FileAnswer(), + _ => throw new Exception() + }; + + } + } +} \ No newline at end of file diff --git a/src/DomainServices/Factories/GraphSelectorFactory.cs b/src/DomainServices/Factories/GraphSelectorFactory.cs index a10572b..63d06ac 100644 --- a/src/DomainServices/Factories/GraphSelectorFactory.cs +++ b/src/DomainServices/Factories/GraphSelectorFactory.cs @@ -1,10 +1,12 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Festispec.Models; using Festispec.Models.GraphConverters; using Festispec.Models.Interfaces; namespace Festispec.DomainServices.Factories { + [ExcludeFromCodeCoverage] public class GraphSelectorFactory { private readonly Dictionary _converters; diff --git a/src/DomainServices/Factories/QuestionFactory.cs b/src/DomainServices/Factories/QuestionFactory.cs index d52cb73..153c740 100644 --- a/src/DomainServices/Factories/QuestionFactory.cs +++ b/src/DomainServices/Factories/QuestionFactory.cs @@ -1,8 +1,10 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Festispec.Models.Questions; namespace Festispec.DomainServices.Factories { + [ExcludeFromCodeCoverage] public class QuestionFactory { public QuestionFactory() diff --git a/src/DomainServices/Interfaces/IAvailabilityService.cs b/src/DomainServices/Interfaces/IAvailabilityService.cs index 47a0f46..826148d 100644 --- a/src/DomainServices/Interfaces/IAvailabilityService.cs +++ b/src/DomainServices/Interfaces/IAvailabilityService.cs @@ -8,14 +8,9 @@ namespace Festispec.DomainServices.Interfaces { public interface IAvailabilityService { - Task AddUnavailabilityEntireDay(int employeeId, DateTime date, string reason); - - Task RemoveUnavailablity(int availabilityId); - - Task SaveChanges(); - + Task AddUnavailabilityEntireDay(int employeeId, DateTime date, string reason); + Task RemoveUnavailability(int availabilityId); Availability GetUnavailabilityForDay(int employeeId, DateTime date); - - Task> GetUnavailabilitiesForFuture(int employeeId, DateTime startDate); + Task> GetUnavailabilityForFuture(int employeeId, DateTime startDate); } } diff --git a/src/DomainServices/Interfaces/ICustomerService.cs b/src/DomainServices/Interfaces/ICustomerService.cs index 8c4ca48..120200a 100755 --- a/src/DomainServices/Interfaces/ICustomerService.cs +++ b/src/DomainServices/Interfaces/ICustomerService.cs @@ -7,18 +7,12 @@ namespace Festispec.DomainServices.Interfaces public interface ICustomerService : ISyncable { List GetAllCustomers(); - Customer GetCustomer(int customerId); Task GetCustomerAsync(int customerId); - Task RemoveCustomerAsync(int customerId); - Task CreateCustomerAsync(string name, int kvkNr, Address address, ContactDetails contactDetails); Task CreateCustomerAsync(Customer customer); - Task UpdateCustomerAsync(Customer customer); - - Task SaveChangesAsync(); public bool CanDeleteCustomer(Customer customer); } } \ No newline at end of file diff --git a/src/DomainServices/Interfaces/IEmployeeService.cs b/src/DomainServices/Interfaces/IEmployeeService.cs index 965af18..52505da 100644 --- a/src/DomainServices/Interfaces/IEmployeeService.cs +++ b/src/DomainServices/Interfaces/IEmployeeService.cs @@ -7,22 +7,13 @@ namespace Festispec.DomainServices.Interfaces public interface IEmployeeService : ISyncable { List GetAllEmployees(); - List GetAllEmployeesActiveAndNonActive(); - Employee GetEmployee(int employeeId); Task GetEmployeeAsync(int employeeId); - Task RemoveEmployeeAsync(int employeeId); - Task CreateEmployeeAsync(FullName name, string iban, string username, string password, Role role, Address address, ContactDetails contactDetails); - - Task CreateEmployeeAsync(Employee employee); - Task UpdateEmployee(Employee employee); - - Task SaveChangesAsync(); bool CanRemoveEmployee(Employee employee); Account GetAccountForEmployee(int employeeId); diff --git a/src/DomainServices/Interfaces/IExampleService.cs b/src/DomainServices/Interfaces/IExampleService.cs deleted file mode 100644 index 76b4262..0000000 --- a/src/DomainServices/Interfaces/IExampleService.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Festispec.DomainServices.Interfaces -{ - public interface IExampleService - { - bool ReturnTrue(); - bool ReturnFalse(); - string ReturnString(); - } -} \ No newline at end of file diff --git a/src/DomainServices/Interfaces/IFestivalService.cs b/src/DomainServices/Interfaces/IFestivalService.cs index 57153cf..b347308 100644 --- a/src/DomainServices/Interfaces/IFestivalService.cs +++ b/src/DomainServices/Interfaces/IFestivalService.cs @@ -7,7 +7,6 @@ namespace Festispec.DomainServices.Interfaces public interface IFestivalService : ISyncable { Task CreateFestival(Festival festival, int customerId); - Task GetFestivalAsync(int festivalId); Festival GetFestival(int festivalId); ICollection GetFestivals(); Task UpdateFestival(Festival festival); diff --git a/src/DomainServices/Interfaces/IInspectionService.cs b/src/DomainServices/Interfaces/IInspectionService.cs index 1a5fad5..65726bf 100644 --- a/src/DomainServices/Interfaces/IInspectionService.cs +++ b/src/DomainServices/Interfaces/IInspectionService.cs @@ -26,8 +26,10 @@ int employeeId ); Task RemoveInspection(int plannedInspectionId, string cancellationReason); - Task SaveChanges(); Task GetFestivalAsync(int festivalId); - Task ProcessPlannedInspections(IEnumerable plannedInspections); + Task ProcessPlannedInspections(IEnumerable plannedInspections, + Questionnaire questionnaire, string instructions); } + + } \ No newline at end of file diff --git a/src/DomainServices/Interfaces/IQuestionService.cs b/src/DomainServices/Interfaces/IQuestionService.cs deleted file mode 100644 index 54f2696..0000000 --- a/src/DomainServices/Interfaces/IQuestionService.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Threading.Tasks; -using Festispec.Models; - -namespace Festispec.DomainServices.Interfaces -{ - public interface IQuestionService - { - Task GetQuestionaire(int id); - } -} \ No newline at end of file diff --git a/src/DomainServices/Interfaces/IQuestionnaireService.cs b/src/DomainServices/Interfaces/IQuestionnaireService.cs index 0ebbc93..5becf29 100644 --- a/src/DomainServices/Interfaces/IQuestionnaireService.cs +++ b/src/DomainServices/Interfaces/IQuestionnaireService.cs @@ -17,12 +17,8 @@ public interface IQuestionnaireService : ISaveable, ISyncable Task CopyQuestionnaire(int questionnaireId, string questionnaireName); Task GetQuestion(int questionId); Task CreateAnswer(Answer answer); - void Save(); - List GetQuestionsFromQuestionnaire(int questionnaireId); - List GetAnswers(); - - + Task GetAnswer(int id) where TAnswer : Answer; Task> GetPlannedInspections(int employeeId); Task GetPlannedInspection(int plannedInspectionId); } diff --git a/src/DomainServices/Interfaces/ISicknessService.cs b/src/DomainServices/Interfaces/ISicknessService.cs index 03f5142..fc801df 100644 --- a/src/DomainServices/Interfaces/ISicknessService.cs +++ b/src/DomainServices/Interfaces/ISicknessService.cs @@ -8,8 +8,8 @@ namespace Festispec.DomainServices.Interfaces { public interface ISicknessService { - Task AddAbsense(int employeeId, string reason, DateTime? endDate); - Task EndAbsense(int employeeId); + Task AddAbsence(int employeeId, string reason, DateTime? endDate); + Task EndAbsence(int employeeId); bool IsSick(int employeeId); } diff --git a/src/DomainServices/Interfaces/ISyncService.cs b/src/DomainServices/Interfaces/ISyncService.cs index d75cd54..f401797 100644 --- a/src/DomainServices/Interfaces/ISyncService.cs +++ b/src/DomainServices/Interfaces/ISyncService.cs @@ -16,8 +16,7 @@ public interface ISyncService where T : Entity void AddEntities(IEnumerable entities); void SaveChanges(); - void SaveChangesAsync(); - + FestispecContext GetSyncContext(); void Flush(); } diff --git a/src/DomainServices/Services/AddressService.cs b/src/DomainServices/Services/AddressService.cs index de643cc..9062b57 100644 --- a/src/DomainServices/Services/AddressService.cs +++ b/src/DomainServices/Services/AddressService.cs @@ -21,8 +21,7 @@ public async Task
SaveAddress(Address address) if (!address.Validate()) throw new InvalidAddressException(); - Address existing = await _db.Addresses.FirstOrDefaultAsync(a => - a.Latitude != 0 && a.Latitude == address.Latitude && a.Longitude != 0 && a.Longitude == a.Longitude); + Address existing = await _db.Addresses.FirstOrDefaultAsync(a => a.Latitude == address.Latitude && a.Longitude == address.Longitude); if (existing != null) return existing; @@ -36,9 +35,9 @@ public async Task
SaveAddress(Address address) public async Task RemoveAddress(Address address) { var existing = 0; - existing += await _db.Festivals.Include(f => f.Address).CountAsync(a => a.Address.Id == address.Id); - existing += await _db.Employees.Include(e => e.Address).CountAsync(e => e.Address.Id == address.Id); - existing += await _db.Customers.Include(c => c.Address).CountAsync(c => c.Address.Id == address.Id); + existing += await _db.Festivals.Include(f => f.Address).CountAsync(a => a.Address.Id == address.Id && a.Address.Latitude == address.Latitude && a.Address.Longitude == address.Longitude); + existing += await _db.Employees.Include(e => e.Address).CountAsync(e => e.Address.Id == address.Id && e.Address.Latitude == address.Latitude && e.Address.Longitude == address.Longitude); + existing += await _db.Customers.Include(c => c.Address).CountAsync(c => c.Address.Id == address.Id && c.Address.Latitude == address.Latitude && c.Address.Longitude == address.Longitude); if (existing == 0) _db.Addresses.Remove(address); @@ -46,4 +45,4 @@ public async Task RemoveAddress(Address address) await _db.SaveChangesAsync(); } } -} \ No newline at end of file +} diff --git a/src/DomainServices/Services/AuthenticationService.cs b/src/DomainServices/Services/AuthenticationService.cs index 6ee0050..b81be18 100644 --- a/src/DomainServices/Services/AuthenticationService.cs +++ b/src/DomainServices/Services/AuthenticationService.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Festispec.Models.EntityMapping; using System.Data.Entity; +using System.Diagnostics.CodeAnalysis; namespace Festispec.DomainServices.Services { @@ -13,7 +14,8 @@ public class AuthenticationService : IAuthenticationService private readonly FestispecContext _db; private readonly ISyncService _syncService; - public Account LoggedIn { get; private set; } + [ExcludeFromCodeCoverage] + private Account LoggedIn { get; set; } public AuthenticationService(FestispecContext db, ISyncService syncService) { @@ -23,7 +25,7 @@ public AuthenticationService(FestispecContext db, ISyncService syncServ public Account AssembleAccount(string username, string password, Role requiredRole) { - Account existing = _db.Accounts.FirstOrDefault(x => x.Username == username); + var existing = _db.Accounts.FirstOrDefault(x => x.Username == username); if (existing != null) throw new EntityExistsException(); @@ -43,7 +45,7 @@ public Account AssembleAccount(string username, string password, Role requiredRo public Account Login(string username, string password, Role requiredRole) { - Account account = _db.Accounts.FirstOrDefault(x => x.Username == username); + var account = _db.Accounts.FirstOrDefault(x => x.Username == username); if (account == null || !BCrypt.Net.BCrypt.Verify(password, account.Password)) throw new AuthenticationException("Username or password are incorrect"); @@ -59,7 +61,7 @@ public Account Login(string username, string password, Role requiredRole) public async Task ChangePassword(string username, string password, string newPassword) { - Account account = _db.Accounts.FirstOrDefault(x => x.Username == username); + var account = _db.Accounts.FirstOrDefault(x => x.Username == username); if (account == null || !BCrypt.Net.BCrypt.Verify(password, account.Password)) throw new AuthenticationException("Username or password are incorrect"); @@ -69,14 +71,15 @@ public async Task ChangePassword(string username, string password, string newPas await _db.SaveChangesAsync(); } + [ExcludeFromCodeCoverage] public void Sync() { if (LoggedIn == null) return; - FestispecContext ctx = _syncService.GetSyncContext(); + var ctx = _syncService.GetSyncContext(); - Account account = ctx.Accounts.Include(a => a.Employee).First(a => a.Id == LoggedIn.Id); + var account = ctx.Accounts.Include(a => a.Employee).First(a => a.Id == LoggedIn.Id); _syncService.Flush(); _syncService.AddEntity(account); diff --git a/src/DomainServices/Services/AvailabilityService.cs b/src/DomainServices/Services/AvailabilityService.cs index 52ac867..f485ea2 100644 --- a/src/DomainServices/Services/AvailabilityService.cs +++ b/src/DomainServices/Services/AvailabilityService.cs @@ -1,14 +1,12 @@ -using Festispec.DomainServices.Interfaces; -using Festispec.Models; -using Festispec.Models.EntityMapping; -using Festispec.Models.Exception; -using System; +using System; using System.Collections.Generic; using System.Data.Entity; -using System.Data.Entity.Core.Objects; using System.Linq; -using System.Text; using System.Threading.Tasks; +using Festispec.DomainServices.Interfaces; +using Festispec.Models; +using Festispec.Models.EntityMapping; +using Festispec.Models.Exception; namespace Festispec.DomainServices.Services { @@ -28,7 +26,7 @@ public async Task AddUnavailabilityEntireDay(int employeeId, DateT var employee = _db.Employees.FirstOrDefault(e => e.Id == employeeId); - var availability = new Availability() + var availability = new Availability { IsAvailable = false, Employee = employee, @@ -42,19 +40,20 @@ public async Task AddUnavailabilityEntireDay(int employeeId, DateT throw new InvalidDataException(); _db.PlannedEvents.Add(availability); - - if (await _db.SaveChangesAsync() == 0) - throw new NoRowsChangedException(); + await _db.SaveChangesAsync(); return availability; } public Availability GetUnavailabilityForDay(int employeeId, DateTime date) { - return _db.Availabilities.FirstOrDefault(a => a.Employee.Id == employeeId && EntityFunctions.TruncateTime(a.StartTime) == EntityFunctions.TruncateTime(date) && a.EventTitle == "Niet beschikbaar"); + return _db.Availabilities.FirstOrDefault( + a => a.Employee.Id == employeeId + && _db.TruncateTime(a.StartTime) == _db.TruncateTime(date) + && a.EventTitle == "Niet beschikbaar"); } - public async Task RemoveUnavailablity(int availabilityId) + public async Task RemoveUnavailability(int availabilityId) { var availability = _db.Availabilities.FirstOrDefault(a => a.Id == availabilityId); @@ -66,33 +65,32 @@ public async Task RemoveUnavailablity(int availabilityId) await _db.SaveChangesAsync(); } - public async Task SaveChanges() - { - await _db.SaveChangesAsync(); - } - - public async Task> GetUnavailabilitiesForFuture(int employeeId, DateTime startDate) + public async Task> GetUnavailabilityForFuture(int employeeId, DateTime startDate) { var list = await _db.Availabilities .OrderByDescending(c => c.EndTime) - .Where(c => c.StartTime > startDate && c.Employee.Id == employeeId && c.EventTitle == "Niet beschikbaar") + .Where(c => c.StartTime > startDate) + .Where(c => c.Employee.Id == employeeId) + .Where(c => c.EventTitle == "Niet beschikbaar") // This is really bad practice! .ToListAsync(); var dictionary = new Dictionary(); - foreach (Availability availability in list) + foreach (Availability availability in list.Where(availability => availability.EndTime != null)) { - foreach (DateTime day in EachDay(availability.StartTime, (DateTime)availability.EndTime)) - { - long epoch = (long)(day - new DateTime(1970, 1, 1)).TotalSeconds; - dictionary.Add(epoch, availability); - } + CalculateTimeFromEpoch(availability).ToList().ForEach(l => dictionary.Add(l, availability)); } return dictionary; } - public IEnumerable EachDay(DateTime from, DateTime thru) + private static IEnumerable EachDay(DateTime from, DateTime thru) { for (var day = from.Date; day.Date <= thru.Date; day = day.AddDays(1)) yield return day; } + + public static IEnumerable CalculateTimeFromEpoch(Availability availability) + { + return EachDay(availability.StartTime, (DateTime) availability.EndTime) + .Select(day => (long) (day - new DateTime(1970, 1, 1)).TotalSeconds); + } } } diff --git a/src/DomainServices/Services/CustomerService.cs b/src/DomainServices/Services/CustomerService.cs index 6a43c66..02262a8 100755 --- a/src/DomainServices/Services/CustomerService.cs +++ b/src/DomainServices/Services/CustomerService.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Data.Entity; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; @@ -22,10 +23,7 @@ public CustomerService(FestispecContext db, ISyncService syncService, _addressService = addressService; } - public List GetAllCustomers() - { - return _db.Customers.Include(c => c.Address).ToList(); - } + public List GetAllCustomers() => _db.Customers.Include(c => c.Address).ToList(); public async Task CreateCustomerAsync(string name, int kvkNr, Address address, ContactDetails contactDetails) @@ -57,8 +55,7 @@ public async Task CreateCustomerAsync(Customer customer) public async Task GetCustomerAsync(int customerId) { - Customer customer = await _db.Customers - .Include(c => c.ContactPersons) + var customer = await _db.Customers .Include(c => c.Festivals) .Include(c => c.Address) .FirstOrDefaultAsync(c => c.Id == customerId); @@ -71,8 +68,7 @@ public async Task GetCustomerAsync(int customerId) public Customer GetCustomer(int customerId) { - Customer customer = _db.Customers - .Include(c => c.ContactPersons) + var customer = _db.Customers .Include(c => c.Festivals) .Include(c => c.Address) .FirstOrDefault(c => c.Id == customerId); @@ -85,12 +81,11 @@ public Customer GetCustomer(int customerId) public async Task RemoveCustomerAsync(int customerId) { - Customer customer = await GetCustomerAsync(customerId); + var customer = await GetCustomerAsync(customerId); if (customer.Festivals?.Count > 0) throw new CustomerHasFestivalsException(); - _db.ContactPersons.RemoveRange(customer.ContactPersons); await _addressService.RemoveAddress(customer.Address); _db.Customers.Remove(customer); @@ -107,24 +102,17 @@ public async Task UpdateCustomerAsync(Customer customer) await SaveChangesAsync(); } - public async Task SaveChangesAsync() - { - return await _db.SaveChangesAsync(); - } + private async Task SaveChangesAsync() => await _db.SaveChangesAsync(); - public bool CanDeleteCustomer(Customer customer) - { - return customer.Festivals.Count == 0 - && customer.ContactPersons.Count == 0; - } + public bool CanDeleteCustomer(Customer customer) => customer.Festivals.Count == 0; + [ExcludeFromCodeCoverage] public void Sync() { - FestispecContext db = _syncService.GetSyncContext(); + var db = _syncService.GetSyncContext(); - List customers = db.Customers + var customers = db.Customers .Include(c => c.Address) - .Include(c => c.ContactPersons) .Include(c => c.Festivals).ToList(); _syncService.Flush(); diff --git a/src/DomainServices/Services/DbPollOfflineService.cs b/src/DomainServices/Services/DbPollOfflineService.cs index efe338e..707e39b 100644 --- a/src/DomainServices/Services/DbPollOfflineService.cs +++ b/src/DomainServices/Services/DbPollOfflineService.cs @@ -1,9 +1,11 @@ using System.Data.SqlClient; +using System.Diagnostics.CodeAnalysis; using Festispec.DomainServices.Interfaces; using Festispec.Models.EntityMapping; namespace Festispec.DomainServices.Services { + [ExcludeFromCodeCoverage] public class DbPollOfflineService : IOfflineService { public bool IsOnline { get; } diff --git a/src/DomainServices/Services/EmployeeService.cs b/src/DomainServices/Services/EmployeeService.cs index bf15712..fd999ff 100644 --- a/src/DomainServices/Services/EmployeeService.cs +++ b/src/DomainServices/Services/EmployeeService.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Data.Entity; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; @@ -40,7 +41,7 @@ public List GetAllEmployeesActiveAndNonActive() public async Task CreateEmployeeAsync(FullName name, string iban, string username, string password, Role role, Address address, ContactDetails contactDetails) { - Account account = _authenticationService.AssembleAccount(username, password, role); + var account = _authenticationService.AssembleAccount(username, password, role); var employee = new Employee { @@ -54,7 +55,7 @@ public async Task CreateEmployeeAsync(FullName name, string iban, stri return await CreateEmployeeAsync(employee); } - public async Task CreateEmployeeAsync(Employee employee) + private async Task CreateEmployeeAsync(Employee employee) { if (!employee.Validate()) throw new InvalidDataException(); @@ -70,7 +71,7 @@ public async Task CreateEmployeeAsync(Employee employee) public async Task GetEmployeeAsync(int employeeId) { - Employee employee = await _db.Employees + var employee = await _db.Employees .Include(e => e.Address) .FirstOrDefaultAsync(e => e.Id == employeeId); @@ -82,7 +83,7 @@ public async Task GetEmployeeAsync(int employeeId) public Employee GetEmployee(int employeeId) { - Employee employee = _db.Employees + var employee = _db.Employees .Include(e => e.Address) .FirstOrDefault(e => e.Id == employeeId); @@ -94,7 +95,7 @@ public Employee GetEmployee(int employeeId) public Account GetAccountForEmployee(int employeeId) { - Account account = _db.Accounts.FirstOrDefault(a => a.Id == employeeId); + var account = _db.Accounts.FirstOrDefault(a => a.Id == employeeId); if (account == null) throw new EntityNotFoundException(); @@ -109,7 +110,7 @@ public bool CanRemoveEmployee(Employee employee) public async Task RemoveEmployeeAsync(int employeeId) { - Employee employee = await GetEmployeeAsync(employeeId); + var employee = await GetEmployeeAsync(employeeId); if (employee.PlannedEvents.ToList().Count > 0) throw new EmployeeHasPlannedEventsException(); @@ -147,7 +148,7 @@ public async Task CreateCertificateAsync(Certificate certificate) public Certificate GetCertificate(int certificateId) { - Certificate certificate = _db.Certificates.FirstOrDefault(a => a.Id == certificateId); + var certificate = _db.Certificates.FirstOrDefault(a => a.Id == certificateId); if (certificate == null) throw new EntityNotFoundException(); @@ -157,7 +158,7 @@ public Certificate GetCertificate(int certificateId) public async Task RemoveCertificateAsync(int certificateId) { - Certificate certificate = GetCertificate(certificateId); + var certificate = GetCertificate(certificateId); _db.Certificates.Remove(certificate); @@ -171,11 +172,12 @@ public async Task SaveChangesAsync() return await _db.SaveChangesAsync(); } + [ExcludeFromCodeCoverage] public void Sync() { - FestispecContext db = _employeeSyncService.GetSyncContext(); + var db = _employeeSyncService.GetSyncContext(); - List employees = db.Employees + var employees = db.Employees .Include(e => e.Address) .Include(e => e.Certificates) .Include(e => e.Account).ToList(); diff --git a/src/DomainServices/Services/ExampleService.cs b/src/DomainServices/Services/ExampleService.cs deleted file mode 100644 index d366f0c..0000000 --- a/src/DomainServices/Services/ExampleService.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using Festispec.DomainServices.Interfaces; - -namespace Festispec.DomainServices.Services -{ - public class ExampleService : IExampleService - { - public bool ReturnTrue() - { - return true; - } - - public bool ReturnFalse() - { - return false; - } - - public string ReturnString() - { - return $"Test Command {new Random().Next(1, 1000)}"; - } - } -} \ No newline at end of file diff --git a/src/DomainServices/Services/FestivalService.cs b/src/DomainServices/Services/FestivalService.cs index 0d57088..b5c78d7 100644 --- a/src/DomainServices/Services/FestivalService.cs +++ b/src/DomainServices/Services/FestivalService.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Data.Entity; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; @@ -43,13 +44,14 @@ public async Task CreateFestival(Festival festival, int customerId) return festival; } - public async Task GetFestivalAsync(int festivalId) + private async Task GetFestivalAsync(int festivalId) { - Festival festival = await _db.Festivals + var festival = await _db.Festivals .Include(f => f.Questionnaires) .Include(f => f.Questionnaires.Select(q => q.Questions.Select(qe => qe.Answers))) .Include(f => f.PlannedInspections) .Include(f => f.Address) + .Include(f => f.Customer) .FirstOrDefaultAsync(f => f.Id == festivalId); if (festival == null) @@ -60,10 +62,11 @@ public async Task GetFestivalAsync(int festivalId) public Festival GetFestival(int festivalId) { - Festival festival = _db.Festivals + var festival = _db.Festivals .Include(f => f.Questionnaires) .Include(f => f.PlannedInspections) .Include(f => f.Address) + .Include(f => f.Customer) .FirstOrDefault(f => f.Id == festivalId); if (festival == null) @@ -94,7 +97,7 @@ public async Task UpdateFestival(Festival festival) public async Task RemoveFestival(int festivalId) { - Festival festival = await GetFestivalAsync(festivalId); + var festival = await GetFestivalAsync(festivalId); if (festival.Questionnaires.Count > 0) throw new FestivalHasQuestionnairesException(); @@ -105,11 +108,12 @@ public async Task RemoveFestival(int festivalId) await _db.SaveChangesAsync(); } + [ExcludeFromCodeCoverage] public void Sync() { - FestispecContext db = _syncService.GetSyncContext(); + var db = _syncService.GetSyncContext(); - List festivals = db.Festivals + var festivals = db.Festivals .Include(f => f.Address) .Include(f => f.Questionnaires) .Include(f => f.Questionnaires.Select(q => q.Questions)) @@ -120,4 +124,4 @@ public void Sync() _syncService.SaveChanges(); } } -} \ No newline at end of file +} diff --git a/src/DomainServices/Services/GoogleMapsService.cs b/src/DomainServices/Services/GoogleMapsService.cs index db73b56..5998f88 100644 --- a/src/DomainServices/Services/GoogleMapsService.cs +++ b/src/DomainServices/Services/GoogleMapsService.cs @@ -8,6 +8,8 @@ using System; using System.Collections.Generic; using System.Data.Entity; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; using System.Linq; using System.Net.Http; using System.Text.RegularExpressions; @@ -15,9 +17,10 @@ namespace Festispec.DomainServices.Services { + [ExcludeFromCodeCoverage] public class GoogleMapsService : IGoogleMapsService { - private readonly string API_KEY; + private readonly string _apiKey; private readonly HttpClient _client; private readonly FestispecContext _db; private readonly string _sessionToken; @@ -35,13 +38,13 @@ public GoogleMapsService(FestispecContext db, ISyncService syncS .Select(s => s[new Random().Next(s.Length)]).ToArray()); _db = db; _syncService = syncService; - API_KEY = config["ApiKeys:Google"]; + _apiKey = config["ApiKeys:Google"]; } public async Task> GetSuggestions(string input) { - HttpResponseMessage request = await _client.GetAsync( - $"place/autocomplete/json?input={Uri.EscapeDataString(input)}&components=country:nl|country:be|country:de&sessiontoken={_sessionToken}&language=nl&key={API_KEY}"); + var request = await _client.GetAsync( + $"place/autocomplete/json?input={Uri.EscapeDataString(input)}&components=country:nl|country:be|country:de&sessiontoken={_sessionToken}&language=nl&key={_apiKey}"); var result = JsonConvert.DeserializeObject(await request.Content.ReadAsStringAsync()); if (result.Status.Equals(GoogleStatusCodes.ZeroResults)) @@ -55,8 +58,8 @@ public async Task> GetSuggestions(string input) public async Task
GetAddress(string placeId) { - HttpResponseMessage request = await _client.GetAsync( - $"place/details/json?place_id={placeId}&fields=address_component,formatted_address,geometry&sessiontoken={_sessionToken}&language=nl&key={API_KEY}"); + var request = await _client.GetAsync( + $"place/details/json?place_id={placeId}&fields=address_component,formatted_address,geometry&sessiontoken={_sessionToken}&language=nl&key={_apiKey}"); var result = JsonConvert.DeserializeObject(await request.Content.ReadAsStringAsync()); if (!result.Status.Equals(GoogleStatusCodes.Ok)) @@ -64,7 +67,7 @@ public async Task
GetAddress(string placeId) int.TryParse( Regex.Replace(GetComponent(result.Place, "street_number")?.LongName ?? string.Empty, "[^.0-9]", ""), - out int houseNumber); + out var houseNumber); return new Address { @@ -82,14 +85,17 @@ public async Task
GetAddress(string placeId) public async Task CalculateDistance(Address origin, Address destination) { - DistanceResult existing = await _db.DistanceResults + var existing = await _db.DistanceResults .FirstOrDefaultAsync(x => x.Origin.Id == origin.Id && x.Destination.Id == destination.Id); if (existing != null) return existing.Distance; - HttpResponseMessage request = await _client.GetAsync( - $"distancematrix/json?units=metric&origins={origin.Latitude.ToString().Replace(",", ".")},{origin.Longitude.ToString().Replace(",", ".")}&destinations={destination.Latitude.ToString().Replace(",", ".")},{destination.Longitude.ToString().Replace(",", ".")}&language=nl&key={API_KEY}"); + var request = await _client.GetAsync( + "distancematrix/json?units=metric" + + $"&origins={origin.Latitude.ToString(CultureInfo.InvariantCulture).Replace(",", ".")},{origin.Longitude.ToString(CultureInfo.InvariantCulture).Replace(",", ".")}" + + $"&destinations={destination.Latitude.ToString(CultureInfo.InvariantCulture).Replace(",", ".")},{destination.Longitude.ToString(CultureInfo.InvariantCulture).Replace(",", ".")}" + + $"&language=nl&key={_apiKey}"); var result = JsonConvert.DeserializeObject(await request.Content.ReadAsStringAsync()); @@ -116,9 +122,9 @@ private AddressComponent GetComponent(Place place, string name) public void Sync() { - FestispecContext db = _syncService.GetSyncContext(); + var db = _syncService.GetSyncContext(); - List distanceResults = db.DistanceResults + var distanceResults = db.DistanceResults .Include(i => i.Destination) .Include(i => i.Origin) .ToList(); diff --git a/src/DomainServices/Services/InspectionService.cs b/src/DomainServices/Services/InspectionService.cs index 169d5a6..242cced 100644 --- a/src/DomainServices/Services/InspectionService.cs +++ b/src/DomainServices/Services/InspectionService.cs @@ -1,7 +1,7 @@ -using System; +using System; using System.Collections.Generic; using System.Data.Entity; -using System.Data.Entity.Core.Objects; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; @@ -33,7 +33,7 @@ public List GetAllInspectors() public async Task GetFestivalAsync(int festivalId) { - Festival festival = await _db.Festivals + var festival = await _db.Festivals .Include(f => f.Questionnaires) .Include(f => f.PlannedInspections) .Include(f => f.Address) @@ -54,7 +54,7 @@ public async Task CreatePlannedInspection( int employeeId ) { - PlannedInspection existing = _db.PlannedInspections + var existing = _db.PlannedInspections .FirstOrDefault(x => x.Questionnaire.Id == questionnaireId && x.Festival.Id == festivalId && x.Employee.Id == employeeId && x.StartTime.Equals(startTime) && x.IsCancelled == null); @@ -82,31 +82,41 @@ int employeeId return null; } - public async Task ProcessPlannedInspections(IEnumerable plannedInspections) + [ExcludeFromCodeCoverage] // the _db.Entry makes this borderline untestable + public async Task ProcessPlannedInspections(IEnumerable plannedInspections, + Questionnaire questionnaire, string instructions) { - foreach (PlannedInspection plannedInspection in plannedInspections) + foreach (var plannedInspection in plannedInspections) { + plannedInspection.Questionnaire = questionnaire; + plannedInspection.Instructions = instructions; if (plannedInspection.Id != 0) _db.Entry(plannedInspection).State = EntityState.Modified; else { - await CreatePlannedInspection(plannedInspection.Festival.Id, plannedInspection.Questionnaire.Id, - plannedInspection.StartTime, (DateTime)plannedInspection.EndTime, plannedInspection.EventTitle, - plannedInspection.Employee.Id); + if (plannedInspection.EndTime != null) + await CreatePlannedInspection( + plannedInspection.Festival.Id, + plannedInspection.Questionnaire.Id, + plannedInspection.StartTime, + (DateTime) plannedInspection.EndTime, + plannedInspection.EventTitle, + plannedInspection.Employee.Id); } } return await SaveChanges(); } - - public async Task SaveChanges() + + [ExcludeFromCodeCoverage] + private async Task SaveChanges() { return await _db.SaveChangesAsync(); } public async Task GetPlannedInspection(int plannedInspectionId) { - PlannedInspection plannedInspection = await _db.PlannedInspections + var plannedInspection = await _db.PlannedInspections .Include(pi => pi.Festival) .Include(pi => pi.Festival.Address) .FirstOrDefaultAsync(e => e.Id == plannedInspectionId); @@ -119,7 +129,7 @@ public async Task GetPlannedInspection(int plannedInspectionI public List> GetPlannedInspectionsGrouped(Festival festival) { - List plannedInspections = _db.PlannedInspections + var plannedInspections = _db.PlannedInspections .Include(e => e.Employee.Address) .Where(e => e.Festival.Id == festival.Id && e.IsCancelled == null) .ToList(); @@ -133,7 +143,7 @@ public List> GetPlannedInspectionsGrouped(Festival festi public async Task GetPlannedInspection(Festival festival, Employee employee, DateTime startTime) { - PlannedInspection plannedInspection = await _db.PlannedInspections + var plannedInspection = await _db.PlannedInspections .FirstOrDefaultAsync(e => e.Festival.Id == festival.Id && e.Employee.Id == employee.Id && e.StartTime.Equals(startTime) && e.IsCancelled == null); if (plannedInspection == null) @@ -144,12 +154,10 @@ public async Task GetPlannedInspection(Festival festival, Emp public async Task> GetPlannedInspections(int festivalId, DateTime startTime) { - List plannedInspections = await _db.PlannedInspections + var plannedInspections = await _db.PlannedInspections .Where(e => e.Festival.Id == festivalId && e.StartTime.Equals(startTime) && e.IsCancelled == null) .ToListAsync(); - - if (plannedInspections == null) - throw new EntityNotFoundException(); + return plannedInspections; } @@ -157,9 +165,9 @@ public async Task> GetPlannedInspections(int festivalId, public async Task> GetPlannedInspections(int employeeId) { - List plannedInspections = await _db.PlannedInspections + var plannedInspections = await _db.PlannedInspections .Include(e => e.Employee) - .Where(e => e.Employee.Id == employeeId && EntityFunctions.TruncateTime(e.StartTime) == EntityFunctions.TruncateTime(DateTime.Now)) + .Where(e => e.Employee.Id == employeeId && _db.TruncateTime(e.StartTime) == _db.TruncateTime(DateTime.Now)) .ToListAsync(); if (plannedInspections.Count < 1) @@ -170,7 +178,7 @@ public async Task> GetPlannedInspections(int employeeId) public async Task RemoveInspection(int plannedInspectionId, string cancellationReason) { - PlannedInspection plannedInspection = await GetPlannedInspection(plannedInspectionId); + var plannedInspection = await GetPlannedInspection(plannedInspectionId); //Check if submitted answers by employee if (plannedInspection.Answers.Count > 0) @@ -179,18 +187,19 @@ public async Task RemoveInspection(int plannedInspectionId, string cancellationR plannedInspection.IsCancelled = DateTime.Now; plannedInspection.CancellationReason = cancellationReason; - //Check if cancellationreason is not longer than 250 characters + //Check if cancellation reason is not longer than 250 characters if (!plannedInspection.Validate()) throw new InvalidDataException(); await _db.SaveChangesAsync(); } + [ExcludeFromCodeCoverage] public void Sync() { - FestispecContext db = _syncService.GetSyncContext(); + var db = _syncService.GetSyncContext(); - List plannedInspections = db.PlannedInspections + var plannedInspections = db.PlannedInspections .Include(i => i.Festival) .Include(i => i.Festival.Address) .Include(i => i.Employee) diff --git a/src/DomainServices/Services/JsonSyncService.cs b/src/DomainServices/Services/JsonSyncService.cs index 5f9df56..1c8fa4c 100644 --- a/src/DomainServices/Services/JsonSyncService.cs +++ b/src/DomainServices/Services/JsonSyncService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -14,6 +15,7 @@ namespace Festispec.DomainServices.Services { + [ExcludeFromCodeCoverage] public class JsonSyncService : ISyncService where T : Entity { private readonly FestispecContext _db; @@ -52,7 +54,7 @@ private void Initialise() { if (!File.Exists(_jsonFile)) { - using (FileStream fileStream = File.Create(_jsonFile)) fileStream.Dispose(); + using (var fileStream = File.Create(_jsonFile)) fileStream.Dispose(); Flush(); } @@ -110,12 +112,6 @@ public void SaveChanges() File.WriteAllText(_jsonFile, JsonObject.ToString(Formatting.None)); } - public async void SaveChangesAsync() - { - JsonObject["updatedAt"] = new JValue(DateTime.Now); - await File.WriteAllTextAsync(_jsonFile, JsonObject.ToString(Formatting.None)); - } - public FestispecContext GetSyncContext() => _db; public void Flush() diff --git a/src/DomainServices/Services/OfflineAddressService.cs b/src/DomainServices/Services/Offline/OfflineAddressService.cs similarity index 78% rename from src/DomainServices/Services/OfflineAddressService.cs rename to src/DomainServices/Services/Offline/OfflineAddressService.cs index 501d006..1cdcbdb 100644 --- a/src/DomainServices/Services/OfflineAddressService.cs +++ b/src/DomainServices/Services/Offline/OfflineAddressService.cs @@ -1,9 +1,11 @@ +using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; using Festispec.Models; -namespace Festispec.DomainServices.Services +namespace Festispec.DomainServices.Services.Offline { + [ExcludeFromCodeCoverage] public class OfflineAddressService : IAddressService { public Task
SaveAddress(Address address) diff --git a/src/DomainServices/Services/OfflineAuthenticationService.cs b/src/DomainServices/Services/Offline/OfflineAuthenticationService.cs similarity index 85% rename from src/DomainServices/Services/OfflineAuthenticationService.cs rename to src/DomainServices/Services/Offline/OfflineAuthenticationService.cs index 3b61c8c..8f70cf5 100644 --- a/src/DomainServices/Services/OfflineAuthenticationService.cs +++ b/src/DomainServices/Services/Offline/OfflineAuthenticationService.cs @@ -1,11 +1,13 @@ +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; using Festispec.Models; using Festispec.Models.Exception; -namespace Festispec.DomainServices.Services +namespace Festispec.DomainServices.Services.Offline { + [ExcludeFromCodeCoverage] public class OfflineAuthenticationService : IAuthenticationService { private readonly ISyncService _syncService; @@ -22,7 +24,7 @@ public Account AssembleAccount(string username, string password, Role requiredRo public Account Login(string username, string password, Role requiredRole) { - Account account = _syncService.GetAll().FirstOrDefault(x => x.Username == username); + var account = _syncService.GetAll().FirstOrDefault(x => x.Username == username); if (account == null || !BCrypt.Net.BCrypt.Verify(password, account.Password)) throw new AuthenticationException("Username or password are incorrect"); diff --git a/src/DomainServices/Services/OfflineCustomerService.cs b/src/DomainServices/Services/Offline/OfflineCustomerService.cs similarity index 90% rename from src/DomainServices/Services/OfflineCustomerService.cs rename to src/DomainServices/Services/Offline/OfflineCustomerService.cs index f595fc7..2ce3fc2 100644 --- a/src/DomainServices/Services/OfflineCustomerService.cs +++ b/src/DomainServices/Services/Offline/OfflineCustomerService.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; using Festispec.Models; -namespace Festispec.DomainServices.Services +namespace Festispec.DomainServices.Services.Offline { + [ExcludeFromCodeCoverage] public class OfflineCustomerService : ICustomerService { private readonly ISyncService _syncService; @@ -50,11 +52,6 @@ public Task UpdateCustomerAsync(Customer customer) throw new System.InvalidOperationException(); } - public Task SaveChangesAsync() - { - throw new System.InvalidOperationException(); - } - public bool CanDeleteCustomer(Customer customer) { return false; diff --git a/src/DomainServices/Services/OfflineEmployeeService.cs b/src/DomainServices/Services/Offline/OfflineEmployeeService.cs similarity index 91% rename from src/DomainServices/Services/OfflineEmployeeService.cs rename to src/DomainServices/Services/Offline/OfflineEmployeeService.cs index 2e06179..f31f425 100644 --- a/src/DomainServices/Services/OfflineEmployeeService.cs +++ b/src/DomainServices/Services/Offline/OfflineEmployeeService.cs @@ -1,12 +1,14 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; using Festispec.Models; using Festispec.Models.Exception; -namespace Festispec.DomainServices.Services +namespace Festispec.DomainServices.Services.Offline { + [ExcludeFromCodeCoverage] public class OfflineEmployeeService : IEmployeeService { private readonly ISyncService _employeeSyncService; @@ -46,11 +48,6 @@ public Task CreateEmployeeAsync(FullName name, string iban, string use throw new System.InvalidOperationException(); } - public Task CreateEmployeeAsync(Employee employee) - { - throw new System.InvalidOperationException(); - } - public Task UpdateEmployee(Employee employee) { throw new System.InvalidOperationException(); @@ -73,7 +70,7 @@ public Account GetAccountForEmployee(int employeeId) public Certificate GetCertificate(int certificateId) { - foreach (Certificate cert in GetAllEmployees() + foreach (var cert in GetAllEmployees() .Select(allEmployee => allEmployee.Certificates.FirstOrDefault(c => c.Id == certificateId)) .Where(cert => cert != null)) { diff --git a/src/DomainServices/Services/OfflineFestivalService.cs b/src/DomainServices/Services/Offline/OfflineFestivalService.cs similarity index 85% rename from src/DomainServices/Services/OfflineFestivalService.cs rename to src/DomainServices/Services/Offline/OfflineFestivalService.cs index 5220ecf..cd99087 100644 --- a/src/DomainServices/Services/OfflineFestivalService.cs +++ b/src/DomainServices/Services/Offline/OfflineFestivalService.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; using Festispec.Models; -namespace Festispec.DomainServices.Services +namespace Festispec.DomainServices.Services.Offline { + [ExcludeFromCodeCoverage] public class OfflineFestivalService : IFestivalService { private readonly ISyncService _syncService; @@ -20,11 +22,6 @@ public Task CreateFestival(Festival festival, int customerId) throw new System.InvalidOperationException(); } - public async Task GetFestivalAsync(int festivalId) - { - return await _syncService.GetEntityAsync(festivalId); - } - public Festival GetFestival(int festivalId) { return _syncService.GetEntity(festivalId); diff --git a/src/DomainServices/Services/OfflineGoogleMapsService.cs b/src/DomainServices/Services/Offline/OfflineGoogleMapsService.cs similarity index 80% rename from src/DomainServices/Services/OfflineGoogleMapsService.cs rename to src/DomainServices/Services/Offline/OfflineGoogleMapsService.cs index 8f922d2..e34144a 100644 --- a/src/DomainServices/Services/OfflineGoogleMapsService.cs +++ b/src/DomainServices/Services/Offline/OfflineGoogleMapsService.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; @@ -6,8 +7,9 @@ using Festispec.Models.Exception; using Festispec.Models.Google; -namespace Festispec.DomainServices.Services +namespace Festispec.DomainServices.Services.Offline { + [ExcludeFromCodeCoverage] public class OfflineGoogleMapsService : IGoogleMapsService { private readonly ISyncService _syncService; @@ -29,7 +31,7 @@ public Task
GetAddress(string placeId) public async Task CalculateDistance(Address origin, Address destination) { - DistanceResult existing = (await _syncService.GetAllAsync()).FirstOrDefault(x => x.Origin.Id == origin.Id && x.Destination.Id == destination.Id); + var existing = (await _syncService.GetAllAsync()).FirstOrDefault(x => x.Origin.Id == origin.Id && x.Destination.Id == destination.Id); if (existing == null) throw new GoogleMapsApiException(); diff --git a/src/DomainServices/Services/OfflineInspectionService.cs b/src/DomainServices/Services/Offline/OfflineInspectionService.cs similarity index 88% rename from src/DomainServices/Services/OfflineInspectionService.cs rename to src/DomainServices/Services/Offline/OfflineInspectionService.cs index f209533..97a89ed 100644 --- a/src/DomainServices/Services/OfflineInspectionService.cs +++ b/src/DomainServices/Services/Offline/OfflineInspectionService.cs @@ -1,14 +1,16 @@ using System; using System.Collections.Generic; using System.Data.Entity.Core.Objects; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; using Festispec.Models; using Festispec.Models.Exception; -namespace Festispec.DomainServices.Services +namespace Festispec.DomainServices.Services.Offline { + [ExcludeFromCodeCoverage] public class OfflineInspectionService : IInspectionService { private readonly ISyncService _plannedInspectionSyncService; @@ -43,7 +45,7 @@ public async Task GetPlannedInspection(int plannedInspectionI public async Task GetPlannedInspection(Festival festival, Employee employee, DateTime startTime) { - PlannedInspection plannedInspection = (await _plannedInspectionSyncService.GetAllAsync()).FirstOrDefault( + var plannedInspection = (await _plannedInspectionSyncService.GetAllAsync()).FirstOrDefault( e => e.Festival.Id == festival.Id && e.Employee.Id == employee.Id && e.StartTime.Equals(startTime) && e.IsCancelled == null); @@ -67,8 +69,7 @@ public async Task> GetPlannedInspections(int festivalId, public async Task> GetPlannedInspections(int employeeId) { return (await _plannedInspectionSyncService.GetAllAsync()).Where(e => - e.Employee.Id == employeeId && EntityFunctions.TruncateTime(e.StartTime) == - EntityFunctions.TruncateTime(DateTime.Now)).ToList(); + e.Employee.Id == employeeId && e.StartTime.Date == DateTime.Now.Date).ToList(); } public List> GetPlannedInspectionsGrouped(Festival festival) @@ -87,17 +88,13 @@ public Task RemoveInspection(int plannedInspectionId, string cancellationReason) throw new InvalidOperationException(); } - public Task SaveChanges() - { - throw new InvalidOperationException(); - } - public async Task GetFestivalAsync(int festivalId) { return await _festivalSyncService.GetEntityAsync(festivalId); } - public Task ProcessPlannedInspections(IEnumerable plannedInspections) + public Task ProcessPlannedInspections(IEnumerable plannedInspections, + Questionnaire questionnaire, string instructions) { throw new InvalidOperationException(); } diff --git a/src/DomainServices/Services/OfflineQuestionnaireService.cs b/src/DomainServices/Services/Offline/OfflineQuestionnaireService.cs similarity index 82% rename from src/DomainServices/Services/OfflineQuestionnaireService.cs rename to src/DomainServices/Services/Offline/OfflineQuestionnaireService.cs index 1324a26..f613169 100644 --- a/src/DomainServices/Services/OfflineQuestionnaireService.cs +++ b/src/DomainServices/Services/Offline/OfflineQuestionnaireService.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; @@ -7,8 +8,9 @@ using Festispec.Models.Exception; using Festispec.Models.Questions; -namespace Festispec.DomainServices.Services +namespace Festispec.DomainServices.Services.Offline { + [ExcludeFromCodeCoverage] public class OfflineQuestionnaireService : IQuestionnaireService { private readonly ISyncService _syncService; @@ -35,7 +37,7 @@ public Task AddQuestion(int questionnaireId, Question question) public Question GetQuestionFromQuestionnaire(int questionnaireId, int questionId) { - Question questionFromQuestionnaire = _syncService.GetEntity(questionnaireId).Questions.FirstOrDefault(q => q.Id == questionId); + var questionFromQuestionnaire = _syncService.GetEntity(questionnaireId).Questions.FirstOrDefault(q => q.Id == questionId); if (questionFromQuestionnaire == null) throw new EntityNotFoundException(); @@ -71,26 +73,14 @@ public Task CreateAnswer(Answer answer) throw new System.InvalidOperationException(); } - public void Save() - { - throw new System.InvalidOperationException(); - } - public List GetQuestionsFromQuestionnaire(int questionnaireId) { return _syncService.GetEntity(questionnaireId).Questions.ToList(); } - public List GetAnswers() + public Task GetAnswer(int id) where TAnswer : Answer { - var answers = new List(); - - foreach (Question questionnaireQuestion in _syncService.GetAll().ToList().SelectMany(questionnaire => questionnaire.Questions.ToList())) - { - answers.AddRange(questionnaireQuestion.Answers); - } - - return answers; + throw new System.NotImplementedException(); } public Task> GetPlannedInspections(int employeeId) diff --git a/src/DomainServices/Services/QuestionnaireService.cs b/src/DomainServices/Services/QuestionnaireService.cs index 2c45d60..cb95b5e 100644 --- a/src/DomainServices/Services/QuestionnaireService.cs +++ b/src/DomainServices/Services/QuestionnaireService.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Data.Entity; -using System.Data.Entity.Core.Objects; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; @@ -28,23 +28,26 @@ public QuestionnaireService(FestispecContext db, ISyncService syn public Questionnaire GetQuestionnaire(int questionnaireId) { - Questionnaire questionnaire = _db.Questionnaires.Include(x => x.Questions) + var questionnaire = _db.Questionnaires + .Include(x => x.Questions) .FirstOrDefault(q => q.Id == questionnaireId); if (questionnaire == null) throw new EntityNotFoundException(); - foreach (MultipleChoiceQuestion q in questionnaire.Questions.OfType()) + foreach (var q in questionnaire.Questions.OfType()) q.StringToObjects(); return questionnaire; } - + + [ExcludeFromCodeCoverage] public async Task SaveChangesAsync() { return await _db.SaveChangesAsync(); } - + + [ExcludeFromCodeCoverage] public int SaveChanges() { return _db.SaveChanges(); @@ -52,13 +55,11 @@ public int SaveChanges() public async Task CreateQuestionnaire(string name, int festivalId) { - Questionnaire existing = await _db.Questionnaires.Include(x => x.Festival) - .FirstOrDefaultAsync(x => x.Name == name && x.Festival.Id == festivalId); - - if (existing != null) + if (await _db.Questionnaires.Include(x => x.Festival) + .AnyAsync(x => x.Name == name && x.Festival.Id == festivalId)) throw new EntityExistsException(); - Festival festival = await _db.Festivals.FirstOrDefaultAsync(f => f.Id == festivalId); + var festival = await _db.Festivals.FirstOrDefaultAsync(f => f.Id == festivalId); var questionnaire = new Questionnaire(name, festival); @@ -66,33 +67,30 @@ public async Task CreateQuestionnaire(string name, int festivalId throw new InvalidDataException(); _db.Questionnaires.Add(questionnaire); - - if (await _db.SaveChangesAsync() == 0) - throw new NoRowsChangedException(); + await _db.SaveChangesAsync(); return questionnaire; } public async Task RemoveQuestionnaire(int questionnaireId) { - Questionnaire questionnaire = GetQuestionnaire(questionnaireId); + var questionnaire = GetQuestionnaire(questionnaireId); - if (questionnaire.Questions.FirstOrDefault(q => q.Answers.Count > 0) != null) + if (questionnaire.Questions.Any(q => q.Answers.Count > 0)) throw new QuestionHasAnswersException(); _db.Questionnaires.Remove(questionnaire); - if (await _db.SaveChangesAsync() == 0) - throw new NoRowsChangedException(); + await _db.SaveChangesAsync(); } public async Task CopyQuestionnaire(int questionnaireId, string questionnaireName) { - Questionnaire oldQuestionnaire = GetQuestionnaire(questionnaireId); + var oldQuestionnaire = GetQuestionnaire(questionnaireId); - Questionnaire newQuestionnaire = + var newQuestionnaire = await CreateQuestionnaire(questionnaireName, oldQuestionnaire.Festival.Id); - + foreach (var e in oldQuestionnaire.Questions) { await AddQuestion(newQuestionnaire.Id, new ReferenceQuestion(e.Contents, newQuestionnaire, e)); @@ -109,9 +107,14 @@ public async Task CopyQuestionnaire(int questionnaireId, string q public Question GetQuestionFromQuestionnaire(int questionnaireId, int questionId) { - Questionnaire questionnaire = _db.Questionnaires.Include(x => x.Questions) + var questionnaire = _db.Questionnaires + .Include(x => x.Questions) .FirstOrDefault(q => q.Id == questionnaireId); - Question question = questionnaire.Questions.FirstOrDefault(q => q.Id == questionId); + + if (questionnaire == null) + throw new EntityNotFoundException(); + + var question = questionnaire.Questions.FirstOrDefault(q => q.Id == questionId); if (question == null) throw new EntityNotFoundException(); @@ -121,13 +124,12 @@ public Question GetQuestionFromQuestionnaire(int questionnaireId, int questionId public List GetQuestionsFromQuestionnaire(int questionnaireId) { - List questions = _db.Questions.Include(x => x.Answers) - .Where(q => q.Questionnaire.Id == questionnaireId).ToList(); - - if (questions == null) - throw new EntityNotFoundException(); + var questions = _db.Questions + .Include(x => x.Answers) + .Where(q => q.Questionnaire.Id == questionnaireId) + .ToList(); - foreach (MultipleChoiceQuestion q in questions.OfType()) + foreach (var q in questions.OfType()) q.StringToObjects(); return questions; @@ -135,29 +137,30 @@ public List GetQuestionsFromQuestionnaire(int questionnaireId) public async Task AddQuestion(int questionnaireId, Question question) { - Questionnaire questionnaire = _db.Questionnaires.FirstOrDefault(q => q.Id == questionnaireId); + var questionnaire = _db.Questionnaires.FirstOrDefault(q => q.Id == questionnaireId); question.Questionnaire = questionnaire; + if (questionnaire == null) + throw new EntityNotFoundException(); + if (!question.Validate()) throw new InvalidDataException(); questionnaire.Questions.Add(question); - - if (await _db.SaveChangesAsync() == 0) - throw new NoRowsChangedException(); + await _db.SaveChangesAsync(); return question; } public async Task RemoveQuestion(int questionId) { - Question question = _db.Questions.Include(x => x.Answers).FirstOrDefault(q => q.Id == questionId); + var question = _db.Questions.Include(x => x.Answers).FirstOrDefault(q => q.Id == questionId); if (question == null) throw new EntityNotFoundException(); - if (question.Answers.Count() > 0) + if (question.Answers.Any()) throw new QuestionHasAnswersException(); if (_db.Questions.OfType().Include(x => x.Question) @@ -169,11 +172,6 @@ public async Task RemoveQuestion(int questionId) return await _db.SaveChangesAsync() > 1; } - public void Save() - { - _db.SaveChanges(); - } - public async Task CreateAnswer(Answer answer) { if (!answer.Validate()) @@ -186,9 +184,9 @@ public async Task CreateAnswer(Answer answer) return answer; } - public List GetAnswers() + public async Task GetAnswer(int id) where TAnswer : Answer { - return _db.Answers.Include(a => a.Question).ToList(); + return await _db.Answers.OfType().FirstOrDefaultAsync(a => a.Id == id); } public async Task GetQuestion(int questionId) @@ -199,27 +197,26 @@ public async Task GetQuestion(int questionId) #endregion Question Management - - - #region inspection + #region inspection public async Task> GetPlannedInspections(int employeeId) { - List plannedInspections = await _db.PlannedInspections + if (!_db.Employees.Any(e => e.Id == employeeId)) + throw new EntityNotFoundException(); + + var plannedInspections = await _db.PlannedInspections .Include(e => e.Employee) - .Where(e => e.Employee.Id == employeeId && EntityFunctions.TruncateTime(e.StartTime) == EntityFunctions.TruncateTime(DateTime.Now)) + .Where(e => e.Employee.Id == employeeId) .ToListAsync(); - if (plannedInspections.Count < 1) - throw new EntityNotFoundException(); - - return plannedInspections; + // LINQ does not like .Date inside an EF query. Or maybe EF doesn't like it. Either way, this works. + return plannedInspections.Where(e => e.StartTime.Date == DateTime.Now.Date).ToList(); } - - + + public async Task GetPlannedInspection(int plannedInspectionId) { - PlannedInspection plannedInspection = await _db.PlannedInspections + var plannedInspection = await _db.PlannedInspections .Include(pi => pi.Festival) .Include(pi => pi.Festival.Address) .FirstOrDefaultAsync(e => e.Id == plannedInspectionId); @@ -232,11 +229,12 @@ public async Task GetPlannedInspection(int plannedInspectionI #endregion + [ExcludeFromCodeCoverage] public void Sync() { - FestispecContext db = _syncService.GetSyncContext(); - - List questionnaires = db.Questionnaires + var db = _syncService.GetSyncContext(); + + var questionnaires = db.Questionnaires .Include(q => q.Festival) .Include(q => q.Questions) .Include(q => q.Questions.Select(qu => qu.Answers)) @@ -247,4 +245,4 @@ public void Sync() _syncService.SaveChanges(); } } -} +} \ No newline at end of file diff --git a/src/DomainServices/Services/SicknessService.cs b/src/DomainServices/Services/SicknessService.cs index 90842c9..df5a475 100644 --- a/src/DomainServices/Services/SicknessService.cs +++ b/src/DomainServices/Services/SicknessService.cs @@ -5,6 +5,7 @@ using System; using System.Linq; using System.Data.Entity; +using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; namespace Festispec.DomainServices.Services @@ -18,14 +19,14 @@ public SicknessService(FestispecContext db) _db = db; } - public async Task AddAbsense(int employeeId, string reason, DateTime? endTime) + public async Task AddAbsence(int employeeId, string reason, DateTime? endTime) { if (endTime < DateTime.Now) throw new DateHasPassedException(); var employee = _db.Employees.Include(e => e.Address).FirstOrDefault(e => e.Id == employeeId); - var absense = new Availability() + var absence = new Availability() { IsAvailable = false, Employee = employee, @@ -35,31 +36,29 @@ public async Task AddAbsense(int employeeId, string reason, DateTi EventTitle = "Afwezig wegens ziekte" }; - if (!absense.Validate()) + if (!absence.Validate()) throw new InvalidDataException(); - _db.PlannedEvents.Add(absense); + _db.PlannedEvents.Add(absence); + await _db.SaveChangesAsync(); - if (await _db.SaveChangesAsync() == 0) - throw new NoRowsChangedException(); - - return absense; + return absence; } - public async Task EndAbsense(int employeeId) + [ExcludeFromCodeCoverage] + public async Task EndAbsence(int employeeId) { - var absense = GetCurrentAbsense(employeeId); + var absence = GetCurrentAbsence(employeeId); - if (absense == null) + if (absence == null) throw new EmployeeNotSickException(); - absense.EndTime = DateTime.Now; + absence.EndTime = DateTime.Now; - if (await _db.SaveChangesAsync() == 0) - throw new NoRowsChangedException(); + await _db.SaveChangesAsync(); } - private Availability GetCurrentAbsense(int employeeId) + private Availability GetCurrentAbsence(int employeeId) { return _db.Availabilities.FirstOrDefault(a => a.Employee.Id == employeeId && a.EventTitle == "Afwezig wegens ziekte" @@ -68,9 +67,9 @@ private Availability GetCurrentAbsense(int employeeId) public bool IsSick(int employeeId) { - var absense = GetCurrentAbsense(employeeId); + var absence = GetCurrentAbsence(employeeId); - return absense != null; + return absence != null; } } } diff --git a/src/DomainServices/Startup.cs b/src/DomainServices/Startup.cs index 9e96441..f2bf275 100644 --- a/src/DomainServices/Startup.cs +++ b/src/DomainServices/Startup.cs @@ -5,9 +5,12 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; +using System.Diagnostics.CodeAnalysis; +using Festispec.DomainServices.Services.Offline; namespace Festispec.DomainServices { + [ExcludeFromCodeCoverage] public static class IServiceCollectionExtension { public static IServiceCollection AddDomainServices(this IServiceCollection services) @@ -15,17 +18,15 @@ public static IServiceCollection AddDomainServices(this IServiceCollection servi services.AddTransient(); services.AddScoped(typeof(ISyncService<>), typeof(JsonSyncService<>)); services.AddSingleton(); - string environment = Environment.GetEnvironmentVariable("Environment") ?? "Production"; + string environment = Environment.GetEnvironmentVariable("Environment") ?? "Debug"; - IConfigurationRoot configuration = new ConfigurationBuilder() + var configuration = new ConfigurationBuilder() .AddJsonFile($"appsettings.{environment}.json") .Build(); services.AddSingleton(config => configuration); // Register services for *both* online and offline here - services.AddScoped(); - // Register all your online services here if (services.BuildServiceProvider().GetRequiredService().IsOnline) { @@ -59,6 +60,7 @@ public static IServiceCollection AddDomainServices(this IServiceCollection servi // Example: services.AddSingleton(new ExampleFactory()); services.AddSingleton(new QuestionFactory()); services.AddSingleton(new GraphSelectorFactory()); + services.AddSingleton(new AnswerFactory()); return services; } diff --git a/src/Models/Address.cs b/src/Models/Address.cs index f76616b..951e7f3 100644 --- a/src/Models/Address.cs +++ b/src/Models/Address.cs @@ -36,13 +36,9 @@ public class Address : Validateable public override string ToString() { - if (HouseNumber == 0 && (StreetName == null || StreetName.Length == 0)) - return $"{City} {Country}"; - - if (HouseNumber == 0) - return $"{StreetName}, {City} {Country}"; - - return $"{StreetName} {HouseNumber}{Suffix}, {City} {Country}"; + return HouseNumber == 0 && string.IsNullOrEmpty(StreetName) ? $"{City} {Country}" : + HouseNumber == 0 ? $"{StreetName}, {City} {Country}" : + $"{StreetName} {HouseNumber}{Suffix}, {City} {Country}"; } } } \ No newline at end of file diff --git a/src/Models/Answers/Answer.cs b/src/Models/Answers/Answer.cs index 3b27b74..efb0b33 100755 --- a/src/Models/Answers/Answer.cs +++ b/src/Models/Answers/Answer.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Festispec.Models.Questions; @@ -11,7 +10,5 @@ public abstract class Answer : Entity [Required] public virtual Question Question { get; set; } [Required] public virtual PlannedInspection PlannedInspection { get; set; } - - public virtual ICollection Attachments { get; set; } } } \ No newline at end of file diff --git a/src/Models/Answers/Attachment.cs b/src/Models/Answers/Attachment.cs deleted file mode 100755 index 9222929..0000000 --- a/src/Models/Answers/Attachment.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Festispec.Models.Answers -{ - public class Attachment : Entity - { - public int Id { get; set; } - - [Required] public string FilePath { get; set; } - - [Required] public virtual Answer Answer { get; set; } - } -} \ No newline at end of file diff --git a/src/Models/Answers/MultipleChoiceAnswer.cs b/src/Models/Answers/MultipleChoiceAnswer.cs index d7e0090..e9aeaf5 100644 --- a/src/Models/Answers/MultipleChoiceAnswer.cs +++ b/src/Models/Answers/MultipleChoiceAnswer.cs @@ -2,7 +2,7 @@ namespace Festispec.Models.Answers { - public class MultipleChoiceAnswer : Answer, IAnswer + public class MultipleChoiceAnswer : Answer { public int MultipleChoiceAnswerKey { get; set; } diff --git a/src/Models/Answers/NumericAnswer.cs b/src/Models/Answers/NumericAnswer.cs index aa7d876..9a2ea71 100644 --- a/src/Models/Answers/NumericAnswer.cs +++ b/src/Models/Answers/NumericAnswer.cs @@ -2,7 +2,7 @@ namespace Festispec.Models.Answers { - public class NumericAnswer : Answer, IAnswer + public class NumericAnswer : Answer { public int IntAnswer { get; set; } diff --git a/src/Models/Answers/StringAnswer.cs b/src/Models/Answers/StringAnswer.cs index c33a55b..73461cd 100644 --- a/src/Models/Answers/StringAnswer.cs +++ b/src/Models/Answers/StringAnswer.cs @@ -2,7 +2,7 @@ namespace Festispec.Models.Answers { - public class StringAnswer : Answer, IAnswer + public class StringAnswer : Answer { public string AnswerContents { get; set; } diff --git a/src/Models/Attributes/ListElements.cs b/src/Models/Attributes/ListElements.cs index 09fe9c1..076046a 100644 --- a/src/Models/Attributes/ListElements.cs +++ b/src/Models/Attributes/ListElements.cs @@ -16,9 +16,8 @@ public ListElements(int minElements, int maxElements = -1) public override bool IsValid(object value) { - var list = value as ICollection; - if (list != null) - return list.Count >= _minElements && (_maxElements > 0 ? list.Count <= _maxElements : true); + if (value is ICollection list) + return list.Count >= _minElements && (_maxElements <= 0 || list.Count <= _maxElements); return false; } } diff --git a/src/Models/ContactPerson.cs b/src/Models/ContactPerson.cs deleted file mode 100755 index 6b8e5eb..0000000 --- a/src/Models/ContactPerson.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace Festispec.Models -{ - public class ContactPerson : Entity - { - public int Id { get; set; } - - [Required] [MaxLength(20)] public string Role { get; set; } - - public FullName Name { get; set; } - - public ContactDetails ContactDetails { get; set; } - - public virtual Customer Customer { get; set; } - - public virtual ICollection Notes { get; set; } - } -} \ No newline at end of file diff --git a/src/Models/ContactPersonNote.cs b/src/Models/ContactPersonNote.cs deleted file mode 100755 index ee02284..0000000 --- a/src/Models/ContactPersonNote.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Festispec.Models -{ - public class ContactPersonNote : Entity - { - public int Id { get; set; } - - public ContactPerson ContactPerson { get; set; } - - [Required] [MaxLength(500)] public string Note { get; set; } - } -} \ No newline at end of file diff --git a/src/Models/Customer.cs b/src/Models/Customer.cs old mode 100644 new mode 100755 index 6989143..a6a67c2 --- a/src/Models/Customer.cs +++ b/src/Models/Customer.cs @@ -16,12 +16,10 @@ public Customer() [Required] [MaxLength(20)] public string CustomerName { get; set; } - public Address Address { get; set; } + [MaxLength(500)] public string Notes { get; set; } + public Address Address { get; set; } public ContactDetails ContactDetails { get; set; } - - public virtual ICollection ContactPersons { get; set; } - public virtual ICollection Festivals { get; set; } } } \ No newline at end of file diff --git a/src/Models/DKD.cd b/src/Models/DKD.cd index c18892c..41c7222 100644 --- a/src/Models/DKD.cd +++ b/src/Models/DKD.cd @@ -1,104 +1,88 @@  - - - - - + + - - - - - - - + + - - - - - - + + + + + + + + + - AAACAAAAAAAAAAAAAAACCAAAQAAAAAACAgAAAAAAAAA= + AAAiAAAAAAAAAAAAAAACCAAAQAAAAAACAAAAAAAAAAA= Customer.cs + + + - + - - - - - - - - + + + + - + + + + + + - + - - AAECgAAAAAAgAAAAABAQAAAAAAAQAAACAAAAAAAABAA= - Festival.cs - - - - - - - - - + - - + + + - - AAEiAAAAAAAAAAAAEAACAAQAAAAAAAAAAAAAAAAAAAA= - ContactPerson.cs - - - - - - - - - - - + - - + + + + + - AAACAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAEAAAA= - ContactPersonNote.cs + AAECgAAAAAAgAAAAABAQAAAAAAAQAAACAAAAAAAAAAA= + Festival.cs - + + + + + + + @@ -110,33 +94,31 @@ - AAAAAAAAAAAAAACIAAAAAAAAAEIAAAABACAAAAAAAAA= + AAACAAAAAEAAAACMAAAIAAAAAEIAAAABACAAAAAAAAA= Address.cs - + - + - + - - - - + + - + @@ -146,7 +128,7 @@ - AAACAAAAAAAAAAAAAAACCCQAAAAAAAACAAAAAEAAAEA= + AAACAAAAAACAAAAAAAACCCQAAAAAAAACAAAAAEAAAEA= Employee.cs @@ -156,14 +138,17 @@ - - + + - - + + + + + - + @@ -172,27 +157,40 @@ - + + + + - + + + + + + + + - - + + + + - + - + - - - - + + + + + AAAAQAAAAAAAAAABAAACBAAAAAAAAAAAQAAAIAAAAAg= @@ -202,9 +200,12 @@ + + + - + @@ -219,7 +220,7 @@ - + AAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAIAAAAA= Availability.cs @@ -230,11 +231,11 @@ - + - AAACAAAAEACAAAAAEQAAAAAACAAAAAACAAAAAAAAAAA= + AAACAAAAEACAAAAAEQAAAAAACAAAAAACAAAAAAgAAAA= Account.cs @@ -243,21 +244,21 @@ - + - AAAAAAAAAAAAAAAAAAAAAAAAIAAgAAAAAAAAAAAAAAA= + AAAAAAAAAAAAAAAEAAAAAAAgIAAgAAAAAAAAAEAAAAA= OpeningHours.cs - + - AAACAAAAAAAAAAAAAAQAAAAASIAAAAAAAAAAAAAAAAA= + AAACAAAAAACAAAAAAAQAAAAASIAAAAAAAAAAAAAAAAA= Certificate.cs @@ -265,49 +266,32 @@ - + AAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAA= Answers\StringAnswer.cs - - - - - - - - - - - AAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAACAAAAA= - Reports\Report.cs - - - - - - - - - AAECAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAABAA= - Reports\ReportEntry.cs - - - - - + + + + + + + - - - + + + + + + - AAACAAAAAAAAAAEAABAAAAAAAAAAAAAEAAAAAAAAAAA= + AAACAAAAAAAAAAAAABAAAAAAAAAAAAAEAAAAAAAAAAA= Answers\Answer.cs @@ -315,168 +299,134 @@ - - - - BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAA= - Reports\ReportTextEntry.cs - - - - - - - - - - - - - - AAAAAAAAAAAAAABAAAQAQAAAAAAAAAAAAAAAAAAAAIA= - Reports\ReportGraphEntry.cs - - - - - - - + AAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= Questions\DrawQuestion.cs - + AAAAAAAAAAAAAAAACAQAAAAAgAAAAAAAAAAAAAAAAAA= Questions\StringQuestion.cs - + + + + + + + + + - wCEAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAA= + AAAAAAAQAQAAAAAAAAQAAQAAAQAAAAgAAAAAAABAAAA= Questions\MultipleChoiceQuestion.cs + + + + + + + - AAACAAAAAAAAAAAAAAQAAAAAAAAAAAAAQAAAAABACAg= + AAACAAAAAAAAAAAAAAQAAAAAAAAAAAAAQAAAAABAAAo= Questions\Question.cs - - - - - AAACAAAAAAAAAAAAAAAAAAAAACAAAAAEAAAAAAAAAAA= - Questions\QuestionCategory.cs - - - - - - AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAgAAAAA= - Answers\Attachment.cs - - - - + + + - + + + + + + + + + - gAAAAACAAAAAAAAAIAQAAAAAAAAAAAAAAAAAAAAAAAA= + gAAAAACAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAA= Questions\NumericQuestion.cs - - - - + AAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAA= Answers\NumericAnswer.cs - - + AAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAg= Answers\MultipleChoiceAnswer.cs - - + AAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAA= Answers\FileAnswer.cs - + + + + + + + + + AAAAAAAAAAAAAAAAAAQBAAAAAAAAQAAAAAAAAAAAAAA= Questions\RatingQuestion.cs - + + + + + + + + + AAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAA= Questions\UploadPictureQuestion.cs - - - - AAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAA= - ReferenceQuestion.cs - - - - - - AAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= - Interfaces\IAnswer.cs - - - + AAAAAAAgAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAA= Role.cs - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAE= - GraphXAxisType.cs - - - + AAAAAAAAAAAAAAAAAABCAAAAAAAAAAAAAAAAAAEBAAA= GraphType.cs - - - - AAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAA= - Questions\AnswerUnit.cs - - \ No newline at end of file diff --git a/src/Models/EntityMapping/AnswerMapping.cs b/src/Models/EntityMapping/AnswerMapping.cs index ba9587e..0af3a85 100755 --- a/src/Models/EntityMapping/AnswerMapping.cs +++ b/src/Models/EntityMapping/AnswerMapping.cs @@ -13,9 +13,7 @@ public AnswerMapping() HasRequired(a => a.PlannedInspection) .WithMany(pi => pi.Answers) - .WillCascadeOnDelete(false); - - HasMany(a => a.Attachments).WithRequired(a => a.Answer); + .WillCascadeOnDelete(false); } } } \ No newline at end of file diff --git a/src/Models/EntityMapping/AttachmentMapping.cs b/src/Models/EntityMapping/AttachmentMapping.cs deleted file mode 100755 index 581ddb2..0000000 --- a/src/Models/EntityMapping/AttachmentMapping.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Data.Entity.ModelConfiguration; -using Festispec.Models.Answers; - -namespace Festispec.Models.EntityMapping -{ - internal class AttachmentMapping : EntityTypeConfiguration - { - public AttachmentMapping() - { - Property(a => a.FilePath).IsRequired(); - - HasRequired(a => a.Answer).WithMany(a => a.Attachments); - } - } -} \ No newline at end of file diff --git a/src/Models/EntityMapping/ContactPersonMapping.cs b/src/Models/EntityMapping/ContactPersonMapping.cs deleted file mode 100755 index a3d403a..0000000 --- a/src/Models/EntityMapping/ContactPersonMapping.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Data.Entity.ModelConfiguration; - -namespace Festispec.Models.EntityMapping -{ - internal class ContactPersonMapping : EntityTypeConfiguration - { - public ContactPersonMapping() - { - Property(l => l.Role).IsRequired(); - - HasRequired(l => l.Customer).WithMany(c => c.ContactPersons); - - HasMany(l => l.Notes).WithRequired(n => n.ContactPerson); - } - } -} \ No newline at end of file diff --git a/src/Models/EntityMapping/ContactPersonNoteMapping.cs b/src/Models/EntityMapping/ContactPersonNoteMapping.cs deleted file mode 100755 index 34056da..0000000 --- a/src/Models/EntityMapping/ContactPersonNoteMapping.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Data.Entity.ModelConfiguration; - -namespace Festispec.Models.EntityMapping -{ - internal class ContactPersonNoteMapping : EntityTypeConfiguration - { - public ContactPersonNoteMapping() - { - HasRequired(ln => ln.ContactPerson).WithMany(l => l.Notes); - - Property(ln => ln.Note).IsRequired(); - } - } -} \ No newline at end of file diff --git a/src/Models/EntityMapping/CustomerMapping.cs b/src/Models/EntityMapping/CustomerMapping.cs index d4e4dba..f18b47e 100755 --- a/src/Models/EntityMapping/CustomerMapping.cs +++ b/src/Models/EntityMapping/CustomerMapping.cs @@ -9,7 +9,6 @@ public CustomerMapping() Property(p => p.KvkNr).IsRequired(); Property(p => p.CustomerName).IsRequired(); - HasMany(c => c.ContactPersons).WithRequired(l => l.Customer); HasMany(c => c.Festivals).WithRequired(f => f.Customer); } } diff --git a/src/Models/EntityMapping/FestispecContext.cs b/src/Models/EntityMapping/FestispecContext.cs index d4604a9..bc744a7 100644 --- a/src/Models/EntityMapping/FestispecContext.cs +++ b/src/Models/EntityMapping/FestispecContext.cs @@ -1,11 +1,10 @@ -using System; +using System; using System.Data.Entity; using System.Data.Entity.Infrastructure; using System.Linq; using System.Threading.Tasks; using Festispec.Models.Answers; using Festispec.Models.Questions; -using Festispec.Models.Reports; using Microsoft.Extensions.Configuration; namespace Festispec.Models.EntityMapping @@ -13,31 +12,24 @@ namespace Festispec.Models.EntityMapping public class FestispecContext : DbContext { public FestispecContext(IConfiguration config) : base(config["ConnectionString"]) - { - } - - public FestispecContext() : base("Default") - { + { } - + public FestispecContext() : base("Default") + { + } + public virtual DbSet Accounts { get; set; } public virtual DbSet Answers { get; set; } - public virtual DbSet Attachments { get; set; } public virtual DbSet Availabilities { get; set; } public virtual DbSet Certificates { get; set; } - public virtual DbSet ContactPersons { get; set; } - public virtual DbSet ContactPersonNotes { get; set; } public virtual DbSet Customers { get; set; } public virtual DbSet Employees { get; set; } public virtual DbSet Festivals { get; set; } public virtual DbSet PlannedEvents { get; set; } public virtual DbSet PlannedInspections { get; set; } public virtual DbSet Questions { get; set; } - public virtual DbSet QuestionCategories { get; set; } public virtual DbSet Questionnaires { get; set; } - public virtual DbSet Reports { get; set; } - public virtual DbSet ReportEntries { get; set; } public virtual DbSet
Addresses { get; set; } public virtual DbSet DistanceResults { get; set; } @@ -60,6 +52,11 @@ public override async Task SaveChangesAsync() return await base.SaveChangesAsync(); } + public virtual DateTime? TruncateTime(DateTime dateTime) + { + return DbFunctions.TruncateTime(dateTime); + } + private void AddTimestamps() { foreach (DbEntityEntry entity in ChangeTracker.Entries().Where(x => @@ -72,4 +69,4 @@ private void AddTimestamps() } } } -} +} diff --git a/src/Models/EntityMapping/FestivalMapping.cs b/src/Models/EntityMapping/FestivalMapping.cs index d26767b..13bf90c 100755 --- a/src/Models/EntityMapping/FestivalMapping.cs +++ b/src/Models/EntityMapping/FestivalMapping.cs @@ -8,8 +8,7 @@ public FestivalMapping() { Property(f => f.FestivalName).IsRequired(); Property(f => f.Description).IsRequired(); - - HasOptional(f => f.Report).WithRequired(r => r.Festival); + HasRequired(f => f.Customer).WithMany(c => c.Festivals); HasMany(f => f.Questionnaires).WithRequired(q => q.Festival); diff --git a/src/Models/EntityMapping/QuestionCategoryMapping.cs b/src/Models/EntityMapping/QuestionCategoryMapping.cs deleted file mode 100644 index 50217bb..0000000 --- a/src/Models/EntityMapping/QuestionCategoryMapping.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Data.Entity.ModelConfiguration; -using Festispec.Models.Questions; - -namespace Festispec.Models.EntityMapping -{ - internal class QuestionCategoryMapping : EntityTypeConfiguration - { - public QuestionCategoryMapping() - { - Property(qc => qc.CategoryName).IsRequired(); - HasMany(qc => qc.Questions).WithOptional(q => q.Category); - } - } -} \ No newline at end of file diff --git a/src/Models/EntityMapping/ReportEntryMapping.cs b/src/Models/EntityMapping/ReportEntryMapping.cs deleted file mode 100755 index 3f74d05..0000000 --- a/src/Models/EntityMapping/ReportEntryMapping.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Data.Entity.ModelConfiguration; -using Festispec.Models.Reports; - -namespace Festispec.Models.EntityMapping -{ - internal class ReportEntryMapping : EntityTypeConfiguration - { - public ReportEntryMapping() - { - Property(re => re.Order).IsRequired(); - - HasRequired(re => re.Question).WithRequiredDependent(); - HasRequired(re => re.Report).WithMany(r => r.ReportEntries); - } - } -} \ No newline at end of file diff --git a/src/Models/EntityMapping/ReportMapping.cs b/src/Models/EntityMapping/ReportMapping.cs deleted file mode 100755 index 3508924..0000000 --- a/src/Models/EntityMapping/ReportMapping.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Data.Entity.ModelConfiguration; -using Festispec.Models.Reports; - -namespace Festispec.Models.EntityMapping -{ - internal class ReportMapping : EntityTypeConfiguration - { - public ReportMapping() - { - HasMany(r => r.ReportEntries).WithRequired(re => re.Report); - HasRequired(r => r.Festival).WithOptional(f => f.Report); - } - } -} \ No newline at end of file diff --git a/src/Models/Exception/EmployeeNotSickException.cs b/src/Models/Exception/EmployeeNotSickException.cs index 57fdcf7..471b8aa 100644 --- a/src/Models/Exception/EmployeeNotSickException.cs +++ b/src/Models/Exception/EmployeeNotSickException.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Festispec.Models.Exception +namespace Festispec.Models.Exception { public class EmployeeNotSickException : System.Exception { diff --git a/src/Models/Exception/NoRowsChangedException.cs b/src/Models/Exception/NoRowsChangedException.cs deleted file mode 100644 index c664d4f..0000000 --- a/src/Models/Exception/NoRowsChangedException.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Festispec.Models.Exception -{ - public class NoRowsChangedException : System.Exception - { - public NoRowsChangedException(string message) : base(message) - { - } - - public NoRowsChangedException(string message, System.Exception innerException) : base(message, innerException) - { - } - - public NoRowsChangedException() - { - } - } -} \ No newline at end of file diff --git a/src/Models/Festival.cs b/src/Models/Festival.cs index 75c8a2c..ced8613 100755 --- a/src/Models/Festival.cs +++ b/src/Models/Festival.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using Festispec.Models.Reports; namespace Festispec.Models { @@ -15,9 +14,7 @@ public class Festival : Entity [Required] public Address Address { get; set; } [Required] public virtual Customer Customer { get; set; } - - public virtual Report Report { get; set; } - + [Required] public OpeningHours OpeningHours { get; set; } public virtual ICollection PlannedInspections { get; set; } diff --git a/src/Models/GraphConverters/ChartGraphable.cs b/src/Models/GraphConverters/ChartGraphable.cs index 3ffbb08..46d6878 100644 --- a/src/Models/GraphConverters/ChartGraphable.cs +++ b/src/Models/GraphConverters/ChartGraphable.cs @@ -11,35 +11,25 @@ public class ChartGraphable : IGraphable { public List TypeToChart(Question question) { - ICollection multipleChoiceAnswers = question.Answers; - var chartSeries = new List(); + var multipleChoiceQuestion = (MultipleChoiceQuestion) question; - - if (multipleChoiceAnswers == null) - return chartSeries; - - - var quest = (MultipleChoiceQuestion) question; - - for (var i = 0; i < quest.OptionCollection.Count; i++) + for (var i = 0; i < multipleChoiceQuestion.OptionCollection.Count; i++) { - StringObject option = quest.OptionCollection[i]; + var option = multipleChoiceQuestion.OptionCollection[i]; // Hoevaak hebben we de index answered. - int count = quest.Answers.Count(a => - { - var answer = (MultipleChoiceAnswer) a; - return answer.MultipleChoiceAnswerKey == i; - }); + var count = multipleChoiceQuestion.Answers + .OfType() + .Count(a => a.MultipleChoiceAnswerKey == i); - var serie = new GraphableSeries + var graphableSeries = new GraphableSeries { Title = option.Value, - Values = new ChartValues {count} + Values = new ChartValues { count } }; - chartSeries.Add(serie); + chartSeries.Add(graphableSeries); } diff --git a/src/Models/GraphConverters/ColumnGraphable.cs b/src/Models/GraphConverters/ColumnGraphable.cs index 3e06831..662ed00 100644 --- a/src/Models/GraphConverters/ColumnGraphable.cs +++ b/src/Models/GraphConverters/ColumnGraphable.cs @@ -12,21 +12,22 @@ public class ColumnGraphable : IGraphable public List TypeToChart(Question question) { var series = new List(); - IEnumerable plannedInspections = question.Answers.Select(x => x.PlannedInspection); + var plannedInspections = question.Answers.Select(x => x.PlannedInspection); - foreach (PlannedInspection plannedInspection in plannedInspections) + foreach (var plannedInspection in plannedInspections) { - var serie = new GraphableSeries + var graphableSeries = new GraphableSeries { Title = plannedInspection.EventTitle, Values = new ChartValues() }; - Answer answer = question.Answers.FirstOrDefault(x => x.PlannedInspection.Id == plannedInspection.Id); + var answer = question.Answers + .OfType() + .FirstOrDefault(x => x.PlannedInspection.Id == plannedInspection.Id); - var numAnswer = (NumericAnswer) answer; - serie.Values.Add(numAnswer.IntAnswer); - series.Add(serie); + if (answer != null) graphableSeries.Values.Add(answer.IntAnswer); + series.Add(graphableSeries); } return series; diff --git a/src/Models/GraphConverters/LineGraphable.cs b/src/Models/GraphConverters/LineGraphable.cs index c348937..28c01a9 100644 --- a/src/Models/GraphConverters/LineGraphable.cs +++ b/src/Models/GraphConverters/LineGraphable.cs @@ -12,20 +12,15 @@ public class LineGraphable : IGraphable public List TypeToChart(Question question) { var series = new List(); - - ICollection answers = question.Answers; - var serie = new GraphableSeries(); - serie.Title = question.Contents; + var graphableSeries = new GraphableSeries { Title = question.Contents }; var chartValues = new ChartValues(); - foreach (Answer answer in answers) - { - var numAnswer = (NumericAnswer) answer; - chartValues.Add(numAnswer.IntAnswer); - } + foreach (var answer in question.Answers.OfType()) + chartValues.Add(answer.IntAnswer); + - serie.Values = chartValues; - series.Add(serie); + graphableSeries.Values = chartValues; + series.Add(graphableSeries); return series; } diff --git a/src/Models/GraphValues.cs b/src/Models/GraphValues.cs deleted file mode 100644 index e69de29..0000000 diff --git a/src/Models/GraphXAxisType.cs b/src/Models/GraphXAxisType.cs deleted file mode 100644 index ebbef2d..0000000 --- a/src/Models/GraphXAxisType.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Festispec.Models -{ - public enum GraphXAxisType - { - CreatedTime, - MultipleChoiceOption - } -} \ No newline at end of file diff --git a/src/Models/Interfaces/IAnswer.cs b/src/Models/Interfaces/IAnswer.cs deleted file mode 100644 index d4a5f9c..0000000 --- a/src/Models/Interfaces/IAnswer.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Festispec.Models.Interfaces -{ - public interface IAnswer - { - TAnswer GetAnswer(); - } -} \ No newline at end of file diff --git a/src/Models/Interfaces/IAnswerable.cs b/src/Models/Interfaces/IAnswerable.cs deleted file mode 100644 index 42914e3..0000000 --- a/src/Models/Interfaces/IAnswerable.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; -using Festispec.Models.Answers; - -namespace Festispec.Models.Interfaces -{ - public interface IAnswerable where TAnswer : Answer - { - ICollection Answers { get; set; } - } -} \ No newline at end of file diff --git a/src/Models/Migrations/202001081644430_Initial.cs b/src/Models/Migrations/202001081644430_Initial.cs deleted file mode 100644 index e0e5536..0000000 --- a/src/Models/Migrations/202001081644430_Initial.cs +++ /dev/null @@ -1,387 +0,0 @@ -using System.Data.Entity.Migrations; - -namespace Festispec.Models.Migrations -{ - public partial class Initial : DbMigration - { - public override void Up() - { - CreateTable( - "dbo.Accounts", - c => new - { - Id = c.Int(false), - Username = c.String(false, 45), - Password = c.String(false, 100), - IsNonActive = c.DateTime(), - Role = c.Int(false), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Employees", t => t.Id) - .Index(t => t.Id); - - CreateTable( - "dbo.Employees", - c => new - { - Id = c.Int(false, true), - Name_First = c.String(false, 40), - Name_Middle = c.String(maxLength: 40), - Name_Last = c.String(false, 40), - Iban = c.String(false, 30), - ContactDetails_PhoneNumber = c.String(maxLength: 50), - ContactDetails_EmailAddress = c.String(maxLength: 50), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - Address_Id = c.Int() - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Addresses", t => t.Address_Id) - .Index(t => t.Address_Id); - - CreateTable( - "dbo.Addresses", - c => new - { - Id = c.Int(false, true), - ZipCode = c.String(false, 10), - StreetName = c.String(false, 50), - HouseNumber = c.Int(), - Suffix = c.String(maxLength: 10), - City = c.String(false, 200), - Country = c.String(false, 75), - Latitude = c.Single(false), - Longitude = c.Single(false) - }) - .PrimaryKey(t => t.Id); - - CreateTable( - "dbo.Certificates", - c => new - { - Id = c.Int(false, true), - CertificateTitle = c.String(false, 45), - CertificationDate = c.DateTime(false), - ExpirationDate = c.DateTime(false), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - Employee_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Employees", t => t.Employee_Id, true) - .Index(t => t.Employee_Id); - - CreateTable( - "dbo.PlannedEvents", - c => new - { - Id = c.Int(false, true), - StartTime = c.DateTime(false), - EndTime = c.DateTime(false), - EventTitle = c.String(false, 45), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - IsAvailable = c.Boolean(), - Reason = c.String(maxLength: 250), - WorkedHours = c.Int(), - WorkedHoursAccepted = c.DateTime(), - CancellationReason = c.String(maxLength: 250), - IsCancelled = c.DateTime(), - Discriminator = c.String(false, 128), - Festival_Id = c.Int(), - Questionnaire_Id = c.Int(), - Employee_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Festivals", t => t.Festival_Id) - .ForeignKey("dbo.Questionnaires", t => t.Questionnaire_Id, true) - .ForeignKey("dbo.Employees", t => t.Employee_Id, true) - .Index(t => t.Festival_Id) - .Index(t => t.Questionnaire_Id) - .Index(t => t.Employee_Id); - - CreateTable( - "dbo.Answers", - c => new - { - Id = c.Int(false, true), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - MultipleChoiceAnswerKey = c.Int(), - IntAnswer = c.Int(), - AnswerContents = c.String(), - UploadedFilePath = c.String(), - Discriminator = c.String(false, 128), - PlannedInspection_Id = c.Int(false), - Question_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.PlannedEvents", t => t.PlannedInspection_Id) - .ForeignKey("dbo.Questions", t => t.Question_Id) - .Index(t => t.PlannedInspection_Id) - .Index(t => t.Question_Id); - - CreateTable( - "dbo.Attachments", - c => new - { - Id = c.Int(false, true), - FilePath = c.String(false), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - Answer_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Answers", t => t.Answer_Id, true) - .Index(t => t.Answer_Id); - - CreateTable( - "dbo.Questions", - c => new - { - Id = c.Int(false, true), - Contents = c.String(false, 250), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - Options = c.String(), - Minimum = c.Int(), - Maximum = c.Int(), - Unit = c.Int(), - LowRatingDescription = c.String(), - HighRatingDescription = c.String(), - IsMultiline = c.Boolean(), - PicturePath = c.String(), - Discriminator = c.String(false, 128), - Category_Id = c.Int(), - Questionnaire_Id = c.Int(false), - Question_Id = c.Int() - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.QuestionCategories", t => t.Category_Id) - .ForeignKey("dbo.Questionnaires", t => t.Questionnaire_Id, true) - .ForeignKey("dbo.Questions", t => t.Question_Id) - .Index(t => t.Category_Id) - .Index(t => t.Questionnaire_Id) - .Index(t => t.Question_Id); - - CreateTable( - "dbo.QuestionCategories", - c => new - { - Id = c.Int(false, true), - CategoryName = c.String(false, 45), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false) - }) - .PrimaryKey(t => t.Id); - - CreateTable( - "dbo.Questionnaires", - c => new - { - Id = c.Int(false, true), - Name = c.String(false, 45), - IsComplete = c.DateTime(), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - Festival_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Festivals", t => t.Festival_Id, true) - .Index(t => t.Festival_Id); - - CreateTable( - "dbo.Festivals", - c => new - { - Id = c.Int(false, true), - FestivalName = c.String(false, 45), - Description = c.String(false, 250), - OpeningHours_StartTime = c.Time(false, 7), - OpeningHours_EndTime = c.Time(false, 7), - OpeningHours_StartDate = c.DateTime(false), - OpeningHours_EndDate = c.DateTime(false), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - Address_Id = c.Int(false), - Customer_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Addresses", t => t.Address_Id, true) - .ForeignKey("dbo.Customers", t => t.Customer_Id, true) - .Index(t => t.Address_Id) - .Index(t => t.Customer_Id); - - CreateTable( - "dbo.Customers", - c => new - { - Id = c.Int(false, true), - KvkNr = c.Int(false), - CustomerName = c.String(false, 20), - ContactDetails_PhoneNumber = c.String(maxLength: 50), - ContactDetails_EmailAddress = c.String(maxLength: 50), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - Address_Id = c.Int() - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Addresses", t => t.Address_Id) - .Index(t => t.Address_Id); - - CreateTable( - "dbo.ContactPersons", - c => new - { - Id = c.Int(false, true), - Role = c.String(false, 20), - Name_First = c.String(false, 40), - Name_Middle = c.String(maxLength: 40), - Name_Last = c.String(false, 40), - ContactDetails_PhoneNumber = c.String(maxLength: 50), - ContactDetails_EmailAddress = c.String(maxLength: 50), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - Customer_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Customers", t => t.Customer_Id, true) - .Index(t => t.Customer_Id); - - CreateTable( - "dbo.ContactPersonNotes", - c => new - { - Id = c.Int(false, true), - Note = c.String(false, 500), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - ContactPerson_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.ContactPersons", t => t.ContactPerson_Id, true) - .Index(t => t.ContactPerson_Id); - - CreateTable( - "dbo.Reports", - c => new - { - Id = c.Int(false), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Festivals", t => t.Id) - .Index(t => t.Id); - - CreateTable( - "dbo.ReportEntries", - c => new - { - Id = c.Int(false), - Order = c.Int(false), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - GraphXAxisType = c.Int(), - GraphType = c.Int(), - XAxisLabel = c.String(), - YAxisLabel = c.String(), - Header = c.String(), - Text = c.String(), - Discriminator = c.String(false, 128), - Report_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Questions", t => t.Id) - .ForeignKey("dbo.Reports", t => t.Report_Id, true) - .Index(t => t.Id) - .Index(t => t.Report_Id); - - CreateTable( - "dbo.DistanceResults", - c => new - { - Id = c.Int(false, true), - Distance = c.Double(false), - CreatedAt = c.DateTime(false), - UpdatedAt = c.DateTime(false), - Destination_Id = c.Int(false), - Origin_Id = c.Int(false) - }) - .PrimaryKey(t => t.Id) - .ForeignKey("dbo.Addresses", t => t.Destination_Id) - .ForeignKey("dbo.Addresses", t => t.Origin_Id) - .Index(t => t.Destination_Id) - .Index(t => t.Origin_Id); - } - - public override void Down() - { - DropForeignKey("dbo.DistanceResults", "Origin_Id", "dbo.Addresses"); - DropForeignKey("dbo.DistanceResults", "Destination_Id", "dbo.Addresses"); - DropForeignKey("dbo.Accounts", "Id", "dbo.Employees"); - DropForeignKey("dbo.PlannedEvents", "Employee_Id", "dbo.Employees"); - DropForeignKey("dbo.PlannedEvents", "Questionnaire_Id", "dbo.Questionnaires"); - DropForeignKey("dbo.Answers", "Question_Id", "dbo.Questions"); - DropForeignKey("dbo.Questions", "Question_Id", "dbo.Questions"); - DropForeignKey("dbo.Questions", "Questionnaire_Id", "dbo.Questionnaires"); - DropForeignKey("dbo.Reports", "Id", "dbo.Festivals"); - DropForeignKey("dbo.ReportEntries", "Report_Id", "dbo.Reports"); - DropForeignKey("dbo.ReportEntries", "Id", "dbo.Questions"); - DropForeignKey("dbo.Questionnaires", "Festival_Id", "dbo.Festivals"); - DropForeignKey("dbo.PlannedEvents", "Festival_Id", "dbo.Festivals"); - DropForeignKey("dbo.Festivals", "Customer_Id", "dbo.Customers"); - DropForeignKey("dbo.ContactPersonNotes", "ContactPerson_Id", "dbo.ContactPersons"); - DropForeignKey("dbo.ContactPersons", "Customer_Id", "dbo.Customers"); - DropForeignKey("dbo.Customers", "Address_Id", "dbo.Addresses"); - DropForeignKey("dbo.Festivals", "Address_Id", "dbo.Addresses"); - DropForeignKey("dbo.Questions", "Category_Id", "dbo.QuestionCategories"); - DropForeignKey("dbo.Answers", "PlannedInspection_Id", "dbo.PlannedEvents"); - DropForeignKey("dbo.Attachments", "Answer_Id", "dbo.Answers"); - DropForeignKey("dbo.Certificates", "Employee_Id", "dbo.Employees"); - DropForeignKey("dbo.Employees", "Address_Id", "dbo.Addresses"); - DropIndex("dbo.DistanceResults", new[] {"Origin_Id"}); - DropIndex("dbo.DistanceResults", new[] {"Destination_Id"}); - DropIndex("dbo.ReportEntries", new[] {"Report_Id"}); - DropIndex("dbo.ReportEntries", new[] {"Id"}); - DropIndex("dbo.Reports", new[] {"Id"}); - DropIndex("dbo.ContactPersonNotes", new[] {"ContactPerson_Id"}); - DropIndex("dbo.ContactPersons", new[] {"Customer_Id"}); - DropIndex("dbo.Customers", new[] {"Address_Id"}); - DropIndex("dbo.Festivals", new[] {"Customer_Id"}); - DropIndex("dbo.Festivals", new[] {"Address_Id"}); - DropIndex("dbo.Questionnaires", new[] {"Festival_Id"}); - DropIndex("dbo.Questions", new[] {"Question_Id"}); - DropIndex("dbo.Questions", new[] {"Questionnaire_Id"}); - DropIndex("dbo.Questions", new[] {"Category_Id"}); - DropIndex("dbo.Attachments", new[] {"Answer_Id"}); - DropIndex("dbo.Answers", new[] {"Question_Id"}); - DropIndex("dbo.Answers", new[] {"PlannedInspection_Id"}); - DropIndex("dbo.PlannedEvents", new[] {"Employee_Id"}); - DropIndex("dbo.PlannedEvents", new[] {"Questionnaire_Id"}); - DropIndex("dbo.PlannedEvents", new[] {"Festival_Id"}); - DropIndex("dbo.Certificates", new[] {"Employee_Id"}); - DropIndex("dbo.Employees", new[] {"Address_Id"}); - DropIndex("dbo.Accounts", new[] {"Id"}); - DropTable("dbo.DistanceResults"); - DropTable("dbo.ReportEntries"); - DropTable("dbo.Reports"); - DropTable("dbo.ContactPersonNotes"); - DropTable("dbo.ContactPersons"); - DropTable("dbo.Customers"); - DropTable("dbo.Festivals"); - DropTable("dbo.Questionnaires"); - DropTable("dbo.QuestionCategories"); - DropTable("dbo.Questions"); - DropTable("dbo.Attachments"); - DropTable("dbo.Answers"); - DropTable("dbo.PlannedEvents"); - DropTable("dbo.Certificates"); - DropTable("dbo.Addresses"); - DropTable("dbo.Employees"); - DropTable("dbo.Accounts"); - } - } -} \ No newline at end of file diff --git a/src/Models/Migrations/202001081644430_Initial.resx b/src/Models/Migrations/202001081644430_Initial.resx deleted file mode 100644 index a539322..0000000 --- a/src/Models/Migrations/202001081644430_Initial.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - H4sIAAAAAAAACuw9227kNpbvC+w/FOppZpBx2d0TZKZhZ+C4uxMjttvb7s5k5qUhV9G2kCqpVlI5biz2y/ZhP2l/YSmJkng5vFOqkl0I0CmL5OHhufGQPOT5v//53+O/P62Wk0eU5XGanEyPDg6nE5TM00Wc3J9MN8Xdn/86/fv3//5vx+8Wq6fJL02912U93DLJT6YPRbF+M5vl8we0ivKDVTzP0jy9Kw7m6WoWLdLZq8PDv82OjmYIg5hiWJPJ8cdNUsQrVP2B/zxLkzlaF5toeZku0DIn33HJTQV1chWtUL6O5uhk+h7lRZyv0fygrnvwDoMqvl5G6zXGeTo5XcYRxuoGLe+mkyhJ0iIqMM5vPufopsjS5P5mjT9Ey09f1wjXu4uWOSJjedNVNx3W4atyWLOuYQNqvsmLdGUJ8Og1odOMb+5E7ZrYhJJn6Wq9RE/lsCtyYkpulsvy13TC9/bmbJmVFQFqN42+mdQfvmmFAstO+d83k7PNsthk6CRBmyKLlt9Mrje3y3j+M/r6Kf0NJScJBkGjhpG7ztI1yoqvDWZxlhfTSY0C5lrF2Mvo6QIl98XDyfQvWPrex09o0XwgXPycxFh0cZsi2+A/r3BH0e0SteUzZa+X8WKxRP7dqnu5iHof2vGMYrZaBj6sUYJR+CndZLmVHNANe5WFmyLKik/YWDREq39b8vZdsvCGUWHyNipaKOVvV2wc4FiwFRvUIpoXb1ERxUs7xrJNe2Xt9UOaoKvN6hZlCo34NoTWvVvh0ZwuFhnK87B9SblSz0sUU07n8xTPe1bcIG3CsgGXMR8ocn1EdwTb84VA0xnfkKdy2aYeyHlSvH5lrRd4js6SakaS28dv+zD911Ge/55mC0XHR4e9TDrn+VWanM6L+BEwB+qmH1NqtsLuzkH9wRKBswzh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x7rQCp1r3Udbc9lNX3vzdGF0GVTAPVTl5kCJ+dikh5IqbybsoKJxPNOptAfXwHqkq0jdsomtZVdnZxQ1biJC44xhv1xKj9x+01wEqCVHNWw+8iv69mhGAwTvCEIDFV/k9AdbaYlMMdWjZnv3sMG7rMBg9bdegN3eGkGk0+K4YpTY92S+hxqsOIFLPmQNZe1FBtG1CDYglkA0jkMXnHLCBi+6Z0kcGuYdwmqgYiFCkLw/gsDIQAxhMs0AAnUF26CGDXeq6gadh/9jRp/9wMyaMr7IUGGyXs2tR1rP/oPE77iAA3W4DKEO+psS8jXqpuzJWGHDwTk6+igi+EPMSw5DNopFOHUpeEUgXLHFaogiS8PJBl9a70q0Fll53Rx0e6D8J8mfcjAL/UUJFDF/wYaPrh2ZeY3UuJNADAGFRi9PlbVfW5mWgIrpqox8z3osJt1nnrQcFQYEBUn4LwDw+VDBFXirR2ou1gbk8jDdeUj4hR+qzJ4LoQ+DuquKmK3QNE2i/QKpNVsZFc/BODDlOQLtl6H2uf67FoTjwMMWdekX6Efah5vN5douOptKLZmH7szQw1eiHSAJF8ZDRFowNyxWC37zTfvYSoO9oEBm4YBBFm8wjuvVXO+KDQZyBG2ngLQWffODr55ta89qG3Ljmf1rjX5gP8s0iy6R5f4CHeZV1/x8TCWuHhVv/eHz6jz+L4DcYxhJrUp7IA2dc6Tu7Q5ouYwaqrw+f5QES3wqfFpueNaLkmzdI4pFif308kv0XJTKdRtaYA/bIr1psBDRqvbJePVlefcqv6PZwLOxyTrYYghYDTj8lXJD8kPm3i5aPF+D7ymKAFRHqCTRzhLXuLzeLyBh8dIIF2lZWY/E0CEfO25/yeEDU95BvwhuYkeMRB73D7n6ALdR/Ov+PtjXL0cKwOiZwRL9uO3cXSfRaucwOja4z+xDC9WT9//PwAAAP//AwBOHLpWr7YBAA== - - - dbo - - \ No newline at end of file diff --git a/src/Models/Migrations/202001091540426_EndDateNullable.resx b/src/Models/Migrations/202001091540426_EndDateNullable.resx deleted file mode 100644 index fbbe19e..0000000 --- a/src/Models/Migrations/202001091540426_EndDateNullable.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - H4sIAAAAAAAACuw9227kNpbvC+w/FOppZpBx2d0TZKZhZ+C4uxMjttvb7s5k5qUhV9G2kCqpVlI5biz2y/ZhP2l/YSmJkng5vFOqkl0I0CmL5OHhufGQPOT5v//53+O/P62Wk0eU5XGanEyPDg6nE5TM00Wc3J9MN8Xdn/86/fv3//5vx+8Wq6fJL02912U93DLJT6YPRbF+M5vl8we0ivKDVTzP0jy9Kw7m6WoWLdLZq8PDv82OjmYIg5hiWJPJ8cdNUsQrVP2B/zxLkzlaF5toeZku0DIn33HJTQV1chWtUL6O5uhk+h7lRZyv0fygrnvwDoMqvl5G6zXGeTo5XcYRxuoGLe+mkyhJ0iIqMM5vPufopsjS5P5mjT9Ey09f1wjXu4uWOSJjedNVNx3W4atyWLOuYQNqvsmLdGUJ8Og1odOMb+5E7ZrYhJJn6Wq9RE/lsCtyYkpulsvy13TC9/bmbJmVFQFqN42+mdQfvmmFAstO+d83k7PNsthk6CRBmyKLlt9Mrje3y3j+M/r6Kf0NJScJBkGjhpG7ztI1yoqvDWZxlhfTSY0C5lrF2Mvo6QIl98XDyfQvWPrex09o0XwgXPycxFh0cZsi2+A/r3BH0e0SteUzZa+X8WKxRP7dqnu5iHof2vGMYrZaBj6sUYJR+CndZLmVHNANe5WFmyLKik/YWDREq39b8vZdsvCGUWHyNipaKOVvV2wc4FiwFRvUIpoXb1ERxUs7xrJNe2Xt9UOaoKvN6hZlCo34NoTWvVvh0ZwuFhnK87B9SblSz0sUU07n8x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AA//8DAMBRoXKdtgEA - - - dbo - - \ No newline at end of file diff --git a/src/Models/Migrations/202001081644430_Initial.Designer.cs b/src/Models/Migrations/202001121533405_Initial.Designer.cs similarity index 93% rename from src/Models/Migrations/202001081644430_Initial.Designer.cs rename to src/Models/Migrations/202001121533405_Initial.Designer.cs index c268079..39624c5 100644 --- a/src/Models/Migrations/202001081644430_Initial.Designer.cs +++ b/src/Models/Migrations/202001121533405_Initial.Designer.cs @@ -13,7 +13,7 @@ public sealed partial class Initial : IMigrationMetadata string IMigrationMetadata.Id { - get { return "202001081644430_Initial"; } + get { return "202001121533405_Initial"; } } string IMigrationMetadata.Source diff --git a/src/Models/Migrations/202001121533405_Initial.cs b/src/Models/Migrations/202001121533405_Initial.cs new file mode 100644 index 0000000..534b23b --- /dev/null +++ b/src/Models/Migrations/202001121533405_Initial.cs @@ -0,0 +1,307 @@ +namespace Festispec.Models.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class Initial : DbMigration + { + public override void Up() + { + CreateTable( + "dbo.Accounts", + c => new + { + Id = c.Int(nullable: false), + Username = c.String(nullable: false, maxLength: 45), + Password = c.String(nullable: false, maxLength: 100), + IsNonActive = c.DateTime(), + Role = c.Int(nullable: false), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.Employees", t => t.Id) + .Index(t => t.Id); + + CreateTable( + "dbo.Employees", + c => new + { + Id = c.Int(nullable: false, identity: true), + Name_First = c.String(nullable: false, maxLength: 40), + Name_Middle = c.String(maxLength: 40), + Name_Last = c.String(nullable: false, maxLength: 40), + Iban = c.String(nullable: false, maxLength: 30), + ContactDetails_PhoneNumber = c.String(maxLength: 50), + ContactDetails_EmailAddress = c.String(maxLength: 50), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + Address_Id = c.Int(), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.Addresses", t => t.Address_Id) + .Index(t => t.Address_Id); + + CreateTable( + "dbo.Addresses", + c => new + { + Id = c.Int(nullable: false, identity: true), + ZipCode = c.String(nullable: false, maxLength: 10), + StreetName = c.String(nullable: false, maxLength: 50), + HouseNumber = c.Int(), + Suffix = c.String(maxLength: 10), + City = c.String(nullable: false, maxLength: 200), + Country = c.String(nullable: false, maxLength: 75), + Latitude = c.Single(nullable: false), + Longitude = c.Single(nullable: false), + }) + .PrimaryKey(t => t.Id); + + CreateTable( + "dbo.Certificates", + c => new + { + Id = c.Int(nullable: false, identity: true), + CertificateTitle = c.String(nullable: false, maxLength: 45), + CertificationDate = c.DateTime(nullable: false), + ExpirationDate = c.DateTime(nullable: false), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + Employee_Id = c.Int(nullable: false), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.Employees", t => t.Employee_Id, cascadeDelete: true) + .Index(t => t.Employee_Id); + + CreateTable( + "dbo.PlannedEvents", + c => new + { + Id = c.Int(nullable: false, identity: true), + StartTime = c.DateTime(nullable: false), + EndTime = c.DateTime(), + EventTitle = c.String(nullable: false, maxLength: 45), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + IsAvailable = c.Boolean(), + Reason = c.String(maxLength: 250), + WorkedHours = c.Int(), + WorkedHoursAccepted = c.DateTime(), + CancellationReason = c.String(maxLength: 250), + IsCancelled = c.DateTime(), + Discriminator = c.String(nullable: false, maxLength: 128), + Festival_Id = c.Int(), + Questionnaire_Id = c.Int(), + Employee_Id = c.Int(nullable: false), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.Festivals", t => t.Festival_Id) + .ForeignKey("dbo.Questionnaires", t => t.Questionnaire_Id, cascadeDelete: true) + .ForeignKey("dbo.Employees", t => t.Employee_Id, cascadeDelete: true) + .Index(t => t.Festival_Id) + .Index(t => t.Questionnaire_Id) + .Index(t => t.Employee_Id); + + CreateTable( + "dbo.Answers", + c => new + { + Id = c.Int(nullable: false, identity: true), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + MultipleChoiceAnswerKey = c.Int(), + IntAnswer = c.Int(), + AnswerContents = c.String(), + UploadedFilePath = c.String(), + Discriminator = c.String(nullable: false, maxLength: 128), + PlannedInspection_Id = c.Int(nullable: false), + Question_Id = c.Int(nullable: false), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.PlannedEvents", t => t.PlannedInspection_Id) + .ForeignKey("dbo.Questions", t => t.Question_Id) + .Index(t => t.PlannedInspection_Id) + .Index(t => t.Question_Id); + + CreateTable( + "dbo.Questions", + c => new + { + Id = c.Int(nullable: false, identity: true), + Contents = c.String(nullable: false, maxLength: 250), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + Options = c.String(), + Minimum = c.Int(), + Maximum = c.Int(), + Unit = c.Int(), + LowRatingDescription = c.String(), + HighRatingDescription = c.String(), + IsMultiline = c.Boolean(), + PicturePath = c.String(), + Discriminator = c.String(nullable: false, maxLength: 128), + Category_Id = c.Int(), + Questionnaire_Id = c.Int(nullable: false), + Question_Id = c.Int(), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.QuestionCategories", t => t.Category_Id) + .ForeignKey("dbo.Questionnaires", t => t.Questionnaire_Id, cascadeDelete: true) + .ForeignKey("dbo.Questions", t => t.Question_Id) + .Index(t => t.Category_Id) + .Index(t => t.Questionnaire_Id) + .Index(t => t.Question_Id); + + CreateTable( + "dbo.QuestionCategories", + c => new + { + Id = c.Int(nullable: false, identity: true), + CategoryName = c.String(nullable: false, maxLength: 45), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + }) + .PrimaryKey(t => t.Id); + + CreateTable( + "dbo.Questionnaires", + c => new + { + Id = c.Int(nullable: false, identity: true), + Name = c.String(nullable: false, maxLength: 45), + IsComplete = c.DateTime(), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + Festival_Id = c.Int(nullable: false), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.Festivals", t => t.Festival_Id, cascadeDelete: true) + .Index(t => t.Festival_Id); + + CreateTable( + "dbo.Festivals", + c => new + { + Id = c.Int(nullable: false, identity: true), + FestivalName = c.String(nullable: false, maxLength: 45), + Description = c.String(nullable: false, maxLength: 250), + OpeningHours_StartTime = c.Time(nullable: false, precision: 7), + OpeningHours_EndTime = c.Time(nullable: false, precision: 7), + OpeningHours_StartDate = c.DateTime(nullable: false), + OpeningHours_EndDate = c.DateTime(nullable: false), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + Address_Id = c.Int(nullable: false), + Customer_Id = c.Int(nullable: false), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.Addresses", t => t.Address_Id, cascadeDelete: true) + .ForeignKey("dbo.Customers", t => t.Customer_Id, cascadeDelete: true) + .Index(t => t.Address_Id) + .Index(t => t.Customer_Id); + + CreateTable( + "dbo.Customers", + c => new + { + Id = c.Int(nullable: false, identity: true), + KvkNr = c.Int(nullable: false), + CustomerName = c.String(nullable: false, maxLength: 20), + ContactDetails_PhoneNumber = c.String(maxLength: 50), + ContactDetails_EmailAddress = c.String(maxLength: 50), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + Address_Id = c.Int(), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.Addresses", t => t.Address_Id) + .Index(t => t.Address_Id); + + CreateTable( + "dbo.Attachments", + c => new + { + Id = c.Int(nullable: false, identity: true), + FilePath = c.String(nullable: false), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + Answer_Id = c.Int(nullable: false), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.Answers", t => t.Answer_Id, cascadeDelete: true) + .Index(t => t.Answer_Id); + + CreateTable( + "dbo.DistanceResults", + c => new + { + Id = c.Int(nullable: false, identity: true), + Distance = c.Double(nullable: false), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + Destination_Id = c.Int(nullable: false), + Origin_Id = c.Int(nullable: false), + }) + .PrimaryKey(t => t.Id) + .ForeignKey("dbo.Addresses", t => t.Destination_Id) + .ForeignKey("dbo.Addresses", t => t.Origin_Id) + .Index(t => t.Destination_Id) + .Index(t => t.Origin_Id); + + } + + public override void Down() + { + DropForeignKey("dbo.DistanceResults", "Origin_Id", "dbo.Addresses"); + DropForeignKey("dbo.DistanceResults", "Destination_Id", "dbo.Addresses"); + DropForeignKey("dbo.Attachments", "Answer_Id", "dbo.Answers"); + DropForeignKey("dbo.Accounts", "Id", "dbo.Employees"); + DropForeignKey("dbo.PlannedEvents", "Employee_Id", "dbo.Employees"); + DropForeignKey("dbo.PlannedEvents", "Questionnaire_Id", "dbo.Questionnaires"); + DropForeignKey("dbo.Answers", "Question_Id", "dbo.Questions"); + DropForeignKey("dbo.Questions", "Question_Id", "dbo.Questions"); + DropForeignKey("dbo.Questions", "Questionnaire_Id", "dbo.Questionnaires"); + DropForeignKey("dbo.Questionnaires", "Festival_Id", "dbo.Festivals"); + DropForeignKey("dbo.PlannedEvents", "Festival_Id", "dbo.Festivals"); + DropForeignKey("dbo.Festivals", "Customer_Id", "dbo.Customers"); + DropForeignKey("dbo.Customers", "Address_Id", "dbo.Addresses"); + DropForeignKey("dbo.Festivals", "Address_Id", "dbo.Addresses"); + DropForeignKey("dbo.Questions", "Category_Id", "dbo.QuestionCategories"); + DropForeignKey("dbo.Answers", "PlannedInspection_Id", "dbo.PlannedEvents"); + DropForeignKey("dbo.Certificates", "Employee_Id", "dbo.Employees"); + DropForeignKey("dbo.Employees", "Address_Id", "dbo.Addresses"); + DropIndex("dbo.DistanceResults", new[] { "Origin_Id" }); + DropIndex("dbo.DistanceResults", new[] { "Destination_Id" }); + DropIndex("dbo.Attachments", new[] { "Answer_Id" }); + DropIndex("dbo.Customers", new[] { "Address_Id" }); + DropIndex("dbo.Festivals", new[] { "Customer_Id" }); + DropIndex("dbo.Festivals", new[] { "Address_Id" }); + DropIndex("dbo.Questionnaires", new[] { "Festival_Id" }); + DropIndex("dbo.Questions", new[] { "Question_Id" }); + DropIndex("dbo.Questions", new[] { "Questionnaire_Id" }); + DropIndex("dbo.Questions", new[] { "Category_Id" }); + DropIndex("dbo.Answers", new[] { "Question_Id" }); + DropIndex("dbo.Answers", new[] { "PlannedInspection_Id" }); + DropIndex("dbo.PlannedEvents", new[] { "Employee_Id" }); + DropIndex("dbo.PlannedEvents", new[] { "Questionnaire_Id" }); + DropIndex("dbo.PlannedEvents", new[] { "Festival_Id" }); + DropIndex("dbo.Certificates", new[] { "Employee_Id" }); + DropIndex("dbo.Employees", new[] { "Address_Id" }); + DropIndex("dbo.Accounts", new[] { "Id" }); + DropTable("dbo.DistanceResults"); + DropTable("dbo.Attachments"); + DropTable("dbo.Customers"); + DropTable("dbo.Festivals"); + DropTable("dbo.Questionnaires"); + DropTable("dbo.QuestionCategories"); + DropTable("dbo.Questions"); + DropTable("dbo.Answers"); + DropTable("dbo.PlannedEvents"); + DropTable("dbo.Certificates"); + DropTable("dbo.Addresses"); + DropTable("dbo.Employees"); + DropTable("dbo.Accounts"); + } + } +} diff --git a/src/Models/Migrations/202001121533405_Initial.resx b/src/Models/Migrations/202001121533405_Initial.resx new file mode 100644 index 0000000..ee56fe8 --- /dev/null +++ b/src/Models/Migrations/202001121533405_Initial.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + H4sIAAAAAAAACuw9XW/cOJLvB9x/aPTT7iLrtpMdzG5g7yJjJ3vGxIk3TuYO9xLIat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JLgAvviB95cEF6BJFA4ZlYtmc+IUx2vKvRhfKGf4m0JJUHvl4cKa4kMYeETxUXogBTJehhKzV1g+SZOAedflE2hL7TogHG/EjphSmUdURXMfbGKutAZWyzrjcu6YMIdUjBE1A0h/GWY68rMwMldiwCeyjYj6YBKZWXZBfGYUXZFqui6RLUyi6Xi7g6UHQ+5VTS9DqnbDD0Sm4vQGSmS9UMsyEZax0ZjkdBxkZTKUakFzVEKpUh3VKGU9nC5uSNeVRE64yvIOmTriJ2yEdhVnsczqhon/uTuHXKtjs6lMXwTthrZUZJqSD7yZwN2KhbTlDrYSqZqdsT1HzbTUiKp+3y79PfgaSvdQSVTt3Md1VziqDLm6NDASnU6iVf45HXpz8Xp23pISq9reaHO5LAjhRpE8DsQmwUvHBmCa58EBXr3vyh8zu8LbPbgCHwuJLSW8LjWWy3KNPm9iU2lHXGa1HapmajCLct/yFtdU51/kI6KTe5E/pMIF4IhaPgHp4ppUMBVHWP6TBdS6YVKoslzIYmsWphrvTxiTGOrMlyXQFXEga1Lgv8UNC4I4yCAt6ertZhRpzqm0mJMfClO2cnWHJ3otyX+FDZO3XFFYw2NpMVva/KCSU5G+VqzXaQJc5dwPe0P38KnKSZmlMxTb6by41SleUmeEzJ8qrqshOKcbe0rUZRX+WWELC9edDQM+fiMGJAZEfZ28kJqO1x2uugvctAH+KeQwg7eu0Pmylb9C3J4+V9n9wREm4q36KU+ATrUuSzuyuHunxvRUIWP/AmaZAmv49+0lxBJ2sDiFGIsK+7ns1+SfNPJjtt2r/m4adabBk4ZrG5z5mjbGhB0/Z8uhDGfovinMaYAh5m1cQo+Fj9tsnyJx/1O8j5fAaK1TKCwDu1aQkMHPMDDOSJIMDObJSCEPmxQ+QygjG0v1z8WN0mb2c19bDCT3Xtwn6Tf4PcuE6EaiHkhWLSfXmTJfZWsagSDtId/Qhperp7++v8AAAD//wMAOrRjHXdbAQA= + + + dbo + + \ No newline at end of file diff --git a/src/Models/Migrations/202001091540426_EndDateNullable.Designer.cs b/src/Models/Migrations/202001131230471_DropUnit.Designer.cs old mode 100644 new mode 100755 similarity index 79% rename from src/Models/Migrations/202001091540426_EndDateNullable.Designer.cs rename to src/Models/Migrations/202001131230471_DropUnit.Designer.cs index 7073074..265c388 --- a/src/Models/Migrations/202001091540426_EndDateNullable.Designer.cs +++ b/src/Models/Migrations/202001131230471_DropUnit.Designer.cs @@ -1,29 +1,29 @@ -// -namespace Festispec.Models.Migrations -{ - using System.CodeDom.Compiler; - using System.Data.Entity.Migrations; - using System.Data.Entity.Migrations.Infrastructure; - using System.Resources; - - [GeneratedCode("EntityFramework.Migrations", "6.3.0")] - public sealed partial class EndDateNullable : IMigrationMetadata - { - private readonly ResourceManager Resources = new ResourceManager(typeof(EndDateNullable)); - - string IMigrationMetadata.Id - { - get { return "202001091540426_EndDateNullable"; } - } - - string IMigrationMetadata.Source - { - get { return null; } - } - - string IMigrationMetadata.Target - { - get { return Resources.GetString("Target"); } - } - } -} +// +namespace Festispec.Models.Migrations +{ + using System.CodeDom.Compiler; + using System.Data.Entity.Migrations; + using System.Data.Entity.Migrations.Infrastructure; + using System.Resources; + + [GeneratedCode("EntityFramework.Migrations", "6.3.0")] + public sealed partial class DropUnit : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(DropUnit)); + + string IMigrationMetadata.Id + { + get { return "202001131230471_DropUnit"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/src/Models/Migrations/202001091540426_EndDateNullable.cs b/src/Models/Migrations/202001131230471_DropUnit.cs old mode 100644 new mode 100755 similarity index 51% rename from src/Models/Migrations/202001091540426_EndDateNullable.cs rename to src/Models/Migrations/202001131230471_DropUnit.cs index d06cc41..0e048b6 --- a/src/Models/Migrations/202001091540426_EndDateNullable.cs +++ b/src/Models/Migrations/202001131230471_DropUnit.cs @@ -1,18 +1,18 @@ -namespace Festispec.Models.Migrations -{ - using System; - using System.Data.Entity.Migrations; - - public partial class EndDateNullable : DbMigration - { - public override void Up() - { - AlterColumn("dbo.PlannedEvents", "EndTime", c => c.DateTime()); - } - - public override void Down() - { - AlterColumn("dbo.PlannedEvents", "EndTime", c => c.DateTime(nullable: false)); - } - } -} +namespace Festispec.Models.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class DropUnit : DbMigration + { + public override void Up() + { + DropColumn("dbo.Questions", "Unit"); + } + + public override void Down() + { + AddColumn("dbo.Questions", "Unit", c => c.Int()); + } + } +} diff --git a/src/Models/Migrations/202001131230471_DropUnit.resx b/src/Models/Migrations/202001131230471_DropUnit.resx new file mode 100755 index 0000000..11d6cd2 --- /dev/null +++ b/src/Models/Migrations/202001131230471_DropUnit.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + H4sIAAAAAAAACuw9XW/cOJLvB9x/aPTT7iLrtpMdzG5gz8JjJ3vGxLEnTuYO9xLIatoWopZ6JbXHxuF+2T3cT7q/cJRE8ftbVLfkNAbItEWySBarikVWser//ud/j//+tEpnj6Aokzw7mR8dHM5nIIvzZZLdn8w31d2f/zr/+0//+i/H75arp9lvXb03dT3YMitP5g9VtX67WJTxA1hF5cEqiYu8zO+qgzhfLaJlvnh9ePi3xdHRAkAQcwhrNjv+tMmqZAWaP+CfZ3kWg3W1idLLfAnSEn2HJTcN1NnHaAXKdRSDk/l7UFZJuQbxQVv34B0EVT1fRus1HPN8dpomERzVDUjv5rMoy/IqquCY334pwU1V5Nn9zRp+iNLPz2sA691FaQnQXN6S6rbTOnxdT2tBGnag4k1Z5StHgEdvEJ4WfHMvbLfIRpg8y1frFDzV027Q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J6yhYpM7kf8k+gvBPmjgVTENCnRuM4GmL9UtJel4w8lzIQusWphrvTxCTGOrMlyXAfVUwIGtS4L/FDQuCMMggLenq7WYQac6pNJizFwpTtnJ1hyc6Lcl/lTZFkV82FhDA2nx25q8YJKTUb7WbBdowtwlXEv73bf+0xQzK0rmqTdT+XGq0rwkT+rYf6q6tILinG3tK0GUV/llhCyxXXA0dAn1jBiQGRFGO3khNx0uO160FznoA/xTyEEH790hcyWr9gU5vPwvk3sCos6lm7VSnwDt6lxkd3l398+NqKvCh+4EVbSE1/Gn9SVEFFewOIYYS7L7+ey3KN00suO23muuNtV6U8Epg9VtyhxtawOCrv/jhTDmYxTANMQU4DCTOk7BVfbzJkmXeNzvJe/zFSBqywQK61CvJTR0wAM8nCOCBFOrWQJC6MMGlc8Aytj6cv0qu4nq1GzuY4Op6D6A+yh+ht+bVIJqIOaFYNF+fJ5E90W0KhEM0h7+CWl4uXr66f8BAAD//wMAyfxjxGxZAQA= + + + dbo + + \ No newline at end of file diff --git a/src/Models/Migrations/202001131333256_CustomerNotes.Designer.cs b/src/Models/Migrations/202001131333256_CustomerNotes.Designer.cs new file mode 100755 index 0000000..d9db96e --- /dev/null +++ b/src/Models/Migrations/202001131333256_CustomerNotes.Designer.cs @@ -0,0 +1,29 @@ +// +namespace Festispec.Models.Migrations +{ + using System.CodeDom.Compiler; + using System.Data.Entity.Migrations; + using System.Data.Entity.Migrations.Infrastructure; + using System.Resources; + + [GeneratedCode("EntityFramework.Migrations", "6.3.0")] + public sealed partial class CustomerNotes : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(CustomerNotes)); + + string IMigrationMetadata.Id + { + get { return "202001131333256_CustomerNotes"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/src/Models/Migrations/202001131333256_CustomerNotes.cs b/src/Models/Migrations/202001131333256_CustomerNotes.cs new file mode 100755 index 0000000..c06ab18 --- /dev/null +++ b/src/Models/Migrations/202001131333256_CustomerNotes.cs @@ -0,0 +1,18 @@ +namespace Festispec.Models.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class CustomerNotes : DbMigration + { + public override void Up() + { + AddColumn("dbo.Customers", "Notes", c => c.String(maxLength: 500)); + } + + public override void Down() + { + DropColumn("dbo.Customers", "Notes"); + } + } +} diff --git a/src/Models/Migrations/202001131333256_CustomerNotes.resx b/src/Models/Migrations/202001131333256_CustomerNotes.resx new file mode 100755 index 0000000..7b05a6a --- /dev/null +++ b/src/Models/Migrations/202001131333256_CustomerNotes.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + H4sIAAAAAAAACuw9XW/cOJLvB9x/aPTT7iLrtpMdzG5gzyJjJ3vGxLE3TuYO9xLIatoWopZ6JbXHwWF/2T7cT7q/cJRE8fubVHfLMQbItEWySBaLxWJVser//vW/x399XOWzB1DVWVmczI8ODuczUKTlMivuTuab5vaPf57/9ad//7fjt8vV4+zXod6rth5sWdQn8/umWb9eLOr0HqyS+mCVpVVZl7fNQVquFsmyXLw8PPzL4uhoASCIOYQ1mx1/3BRNtgLdH/DP07JIwbrZJPlFuQR5jb7DkusO6uxDsgL1OknByfwdqJusXoP0oK978BaCar5dJOs1HPN89ibPEjiqa5DfzmdJUZRN0sAxv/5cg+umKou76zX8kOSfvq0BrHeb5DVAc3lNqttO6/BlO60FaTiASjd1U64cAR69Qnha8M29sN0jG2HytFytc/DYTrtDJ8TkJs/bX/MZ39vr07xqK0qwPTR6Mes/vMBEAWmn/e/F7HSTN5sKnBRg01RJ/mJ2tbnJs/QX8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KNPkzyY2wXbEaVLHpWaiCrcs/yFvdU21SYo1VGxyJ/KfRDgTDEEDL4ppUKBzm4k0falsKcnxG4+fC6ll1cxc6+URYxpb5eG6tKoiDmxdEvynoHFBGAcBQlpQpRQz6lTHFFpMhmPJlJ1szdGJflvsD19COLWB5rqisYZGkuK3NXnBJCejfK3ZLtKEOSVcT/vDt/BpiukaJfPUm6n8dqrSvCTPFBk+VV2uQnHOtvaVKMKrXBkhy5YXHQ1Dlj4jBmRGhL2dvJDwDpcdL3pFDvoA/xQS20G9O9xc2ap/QQ6V/3V2R0C0CXqLnusToEOd8+K2HHT/3IiGKnw8UNAkS6iOf9MqIZK0gcUpxFhW3M1nvyb5puMdN+1Zc7lp1psGThmsbnLmatsaEHT9Hy+EMR+jqKgxpgCHmbVxCi6LnzdZvsTjfid5n68A0VomUFiHdi2hoQNe4OEcESSYr80SEEIfNqh8ApDHtsr1y+I6afO9uY8N5rd7D+6S9Bv83uUnVAMxLwSL9uOzLLmrklWNYJD28E9Iw8vV40//DwAA//8DABpnK2xrWgEA + + + dbo + + \ No newline at end of file diff --git a/src/Models/Migrations/202001131421208_UnusedClasses.Designer.cs b/src/Models/Migrations/202001131421208_UnusedClasses.Designer.cs new file mode 100755 index 0000000..cc8c534 --- /dev/null +++ b/src/Models/Migrations/202001131421208_UnusedClasses.Designer.cs @@ -0,0 +1,29 @@ +// +namespace Festispec.Models.Migrations +{ + using System.CodeDom.Compiler; + using System.Data.Entity.Migrations; + using System.Data.Entity.Migrations.Infrastructure; + using System.Resources; + + [GeneratedCode("EntityFramework.Migrations", "6.3.0")] + public sealed partial class UnusedClasses : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(UnusedClasses)); + + string IMigrationMetadata.Id + { + get { return "202001131421208_UnusedClasses"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/src/Models/Migrations/202001131421208_UnusedClasses.cs b/src/Models/Migrations/202001131421208_UnusedClasses.cs new file mode 100755 index 0000000..488fbe2 --- /dev/null +++ b/src/Models/Migrations/202001131421208_UnusedClasses.cs @@ -0,0 +1,51 @@ +namespace Festispec.Models.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class UnusedClasses : DbMigration + { + public override void Up() + { + DropForeignKey("dbo.Questions", "Category_Id", "dbo.QuestionCategories"); + DropForeignKey("dbo.Attachments", "Answer_Id", "dbo.Answers"); + DropIndex("dbo.Questions", new[] { "Category_Id" }); + DropIndex("dbo.Attachments", new[] { "Answer_Id" }); + DropColumn("dbo.Questions", "Category_Id"); + DropTable("dbo.QuestionCategories"); + DropTable("dbo.Attachments"); + } + + public override void Down() + { + CreateTable( + "dbo.Attachments", + c => new + { + Id = c.Int(nullable: false, identity: true), + FilePath = c.String(nullable: false), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + Answer_Id = c.Int(nullable: false), + }) + .PrimaryKey(t => t.Id); + + CreateTable( + "dbo.QuestionCategories", + c => new + { + Id = c.Int(nullable: false, identity: true), + CategoryName = c.String(nullable: false, maxLength: 45), + CreatedAt = c.DateTime(nullable: false), + UpdatedAt = c.DateTime(nullable: false), + }) + .PrimaryKey(t => t.Id); + + AddColumn("dbo.Questions", "Category_Id", c => c.Int()); + CreateIndex("dbo.Attachments", "Answer_Id"); + CreateIndex("dbo.Questions", "Category_Id"); + AddForeignKey("dbo.Attachments", "Answer_Id", "dbo.Answers", "Id", cascadeDelete: true); + AddForeignKey("dbo.Questions", "Category_Id", "dbo.QuestionCategories", "Id"); + } + } +} diff --git a/src/Models/Migrations/202001131421208_UnusedClasses.resx b/src/Models/Migrations/202001131421208_UnusedClasses.resx new file mode 100755 index 0000000..cdae42c --- /dev/null +++ b/src/Models/Migrations/202001131421208_UnusedClasses.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + H4sIAAAAAAAACuw9XW/cOJLvB9x/aPTT7iLrtpMdzF5g78Jjx3vGxLEvTuYO9xLI3bQtjFrqldQZB4f9ZftwP+n+wpESxe9vUd2SYwyQaYtkkSxWFYvFYtX//fN/j//6tM5mX0FZpUV+Mj86OJzPQL4sVmn+cDLf1vd//PP8r3/51385frdaP81+6eq9QfVgy7w6mT/W9ebtYlEtH8E6qQ7W6bIsquK+PlgW60WyKhavDw//bXF0tAAQxBzCms2OP27zOl2D5g/451mRL8Gm3ibZVbECWYW/w5LbBursQ7IG1SZZgpP5BajqtNqA5UFb9+AdBFV/u0o2Gzjm+ew0SxM4qluQ3c9nSZ4XdVLDMb/9XIHbuizyh9sN/JBkn75tAKx3n2QVwHN5S6u7TuvwNZrWgjbsQC23VV2sPQEevcF4WojNg7DdIhtj8qxYbzLwhKbdoBNicptl6Nd8Jvb29iwrUUUFtrtGr2bth1eEKCDtoP9ezc62Wb0twUkOtnWZZK9mN9u7LF3+DL59Kn4F+UkOQbBDg4O7KYsNKOtv3cjSsqrns3YIcNWahb1Knt6D/KF+PJn/CVLfRfoEVt0HvIqf8xSSLmxTl1v45wfYUXKXAVK+MPZ6la5WGejfrbmX98ngUzteMIttpoHrDcjhEP692JaVFx2wDQelhds6KetPUFh0SGt/e67tu3zVG0YzkvOkJlDQ79DRBMDxWFYoUOtkWZ+DOkkzv4Xlmw66tDePRQ4+bNd3oDRwxA8xuO7dGs7mdLUqQVXF7Uu7Ku2+xCzK6XJZwH3PazVwm7jLAMu4Dwy6PoJ7PNrLlYTThdhQxDJq007kMq/fvPbmC7hHl3mzI+nl4w9DiP6bpKp+K8qVoeOjw0E2ncvqQ5GfLuv0q0IcmJt+LJjdCqo7B+0HzwGclQD2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z1Ng1FZMWFD7fganfpQqkqjER0NXfoOKwZUdtbRTl7KhEHKjhftgR5/gH9KGS+gaRJSXLpu38BB+2iVPlAQKKlT3opCCrSrc5nfF515VBhRV0UMFATqZAUtlqfoMJosa1i8hBhL84f57Jck2zYMdYcE8PW23mxrOGWwvsu+schANlZT/8cLaczHOFxSjCnAYabopeV1/tM2zVZk3BeKF4YaEMh4ix+morWEtuAaPMA5YkgwkYMjIIw+YnP+BKDgQfbH6/w2QYkg/McGE1+8Bw/J8hv83iQu0QOxLwSP9uPzNHkok3WFYdD28E9Iw6v101/+HwAA//8DAP9OV2lNOQEA + + + dbo + + \ No newline at end of file diff --git a/src/Models/Migrations/202001141846014_InspectionInstructions.Designer.cs b/src/Models/Migrations/202001141846014_InspectionInstructions.Designer.cs new file mode 100755 index 0000000..3783f29 --- /dev/null +++ b/src/Models/Migrations/202001141846014_InspectionInstructions.Designer.cs @@ -0,0 +1,29 @@ +// +namespace Festispec.Models.Migrations +{ + using System.CodeDom.Compiler; + using System.Data.Entity.Migrations; + using System.Data.Entity.Migrations.Infrastructure; + using System.Resources; + + [GeneratedCode("EntityFramework.Migrations", "6.3.0")] + public sealed partial class InspectionInstructions : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(InspectionInstructions)); + + string IMigrationMetadata.Id + { + get { return "202001141846014_InspectionInstructions"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/src/Models/Migrations/202001141846014_InspectionInstructions.cs b/src/Models/Migrations/202001141846014_InspectionInstructions.cs new file mode 100755 index 0000000..9bff2c5 --- /dev/null +++ b/src/Models/Migrations/202001141846014_InspectionInstructions.cs @@ -0,0 +1,18 @@ +namespace Festispec.Models.Migrations +{ + using System; + using System.Data.Entity.Migrations; + + public partial class InspectionInstructions : DbMigration + { + public override void Up() + { + AddColumn("dbo.PlannedEvents", "Instructions", c => c.String(maxLength: 1000)); + } + + public override void Down() + { + DropColumn("dbo.PlannedEvents", "Instructions"); + } + } +} diff --git a/src/Models/Migrations/202001141846014_InspectionInstructions.resx b/src/Models/Migrations/202001141846014_InspectionInstructions.resx new file mode 100755 index 0000000..060aafc --- /dev/null +++ b/src/Models/Migrations/202001141846014_InspectionInstructions.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + H4sIAAAAAAAACuw9XW/cOJLvB+x/aPTT7iLrtpMZzG5gzyJjJ3vGJLEvTmYX9xLI3bQtjFrqldQeG4f9ZftwP+n+wpESRfH7W92SYwyQaYtkkSxWFYvFYtX//ft/j//6sM5m96Cs0iI/mR8dHM5nIF8WqzS/PZlv65s//Xn+1x9/9x/Hb1frh9kvXb1XqB5smVcn87u63rxeLKrlHVgn1cE6XZZFVdzUB8tivUhWxeLl4eFfFkdHCwBBzCGs2ez40zav0zVo/oB/nhb5EmzqbZJ9KFYgq/B3WHLVQJ19TNag2iRLcDJ/B6o6rTZgedDWPXgLQdWPH5LNBo55PnuTpQkc1RXIbuazJM+LOqnhmF9/qcBVXRb57dUGfkiyz48bAOvdJFkF8Fxe99Vtp3X4Ek1r0TfsQC23VV2sHQEevcJ4WvDNvbDdIhtj8rRYbzLwgKbdoBNicptl6Nd8xvf2+jQrUUUJtrtGL2bthxeEKCDtoP9ezE63Wb0twUkOtnWZZC9ml9vrLF3+DB4/F7+C/CSHIOihwcFdlsUGlPVjN7K0rOr5rB0CXLVmYT8kD+9Bflvfncy/g9T3Ln0Aq+4DXsUveQpJF7apyy388yPsKLnOAClfaHv9kK5WGQjvVt/L+2TwqR0vqMXW08DFBuRwCP9ZbMvKiQ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TM3o6pxkkF+fS1XeOig8d03QQrLVGVZYkzh4MROxWKa8vyK4lTNLmT+w2ZaSoSYkOIxfNrq9ILi1O2cnjSHVFVAbx0aWIFH5xgIn7yYW0+ctN6jJwpp8xKKzecVgbR55xIZWWsdUKJMk5eSbHK7iNOkBLdmogpPC/8h73RNtQnCNFRs8hDwn0Q434eggVcKNCjQ3YRHmr5Uy5Hk1wpHgDKtk4gAq4vbGNNQ3MzIcguFI0CX0kjEge0to/8UNLeKwyBASMmj3LgHneqQ+7QxFY04Zafro+hEvyvxp0qfotHQNRcckRTXXU1esLLLKF9riY80Yc4k09J+9y14mhqjsmTCtiboKBqd/FAqy9ERHQ1dbhAjBi4kdtbRTl5Is0HKjhftgR5/gH8K6TSgaRJSXLpu38BB+2iV3vYgUMaovBWFPdCuznl+U3TmUW5EXRU+UBCokxW0WL5Bh9FkWcPiJcRYmt/OZ78k2bZhqGskgC+29WZbwymD9XX2SCMD2Vh1/R8vhDEf43BJMaYAh5mil5YX+U/bNFuRcb+TvDBUgEDGW/wwFa0ltAXX4BbOEUOCWSIsAWH0EZvzZwAFD7I/XuRXCcoy4T42mFXjPbhNlo/we5MVRQ3EvBAs2o/P0uS2TNYVhtG3h39CGl6tH378fwAAAP//AwClKc+kajoBAA== + + + dbo + + \ No newline at end of file diff --git a/src/Models/Migrations/Configuration.cs b/src/Models/Migrations/Configuration.cs index 0252255..f330791 100644 --- a/src/Models/Migrations/Configuration.cs +++ b/src/Models/Migrations/Configuration.cs @@ -3,13 +3,14 @@ using System.Collections.ObjectModel; using System.Data.Entity.Migrations; using System.Data.Entity.Validation; +using System.Diagnostics.CodeAnalysis; using Festispec.Models.Answers; using Festispec.Models.EntityMapping; using Festispec.Models.Questions; -using Festispec.Models.Reports; namespace Festispec.Models.Migrations { + [ExcludeFromCodeCoverage] internal sealed class Configuration : DbMigrationsConfiguration { public Configuration() @@ -94,34 +95,7 @@ protected override void Seed(FestispecContext context) }; context.Customers.AddOrUpdate(customer); - - var contactPerson = new ContactPerson - { - Id = 1, - Customer = customer, - Name = new FullName - { - First = "Niels", - Last = "Kijf" - }, - ContactDetails = new ContactDetails - { - // fake news - EmailAddress = "nielskijf@q-dance.com" - }, - Role = "MA" - }; - - context.ContactPersons.AddOrUpdate(contactPerson); - - var note = new ContactPersonNote - { - Id = 1, - ContactPerson = contactPerson, - Note = "Contact opgenomen met Niels over een inspectie. Voorstel volgt." - }; - - context.ContactPersonNotes.AddOrUpdate(note); + var now = DateTime.Now; var festival = new Festival { @@ -155,8 +129,8 @@ protected override void Seed(FestispecContext context) Festival = festival }; - context.Questionnaires.AddOrUpdate(questionnaire); - + context.Questionnaires.AddOrUpdate(questionnaire); + var employeeInspector = new Employee { Id = 2, @@ -199,28 +173,19 @@ protected override void Seed(FestispecContext context) Employee = employeeInspector, Festival = festival, EventTitle = "Inspection " + festival.FestivalName, - StartTime = DateTime.Now, - EndTime = new DateTime(2020, 7, 29, 5, 00, 00), - Questionnaire = questionnaire, + StartTime = DateTime.Now.Date.Add(new TimeSpan(0, 10, 0, 0)), + EndTime = DateTime.Now.Date.Add(new TimeSpan(0, 20, 0, 0)), + Questionnaire = questionnaire, }; context.PlannedInspections.AddOrUpdate(plannedInspection); - var questionCategory = new QuestionCategory - { - Id = 1, - CategoryName = "Vragen over veiligheid" - }; - - context.QuestionCategories.AddOrUpdate(questionCategory); - #region DrawQuestion var drawQuestion = new DrawQuestion { Id = 1, - Category = questionCategory, PicturePath = "/Uploads/grasso.png", Questionnaire = questionnaire, Contents = "Wat is de kortste looproute van de mainstage naar de nooduitgang?" @@ -244,7 +209,6 @@ protected override void Seed(FestispecContext context) var multipleChoiceQuestion = new MultipleChoiceQuestion { Id = 2, - Category = questionCategory, Contents = "Zijn er evacuatieplannen zichtbaar opgesteld?", Options = "Ja~Nee", OptionCollection = new ObservableCollection @@ -259,15 +223,7 @@ protected override void Seed(FestispecContext context) Id = 2, MultipleChoiceAnswerKey = 0, PlannedInspection = plannedInspection, - Question = multipleChoiceQuestion, - Attachments = new List - { - new Attachment - { - Id = 1, - FilePath = "/attachments/1.png" - } - } + Question = multipleChoiceQuestion }; context.Answers.AddOrUpdate(multipleChoiceQuestionAnswer); @@ -280,7 +236,6 @@ protected override void Seed(FestispecContext context) var numericQuestion = new NumericQuestion { Id = 3, - Category = questionCategory, Contents = "Hoeveel EHBO-posten zijn er aanwezig?", Minimum = 0, Maximum = 99, @@ -305,7 +260,6 @@ protected override void Seed(FestispecContext context) var ratingQuestion = new RatingQuestion { Id = 4, - Category = questionCategory, Contents = "Op een schaal van 1 tot 5, is de beveiliging voldoende aanwezig op het terrein?", HighRatingDescription = "Er is veel beveiliging", LowRatingDescription = "Er is amper beveiliging", @@ -330,7 +284,6 @@ protected override void Seed(FestispecContext context) var stringQuestion = new StringQuestion { Id = 5, - Category = questionCategory, Contents = "Geef een korte samenvatting van het vluchtplan.", IsMultiline = true, Questionnaire = questionnaire @@ -355,7 +308,6 @@ protected override void Seed(FestispecContext context) var pictureQuestion = new UploadPictureQuestion { Id = 6, - Category = questionCategory, Contents = "Plaats een foto van de vluchtroutes op het calamiteitenplan.", Questionnaire = questionnaire }; @@ -378,7 +330,6 @@ protected override void Seed(FestispecContext context) var referenceQuestion = new ReferenceQuestion { Id = 7, - Category = questionCategory, Question = pictureQuestion, Contents = pictureQuestion.Contents, Questionnaire = questionnaire @@ -397,35 +348,6 @@ protected override void Seed(FestispecContext context) #endregion - var report = new Report - { - Id = 1, - Festival = festival, - ReportEntries = new List - { - new ReportTextEntry - { - Id = 1, - Order = 1, - Header = "Het vluchtplan", - Question = stringQuestion, - Text = - "Het vluchtplan was uitgebreid en zit goed in elkaar, maar de inspecteurs hadden nog wel een aantal dingen op te merken." - }, - new ReportGraphEntry - { - Id = 2, - Order = 2, - GraphType = GraphType.Pie, - GraphXAxisType = GraphXAxisType.MultipleChoiceOption, - Question = multipleChoiceQuestion - } - } - }; - - context.Reports.AddOrUpdate(report); - - context.Employees.AddOrUpdate(employeeInspector); @@ -501,4 +423,4 @@ private static Employee CreateEmployee(FestispecContext context, Address address return employee; } } -} +} diff --git a/src/Models/Models.csproj b/src/Models/Models.csproj index a6df035..8ce270d 100644 --- a/src/Models/Models.csproj +++ b/src/Models/Models.csproj @@ -16,8 +16,17 @@ - - 202001091540426_EndDateNullable.cs + + 202001121533405_Initial.cs + + + 202001131333256_CustomerNotes.cs + + + 202001131421208_UnusedClasses.cs + + + 202001141846014_InspectionInstructions.cs diff --git a/src/Models/PlannedInspection.cs b/src/Models/PlannedInspection.cs index 1ab5127..989f9e0 100644 --- a/src/Models/PlannedInspection.cs +++ b/src/Models/PlannedInspection.cs @@ -20,5 +20,7 @@ public class PlannedInspection : PlannedEvent [Required] public virtual Festival Festival { get; set; } public virtual ICollection Answers { get; set; } + + [MaxLength(1000)] public string Instructions { get; set; } } } \ No newline at end of file diff --git a/src/Models/Questions/AnswerUnit.cs b/src/Models/Questions/AnswerUnit.cs deleted file mode 100644 index 2136cf2..0000000 --- a/src/Models/Questions/AnswerUnit.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Festispec.Models.Questions -{ - public enum AnswerUnit - { - People, - Meters - } -} \ No newline at end of file diff --git a/src/Models/Questions/NumericQuestion.cs b/src/Models/Questions/NumericQuestion.cs index 7b1a242..4961402 100644 --- a/src/Models/Questions/NumericQuestion.cs +++ b/src/Models/Questions/NumericQuestion.cs @@ -19,9 +19,6 @@ public NumericQuestion() [Required] public int Maximum { get; set; } - // bijv. Meter, personen, etc. - public AnswerUnit Unit { get; set; } - public override GraphType GraphType => GraphType.Line; } } \ No newline at end of file diff --git a/src/Models/Questions/Question.cs b/src/Models/Questions/Question.cs index 00f5f5a..08ebf9d 100644 --- a/src/Models/Questions/Question.cs +++ b/src/Models/Questions/Question.cs @@ -5,7 +5,7 @@ namespace Festispec.Models.Questions { - public abstract class Question : Entity, IAnswerable + public abstract class Question : Entity { public Question(string contents, Questionnaire questionnaire) { @@ -26,9 +26,6 @@ public Question() [MaxLength(250)] public string Contents { get; set; } - public virtual QuestionCategory Category { get; set; } - - public virtual Questionnaire Questionnaire { get; set; } public abstract GraphType GraphType { get; } diff --git a/src/Models/Questions/QuestionCategory.cs b/src/Models/Questions/QuestionCategory.cs deleted file mode 100644 index e33c833..0000000 --- a/src/Models/Questions/QuestionCategory.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace Festispec.Models.Questions -{ - public class QuestionCategory : Entity - { - public int Id { get; set; } - - [Required] [MaxLength(45)] public string CategoryName { get; set; } - - public virtual ICollection Questions { get; set; } - } -} \ No newline at end of file diff --git a/src/Models/Questions/ReferenceQuestion.cs b/src/Models/Questions/ReferenceQuestion.cs index 57f91ac..ba617d5 100644 --- a/src/Models/Questions/ReferenceQuestion.cs +++ b/src/Models/Questions/ReferenceQuestion.cs @@ -33,7 +33,7 @@ public Question Question private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") { - if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } } \ No newline at end of file diff --git a/src/Models/Reports/Report.cs b/src/Models/Reports/Report.cs deleted file mode 100644 index 30470eb..0000000 --- a/src/Models/Reports/Report.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace Festispec.Models.Reports -{ - public class Report : Entity - { - public int Id { get; set; } - - public virtual ICollection ReportEntries { get; set; } - - [Required] public virtual Festival Festival { get; set; } - } -} \ No newline at end of file diff --git a/src/Models/Reports/ReportEntry.cs b/src/Models/Reports/ReportEntry.cs deleted file mode 100644 index 7356d8b..0000000 --- a/src/Models/Reports/ReportEntry.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Festispec.Models.Questions; - -namespace Festispec.Models.Reports -{ - public abstract class ReportEntry : Entity - { - public int Id { get; set; } - - [Required] public int Order { get; set; } - - [Required] public virtual Question Question { get; set; } - - [Required] public virtual Report Report { get; set; } - } -} \ No newline at end of file diff --git a/src/Models/Reports/ReportGraphEntry.cs b/src/Models/Reports/ReportGraphEntry.cs deleted file mode 100644 index f1353ed..0000000 --- a/src/Models/Reports/ReportGraphEntry.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Festispec.Models.Reports -{ - public class ReportGraphEntry : ReportEntry - { - public GraphXAxisType GraphXAxisType { get; set; } - - public GraphType GraphType { get; set; } - - public string XAxisLabel { get; set; } - - public string YAxisLabel { get; set; } - } -} \ No newline at end of file diff --git a/src/Models/Reports/ReportTextEntry.cs b/src/Models/Reports/ReportTextEntry.cs deleted file mode 100644 index 1f9ab8f..0000000 --- a/src/Models/Reports/ReportTextEntry.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Festispec.Models.Reports -{ - public class ReportTextEntry : ReportEntry - { - public string Header { get; set; } - - public string Text { get; set; } - } -} \ No newline at end of file diff --git a/src/UnitTests/AddressServiceTests.cs b/src/UnitTests/AddressServiceTests.cs new file mode 100755 index 0000000..f4bb647 --- /dev/null +++ b/src/UnitTests/AddressServiceTests.cs @@ -0,0 +1,176 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Festispec.DomainServices.Services; +using Festispec.Models; +using Festispec.Models.EntityMapping; +using Festispec.Models.Exception; +using Festispec.UnitTests.Helpers; +using Moq; +using Xunit; + +namespace Festispec.UnitTests +{ + public class AddressServiceTests + { + public AddressServiceTests() + { + _dbMock = new Mock(); + _modelMocks = new ModelMocks(); + _dbMock.Setup(x => x.Customers).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Customers).Object); + _dbMock.Setup(x => x.Addresses).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Addresses).Object); + _dbMock.Setup(x => x.Festivals).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Festivals).Object); + _dbMock.Setup(x => x.Employees).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Employees).Object); + + _addressService = new AddressService(_dbMock.Object); + } + + private readonly Mock _dbMock; + private readonly ModelMocks _modelMocks; + private readonly AddressService _addressService; + + public static IEnumerable ValidAddresses => new[] + { + new object[] + { + new Address + { + ZipCode = "1072JL", + StreetName = "Lutmastraat", + HouseNumber = 14, + City = "Amsterdam", + Country = "Nederland", + Latitude = 52.3504f, + Longitude = 4.89271f + } + } + }; + + public static IEnumerable InvalidAddresses => new[] + { + new object[] + { + new Address + { + ZipCode = "VeelTeLangePostcode", + StreetName = "Lutmastraat", + HouseNumber = 14, + City = "Amsterdam", + Country = "Nederland", + Latitude = 52.3504f, + Longitude = 4.89271f + } + }, + new object[] + { + new Address + { + ZipCode = "1072JL", + StreetName = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + HouseNumber = 14, + City = "Amsterdam", + Country = "Nederland", + Latitude = 52.3504f, + Longitude = 4.89271f + } + }, + new object[] + { + new Address + { + ZipCode = "1072JL", + StreetName = "Lutmastraat", + HouseNumber = 14, + City = "Amsterdam", + // mist land + Latitude = 52.3504f, + Longitude = 4.89271f + } + }, + new object[] + { + new Address + { + ZipCode = "1072JL", + // Mist straat + HouseNumber = 14, + City = "Amsterdam", + Country = "Netherlands", + Latitude = 52.3504f, + Longitude = 4.89271f + } + } + }; + + public static IEnumerable UnusedAddresses => new[] + { + new object[] + { + new Address + { + ZipCode = "1234AB", + StreetName = "Teststraat", + HouseNumber = 3, + City = "Amsterdam", + Country = "Nederland", + Latitude = 3f, + Longitude = 5f + } + } + }; + + [Theory] + [MemberData(nameof(ValidAddresses))] + public async Task SaveAddressShouldSaveAddress(Address address) + { + var saved = await _addressService.SaveAddress(address); + + Assert.Equal(address, saved); + Assert.True(_dbMock.Object.Addresses.Contains(address)); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); + } + + [Theory] + [MemberData(nameof(ValidAddresses))] + public async Task SaveAddressShouldReturnExistingAddress(Address address) + { + // save it so it exists in the mock database. + await _addressService.SaveAddress(address); + + var existing = await _addressService.SaveAddress(address); + + Assert.Equal(address, existing); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); + } + + [Theory] + [MemberData(nameof(InvalidAddresses))] + public async Task SaveAddressWithInvalidDataShouldThrowException(Address address) + { + Assert.False(address.Validate()); + + await Assert.ThrowsAsync(async () => await _addressService.SaveAddress(address)); + } + + [Theory] + [MemberData(nameof(UnusedAddresses))] + public async Task RemoveAddressWithoutUsagesShouldRemove(Address address) + { + await _addressService.SaveAddress(address); + await _addressService.RemoveAddress(address); + + _dbMock.Verify(x => x.Addresses.Remove(address), Times.Once); + } + + [Fact] + public async Task RemoveAddressWithUsagesShouldNotRemove() + { + var address = _modelMocks.Addresses.First(); + + await _addressService.RemoveAddress(address); + + Assert.Contains(address, _dbMock.Object.Addresses.ToList()); + _dbMock.Verify(x => x.Addresses.Remove(address), Times.Never); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/AuthenticationServiceTests.cs b/src/UnitTests/AuthenticationServiceTests.cs index 1c9d86c..084211f 100755 --- a/src/UnitTests/AuthenticationServiceTests.cs +++ b/src/UnitTests/AuthenticationServiceTests.cs @@ -98,6 +98,13 @@ public void IncorrectRoleThrowsError(string username, string password, Role requ { Assert.Throws(() => _authenticationService.Login(username, password, requiredRole)); } + + [Fact] + public void InactiveAccountThrowsError() + { + Assert.Throws(() => _authenticationService.Login("Henk2", "HeelLangWachtwoord", Role.Employee)); + } + #endregion diff --git a/src/UnitTests/AvailabilityServiceTests.cs b/src/UnitTests/AvailabilityServiceTests.cs index 87c3a46..6c62217 100644 --- a/src/UnitTests/AvailabilityServiceTests.cs +++ b/src/UnitTests/AvailabilityServiceTests.cs @@ -3,14 +3,13 @@ using Moq; using System; using System.Collections.Generic; -using System.Text; using Xunit; using Festispec.DomainServices.Services; using Festispec.Models; using Festispec.UnitTests.Helpers; using Festispec.Models.Exception; using System.Linq; -using Festispec.Models.Questions; +using System.Threading.Tasks; namespace Festispec.UnitTests { @@ -18,7 +17,8 @@ public class AvailabilityServiceTests { private readonly Mock _dbMock; private readonly IAvailabilityService _availabilityService; - private ModelMocks _modelMocks; + private readonly ModelMocks _modelMocks; + public AvailabilityServiceTests() { // Setup database mocks @@ -27,7 +27,7 @@ public AvailabilityServiceTests() _dbMock.Setup(x => x.Employees).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Employees).Object); - _dbMock.Setup(x => x.Availabilities).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Availability).Object); + _dbMock.Setup(x => x.Availabilities).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Availabilities).Object); _dbMock.Setup(x => x.PlannedEvents).Returns(MockHelpers.CreateDbSetMock(_modelMocks.PlannedEvents).Object); @@ -53,9 +53,9 @@ public async void EnteringPassedDateShouldThrowError() } [Fact] - public void RemoveUnavailablity() + public void RemoveUnavailability() { - _availabilityService.RemoveUnavailablity(2); + _availabilityService.RemoveUnavailability(4); _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); } @@ -63,7 +63,46 @@ public void RemoveUnavailablity() [Fact] public async void RemovingInvalidUnavailabilityShouldThrowError() { - await Assert.ThrowsAsync(() => _availabilityService.RemoveUnavailablity(10)); + await Assert.ThrowsAsync(() => _availabilityService.RemoveUnavailability(10)); + } + + [Fact] + public async void InvalidAddUnavailabilityThrowsException() + { + await Assert.ThrowsAsync(() => + _availabilityService.AddUnavailabilityEntireDay(-1, DateTime.Now.Add(new TimeSpan(1,0,0)), string.Empty)); + } + + [Theory] + [InlineData(5)] + public void GetUnavailabilityForDayReturnsCorrectAvailability(int availabilityId) + { + var expected = _modelMocks.PlannedEvents.First(pe => pe.Id == availabilityId) as Availability; + Assert.True(expected != null); + + Availability actual = _availabilityService.GetUnavailabilityForDay(expected.Employee.Id, expected.StartTime.Date); + + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2, 2019, 01, 01)] + public async Task GetUnavailabilityForFutureReturnsCorrectAvailability(int employeeId, int year, int month, int day) + { + var datetime = new DateTime(year, month, day); + var expected = new Dictionary(); + _modelMocks.PlannedEvents + .OfType() + .Where(a => a.StartTime > datetime && a.Employee.Id == employeeId && a.EventTitle == "Niet beschikbaar") + .ToList() + .ForEach( + availability => AvailabilityService.CalculateTimeFromEpoch(availability) + .ToList() + .ForEach(l => expected.Add(l, availability))); + + Dictionary actual = await _availabilityService.GetUnavailabilityForFuture(employeeId, datetime); + + Assert.Equal(expected, actual); } } } diff --git a/src/UnitTests/CustomerServiceTests.cs b/src/UnitTests/CustomerServiceTests.cs index c8882f1..565da0b 100755 --- a/src/UnitTests/CustomerServiceTests.cs +++ b/src/UnitTests/CustomerServiceTests.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; +using System.Data.Entity; using System.Linq; +using System.Threading.Tasks; using Festispec.Models.EntityMapping; using Festispec.DomainServices.Interfaces; using Festispec.DomainServices.Services; @@ -15,14 +17,13 @@ public class CustomerServiceTests { private readonly Mock _dbMock; private readonly ICustomerService _customerService; - private ModelMocks _modelMocks; + private readonly ModelMocks _modelMocks; public CustomerServiceTests() { _dbMock = new Mock(); _modelMocks = new ModelMocks(); _dbMock.Setup(x => x.Customers).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Customers).Object); - _dbMock.Setup(x => x.ContactPersons).Returns(MockHelpers.CreateDbSetMock(_modelMocks.ContactPersons).Object); _dbMock.Setup(x => x.Addresses).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Addresses).Object); _dbMock.Setup(x => x.Festivals).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Festivals).Object); _dbMock.Setup(x => x.Employees).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Employees).Object); @@ -78,7 +79,7 @@ public async void CreateCustomerAddsCustomer(string name, int kvkNr, string zipC { var address = new Address { - City = city, Country = country, HouseNumber = houseNumber, StreetName = street, ZipCode = zipCode + City = city, Country = country, HouseNumber = houseNumber, StreetName = street, ZipCode = zipCode, Latitude = 69, Longitude = 420 }; var contactDetails = new ContactDetails @@ -121,9 +122,10 @@ public async void CreateCustomerWithInvalidDataThrowsException(string name, int } [Theory] - [InlineData(1)] + [InlineData(3)] public async void RemoveCustomerRemovesCustomer(int customerId) { + Assert.True(_customerService.CanDeleteCustomer(_customerService.GetCustomer(customerId))); await _customerService.RemoveCustomerAsync(customerId); await Assert.ThrowsAsync(() => _customerService.GetCustomerAsync(customerId)); @@ -144,8 +146,45 @@ public async void RemoveNonexistentCustomerThrowsException(int customerId) [InlineData(2)] public async void RemoveCustomerWithFestivalsThrowsException(int customerId) { + Assert.False(_customerService.CanDeleteCustomer(_customerService.GetCustomer(customerId))); await Assert.ThrowsAsync(() => _customerService.RemoveCustomerAsync(customerId)); _dbMock.Verify(x => x.SaveChangesAsync(), Times.Never); } + + [Theory] + [InlineData(1)] + public async Task UpdateCustomerAsyncUpdatesAddress(int customerId) + { + Customer customer = await _customerService.GetCustomerAsync(customerId); + + customer.Address.City = "Teststadje"; + customer.Address.Id = 99; + await _customerService.UpdateCustomerAsync(customer); + + Assert.Equal("Teststadje", _dbMock.Object.Addresses.First(x => x.Id == 99).City); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); + } + + [Theory] + [InlineData(1)] + public async Task UpdateCustomerAsyncWithInvalidAddressThrowsException(int customerId) + { + Customer customer = await _customerService.GetCustomerAsync(customerId); + + customer.Address.City = new string('A', 205); + await Assert.ThrowsAsync(async () => await _customerService.UpdateCustomerAsync(customer)); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Never); + } + + [Theory] + [InlineData(1)] + public async Task UpdateCustomerAsyncWithInvalidDataThrowsException(int customerId) + { + Customer customer = await _customerService.GetCustomerAsync(customerId); + + customer.CustomerName = new string('A', 25); + await Assert.ThrowsAsync(async () => await _customerService.UpdateCustomerAsync(customer)); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Never); + } } } \ No newline at end of file diff --git a/src/UnitTests/EmployeeServiceTests.cs b/src/UnitTests/EmployeeServiceTests.cs index 5f68a69..cb7e0f0 100644 --- a/src/UnitTests/EmployeeServiceTests.cs +++ b/src/UnitTests/EmployeeServiceTests.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using Festispec.DomainServices.Interfaces; using Festispec.DomainServices.Services; using Festispec.Models; @@ -34,7 +35,9 @@ public class EmployeeServiceTests HouseNumber = 1, Suffix = "a", City = "Test city", - Country = "Nederland" + Country = "Nederland", + Latitude = 12, + Longitude = 16 }, new ContactDetails { @@ -170,11 +173,20 @@ public EmployeeServiceTests() [Fact] public void GetAllEmployeesReturnsEmployeeList() { - List expected = _modelMocks.Employees; + List expected = _modelMocks.Employees.Where(e => e.Account.IsNonActive == null).ToList(); List actual = _employeeService.GetAllEmployees().ToList(); Assert.Equal(expected, actual); } + + [Fact] + public void GetAllEmployeesIncludingNonActiveReturnsCompleteEmployeeList() + { + List expected = _modelMocks.Employees; + + List actual = _employeeService.GetAllEmployeesActiveAndNonActive().ToList(); + Assert.Equal(expected, actual); + } [Theory] [InlineData(1)] @@ -254,7 +266,7 @@ public async void CreateEmployeeWithInvalidDataThrowsException(FullName fullName } [Theory] - [InlineData(1)] + [InlineData(3)] public async void RemoveEmployeeRemovesEmployee(int employeeId) { Assert.True(_employeeService.CanRemoveEmployee(_employeeService.GetEmployee(employeeId))); @@ -356,5 +368,46 @@ public async void RemoveNonexistentCertificateThrowsException(int certificateId) await Assert.ThrowsAsync(() => _employeeService.RemoveCertificateAsync(certificateId)); _dbMock.Verify(x => x.SaveChangesAsync(), Times.Never); } + + [Theory] + [InlineData(1)] + public async Task UpdateEmployeeAsyncUpdatesAddress(int employeeId) + { + Employee employee = await _employeeService.GetEmployeeAsync(employeeId); + + employee.Address.City = "Teststadje"; + employee.Address.Id = 99; + await _employeeService.UpdateEmployee(employee); + + Assert.Equal("Teststadje", _dbMock.Object.Addresses.First(x => x.Id == 99).City); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); + } + + [Theory] + [InlineData(1)] + public async Task UpdateEmployeeAsyncWithInvalidAddressThrowsException(int employeeId) + { + Employee employee = await _employeeService.GetEmployeeAsync(employeeId); + + employee.Address.City = new string('A', 205); + await Assert.ThrowsAsync(async () => await _employeeService.UpdateEmployee(employee)); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Never); + } + + [Theory] + [InlineData(1)] + public async Task UpdateEmployeeAsyncWithInvalidDataThrowsException(int employeeId) + { + Employee employee = await _employeeService.GetEmployeeAsync(employeeId); + + employee.Name = new FullName + { + First = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + Middle = "AA", + Last = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + }; + await Assert.ThrowsAsync(async () => await _employeeService.UpdateEmployee(employee)); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Never); + } } } \ No newline at end of file diff --git a/src/UnitTests/ExampleServiceTests.cs b/src/UnitTests/ExampleServiceTests.cs deleted file mode 100644 index 4ba4c70..0000000 --- a/src/UnitTests/ExampleServiceTests.cs +++ /dev/null @@ -1,35 +0,0 @@ - -using Festispec.DomainServices.Interfaces; -using Festispec.DomainServices.Services; -using Xunit; - -namespace Festispec.UnitTests -{ - public class ExampleServiceTests - { - private readonly IExampleService _exampleService; - - public ExampleServiceTests() - { - _exampleService = new ExampleService(); - } - - [Fact] - public void ReturnTrueReturnsTrue() - { - Assert.True(_exampleService.ReturnTrue()); - } - - [Fact] - public void ReturnFalseReturnsFalse() - { - Assert.False(_exampleService.ReturnFalse()); - } - - [Fact] - public void ReturnStringReturnsString() - { - Assert.IsType(_exampleService.ReturnString()); - } - } -} diff --git a/src/UnitTests/FestivalServiceTests.cs b/src/UnitTests/FestivalServiceTests.cs new file mode 100644 index 0000000..f02dfd3 --- /dev/null +++ b/src/UnitTests/FestivalServiceTests.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; +using System.Data.Entity; +using System.Linq; +using System.Threading.Tasks; +using Festispec.DomainServices.Interfaces; +using Festispec.DomainServices.Services; +using Festispec.Models; +using Festispec.Models.EntityMapping; +using Festispec.Models.Exception; +using Festispec.UnitTests.Helpers; +using Moq; +using Xunit; + +namespace Festispec.UnitTests +{ + public class FestivalServiceTests + { + + private readonly Mock _dbMock; + private readonly IFestivalService _festivalService; + + public FestivalServiceTests() + { + // Setup database mocks + _dbMock = new Mock(); + + _dbMock.Setup(x => x.Questionnaires).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Questionnaires).Object); + _dbMock.Setup(x => x.Customers).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Customers).Object); + _dbMock.Setup(x => x.Questions).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Questions).Object); + _dbMock.Setup(x => x.Answers).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Answers).Object); + _dbMock.Setup(x => x.PlannedInspections).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().PlannedInspections).Object); + _dbMock.Setup(x => x.Festivals).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Festivals).Object); + _dbMock.Setup(x => x.Employees).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Employees).Object); + _dbMock.Setup(x => x.Addresses).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Addresses).Object); + _dbMock.Setup(m => m.SaveChangesAsync()).ReturnsAsync(1); + + _festivalService = new FestivalService(_dbMock.Object, new JsonSyncService(_dbMock.Object), new AddressService(_dbMock.Object)); + } + + + [Theory] + [InlineData(1)] + public async void GetFestivalShouldReturnFestival(int festivalId) + { + Festival expected = await _dbMock.Object.Festivals.FirstAsync(f => f.Id == festivalId); + Festival actual = _festivalService.GetFestival(festivalId); + + Assert.Equal(expected,actual); + } + [Theory] + [InlineData(99)] + public void GetNonExistingFestivalShouldReturnErrror(int festivalId) + { + Assert.Throws(() => _festivalService.GetFestival(festivalId)); + } + + [Fact] + public async void GetFestivalsShouldReturnFestivalList() + { + List expected = await _dbMock.Object.Festivals.ToListAsync(); + List actual = _festivalService.GetFestivals().ToList(); + + Assert.Equal(expected,actual); + } + + [Theory] + [InlineData(3)] + public async void RemoveFestivalShouldRemoveFestival(int festivalId) + { + await _festivalService.RemoveFestival(festivalId); + + await Assert.ThrowsAsync(() => _festivalService.RemoveFestival(festivalId)); + + } + [Theory] + [InlineData(99)] + public async void RemovingNonExistingShouldThrowError(int festivalId) + { + + await Assert.ThrowsAsync(() => _festivalService.RemoveFestival(festivalId)); + + } + [Theory] + [InlineData(1)] + public async void RemovingWithQuestionnairesShouldThrowError(int festivalId) + { + + await Assert.ThrowsAsync(() => _festivalService.RemoveFestival(festivalId)); + + } + + [Theory] + [InlineData(1, 1)] + public async void CreateFestivalShouldCreateFestival(int festivalId, int customerId) + { + Festival expected = await _dbMock.Object.Festivals.FirstAsync(f => f.Id == festivalId); + Festival actual = await _festivalService.CreateFestival(expected, customerId); + + Assert.Equal(expected,actual); + } + + [Fact] + public async void CreateFestivalWithEarlierClosingHoursShouldThrowError() + { + Festival festival = await _dbMock.Object.Festivals.FirstAsync(f => f.Id == 1); + festival.OpeningHours.StartDate = DateTime.Now; + festival.OpeningHours.EndDate = DateTime.MinValue; + await Assert.ThrowsAsync(() => + _festivalService.CreateFestival(festival, 1)); + } + + [Theory] + [InlineData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")] + public async void CreateFestivalWithTooLongNameShouldThrowError(string name) + { + Festival festival = await _dbMock.Object.Festivals.FirstAsync(f => f.Id == 1); + festival.FestivalName = name; + await Assert.ThrowsAsync(()=> _festivalService.CreateFestival( festival, 1 )); + } + + [Theory] + [InlineData(1)] + public async void UpdateFestivalShouldUpdateFestival(int festivalId ) + { + Festival festival = await _dbMock.Object.Festivals.FirstAsync(f => f.Id == festivalId); + festival.FestivalName = "New Name"; + await _festivalService.UpdateFestival(festival); + + Assert.Equal("New Name",_festivalService.GetFestival(festivalId).FestivalName); + } + + [Fact] + public async void UpdateFestivalWithEarlierClosingHoursShouldThrowError() + { + Festival festival = await _dbMock.Object.Festivals.FirstAsync(f => f.Id == 1); + festival.OpeningHours.StartDate = DateTime.Now; + festival.OpeningHours.EndDate = DateTime.MinValue; + await Assert.ThrowsAsync(() => + _festivalService.UpdateFestival(festival)); + } + + [Theory] + [InlineData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")] + public async void UpdateFestivalWithTooLongNameShouldThrowError(string name) + { + Festival festival = await _dbMock.Object.Festivals.FirstAsync(f => f.Id == 1); + festival.FestivalName = name; + await Assert.ThrowsAsync(()=> _festivalService.UpdateFestival( festival )); + } + + + + } +} \ No newline at end of file diff --git a/src/UnitTests/Helpers/ModelMocks.cs b/src/UnitTests/Helpers/ModelMocks.cs index 87662ce..a45fba2 100644 --- a/src/UnitTests/Helpers/ModelMocks.cs +++ b/src/UnitTests/Helpers/ModelMocks.cs @@ -3,446 +3,445 @@ using Festispec.Models.Questions; using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Linq; -using System.Text; namespace Festispec.UnitTests.Helpers { public class ModelMocks { - public static Address Address = new Address() - { - ZipCode = "1013 GM", - StreetName = "Amsterweg", - HouseNumber = 23, - City = "Utrecht", - Country = "Nederland" - }; - - public static ContactDetails ContactDetails = new ContactDetails() - { - PhoneNumber = "31695734859", - EmailAddress = "psmulde@pinkpop.nl" - }; - - public static OpeningHours OpeningHours = new OpeningHours() - { - StartDate = new DateTime(2020, 3, 10), - EndDate = new DateTime(2020, 3, 12), - StartTime = new TimeSpan(10, 0, 0), - EndTime = new TimeSpan(1, 0, 0) - }; - - public static Employee Employee1 = new Employee() - { - Id = 1, - Account = new Account() - { - Id = 1, - Username = "JohnDoe", - Password = BCrypt.Net.BCrypt.HashPassword("Password123"), - Role = Role.Inspector - } - }; - - public static Availability Sickness = new Availability() - { - Id = 1, - Employee = Employee1, - IsAvailable = false, - Reason = "Ik heb griep", - EventTitle = "Afwezig wegens ziekte", - StartTime = new DateTime(2019, 12, 28) - }; + public List Festivals { get; } - public static Availability Unavailability = new Availability() - { - Id = 2, - Employee = Employee, - IsAvailable = false, - Reason = "Ik heb een verjaardag", - EventTitle = "Niet beschikbaar", - StartTime = new DateTime(2019, 12, 28, 10, 0, 0), - EndTime = new DateTime(2019, 12, 28, 16, 0, 0) - }; + public List Customers { get; } - public static Customer Customer1 = new Customer() - { - Id = 1, - KvkNr = 12345678, - CustomerName = "PinkPop", - Address = Address, - ContactDetails = ContactDetails, - Festivals = new List(), - ContactPersons = new List() - }; + public List Employees { get; } - public static Festival FestivalPinkPop = new Festival() - { - Id = 1, - FestivalName = "PinkPop", - Description = "Placeholder for description", - Address = Address, - OpeningHours = OpeningHours, - Customer = Customer1 - }; + public List Accounts { get; } + public List Certificates { get; } - public static Customer Customer2 = new Customer() - { - Id = 2, - KvkNr = 12345678, - CustomerName = "PinkPop2", - Address = Address, - ContactDetails = ContactDetails, - Festivals = new List - { - FestivalPinkPop - }, - ContactPersons = new List() - }; + public List Questionnaires { get; } - public static Questionnaire Questionnaire1 = new Questionnaire("PinkPop Ochtend", FestivalPinkPop) - { - Id = 1 - }; + public List PlannedInspections { get; } - public static Questionnaire Questionnaire2 = new Questionnaire("PinkPop Middag", FestivalPinkPop) - { - Id = 2 - }; + public List Sickness { get; } - public static RatingQuestion RatingQuestion = new RatingQuestion("Hoe druk is het bij de toiletten", Questionnaire1, "rustig", "druk"); + public List PlannedEvents { get; } - public static NumericQuestion NumericQuestion = new NumericQuestion("Hoeveel zitplaatsen zijn er bij de foodtrucks", Questionnaire1, 0, 1000); + public List Availabilities { get; } - public static UploadPictureQuestion UploadPictureQuestion = new UploadPictureQuestion("Maak een foto van de toiletten", Questionnaire1); + public List Questions { get; } - public static StringQuestion StringQuestion = new StringQuestion("Geef een indruk van de sfeer impressie bij de eetgelegenheden", Questionnaire1); + public List Answers { get; } - public static MultipleChoiceQuestion MultipleChoiceQuestion = new MultipleChoiceQuestion("Wat beschrijft het beste de sfeer bij het publiek na de shows bij de main stage?", Questionnaire1) - { - Options = "Option1,Option2,Option3,Option4", - OptionCollection = new ObservableCollection() - { - new StringObject("Option1") - } - }; + public List
Addresses { get; } - public static StringQuestion ReferencedQuestion = new StringQuestion("test1", Questionnaire3) - { - Id = 1 - }; - - private static List QuestionsWithReference = new List() - { - ReferencedQuestion, - new ReferenceQuestion("test2", Questionnaire3, ReferencedQuestion) - { - Id = 2 - } - }; - - public static Questionnaire Questionnaire3 = new Questionnaire("PinkPop MaandagAvond", FestivalPinkPop) - { - Id = 3, - Questions = QuestionsWithReference - }; - - public static Questionnaire Questionnaire4 = new Questionnaire("PinkPop DinsdagOchtend", FestivalPinkPop) + public ModelMocks() { - Id = 4, - Questions = new List() + Customers = new List { - new StringQuestion("Beschrijf de sfeer bij het evenement", Questionnaire4) + new Customer { - Id = 1 + Id = 1, + KvkNr = 12345678, + CustomerName = "PinkPop", + Address = new Address + { + ZipCode = "1013 GM", + StreetName = "Amsterweg", + HouseNumber = 23, + City = "Utrecht", + Country = "Nederland" + }, + ContactDetails = new ContactDetails + { + PhoneNumber = "31695734859", + EmailAddress = "psmulde@pinkpop.nl" + } }, - new StringQuestion("Beschrijf de sfeer in de rij", Questionnaire4) + new Customer { - Id = 2 - } - } - }; - - public static Questionnaire QuestionnaireThunderDome = new Questionnaire("Thunderdome DinsdagOchtend", festivalThunderDome) - { - Id = 5, - Questions = new List() - { - new StringQuestion("Beschrijf de sfeer bij het evenement", QuestionnaireThunderDome) + Id = 2, + KvkNr = 12345678, + CustomerName = "ThunderDome", + Address = new Address + { + ZipCode = "1013 GM", + StreetName = "Amsterweg", + HouseNumber = 23, + City = "Utrecht", + Country = "Nederland" + }, + ContactDetails = new ContactDetails + { + PhoneNumber = "3123456789", + EmailAddress = "info@thunderdome.nl" + } + }, + new Customer // deze customer GEEN festivals geven! hij wordt gebruikt voor het verwijderen te testen. { - Id = 3 + Id = 3, + KvkNr = 12345678, + CustomerName = "Test Voor Verwijderen Customers", + Address = new Address + { + ZipCode = "1234 AB", + StreetName = "AAAAAAAAAweg", + HouseNumber = 1, + City = "Amsterdam", + Country = "Nederland" + }, + ContactDetails = new ContactDetails + { + PhoneNumber = "31123456789", + EmailAddress = "info@test.nl" + } } - } - }; - - public List Accounts { get; set; } + }; - public List Questions = Questionnaire4.Questions.ToList(); - - public List Questionnaires = new List() - { - Questionnaire1, - Questionnaire2, - Questionnaire3, - Questionnaire4, - QuestionnaireThunderDome - }; - - public static Employee Employee = new Employee() - { - Iban = "NL91ABNA0417164300", - - Account = new Account - { - Username = "EricKuipers", - Password = BCrypt.Net.BCrypt.HashPassword("HeelLangWachtwoord"), - Role = Role.Inspector - } - }; - - public static StringAnswer StringAnswer = new StringAnswer() - { - Question = StringQuestion, - }; - - public static Address Address2 = new Address() - { - ZipCode = "3245JK", - StreetName = "Kadestraat", - City = "Biddinghuizen", - Country = "Nederland" - }; - - public static Customer CustomerThunderDome = new Customer() - { - Id = 4, - KvkNr = 12345678, - CustomerName = "ThunderDome", - Address = new Address() - }; - - public static Festival festivalThunderDome = new Festival() - { - Id = 2, - FestivalName = "ThunderDome", - - Description = "Op 26 oktober 2019 keert Thunderdome terug naar de Jaarbeurs in Utrecht. " + - "In 2017 maakte het legendarische Hardcore concept een comeback na vijf jaar afwezig te zijn geweest.", - - Customer = CustomerThunderDome, - - Address = Address2, - - OpeningHours = new OpeningHours() - { - StartTime = new TimeSpan(10, 0, 0), - - EndTime = new TimeSpan(2, 0, 0), - - StartDate = new DateTime(2019, 12, 10), - - EndDate = new DateTime(2019, 12, 14) - } - }; - - public static PlannedInspection PlannedInspectionPinkpop = new PlannedInspection() - { - Id = 1, - - StartTime = new DateTime(2020, 3, 4, 12, 30, 0), - - EndTime = new DateTime(2020, 3, 4, 17, 0, 0), - - EventTitle = "Pinkpop", - - Employee = Employee, - - Questionnaire = Questionnaire4, - - Festival = FestivalPinkPop, - - Answers = new List() + Festivals = new List { + new Festival + { + Id = 1, + FestivalName = "PinkPop", + Description = "Placeholder for description", + Address = new Address + { + ZipCode = "1013 GM", + StreetName = "Amsterweg", + HouseNumber = 23, + City = "Utrecht", + Country = "Nederland" + }, + OpeningHours = new OpeningHours + { + StartDate = new DateTime(2020, 3, 10), + EndDate = new DateTime(2020, 3, 12), + StartTime = new TimeSpan(10, 0, 0), + EndTime = new TimeSpan(1, 0, 0) + }, + Customer = Customers.First(c => c.Id == 1) + }, + new Festival + { + Id = 2, + FestivalName = "ThunderDome", + Description = "Op 26 oktober 2019 keert Thunderdome terug naar de Jaarbeurs in Utrecht. " + + "In 2017 maakte het legendarische Hardcore concept een comeback na vijf jaar afwezig te zijn geweest.", - } - }; - - public static PlannedInspection PlannedInspectionThunderDome = new PlannedInspection() - { - Id = 2, - - StartTime = new DateTime(2019, 12, 10, 16, 0, 0), - - EndTime = new DateTime(2019, 12, 10, 20, 30, 0), - - EventTitle = "ThunderDome", - - Employee = Employee, - - Questionnaire = QuestionnaireThunderDome, - - Festival = festivalThunderDome, - - Answers = new List() - { - new StringAnswer() + Customer = Customers.First(c => c.Id == 2), + Address = new Address + { + ZipCode = "3245JK", + StreetName = "Kadestraat", + City = "Biddinghuizen", + Country = "Nederland" + }, + OpeningHours = new OpeningHours() + { + StartTime = new TimeSpan(10, 0, 0), + EndTime = new TimeSpan(2, 0, 0), + StartDate = new DateTime(2019, 12, 10), + EndDate = new DateTime(2019, 12, 14) + } + }, + new Festival { - PlannedInspection = PlannedInspectionThunderDome, + Id = 3, + FestivalName = "Intents", + Description = "Op 26 oktober 2019 keert Intents terug naar Brabant. " + + "een legendarische Hardcore/Hardstyle concept een comeback na een jaar afwezig te zijn geweest.", - Question = QuestionnaireThunderDome.Questions.FirstOrDefault() + Customer = Customers.First(c => c.Id == 2), + Address = new Address + { + ZipCode = "5731JR", + StreetName = "Vaanakker", + City = "Mierlo", + Country = "Nederland" + }, + OpeningHours = new OpeningHours() + { + StartTime = new TimeSpan(10, 0, 0), + EndTime = new TimeSpan(2, 0, 0), + StartDate = new DateTime(2019, 12, 10), + EndDate = new DateTime(2019, 12, 14) + } } - } - }; + }; - public List plannedInspections = new List() - { - PlannedInspectionPinkpop, - PlannedInspectionThunderDome - }; - - public List Customers = new List - { - Customer1, - Customer2, - CustomerThunderDome - }; - - public List PlannedEvents = new List - { - Sickness, - Unavailability, - Sickness - }; - - public List Availability = new List - { - Sickness, - Unavailability, - Sickness - }; - - public List Employees1 = new List - { - Employee1 - }; - - public List ContactPersons = new List(); - - public List Employees = new List - { - new Employee + Employees = new List { - Id = 1, - Name = new FullName {First = "Dit", Middle = "is", Last = "Een Test"}, - Iban = "NL01ABCD1234567890", - Account = new Account() + new Employee { Id = 1, - Username = "JohnDoe", - Password = BCrypt.Net.BCrypt.HashPassword("Password123"), - Role = Role.Employee - }, - Address = new Address - { - ZipCode = "1234AB", - StreetName = "Teststraat", - HouseNumber = 123, - Suffix = "a", - City = "Teststad", - Country = "Nederland" + Name = new FullName { First = "Dit", Middle = "is", Last = "Een Test" }, + Iban = "NL01ABCD1234567890", + Account = new Account + { + Id = 1, + Username = "JohnDoe", + Password = "$2y$12$jKRUmk7DrgcdTGc5YIoW8uRZWp98aa6b3/MEweMe82CKFKmI2Xerm", // Password123 + Role = Role.Employee + }, + Address = new Address + { + Id = 1, + ZipCode = "1234AB", + StreetName = "Teststraat", + HouseNumber = 123, + Suffix = "a", + City = "Teststad", + Country = "Nederland" + }, + ContactDetails = new ContactDetails + { + PhoneNumber = "+316123456789", + EmailAddress = "test@testing.com" + }, + Certificates = new List + { + new Certificate + { + Id = 1, + CertificateTitle = "Festispec Training Certificate", + CertificationDate = new DateTime(2019, 11, 25), + ExpirationDate = new DateTime(2025, 11, 25) + } + } }, - ContactDetails = new ContactDetails + new Employee { - PhoneNumber = "+316123456789", - EmailAddress = "test@testing.com" + Id = 2, + Name = new FullName { First = "Test", Last = "Ing" }, + Iban = "NL02DBCA0987654321", + Account = new Account + { + Id = 2, + Username = "EricKuipers", + Password = "$2y$12$fAj/kSCqzIE5BmSYxn9hmOVo.CSAMUrGcTl6SLV6S5Bx88QD3DbGe", // HeelLangWachtwoord + Role = Role.Inspector + }, + Address = new Address + { + ZipCode = "3734AB", + StreetName = "Hermelijnlaan", + HouseNumber = 12, + City = "Den Dolder", + Country = "Nederland" + }, + ContactDetails = new ContactDetails + { + PhoneNumber = "+316314253647", + EmailAddress = "tester@testing.com" + }, + Certificates = new List + { + new Certificate + { + Id = 2, + CertificateTitle = "Festispec Training Certificate", + CertificationDate = new DateTime(2020, 11, 25), + ExpirationDate = new DateTime(2026, 11, 25) + } + } }, - PlannedEvents = new List(), - Certificates = new List + new Employee // deze employeet GEEN PlannedEvents geven! { - new Certificate + Id = 3, + Name = new FullName { First = "Employee Remove", Last = "Test" }, + Iban = "NL3457ABNA234578978923457892347892", + Account = new Account { - Id = 1, - CertificateTitle = "Festispec Training Certificate", - CertificationDate = new DateTime(2019, 11, 25), - ExpirationDate = new DateTime(2025, 11, 25) - } + Id = 3, + Username = "Henk2", + Password = "$2y$12$YNZ3G6P9WX.II7.05PpohOQ0PMyaORCPYmBK5DS9wvEvSEiz5UTNy", // HeelLangWachtwoord + Role = Role.Employee, + IsNonActive = DateTime.Now.Subtract(new TimeSpan(24,0,0)) + }, + Address = new Address + { + ZipCode = "1234AB", + StreetName = "YuriLaan", + HouseNumber = 12, + City = "Den Dolder", + Country = "Nederland" + }, + ContactDetails = new ContactDetails + { + PhoneNumber = "+3112345678", + EmailAddress = "tester@testing.com" + }, + Certificates = new List() } - }, - new Employee + }; + + Questionnaires = new List { - Id = 2, - Name = new FullName{First = "Test", Last = "Ing"}, - Iban = "NL02DBCA0987654321", - Account = new Account + new Questionnaire + { + Id = 1, + Name = "PinkPop Ochtend", + Festival = Festivals.First(f => f.Id == 1) + }, + new Questionnaire { Id = 2, - Username = "EricKuipers", - Password = BCrypt.Net.BCrypt.HashPassword("HeelLangWachtwoord"), - Role = Role.Inspector + Name = "PinkPop Middag", + Festival = Festivals.First(f => f.Id == 1) }, - Address = new Address + new Questionnaire + { + Id = 3, + Name = "ThunderDome DinsdagOchtend", + Festival = Festivals.First(f => f.Id == 2) + } + }; + + Questions = new List + { + new RatingQuestion { - ZipCode = "3734AB", - StreetName = "Hermelijnlaan", - HouseNumber = 12, - City = "Den Dolder", - Country = "Nederland" + Id = 1, + Contents = "Hoe druk is het bij de toiletten?", + Questionnaire = Questionnaires.First(q => q.Id == 1), + LowRatingDescription = "rustig", + HighRatingDescription = "druk" }, - ContactDetails = new ContactDetails + new NumericQuestion { - PhoneNumber = "+316314253647", - EmailAddress = "tester@testing.com" + Id = 2, + Contents = "Hoeveel zitplaatsen zijn er bij de foodtrucks", + Questionnaire = Questionnaires.First(q => q.Id == 1), + Minimum = 0, + Maximum = 1000 }, - PlannedEvents = new List + new UploadPictureQuestion { - new PlannedEvent - { - Id = 1, - StartTime = new DateTime(2019, 11, 27, 17, 00, 00), - EndTime = new DateTime(2019, 11, 28, 03, 00, 00), - EventTitle = "Inspectie bij Q-BASE" - } + Id = 3, + Contents = "Maak een foto van de toiletten", + Questionnaire = Questionnaires.First(q => q.Id == 1), }, - Certificates = new List + new StringQuestion { - new Certificate - { - Id = 2, - CertificateTitle = "Festispec Training Certificate", - CertificationDate = new DateTime(2020, 11, 25), - ExpirationDate = new DateTime(2026, 11, 25) - } + Id = 4, + Contents = "Geef een indruk van de sfeer impressie bij de eetgelegenheden", + Questionnaire = Questionnaires.First(q => q.Id == 1), + }, + new MultipleChoiceQuestion + { + Id = 5, + Contents = "Wat beschrijft het beste de sfeer bij het publiek na de shows bij de main stage?", + Questionnaire = Questionnaires.First(q => q.Id == 1), + Options = "Option1,Option2,Option3,Option4", } - } - }; + }; + // reference questions have to be declared separately. + Questions.Add(new ReferenceQuestion + { + Id = 6, + Contents = "Wat beschrijft het beste de sfeer bij het publiek na de shows bij de main stage?", + Questionnaire = Questionnaires.First(q => q.Id == 2), + Question = Questions.First(q => q.Id == 5) + }); - public List Certificates { get; } + PlannedInspections = new List + { + new PlannedInspection + { + Id = 1, + StartTime = new DateTime(2020, 3, 4, 12, 30, 0), + EndTime = new DateTime(2020, 3, 4, 17, 0, 0), + EventTitle = "PinkPop Ochtend", + Employee = Employees.First(e => e.Id == 2), + Questionnaire = Questionnaires.First(q => q.Id == 1), + Festival = Festivals.First(f => f.Id == 1) + }, + new PlannedInspection + { + Id = 2, + StartTime = new DateTime(2019, 12, 10, 16, 0, 0), + EndTime = new DateTime(2019, 12, 10, 20, 30, 0), + EventTitle = "ThunderDome", + Employee = Employees.First(e => e.Id == 2), + Questionnaire = Questionnaires.First(f => f.Id == 3), + Festival = Festivals.First(f => f.Id == 2) + }, + new PlannedInspection + { + Id = 3, + StartTime = DateTime.Now.Date, + EndTime = new DateTime(2019, 12, 10, 20, 30, 0), + EventTitle = "ThunderDome Test", + Employee = Employees.First(e => e.Id == 2), + Questionnaire = Questionnaires.First(f => f.Id == 3), + Festival = Festivals.First(f => f.Id == 2) + } + }; - public List
Addresses { get; } = new List
(); + Answers = new List + { + new StringAnswer + { + Id = 1, + Question = Questions.First(q => q.Id == 4), + PlannedInspection = PlannedInspections.First(pi => pi.Id == 1), + AnswerContents = "De sfeer was goed." + } + }; - public List Festivals { get; } = new List() - { - FestivalPinkPop - }; + Sickness = new List + { + new Availability + { + Id = 4, + Employee = Employees.First(e => e.Id == 1), + IsAvailable = false, + Reason = "Ik heb griep", + EventTitle = "Afwezig wegens ziekte", + StartTime = new DateTime(2019, 12, 28) + }, + }; - public ModelMocks() - { - Accounts = Employees.Select(e => e.Account).ToList(); - Certificates = Employees.SelectMany(e => e.Certificates).ToList(); + PlannedEvents = new List() + .Concat(PlannedInspections) + .Concat(Sickness) + .Concat(new List + { + new Availability + { + Id = 5, + Employee = Employees.First(e => e.Id == 2), + IsAvailable = false, + Reason = "Ik heb een verjaardag", + EventTitle = "Niet beschikbaar", + StartTime = new DateTime(2019, 12, 28, 10, 0, 0), + EndTime = new DateTime(2019, 12, 28, 16, 0, 0) + } + }) + .ToList(); - int i = 0; - Employees.ForEach(e => + // glue it all together. + Customers.ForEach(c => c.Festivals = Festivals.FindAll(f => f.Customer.Id == c.Id)); + Festivals.ForEach(f => { - e.Address.Id = i++; - Addresses.Add(e.Address); + f.PlannedInspections = PlannedInspections.FindAll(pi => pi.Festival.Id == f.Id); + f.Questionnaires = Questionnaires.FindAll(q => q.Festival.Id == f.Id); }); - Customers.ForEach(c => + Employees.ForEach(e => e.PlannedEvents = PlannedEvents.FindAll(pe => pe.Employee.Id == e.Id)); + Accounts = Employees.Select(e => e.Account).ToList(); + Certificates = Employees.SelectMany(e => e.Certificates).ToList(); + Questionnaires.ForEach(qn => { - c.Address.Id = i++; - Addresses.Add(c.Address); + qn.PlannedInspections = PlannedInspections.FindAll(pi => pi.Questionnaire.Id == qn.Id); + qn.Questions = Questions.FindAll(q => q.Questionnaire.Id == qn.Id); }); + Questions.ForEach(q => q.Answers = Answers.FindAll(a => a.Question.Id == q.Id)); + PlannedInspections.ForEach(pi => pi.Answers = Answers.FindAll(a => a.PlannedInspection.Id == pi.Id)); + Availabilities = PlannedEvents.OfType().ToList(); + Addresses = new List
() + .Concat(Customers.Select(c => c.Address)) + .Concat(Employees.Select(e => e.Address)) + .ToList(); } } } \ No newline at end of file diff --git a/src/UnitTests/InspectionServiceTests.cs b/src/UnitTests/InspectionServiceTests.cs index 276c10e..9ca69f2 100644 --- a/src/UnitTests/InspectionServiceTests.cs +++ b/src/UnitTests/InspectionServiceTests.cs @@ -1,85 +1,181 @@ -using Festispec.DomainServices.Interfaces; +using System; +using System.Collections.Generic; +using System.Data.Entity; +using System.Data.Entity.Infrastructure; +using System.Linq; +using System.Threading.Tasks; +using Festispec.DomainServices.Interfaces; using Festispec.DomainServices.Services; -using Festispec.Models.EntityMapping; using Festispec.Models; -using Moq; -using System; +using Festispec.Models.EntityMapping; +using Festispec.Models.Exception; using Festispec.UnitTests.Helpers; +using Moq; using Xunit; -using Festispec.Models.Exception; namespace Festispec.UnitTests { public class InspectionServiceTests { - private readonly Mock _dbMock; - - private readonly IInspectionService _inspectionService; - public InspectionServiceTests() { // Setup database mock _dbMock = new Mock(); - + _modelMocks = new ModelMocks(); // Setup add mock - _dbMock.Setup(x => x.PlannedInspections.Add(It.IsAny())).Returns((PlannedInspection u) => u); + _dbMock.Setup(x => x.PlannedInspections.Add(It.IsAny())) + .Returns((PlannedInspection u) => u); // Mock accounts - _dbMock.Setup(x => x.PlannedInspections).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().plannedInspections).Object); + _dbMock.Setup(x => x.PlannedInspections) + .Returns(MockHelpers.CreateDbSetMock(new ModelMocks().PlannedInspections).Object); _dbMock.Setup(x => x.Festivals).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Festivals).Object); - _dbMock.Setup(x => x.Questionnaires).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Questionnaires).Object); + _dbMock.Setup(x => x.Questionnaires) + .Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Questionnaires).Object); _dbMock.Setup(x => x.Employees).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Employees).Object); + _dbMock.Setup(x => x.TruncateTime(It.IsAny())).Returns(dt => dt.Date); // Create InspectionService - _inspectionService = new InspectionService(_dbMock.Object, new JsonSyncService(_dbMock.Object)); + _inspectionService = + new InspectionService(_dbMock.Object, new JsonSyncService(_dbMock.Object)); } - - #region Creating Planned Inspections Tests - [Fact] - public async void InvalidDataShouldThrowError() - { - PlannedInspection plannedInspection = ModelMocks.PlannedInspectionThunderDome; - string eventTitle = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. " + - "Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque " + - "penatibus et magnis dis parturient montes,"; + private readonly Mock _dbMock; - await Assert.ThrowsAsync(() => _inspectionService.CreatePlannedInspection( - plannedInspection.Festival.Id, - plannedInspection.Questionnaire.Id, - new DateTime(2019, 12, 10, 12, 30, 0), - new DateTime(2019, 12, 10, 19, 0, 0), - eventTitle, - plannedInspection.Employee.Id)); - } + private readonly IInspectionService _inspectionService; + private readonly ModelMocks _modelMocks; [Fact] public async void CreatingExistingPlannedInspectionAgainShouldThrowError() { await Assert.ThrowsAsync(() => _inspectionService.CreatePlannedInspection( - ModelMocks.FestivalPinkPop.Id, - ModelMocks.Questionnaire4.Id, + _modelMocks.Festivals.FirstOrDefault(f => f.Id == 1).Id, + _modelMocks.Questionnaires.First(q => q.Id == 1).Id, new DateTime(2020, 3, 4, 12, 30, 0), new DateTime(2020, 3, 4, 17, 0, 0), "Pinkpop", - ModelMocks.Employee.Id)); + _modelMocks.Employees.First(e => e.Id == 2).Id)); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Never); + } + + [Fact] + public async void CreatingPlannedInspectionShouldCreatePlannedInspection() + { + await _inspectionService.CreatePlannedInspection( + _modelMocks.Festivals.FirstOrDefault(f => f.Id == 1).Id, + _modelMocks.Questionnaires.First(q => q.Id == 1).Id, + new DateTime(2020, 5, 4, 12, 30, 0), + new DateTime(2020, 5, 4, 17, 0, 0), + "Pinkpop", + _modelMocks.Employees.First(e => e.Id == 3).Id); + _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); + } + + [Fact] + public async void CreatingPlannedInspectionWithInvalidDataShouldReturnError() + { + await Assert.ThrowsAsync(() => _inspectionService.CreatePlannedInspection( + _modelMocks.Festivals.FirstOrDefault(f => f.Id == 1).Id, + _modelMocks.Questionnaires.First(q => q.Id == 1).Id, + new DateTime(2020, 5, 4, 12, 30, 0), + new DateTime(2020, 5, 4, 17, 0, 0), + "Pinkpopaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + _modelMocks.Employees.First(e => e.Id == 3).Id)); + } + + [Theory] + [InlineData(2, 2, 2)] + public async void GetPlannedInspectionShouldReturnPlannedInspection(int plannedInspectionId, int employeeId, + int festivalId) + { + PlannedInspection expected = + _dbMock.Object.PlannedInspections.FirstOrDefault(p => p.Id == plannedInspectionId); + Assert.Equal(expected, await _inspectionService.GetPlannedInspection( + _modelMocks.Festivals.First(f => f.Id == festivalId), + _modelMocks.Employees.First(e => e.Id == employeeId), + _modelMocks.PlannedInspections.First(p => p.Id == plannedInspectionId).StartTime)); } - #endregion + [Theory] + [InlineData(2, 2, 2)] + public async void GetPlannedInspectionShouldReturnError(int plannedInspectionId, int employeeId, int festivalId) + { + await Assert.ThrowsAsync(() => _inspectionService.GetPlannedInspection( + _modelMocks.Festivals.First(f => f.Id == festivalId), + _modelMocks.Employees.First(e => e.Id == employeeId), DateTime.Now)); + } + + [Theory] + [InlineData(1)] + public async void GetNonExistingPlannedInspectionsShouldThrowError(int employeeId) + { + await Assert.ThrowsAsync( + () => _inspectionService.GetPlannedInspections(employeeId)); + } - #region Removing Inspection Tests + + [Theory] + [InlineData(2, 2)] + public async void GetPlannedInspectionsShouldReturnListOfPlannedInspections(int plannedInspectionId, + int festivalId) + { + List expected = + _dbMock.Object.PlannedInspections.Where(p => p.Id == plannedInspectionId).ToList(); + + List actual = await _inspectionService.GetPlannedInspections( + _dbMock.Object.Festivals.First(f => f.Id == festivalId).Id, + _dbMock.Object.PlannedInspections.First(p => p.Id == plannedInspectionId).StartTime); + Assert.Equal(expected, actual); + } [Fact] - public async void RemovingInspectionWithAnswersShouldthrowError() + public void GetAllInspectorsShouldReturnListOfInspectors() { - await Assert.ThrowsAsync(() => - _inspectionService.RemoveInspection(ModelMocks.PlannedInspectionThunderDome.Id, "slecht weer")); + List expected = _dbMock.Object.Employees.Where(e => e.Account.Role == Role.Inspector).ToList(); + + List actual = _inspectionService.GetAllInspectors(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(1)] + public async void GetFestivalAsyncShouldReturnFestival(int festivalId) + { + Festival expected = _dbMock.Object.Festivals.First(f => f.Id == festivalId); + Festival actual = await _inspectionService.GetFestivalAsync(festivalId); + + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(99)] + public async void GetFestivalAsyncvShouldThrowEntityNotFoundException(int festivalId) + { + await Assert.ThrowsAsync(async () => + await _inspectionService.GetFestivalAsync(festivalId)); + } + + [Theory] + [InlineData(2)] + public async void GetPlannedInspectionsShouldReturnPlannedInspections(int plannedInspectionId) + { + PlannedInspection expected = + _dbMock.Object.PlannedInspections.FirstOrDefault(p => p.Id == plannedInspectionId); + Assert.Equal(expected, await _inspectionService.GetPlannedInspection(plannedInspectionId)); + } + + [Theory] + [InlineData(99)] + public async void GetPlannedInspectionsThrowEntityNotFoundException(int plannedInspectionId) + { + await Assert.ThrowsAsync(async () => + await _inspectionService.GetPlannedInspection(plannedInspectionId)); } [Fact] public async void InvalidCancellationReasonShouldThrowError() { - String cancellationReason = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo" + + string cancellationReason = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo" + " ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis " + "parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, " + "pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec " + @@ -87,9 +183,76 @@ public async void InvalidCancellationReasonShouldThrowError() "rhoncus ut, imperdiet"; await Assert.ThrowsAsync(() => - _inspectionService.RemoveInspection(ModelMocks.PlannedInspectionPinkpop.Id, cancellationReason)); + _inspectionService.RemoveInspection(_modelMocks.PlannedInspections.First(p => p.Id == 2).Id, + cancellationReason)); } - #endregion + [Fact] + public async void RemovingInspectionShouldRemoveInspection() + { + await _inspectionService.RemoveInspection(3, "Test reden"); + await Assert.ThrowsAsync(() => _inspectionService.GetPlannedInspection(33)); + } + + [Fact] + public async void InvalidDataShouldThrowError() + { + PlannedInspection plannedInspection = _modelMocks.PlannedInspections.Find(e => e.Id == 1); + string eventTitle = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. " + + "Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque " + + "penatibus et magnis dis parturient montes,"; + + await Assert.ThrowsAsync(() => _inspectionService.CreatePlannedInspection( + plannedInspection.Festival.Id, + plannedInspection.Questionnaire.Id, + new DateTime(2019, 12, 10, 12, 30, 0), + new DateTime(2019, 12, 10, 19, 0, 0), + eventTitle, + plannedInspection.Employee.Id)); + } + + [Theory] + [InlineData(2)] + public async void GetPlannedInspectionByEmployeeIdShouldReturnListOfPlannedInspections(int employeeId) + { + List expected = + _dbMock.Object.PlannedInspections.Where(p => + p.Employee.Id == employeeId && p.StartTime == DateTime.Now.Date).ToList(); + List actual = await _inspectionService.GetPlannedInspections(employeeId); + + Assert.Equal(expected, actual); + } + + [Fact] + public async void RemovingInspectionWithAnswersShouldthrowError() + { + await Assert.ThrowsAsync(() => + _inspectionService.RemoveInspection(_modelMocks.Festivals.First(f => f.Id == 1).Id, "slecht weer")); + } + + [Fact] + public async void GetPlannedInspectionsShouldReturnListOfPlannedInspectionsByFestivalAndStartTime() + { + List expected = await _dbMock.Object.PlannedInspections.Where(p => + p.Festival.Id == 1 && p.StartTime == new DateTime(2020, 3, 4, 12, 30, 0)).ToListAsync(); + List actual = + await _inspectionService.GetPlannedInspections(1, new DateTime(2020, 3, 4, 12, 30, 0)); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2)] + public void GetPlannedInspectionsGroupedShouldReturnCorrectInspectionsAndGrouped(int festivalId) + { + Festival festival = _modelMocks.Festivals.First(f => f.Id == festivalId); + List> expected = _dbMock.Object.PlannedInspections + .Where(pi => pi.Festival.Id == festivalId) + .GroupBy(pi => pi.StartTime).Select(grp => grp.ToList()) + .ToList(); + + List> result = _inspectionService.GetPlannedInspectionsGrouped(festival); + + Assert.Equal(expected, result); + } } } \ No newline at end of file diff --git a/src/UnitTests/QuestionnaireTests.cs b/src/UnitTests/QuestionnaireTests.cs index 8b49dfe..e54456b 100644 --- a/src/UnitTests/QuestionnaireTests.cs +++ b/src/UnitTests/QuestionnaireTests.cs @@ -1,4 +1,6 @@ -using Festispec.Models.EntityMapping; +using System; +using System.Data.Entity; +using Festispec.Models.EntityMapping; using Festispec.DomainServices.Interfaces; using Moq; using Xunit; @@ -7,6 +9,8 @@ using Festispec.UnitTests.Helpers; using Festispec.Models.Exception; using System.Linq; +using System.Threading.Tasks; +using Festispec.Models.Answers; using Festispec.Models.Questions; namespace Festispec.UnitTests @@ -15,20 +19,25 @@ public class QuestionnaireTests { private readonly Mock _dbMock; private readonly IQuestionnaireService _questionnaireService; + public QuestionnaireTests() { // Setup database mocks _dbMock = new Mock(); - _dbMock.Setup(x => x.Questionnaires).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Questionnaires).Object); - + _dbMock.Setup(x => x.Questionnaires) + .Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Questionnaires).Object); _dbMock.Setup(x => x.Questions).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Questions).Object); - + _dbMock.Setup(x => x.Answers).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Answers).Object); + _dbMock.Setup(x => x.PlannedInspections) + .Returns(MockHelpers.CreateDbSetMock(new ModelMocks().PlannedInspections).Object); _dbMock.Setup(x => x.Festivals).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Festivals).Object); - + _dbMock.Setup(x => x.Employees).Returns(MockHelpers.CreateDbSetMock(new ModelMocks().Employees).Object); + _dbMock.Setup(x => x.TruncateTime(It.IsAny())).Returns(dt => dt.Date); _dbMock.Setup(m => m.SaveChangesAsync()).ReturnsAsync(1); - _questionnaireService = new QuestionnaireService(_dbMock.Object, new JsonSyncService(_dbMock.Object)); + _questionnaireService = + new QuestionnaireService(_dbMock.Object, new JsonSyncService(_dbMock.Object)); } [Theory] @@ -36,7 +45,7 @@ public QuestionnaireTests() [InlineData("Defqon")] public async void CreateQuestionnaire(string name) { - var festival = ModelMocks.FestivalPinkPop; + var festival = _dbMock.Object.Festivals.First(f => f.Id == 1); var questionnaire = await _questionnaireService.CreateQuestionnaire(name, festival.Id); Assert.Equal(festival, questionnaire.Festival); @@ -56,7 +65,8 @@ public async void WithoutFestivalShouldThrowError() [InlineData("PinkPop Ochtend")] public async void SameNameShouldThrowError(string name) { - await Assert.ThrowsAsync(() => _questionnaireService.CreateQuestionnaire(name, ModelMocks.FestivalPinkPop.Id)); + await Assert.ThrowsAsync(() => + _questionnaireService.CreateQuestionnaire(name, _dbMock.Object.Festivals.First(f => f.Id == 1).Id)); } [Theory] @@ -64,7 +74,8 @@ public async void SameNameShouldThrowError(string name) [InlineData("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")] public async void InvalidDataShouldThrowError(string name) { - await Assert.ThrowsAsync(() => _questionnaireService.CreateQuestionnaire(name, ModelMocks.FestivalPinkPop.Id)); + await Assert.ThrowsAsync(() => + _questionnaireService.CreateQuestionnaire(name, _dbMock.Object.Festivals.First(f => f.Id == 1).Id)); } [Theory] @@ -82,11 +93,10 @@ public void GetQuestionnaire(int id) [InlineData(100)] public void WrongIdShouldThrowError(int id) { - Assert.Throws(() => _questionnaireService.GetQuestionnaire(id)); + Assert.Throws(() => _questionnaireService.GetQuestionnaire(id)); } [Theory] - [InlineData(1)] [InlineData(2)] public async void RemovingQuestionnaire(int id) { @@ -102,12 +112,21 @@ public async void RemovingQuestionnaire(int id) _dbMock.Object.Questionnaires.Add(expectedRemovedQuestionnaire); } + [Theory] + [InlineData(1)] + public async void RemovingQuestionnaireWithAnswersShouldThrowError(int questionnaireId) + { + await Assert.ThrowsAsync(() => + _questionnaireService.RemoveQuestionnaire(questionnaireId)); + } + + [Theory] [InlineData(1)] [InlineData(2)] public void GetQuestionFromQuestionnaire(int questionId) { - var questionnaire = ModelMocks.Questionnaire3; + var questionnaire = _dbMock.Object.Questionnaires.First(q => q.Id == 1); var expectedQuestion = questionnaire.Questions.FirstOrDefault(q => q.Id == questionId); var question = _questionnaireService.GetQuestionFromQuestionnaire(questionnaire.Id, questionId); @@ -118,10 +137,10 @@ public void GetQuestionFromQuestionnaire(int questionId) [Fact] public async void AddingStringQuestion() { - var questionnaire = ModelMocks.Questionnaire2; - var expectedQuestion = ModelMocks.StringQuestion; + var questionnaire = _dbMock.Object.Questionnaires.First(q => q.Id == 1); + var expectedQuestion = _dbMock.Object.Questions.OfType().First(); - Question question = await _questionnaireService.AddQuestion(questionnaire.Id, expectedQuestion); + var question = await _questionnaireService.AddQuestion(questionnaire.Id, expectedQuestion); Assert.NotNull(_questionnaireService.GetQuestionFromQuestionnaire(questionnaire.Id, question.Id)); Assert.Equal(expectedQuestion.Contents, question.Contents); @@ -132,13 +151,10 @@ public async void AddingStringQuestion() [Fact] public async void AddingMultipleChoiceQuestion() { - var questionnaire = ModelMocks.Questionnaire2; - var expectedQuestion = ModelMocks.MultipleChoiceQuestion; - - Question question = await _questionnaireService.AddQuestion(questionnaire.Id, expectedQuestion); + var questionnaire = _dbMock.Object.Questionnaires.First(q => q.Id == 1); + var expectedQuestion = _dbMock.Object.Questions.OfType().First(); - if (!(question is MultipleChoiceQuestion)) - throw new WrongQuestionTypeException(); + var question = await _questionnaireService.AddQuestion(questionnaire.Id, expectedQuestion); Assert.NotNull(_questionnaireService.GetQuestionFromQuestionnaire(questionnaire.Id, question.Id)); @@ -148,27 +164,25 @@ public async void AddingMultipleChoiceQuestion() [Fact] public async void NoOptionsShouldThrowError() { - var questionnaire = ModelMocks.Questionnaire2; - MultipleChoiceQuestion question = new MultipleChoiceQuestion("test", questionnaire); + var questionnaire = _dbMock.Object.Questionnaires.First(q => q.Id == 1); + var question = new MultipleChoiceQuestion("test", questionnaire); - await Assert.ThrowsAsync(() => _questionnaireService.AddQuestion(questionnaire.Id, question)); + await Assert.ThrowsAsync(() => + _questionnaireService.AddQuestion(questionnaire.Id, question)); } [Fact] public async void AddingNumericQuestion() { - var questionnaire = ModelMocks.Questionnaire2; - var expectedQuestion = ModelMocks.NumericQuestion; - - Question question = await _questionnaireService.AddQuestion(questionnaire.Id, expectedQuestion); + var questionnaire = _dbMock.Object.Questionnaires.First(q => q.Id == 1); + var expectedQuestion = _dbMock.Object.Questions.OfType().First(); - if (!(question is NumericQuestion)) - throw new WrongQuestionTypeException(); + var question = await _questionnaireService.AddQuestion(questionnaire.Id, expectedQuestion); Assert.NotNull(_questionnaireService.GetQuestionFromQuestionnaire(questionnaire.Id, question.Id)); - Assert.Equal(expectedQuestion.Minimum, ((NumericQuestion)question).Minimum); - Assert.Equal(expectedQuestion.Maximum, ((NumericQuestion)question).Maximum); + Assert.Equal(expectedQuestion.Minimum, ((NumericQuestion) question).Minimum); + Assert.Equal(expectedQuestion.Maximum, ((NumericQuestion) question).Maximum); _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); } @@ -176,10 +190,10 @@ public async void AddingNumericQuestion() [Fact] public async void UploadPictureQuestion() { - var questionnaire = ModelMocks.Questionnaire2; - var expectedQuestion = ModelMocks.UploadPictureQuestion; + var questionnaire = _dbMock.Object.Questionnaires.First(q => q.Id == 1); + var expectedQuestion = _dbMock.Object.Questions.OfType().First(); - Question question = await _questionnaireService.AddQuestion(questionnaire.Id, expectedQuestion); + var question = await _questionnaireService.AddQuestion(questionnaire.Id, expectedQuestion); Assert.NotNull(_questionnaireService.GetQuestionFromQuestionnaire(questionnaire.Id, question.Id)); @@ -191,37 +205,165 @@ public async void UploadPictureQuestion() [InlineData(2)] public async void RemovingQuestion(int questionId) { + var question = await _questionnaireService.GetQuestion(questionId); await _questionnaireService.RemoveQuestion(questionId); Assert.Null(_dbMock.Object.Questions.FirstOrDefault(q => q.Id == questionId)); _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); + _dbMock.Object.Questions.Add(question); } - + [Theory] + [InlineData(4)] + public async void RemovingQuestionWithAnswersShouldThrowError(int questionId) + { + await Assert.ThrowsAsync( ()=> _questionnaireService.RemoveQuestion(questionId)); + } + [Theory] + [InlineData(99)] + public async void RemovingNonExistingQuestionShouldThrowError(int questionId) + { + await Assert.ThrowsAsync( ()=> _questionnaireService.RemoveQuestion(questionId)); + } + + [Theory] + [InlineData(5)] + public async void RemovingQuestionLinkedToReferenceQuestionShouldThrowError(int questionId) + { + await Assert.ThrowsAsync( ()=> _questionnaireService.RemoveQuestion(questionId)); + } + [Fact] public void RemovingQuestionWithReferenceShouldThrowError() { - var questionnaire = ModelMocks.Questionnaire3; - var question = ModelMocks.ReferencedQuestion; + var question = _dbMock.Object.Questions.OfType().First(); - Assert.ThrowsAsync(() => _questionnaireService.RemoveQuestion(question.Id)); + Assert.ThrowsAsync(() => _questionnaireService.RemoveQuestion(question.Id)); } [Theory] [InlineData(3)] - [InlineData(4)] public async void CopyQuestionnaire(int questionnaireId) { - Questionnaire oldQuestionnaire = _questionnaireService.GetQuestionnaire(questionnaireId); + var oldQuestionnaire = _questionnaireService.GetQuestionnaire(questionnaireId); + + var newQuestionnaire = + await _questionnaireService.CopyQuestionnaire(questionnaireId, "Copied questionnaire"); + + Assert.Equal(oldQuestionnaire.Questions.Count, newQuestionnaire.Questions.Count); + + foreach (var question in newQuestionnaire.Questions.ToList()) + Assert.True(oldQuestionnaire.Questions.Contains(((ReferenceQuestion) question).Question)); + } + + [Theory] + [InlineData(1)] + public void GetQuestionsFromQuestionnaireShouldReturnListOfQuestions(int questionnaireId) + { + var expected = _dbMock.Object.Questions + .Where(q => q.Questionnaire.Id == questionnaireId) + .ToList(); + var actual = _questionnaireService.GetQuestionsFromQuestionnaire(questionnaireId); + + Assert.Equal(expected, actual); + } + + + [Theory] + [InlineData(1)] + public async Task GetGenericAnswerTAnswerShouldReturnStringAnswer(int answerId) + { + var expected = await _dbMock.Object.Answers.FirstAsync(a => a.Id == answerId); + var actual = await _questionnaireService.GetAnswer(answerId); - Questionnaire newQuestionnaire = await _questionnaireService.CopyQuestionnaire(questionnaireId, "Copied questionnaire"); + Assert.IsType(actual); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2)] + public async void GetPlannedInspectionsShouldReturnListOfPlannedInspections(int employeeId) + { + var expected = await _dbMock.Object.PlannedInspections + .Where(p => p.Employee.Id == employeeId) + .Where(p => p.StartTime.Date == DateTime.Now.Date) + .ToListAsync(); + var actual = await _questionnaireService.GetPlannedInspections(employeeId); + + Assert.Equal(expected, actual); + } + + + [Theory] + [InlineData(1)] + public async void GetPlannedInspectionShouldReturnPlannedInspection(int plannedInspectionId) + { + var expected = await _dbMock.Object.PlannedInspections.FirstAsync(p => p.Id == plannedInspectionId); + var actual = await _questionnaireService.GetPlannedInspection(plannedInspectionId); + + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(1)] + public async void CreateAnswerShouldAddAnswer(int answerId) + { + var expected = await _dbMock.Object.Answers.FirstAsync(a => a.Id == answerId); + var actual = await _questionnaireService.CreateAnswer(expected); + + Assert.Equal(expected,actual); + } + + [Fact] + public async void CopyQuestionnaireShouldReturnNewQuestionnaire() + { + var old = await _dbMock.Object.Questionnaires.FirstAsync(q => q.Id == 1); + var newQuestionnaire = await _questionnaireService.CopyQuestionnaire(old.Id, "new Text"); + + Assert.Equal(old.Questions.Count, newQuestionnaire.Questions.Count); + Assert.Equal("new Text", newQuestionnaire.Name); - Assert.Equal(oldQuestionnaire.Questions.Count(), newQuestionnaire.Questions.Count()); + } - foreach(Question question in newQuestionnaire.Questions.ToList()) - { - Assert.True(oldQuestionnaire.Questions.Contains(((ReferenceQuestion)question).Question)); - } + [Fact] + public async void InvalidQuestionnaireIdThrowsError() + { + await Assert.ThrowsAsync(() => _questionnaireService.AddQuestion(481284, new DrawQuestion())); + } + + [Fact] + public async void InvalidAnswerThrowsError() + { + await Assert.ThrowsAsync(() => _questionnaireService.CreateAnswer(new FileAnswer())); + } + + [Fact] + public async void InvalidEmployeeIdThrowsException() + { + await Assert.ThrowsAsync(() => _questionnaireService.GetPlannedInspections(-020)); + } + + [Fact] + public async void InvalidPlannedInspectionIdThrowsException() + { + await Assert.ThrowsAsync(() => _questionnaireService.GetPlannedInspection(-10)); + } + + [Fact] + public void InvalidQuestionnaireIdGetQuestionThrowsError() + { + Assert.Throws(() => _questionnaireService.GetQuestionFromQuestionnaire(-2, -2)); } + + [Fact] + public void InvalidQuestionIdGetQuestionThrowsError() + { + Assert.Throws(() => _questionnaireService.GetQuestionFromQuestionnaire(1, -2)); + } + + + + + } -} +} \ No newline at end of file diff --git a/src/UnitTests/SicknessServiceTests.cs b/src/UnitTests/SicknessServiceTests.cs index 236e3cb..ed2262d 100644 --- a/src/UnitTests/SicknessServiceTests.cs +++ b/src/UnitTests/SicknessServiceTests.cs @@ -16,19 +16,16 @@ public class SicknessServiceTests { private readonly Mock _dbMock; private readonly ISicknessService _sicknessService; - private ModelMocks _modelMocks; public SicknessServiceTests() { _dbMock = new Mock(); - _modelMocks = new ModelMocks(); - - _dbMock.Setup(x => x.Employees).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Employees1).Object); - - _dbMock.Setup(x => x.Availabilities).Returns(MockHelpers.CreateDbSetMock(_modelMocks.Availability).Object); - - _dbMock.Setup(x => x.PlannedEvents).Returns(MockHelpers.CreateDbSetMock(_modelMocks.PlannedEvents).Object); + var modelMocks = new ModelMocks(); + _dbMock.Setup(x => x.Employees).Returns(MockHelpers.CreateDbSetMock(modelMocks.Employees).Object); + _dbMock.Setup(x => x.Availabilities) + .Returns(MockHelpers.CreateDbSetMock(modelMocks.Availabilities).Object); + _dbMock.Setup(x => x.PlannedEvents).Returns(MockHelpers.CreateDbSetMock(modelMocks.PlannedEvents).Object); _dbMock.Setup(m => m.SaveChangesAsync()).ReturnsAsync(1); _sicknessService = new SicknessService(_dbMock.Object); @@ -37,12 +34,11 @@ public SicknessServiceTests() [Theory] [InlineData("Ik heb griep")] [InlineData("Ik heb mijn been gebroken")] - public async void AddAbsense(string reason) + public async void AddAbsence(string reason) { - var sickness = await _sicknessService.AddAbsense(1, reason, null); + var sickness = await _sicknessService.AddAbsence(1, reason, null); Assert.NotNull(sickness); - Assert.True(_sicknessService.IsSick(1)); _dbMock.Verify(x => x.SaveChangesAsync(), Times.Once); @@ -51,7 +47,8 @@ public async void AddAbsense(string reason) [Fact] public async void EnteringPassedDateShouldThrowException() { - await Assert.ThrowsAsync(() => _sicknessService.AddAbsense(1, "test", new DateTime(2000, 10, 10))); + await Assert.ThrowsAsync(() => + _sicknessService.AddAbsence(1, "test", new DateTime(2000, 10, 10))); } [Fact] @@ -59,5 +56,11 @@ public void IsSick() { Assert.True(_sicknessService.IsSick(1)); } + + [Fact] + public async void InvalidDataThrowsException() + { + await Assert.ThrowsAsync(() => _sicknessService.AddAbsence(-1, string.Empty, null)); + } } } \ No newline at end of file diff --git a/src/UserInterface/AppServices.cs b/src/UserInterface/AppServices.cs index b4fb84f..948021b 100644 --- a/src/UserInterface/AppServices.cs +++ b/src/UserInterface/AppServices.cs @@ -11,7 +11,6 @@ using Festispec.UI.ViewModels.Customers; using Festispec.UI.ViewModels.Employees; using Festispec.UI.ViewModels.Festivals; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Festispec.UI diff --git a/src/UserInterface/Converters/CanEditQuestionConverter.cs b/src/UserInterface/Converters/CanEditQuestionConverter.cs index 7520460..15690f1 100644 --- a/src/UserInterface/Converters/CanEditQuestionConverter.cs +++ b/src/UserInterface/Converters/CanEditQuestionConverter.cs @@ -9,7 +9,7 @@ internal class CanEditQuestionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return (value as Question).Id != 0; + return (value as Question)?.Id != 0; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/src/UserInterface/Converters/CanEditQuestionConverterInverse.cs b/src/UserInterface/Converters/CanEditQuestionConverterInverse.cs index 98857ba..b625d1c 100644 --- a/src/UserInterface/Converters/CanEditQuestionConverterInverse.cs +++ b/src/UserInterface/Converters/CanEditQuestionConverterInverse.cs @@ -9,7 +9,7 @@ internal class CanEditQuestionConverterInverse : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return (value as Question).Id == 0; + return (value as Question)?.Id == 0; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/src/UserInterface/Converters/HasAnswerConverter.cs b/src/UserInterface/Converters/HasAnswerConverter.cs index 800599a..2475f6e 100644 --- a/src/UserInterface/Converters/HasAnswerConverter.cs +++ b/src/UserInterface/Converters/HasAnswerConverter.cs @@ -11,7 +11,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn { var question = value as Question; - return question.AnswerCount == 0; + return question?.AnswerCount == 0; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/src/UserInterface/Converters/HasQuestionsConverter.cs b/src/UserInterface/Converters/HasQuestionsConverter.cs index cfe4782..763b2aa 100644 --- a/src/UserInterface/Converters/HasQuestionsConverter.cs +++ b/src/UserInterface/Converters/HasQuestionsConverter.cs @@ -11,7 +11,7 @@ internal class HasQuestionsConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - bool invert = bool.Parse(parameter as string ?? "false"); + var invert = bool.Parse(parameter as string ?? "false"); if (!(value is Questionnaire questionnaire)) return Visibility.Hidden; diff --git a/src/UserInterface/Converters/HideButtonConverter.cs b/src/UserInterface/Converters/HideButtonConverter.cs index 17c1f24..8b6262a 100644 --- a/src/UserInterface/Converters/HideButtonConverter.cs +++ b/src/UserInterface/Converters/HideButtonConverter.cs @@ -1,11 +1,8 @@ -using Festispec.Models.Questions; -using System; -using System.Collections.Generic; +using System; using System.Globalization; -using System.Text; using System.Windows; -using System.Windows.Controls; using System.Windows.Data; +using Festispec.Models.Questions; namespace Festispec.UI.Converters { @@ -13,7 +10,7 @@ class HideButtonConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return (value as Question).AnswerCount > 0 ? Visibility.Hidden : Visibility.Visible; + return (value as Question)?.AnswerCount > 0 ? Visibility.Hidden : Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/src/UserInterface/Converters/TextTrimmerConverter.cs b/src/UserInterface/Converters/TextTrimmerConverter.cs index e52e494..0f9886e 100644 --- a/src/UserInterface/Converters/TextTrimmerConverter.cs +++ b/src/UserInterface/Converters/TextTrimmerConverter.cs @@ -12,7 +12,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn try { - int length = int.Parse(parameter.ToString()); + var length = int.Parse(parameter.ToString()); if (result.Length > length) result = result.Substring(0, length) + "..."; diff --git a/src/UserInterface/Converters/ToTypeConverter.cs b/src/UserInterface/Converters/ToTypeConverter.cs index dd5b459..1125375 100644 --- a/src/UserInterface/Converters/ToTypeConverter.cs +++ b/src/UserInterface/Converters/ToTypeConverter.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Text; using System.Windows.Data; using Festispec.Models.Questions; @@ -11,28 +9,17 @@ class ToTypeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - switch (value) + return value switch { - case DrawQuestion _: - return "Teken vraag"; - case RatingQuestion _: - return "Beoordelings vraag"; - case StringQuestion _: - return "Open vraag"; - case MultipleChoiceQuestion _: - return "Meerkeuze vraag"; - case UploadPictureQuestion _: - return "Foto vraag"; - case NumericQuestion _: - return "Numerieke vraag"; - case ReferenceQuestion _: - return "Referentie vraag"; - - - - default: - return "vraag"; - } + DrawQuestion _ => "Teken vraag", + RatingQuestion _ => "Beoordelings vraag", + StringQuestion _ => "Open vraag", + MultipleChoiceQuestion _ => "Meerkeuze vraag", + UploadPictureQuestion _ => "Foto vraag", + NumericQuestion _ => "Numerieke vraag", + ReferenceQuestion _ => "Referentie vraag", + _ => "vraag" + }; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/src/UserInterface/Interfaces/IActivateable.cs b/src/UserInterface/Interfaces/IActivateable.cs deleted file mode 100644 index c158da3..0000000 --- a/src/UserInterface/Interfaces/IActivateable.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Festispec.UI.Interfaces -{ - public interface IActivateable - { - public void Initialize(TInput input); - } -} \ No newline at end of file diff --git a/src/UserInterface/Interfaces/IAsyncActivateable.cs b/src/UserInterface/Interfaces/IAsyncActivateable.cs deleted file mode 100644 index 168b974..0000000 --- a/src/UserInterface/Interfaces/IAsyncActivateable.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Threading.Tasks; - -namespace Festispec.UI.ViewModels -{ - public interface IAsyncActivateable - { - public Task Initialize(TInput input); - } -} \ No newline at end of file diff --git a/src/UserInterface/Interfaces/IFrameNavigationService.cs b/src/UserInterface/Interfaces/IFrameNavigationService.cs index 3b68580..9eb635b 100644 --- a/src/UserInterface/Interfaces/IFrameNavigationService.cs +++ b/src/UserInterface/Interfaces/IFrameNavigationService.cs @@ -1,11 +1,9 @@ -using System.Collections.Generic; -using GalaSoft.MvvmLight.Views; +using GalaSoft.MvvmLight.Views; namespace Festispec.UI.Interfaces { public interface IFrameNavigationService : INavigationService { object Parameter { get; } - IEnumerable Pages { get; } } } \ No newline at end of file diff --git a/src/UserInterface/Properties/launchSettings.json b/src/UserInterface/Properties/launchSettings.json index 4db398f..2a739c0 100644 --- a/src/UserInterface/Properties/launchSettings.json +++ b/src/UserInterface/Properties/launchSettings.json @@ -3,7 +3,7 @@ "UserInterface": { "commandName": "Project", "environmentVariables": { - "Environment": "Production" + "Environment": "Debug" } } } diff --git a/src/UserInterface/Services/FrameNavigationService.cs b/src/UserInterface/Services/FrameNavigationService.cs index 6819907..b75d0e1 100644 --- a/src/UserInterface/Services/FrameNavigationService.cs +++ b/src/UserInterface/Services/FrameNavigationService.cs @@ -1,5 +1,4 @@ -using Festispec.UI.Interfaces; -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -7,11 +6,12 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Media; +using Festispec.UI.Interfaces; namespace Festispec.UI.Services { /** Courtesy of https://stackoverflow.com/questions/28966819/mvvm-light-5-0-how-to-use-the-navigation-service */ - public class FrameNavigationService : IFrameNavigationService, INotifyPropertyChanged + public sealed class FrameNavigationService : IFrameNavigationService, INotifyPropertyChanged { #region Fields @@ -39,8 +39,6 @@ private set public object Parameter { get; private set; } - public IEnumerable Pages => _pagesByKey.Keys; - #endregion #region Ctors and Methods @@ -53,11 +51,9 @@ public FrameNavigationService() public void GoBack() { - if (_historic.Count > 1) - { - _historic.RemoveAt(_historic.Count - 1); - NavigateTo(_historic.Last(), null); - } + if (_historic.Count <= 1) return; + _historic.RemoveAt(_historic.Count - 1); + NavigateTo(_historic.Last(), null); } public void NavigateTo(string pageKey) @@ -65,12 +61,12 @@ public void NavigateTo(string pageKey) NavigateTo(pageKey, null); } - public virtual void NavigateTo(string pageKey, object parameter) + public void NavigateTo(string pageKey, object parameter) { lock (_pagesByKey) { if (!_pagesByKey.ContainsKey(pageKey)) - throw new ArgumentException(string.Format("No such page: {0} ", pageKey), nameof(pageKey)); + throw new ArgumentException($@"No such page: {pageKey}", nameof(pageKey)); if (GetDescendantFromName(Application.Current.MainWindow, "MainFrame") is Frame frame) @@ -95,7 +91,7 @@ public void Configure(string key, Uri pageType) private static FrameworkElement GetDescendantFromName(DependencyObject parent, string name) { - int count = VisualTreeHelper.GetChildrenCount(parent); + var count = VisualTreeHelper.GetChildrenCount(parent); if (count < 1) return null; @@ -117,7 +113,7 @@ private static FrameworkElement GetDescendantFromName(DependencyObject parent, s public event PropertyChangedEventHandler PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + private void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } diff --git a/src/UserInterface/Validation/DateFormatValidationRule.cs b/src/UserInterface/Validation/DateFormatValidationRule.cs index f86f885..ef592bd 100644 --- a/src/UserInterface/Validation/DateFormatValidationRule.cs +++ b/src/UserInterface/Validation/DateFormatValidationRule.cs @@ -10,16 +10,13 @@ public class DateFormatValidationRule : ValidationRule public override ValidationResult Validate(object value, CultureInfo cultureInfo) { var input = value as string; - Match match = Regex.Match(input, @"^\d{2}-\d{2}-\d{4}$"); + var match = Regex.Match(input, @"^\d{2}-\d{2}-\d{4}$"); if (!match.Success) return new ValidationResult(false, "Field must be in MM/DD/YYYY format"); - DateTime date; - bool canParse = DateTime.TryParse(input, out date); + var canParse = DateTime.TryParse(input, out var date); if (!canParse) return new ValidationResult(false, "Field must be a valid datetime value"); - if (date.CompareTo(new DateTime(1970, 01, 01)) != 1) - return new ValidationResult(false, "Date must be later than the year 1970"); - return new ValidationResult(true, null); + return date.CompareTo(new DateTime(1970, 01, 01)) != 1 ? new ValidationResult(false, "Date must be later than the year 1970") : new ValidationResult(true, null); } } } \ No newline at end of file diff --git a/src/UserInterface/Validation/TimeFormatValidationRule.cs b/src/UserInterface/Validation/TimeFormatValidationRule.cs index c60eeec..2f605fe 100644 --- a/src/UserInterface/Validation/TimeFormatValidationRule.cs +++ b/src/UserInterface/Validation/TimeFormatValidationRule.cs @@ -12,10 +12,10 @@ public override ValidationResult Validate(object value, CultureInfo cultureInfo) var input = value as string; if (string.IsNullOrEmpty(input)) return new ValidationResult(false, "Field cannot be blank"); - Match match = Regex.Match(input, @"^\d{2}:\d{2}$"); + var match = Regex.Match(input, @"^\d{2}:\d{2}$"); if (!match.Success) return new ValidationResult(false, "Field must be in hh/mm format"); - bool canParse = TimeSpan.TryParse(input, out TimeSpan _); + var canParse = TimeSpan.TryParse(input, out _); return !canParse ? new ValidationResult(false, "Field must be a valid timespan value") : new ValidationResult(true, null); } } diff --git a/src/UserInterface/ViewModels/Customers/CustomerViewModel.cs b/src/UserInterface/ViewModels/Customers/CustomerViewModel.cs index 14bb57c..fbbb194 100755 --- a/src/UserInterface/ViewModels/Customers/CustomerViewModel.cs +++ b/src/UserInterface/ViewModels/Customers/CustomerViewModel.cs @@ -154,11 +154,11 @@ public async void Search() } } - public async void Select(string id) + private async void Select(string id) { try { - Address address = await _googleService.GetAddress(id); + var address = await _googleService.GetAddress(id); Customer.Address = address; CurrentAddress = $"Geselecteerde adres: {Customer.Address}"; RaisePropertyChanged(nameof(CurrentAddress)); diff --git a/src/UserInterface/ViewModels/Employees/AccountViewModel.cs b/src/UserInterface/ViewModels/Employees/AccountViewModel.cs index e19db5e..a1e6077 100644 --- a/src/UserInterface/ViewModels/Employees/AccountViewModel.cs +++ b/src/UserInterface/ViewModels/Employees/AccountViewModel.cs @@ -63,7 +63,7 @@ private void SaveChanges(PasswordWithVerification passwordWithVerification) return; } - IntPtr valuePtr = IntPtr.Zero; + var valuePtr = IntPtr.Zero; try { valuePtr = Marshal.SecureStringToGlobalAllocUnicode(passwordWithVerification.Password); diff --git a/src/UserInterface/ViewModels/Employees/EmployeeViewModel.cs b/src/UserInterface/ViewModels/Employees/EmployeeViewModel.cs index 91b1d70..519eef3 100644 --- a/src/UserInterface/ViewModels/Employees/EmployeeViewModel.cs +++ b/src/UserInterface/ViewModels/Employees/EmployeeViewModel.cs @@ -85,7 +85,7 @@ private async void AddEmployee(PasswordWithVerification passwordWithVerification return; } - IntPtr valuePtr = IntPtr.Zero; + var valuePtr = IntPtr.Zero; try { if (!passwordWithVerification.Equal() || passwordWithVerification.Empty()) @@ -167,7 +167,7 @@ private async void RemoveEmployee() public string SearchQuery { get; set; } public string CurrentAddress { get; set; } - public async void Search() + private async void Search() { try { @@ -188,11 +188,11 @@ public async void Search() } } - public async void Select(string id) + private async void Select(string id) { try { - Address address = await _googleService.GetAddress(id); + var address = await _googleService.GetAddress(id); Employee.Address = address; CurrentAddress = $"Geselecteerde adres: {Employee.Address}"; RaisePropertyChanged(nameof(CurrentAddress)); diff --git a/src/UserInterface/ViewModels/Employees/PasswordWithVerification.cs b/src/UserInterface/ViewModels/Employees/PasswordWithVerification.cs index cb800c9..7e2eb7e 100644 --- a/src/UserInterface/ViewModels/Employees/PasswordWithVerification.cs +++ b/src/UserInterface/ViewModels/Employees/PasswordWithVerification.cs @@ -27,8 +27,8 @@ public bool BothEmpty() public bool Equal() { - IntPtr valuePtrPassword = IntPtr.Zero; - IntPtr valuePtrVerificationPassword = IntPtr.Zero; + var valuePtrPassword = IntPtr.Zero; + var valuePtrVerificationPassword = IntPtr.Zero; try { diff --git a/src/UserInterface/ViewModels/Festivals/CreateFestivalViewModel.cs b/src/UserInterface/ViewModels/Festivals/CreateFestivalViewModel.cs index 344cf5e..488f1a2 100644 --- a/src/UserInterface/ViewModels/Festivals/CreateFestivalViewModel.cs +++ b/src/UserInterface/ViewModels/Festivals/CreateFestivalViewModel.cs @@ -1,6 +1,5 @@ using System; using System.Collections.ObjectModel; -using System.Windows; using System.Windows.Input; using Festispec.DomainServices.Interfaces; using Festispec.Models; @@ -8,12 +7,11 @@ using Festispec.Models.Google; using Festispec.UI.Exceptions; using Festispec.UI.Interfaces; -using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; namespace Festispec.UI.ViewModels.Festivals { - internal class CreateFestivalViewModel : BaseValidationViewModel + public class CreateFestivalViewModel : BaseValidationViewModel { private readonly IGoogleMapsService _googleService; @@ -54,7 +52,7 @@ public CreateFestivalViewModel(IFrameNavigationService navigationService, IFesti public ICommand SearchCommand { get; } public RelayCommand SelectCommand { get; } - public async void CreateFestival() + private async void CreateFestival() { try { @@ -82,7 +80,7 @@ public async void CreateFestival() public string SearchQuery { get; set; } public string CurrentAddress { get; set; } - public async void Search() + private async void Search() { try { diff --git a/src/UserInterface/ViewModels/Festivals/FestivalListViewModel.cs b/src/UserInterface/ViewModels/Festivals/FestivalListViewModel.cs index c32d4cc..5dfcb7c 100644 --- a/src/UserInterface/ViewModels/Festivals/FestivalListViewModel.cs +++ b/src/UserInterface/ViewModels/Festivals/FestivalListViewModel.cs @@ -5,11 +5,12 @@ using Festispec.DomainServices.Interfaces; using Festispec.Models; using Festispec.UI.Interfaces; +using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; namespace Festispec.UI.ViewModels.Festivals { - public class FestivalListViewModel + public class FestivalListViewModel : ViewModelBase { private readonly IFrameNavigationService _navigationService; @@ -45,7 +46,7 @@ private bool Filter(object item) { if (string.IsNullOrEmpty(Search)) return true; - return (item as Festival).FestivalName.IndexOf(Search, StringComparison.OrdinalIgnoreCase) >= 0; + return ((Festival) item).FestivalName.IndexOf(Search, StringComparison.OrdinalIgnoreCase) >= 0; } private void OpenFestival(int festivalId) diff --git a/src/UserInterface/ViewModels/Festivals/FestivalViewModel.cs b/src/UserInterface/ViewModels/Festivals/FestivalViewModel.cs index f6f32f1..4ea96d6 100644 --- a/src/UserInterface/ViewModels/Festivals/FestivalViewModel.cs +++ b/src/UserInterface/ViewModels/Festivals/FestivalViewModel.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; @@ -7,7 +8,6 @@ using Festispec.Models; using Festispec.Models.Exception; using Festispec.UI.Interfaces; -using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.CommandWpf; namespace Festispec.UI.ViewModels.Festivals @@ -21,11 +21,12 @@ public class FestivalViewModel : BaseDeleteCheckViewModel private Festival _festival; - private bool _createQuestionnairePopupIsOpen { get; set; } = false; - private bool _copyQuestionnairePopupIsOpen { get; set; } = false; + private bool _createQuestionnairePopupIsOpen { get; set; } + private bool _copyQuestionnairePopupIsOpen { get; set; } public FestivalViewModel(IFrameNavigationService navigationService, IFestivalService festivalService, - IQuestionnaireService questionnaireService, IInspectionService inspectionService, IOfflineService offlineService) + IQuestionnaireService questionnaireService, IInspectionService inspectionService, + IOfflineService offlineService) { _festivalService = festivalService; _navigationService = navigationService; @@ -34,25 +35,39 @@ public FestivalViewModel(IFrameNavigationService navigationService, IFestivalSer RemoveFestivalCommand = new RelayCommand(OpenDeletePopup, () => offlineService.IsOnline, true); DeleteCommand = new RelayCommand(RemoveFestival, () => offlineService.IsOnline, true); - EditFestivalCommand = new RelayCommand(() => _navigationService.NavigateTo("UpdateFestival", Festival.Id), () => offlineService.IsOnline, true); + EditFestivalCommand = new RelayCommand(() => _navigationService.NavigateTo("UpdateFestival", Festival.Id), + () => offlineService.IsOnline, true); OpenQuestionnaireCommand = new RelayCommand(OpenQuestionnaire); CreateQuestionnaireCommand = new RelayCommand(CreateQuestionnaire, () => offlineService.IsOnline, true); - ConfirmDeleteQuestionnaireCommand = new RelayCommand(DeleteQuestionnaire, () => offlineService.IsOnline, true); - DeleteQuestionnaireCommand = new RelayCommand(id => _deletetingQuestionnareId = id, _ => offlineService.IsOnline, true); + ConfirmDeleteQuestionnaireCommand = + new RelayCommand(DeleteQuestionnaire, () => offlineService.IsOnline, true); + DeleteQuestionnaireCommand = + new RelayCommand(id => _deletetingQuestionnareId = id, _ => offlineService.IsOnline, true); NewQuestionnaireCommand = new RelayCommand(NewQuestionnaire); - OpenCopyQuestionnaireCommand = new RelayCommand(openCopyQuestionnaire); + OpenCopyQuestionnaireCommand = new RelayCommand(OpenCopyQuestionnaire); + CloseCopyQuestionnaireCommand = new RelayCommand(CloseCopyQuestionnaire); CopyQuestionnaireCommand = new RelayCommand(CopyQuestionnaire); GenerateReportCommand = new RelayCommand(GenerateReport); - DeletePlannedInspectionsCommand = new RelayCommand>(DeletePlannedInspection, _ => offlineService.IsOnline, true); EditPlannedInspectionCommand = new RelayCommand>(plannedInspections => - _navigationService.NavigateTo("Inspection", new {PlannedInspectionId = plannedInspections[0].Id, FestivalId = -1}), _ => offlineService.IsOnline, true); - CreatePlannedInspectionCommand = new RelayCommand(() => _navigationService.NavigateTo("Inspection", new {PlannedInspectionId = -1, FestivalId = Festival.Id}), () => offlineService.IsOnline, true); + _navigationService.NavigateTo("Inspection", + new { PlannedInspectionId = plannedInspections[0].Id, FestivalId = -1 }), + _ => offlineService.IsOnline, true); + CreatePlannedInspectionCommand = + new RelayCommand( + () => _navigationService.NavigateTo("Inspection", + new { PlannedInspectionId = -1, FestivalId = Festival.Id }), () => offlineService.IsOnline, + true); CanEdit = offlineService.IsOnline; Initialize((int) _navigationService.Parameter); } + private void CloseCopyQuestionnaire() + { + CopyQuestionnairePopupIsOpen = false; + } + public Festival Festival { get => _festival; @@ -62,6 +77,7 @@ public Festival Festival RaisePropertyChanged(nameof(Festival)); } } + public bool CreateQuestionnairePopupIsOpen { get => _createQuestionnairePopupIsOpen; @@ -70,7 +86,8 @@ public bool CreateQuestionnairePopupIsOpen _createQuestionnairePopupIsOpen = value; RaisePropertyChanged(nameof(CreateQuestionnairePopupIsOpen)); } - } + } + public bool CopyQuestionnairePopupIsOpen { get => _copyQuestionnairePopupIsOpen; @@ -79,7 +96,23 @@ public bool CopyQuestionnairePopupIsOpen _copyQuestionnairePopupIsOpen = value; RaisePropertyChanged(nameof(CopyQuestionnairePopupIsOpen)); } - } + } + + public bool HasAnswers + { + get + { + var questionnaire = Festival.Questionnaires.FirstOrDefault(); + if (questionnaire == null) + return false; + + var questions = questionnaire.Questions; + if (questions.Count < 1) + return false; + + return questions.FirstOrDefault().AnswerCount > 0; + } + } public bool CanEdit { get; set; } @@ -97,15 +130,16 @@ public bool CopyQuestionnairePopupIsOpen public ICommand NewQuestionnaireCommand { get; set; } public ICommand CopyQuestionnaireCommand { get; set; } public ICommand OpenCopyQuestionnaireCommand { get; set; } + public ICommand CloseCopyQuestionnaireCommand { get; set; } public ICommand GenerateReportCommand { get; set; } public RelayCommand OpenQuestionnaireCommand { get; set; } - public RelayCommand DeleteQuestionnaireCommand { get; set; } + private RelayCommand DeleteQuestionnaireCommand { get; set; } public ICommand DeletePlannedInspectionsCommand { get; set; } public ICommand EditPlannedInspectionCommand { get; set; } public ICommand CreatePlannedInspectionCommand { get; set; } - public void Initialize(int id) + private void Initialize(int id) { Festival = _festivalService.GetFestival(id); @@ -119,7 +153,7 @@ public void Initialize(int id) RaisePropertyChanged(nameof(PlannedInspections)); } - public async void RemoveFestival() + private async void RemoveFestival() { try { @@ -128,16 +162,17 @@ public async void RemoveFestival() } catch (FestivalHasQuestionnairesException) { - OpenValidationPopup("Dit festival kan niet worden verwijderd omdat er al vragenlijsten zijn aangemaakt."); + OpenValidationPopup( + "Dit festival kan niet worden verwijderd omdat er al vragenlijsten zijn aangemaakt."); } } - public void OpenQuestionnaire(int id) => _navigationService.NavigateTo("Questionnaire", id); + private void OpenQuestionnaire(int id) => _navigationService.NavigateTo("Questionnaire", id); - public void NewQuestionnaire() => CreateQuestionnairePopupIsOpen = true; + private void NewQuestionnaire() => CreateQuestionnairePopupIsOpen = true; - public async void CreateQuestionnaire() + private async void CreateQuestionnaire() { CreateQuestionnairePopupIsOpen = false; try @@ -148,7 +183,8 @@ public async void CreateQuestionnaire() } catch (Exception) { - OpenValidationPopup("Er is een fout opgetreden tijdens het aanmaken van de vragenlijst. Probeer het opnieuw."); + OpenValidationPopup( + "Er is een fout opgetreden tijdens het aanmaken van de vragenlijst. Probeer het opnieuw."); } } @@ -162,12 +198,13 @@ private async void DeleteQuestionnaire() await _questionnaireService.RemoveQuestionnaire(_deletetingQuestionnareId); _festivalService.Sync(); } - catch(QuestionHasAnswersException) + catch (QuestionHasAnswersException) { OpenValidationPopup("Deze vragenlijst kan niet worden verwijderd omdat er al vragen zijn beantwoord."); } } - public void openCopyQuestionnaire(int copyQuestionnaireId) + + private void OpenCopyQuestionnaire(int copyQuestionnaireId) { CopyQuestionnairePopupIsOpen = true; _copyQuestionnaireId = copyQuestionnaireId; @@ -177,7 +214,8 @@ private async void CopyQuestionnaire() { try { - Questionnaire newQuestionnaire = await _questionnaireService.CopyQuestionnaire(_copyQuestionnaireId, QuestionnaireName); + var newQuestionnaire = + await _questionnaireService.CopyQuestionnaire(_copyQuestionnaireId, QuestionnaireName); CopyQuestionnairePopupIsOpen = false; _navigationService.NavigateTo("Questionnaire", newQuestionnaire.Id); } @@ -194,30 +232,11 @@ private void GenerateReport() #region PlannedInspections - public IEnumerable> PlannedInspections => - Festival != null + public IEnumerable> PlannedInspections => + Festival != null ? _inspectionService.GetPlannedInspectionsGrouped(Festival) : new List>(); - public async void DeletePlannedInspection(List plannedInspections) - { - foreach (PlannedInspection plannedInspection in plannedInspections) - try - { - await _inspectionService.RemoveInspection(plannedInspection.Id, "Niet meer nodig"); - } - catch (QuestionHasAnswersException) - { - OpenValidationPopup("De inspectie kan niet worden verwijderd omdat er een vraag met antwoorden in zit."); - } - catch (InvalidDataException) - { - OpenValidationPopup("De inspectie kan niet worden verwijderd omdat de ingevulde gegevens niet voldoen."); - } - - RaisePropertyChanged(nameof(PlannedInspections)); - } - #endregion PlannedInspections } -} \ No newline at end of file +} diff --git a/src/UserInterface/ViewModels/Festivals/UpdateFestivalViewModel.cs b/src/UserInterface/ViewModels/Festivals/UpdateFestivalViewModel.cs index 0a2772e..b6e4123 100644 --- a/src/UserInterface/ViewModels/Festivals/UpdateFestivalViewModel.cs +++ b/src/UserInterface/ViewModels/Festivals/UpdateFestivalViewModel.cs @@ -1,5 +1,4 @@ using System.Collections.ObjectModel; -using System.Windows; using System.Windows.Input; using Festispec.DomainServices.Interfaces; using Festispec.Models; diff --git a/src/UserInterface/ViewModels/InspectionViewModel.cs b/src/UserInterface/ViewModels/InspectionViewModel.cs index 72b246c..dd6b5d1 100644 --- a/src/UserInterface/ViewModels/InspectionViewModel.cs +++ b/src/UserInterface/ViewModels/InspectionViewModel.cs @@ -34,7 +34,8 @@ internal class InspectionViewModel : BaseDeleteCheckViewModel public InspectionViewModel( IInspectionService inspectionService, IFrameNavigationService navigationService, - IGoogleMapsService googleService + IGoogleMapsService googleService, + IOfflineService offlineService ) { _inspectionService = inspectionService; @@ -44,6 +45,8 @@ IGoogleMapsService googleService CheckBoxCommand = new RelayCommand(CheckBox); SaveCommand = new RelayCommand(Save); ReturnCommand = new RelayCommand(() => _navigationService.NavigateTo("FestivalInfo", Festival.Id)); + OpenDeleteCheckPopup = new RelayCommand(OpenDeletePopup); + DeleteCommand = new RelayCommand(DeletePlannedInspection, () => offlineService.IsOnline, true); PlannedInspections = new List(); Questionnaires = new List(); @@ -53,7 +56,8 @@ IGoogleMapsService googleService } public ICollection PlannedInspections { get; private set; } - private IEnumerable OriginalPlannedInspectionIds { get; set; } + public string Instructions { get; set; } + private ICollection OriginalPlannedInspectionIds { get; set; } public Festival Festival { @@ -64,6 +68,7 @@ public Festival Festival public ICommand CheckBoxCommand { get; set; } public ICommand SaveCommand { get; set; } public ICommand ReturnCommand { get; set; } + public ICommand OpenDeleteCheckPopup { get; set; } public ICollection Questionnaires { get; private set; } @@ -168,10 +173,10 @@ private bool EmployeeHasNoPlannedInspection(Employee employee) if (_originalStartTime == _startTime && _originalStartTime.Year > 100) return true; - if ((_startTime.Ticks >= item.StartTime.Ticks || _endTime.Ticks >= item.StartTime.Ticks) && - (_startTime.Ticks <= ((DateTime)item.EndTime).Ticks || _endTime.Ticks <= ((DateTime)item.EndTime).Ticks)) - return false; - } + if ((_startTime.Ticks >= item.StartTime.Ticks || _endTime.Ticks >= item.StartTime.Ticks) && + (_startTime.Ticks <= ((DateTime)item.EndTime).Ticks || _endTime.Ticks <= ((DateTime)item.EndTime).Ticks)) + return false; + } return true; } @@ -187,9 +192,10 @@ private async Task Initialize(dynamic parameter) _endTime = (DateTime)temp.EndTime; SelectedQuestionnaire = temp.Questionnaire; _selectedDate = temp.StartTime; + Instructions = temp.Instructions; PlannedInspections = await _inspectionService.GetPlannedInspections(temp.Festival.Id, temp.StartTime); - OriginalPlannedInspectionIds = PlannedInspections.Select(pi => pi.Id); + OriginalPlannedInspectionIds = PlannedInspections.Select(pi => pi.Id).ToList(); } else if (parameter.FestivalId > 0) { @@ -245,7 +251,7 @@ private void CheckBox(AdvancedEmployee advancedEmployee) { StartTime = _startTime, EndTime = _endTime, - EventTitle = $"Ingeplande inspectie voor {advancedEmployee.Employee.Name}", + EventTitle = $"Ingeplande inspectie voor {Festival.FestivalName}", Employee = advancedEmployee.Employee, Questionnaire = SelectedQuestionnaire, Festival = Festival @@ -254,12 +260,45 @@ private void CheckBox(AdvancedEmployee advancedEmployee) else PlannedInspections.Remove(existing); } + + private async void DeletePlannedInspection() + { + ICollection keptPlannedInspectionIds = new List(OriginalPlannedInspectionIds); + foreach (int plannedInspectionId in OriginalPlannedInspectionIds) + { + PlannedInspection plannedInspection = await _inspectionService.GetPlannedInspection(plannedInspectionId); + try + { + await _inspectionService.RemoveInspection(plannedInspection.Id, "Niet meer nodig"); + keptPlannedInspectionIds.Remove(plannedInspectionId); + + if (PlannedInspections.Any(pi => pi.Id == plannedInspectionId)) + PlannedInspections.Remove(PlannedInspections.First(pi => pi.Id == plannedInspectionId)); + } + catch (QuestionHasAnswersException) + { + OpenValidationPopup( + $"De inspectie voor {plannedInspection.Employee.Name} kon niet worden verwijderd omdat er een vraag met antwoorden in zit."); + } + catch (InvalidDataException) + { + OpenValidationPopup( + $"De inspectie voor {plannedInspection.Employee.Name} kon niet worden verwijderd omdat de ingevulde gegevens niet voldoen."); + } + } + + OriginalPlannedInspectionIds = keptPlannedInspectionIds; + RaisePropertyChanged(nameof(PlannedInspections)); + + if (!PopupIsOpen) + _navigationService.NavigateTo("FestivalInfo", _festival.Id); + } private async void Save() { try { - await _inspectionService.ProcessPlannedInspections(PlannedInspections); + await _inspectionService.ProcessPlannedInspections(PlannedInspections, SelectedQuestionnaire, Instructions); foreach (int originalPlannedInspectionId in OriginalPlannedInspectionIds) { @@ -275,7 +314,7 @@ private async void Save() } catch (Exception e) { - OpenValidationPopup($"Er is een fout opgetreden bij het opslaan van de klant ({e.GetType()})"); + OpenValidationPopup($"Er is een fout opgetreden bij het opslaan van de inspectie ({e.GetType()})"); } } } diff --git a/src/UserInterface/ViewModels/MainViewModel.cs b/src/UserInterface/ViewModels/MainViewModel.cs index 5f03b55..d6a0751 100644 --- a/src/UserInterface/ViewModels/MainViewModel.cs +++ b/src/UserInterface/ViewModels/MainViewModel.cs @@ -2,7 +2,6 @@ using System.Windows.Controls; using System.Windows.Input; using Festispec.DomainServices.Interfaces; -using Festispec.DomainServices.Services; using Festispec.Models; using Festispec.Models.Exception; using Festispec.UI.Interfaces; diff --git a/src/UserInterface/ViewModels/MapViewModel.cs b/src/UserInterface/ViewModels/MapViewModel.cs index 163a5ce..6f0203c 100644 --- a/src/UserInterface/ViewModels/MapViewModel.cs +++ b/src/UserInterface/ViewModels/MapViewModel.cs @@ -20,7 +20,7 @@ public class MapViewModel : ViewModelBase private readonly IFestivalService _festivalService; private readonly IFrameNavigationService _navigationService; - private readonly List CachePoints = new List(); + private readonly List _cachePoints = new List(); public MapViewModel( IFrameNavigationService navigationService, @@ -67,10 +67,10 @@ private void LoadPoints() private void LoadCustomers() { - List customers = _customerService.GetAllCustomers(); + var customers = _customerService.GetAllCustomers(); - foreach (Customer customer in customers) - CachePoints.Add(new PointItem + foreach (var customer in customers) + _cachePoints.Add(new PointItem { Name = customer.CustomerName, Location = new Location(customer.Address.Latitude, customer.Address.Longitude), @@ -83,10 +83,10 @@ private void LoadCustomers() private void LoadFestivals() { - ICollection festivals = _festivalService.GetFestivals(); + var festivals = _festivalService.GetFestivals(); - foreach (Festival festival in festivals) - CachePoints.Add(new PointItem + foreach (var festival in festivals) + _cachePoints.Add(new PointItem { Name = festival.FestivalName, Location = new Location(festival.Address.Latitude, festival.Address.Longitude), @@ -99,10 +99,10 @@ private void LoadFestivals() private void LoadEmployees() { - List employees = _employeeService.GetAllEmployees(); + var employees = _employeeService.GetAllEmployees(); - foreach (Employee employee in employees) - CachePoints.Add(new PointItem + foreach (var employee in employees) + _cachePoints.Add(new PointItem { Name = employee.Name.ToString(), Location = new Location(employee.Address.Latitude, employee.Address.Longitude), @@ -123,7 +123,7 @@ private void FilterPoints() { Points.Clear(); // Check which items are checked and add them to the points list. - foreach (PointItem point in CachePoints) + foreach (var point in _cachePoints) switch (point.DestinationView) { case "CustomerInfo": diff --git a/src/UserInterface/ViewModels/QuestionnaireViewModel.cs b/src/UserInterface/ViewModels/QuestionnaireViewModel.cs index bc22350..7f357f0 100644 --- a/src/UserInterface/ViewModels/QuestionnaireViewModel.cs +++ b/src/UserInterface/ViewModels/QuestionnaireViewModel.cs @@ -20,7 +20,7 @@ namespace Festispec.UI.ViewModels { - internal class QuestionnaireViewModel : BaseValidationViewModel, IActivateable + internal class QuestionnaireViewModel : BaseDeleteCheckViewModel { private readonly IFestivalService _festivalService; private readonly IFrameNavigationService _navigationService; @@ -33,9 +33,7 @@ internal class QuestionnaireViewModel : BaseValidationViewModel, IActivateable(); RemovedQuestions = new ObservableCollection(); - + OpenDeleteCheckCommand = new RelayCommand(DeleteCommandCheck,_ => offlineService.IsOnline, true); AddQuestionCommand = new RelayCommand(AddQuestion, () => SelectedItem != null, true); - DeleteQuestionCommand = new RelayCommand(DeleteQuestion, _ => offlineService.IsOnline, true); + // DeleteQuestionCommand = new RelayCommand(DeleteQuestion, _ => offlineService.IsOnline, true); + DeleteCommand = new RelayCommand(DeleteQuestion,() => offlineService.IsOnline, true); DeleteQuestionnaireCommand = new RelayCommand(DeleteQuestionnaire, () => offlineService.IsOnline, true); SaveQuestionnaireCommand = new RelayCommand(SaveQuestionnaire, () => offlineService.IsOnline, true); OpenFileWindowCommand = new RelayCommand(OpenFileWindow, HasAnswers); @@ -67,9 +66,10 @@ public QuestionnaireViewModel(IQuestionnaireService questionnaireService, Questi QuestionList.Filter = Filter; } + private Questionnaire Questionnaire { get; set; } public RelayCommand AddQuestionCommand { get; set; } - public ICommand DeleteQuestionCommand { get; set; } + public ICommand OpenDeleteCheckCommand { get; set; } public ICommand DeleteQuestionnaireCommand { get; set; } public ICommand SaveQuestionnaireCommand { get; set; } public ICommand OpenFileWindowCommand { get; set; } @@ -87,6 +87,8 @@ public string SelectedItem set { _selectedItem = value; AddQuestionCommand.RaiseCanExecuteChanged(); } } + private Question SelectedQuestion { get; set; } + public CollectionView QuestionList { get; } @@ -115,7 +117,7 @@ public bool IsOpen } } - public void Initialize(int input) + private void Initialize(int input) { Questionnaire = _questionnaireService.GetQuestionnaire(input); Questions = new ObservableCollection(Questionnaire.Questions); @@ -139,59 +141,65 @@ private List _allQuestions() return Questionnaire.Festival.Questionnaires.SelectMany(item => item.Questions).ToList(); } - private void DeleteQuestionnaire() + private async void DeleteQuestionnaire() { - _navigationService.NavigateTo("FestivalInfo", Questionnaire.Festival.Id); - _questionnaireService.RemoveQuestionnaire(Questionnaire.Id); + var festivalId = Questionnaire.Festival.Id; + await _questionnaireService.RemoveQuestionnaire(Questionnaire.Id); + _navigationService.NavigateTo("FestivalInfo", festivalId); } + private void DeleteCommandCheck(Question question) + { + SelectedQuestion = question; + OpenDeletePopup(); + } private void AddQuestion() { - Question tempQuestion = _questionFactory.GetQuestionType(SelectedItem); + var tempQuestion = _questionFactory.GetQuestionType(SelectedItem); AddedQuestions.Add(tempQuestion); Questions.Add(tempQuestion); } - public void DeleteQuestion(Question item) + private void DeleteQuestion() { - if (AddedQuestions.Contains(item)) - AddedQuestions.Remove(item); + if (AddedQuestions.Contains(SelectedQuestion)) + AddedQuestions.Remove(SelectedQuestion); else - RemovedQuestions.Add(item); - Questions.Remove(item); + RemovedQuestions.Add(SelectedQuestion); + Questions.Remove(SelectedQuestion); } - public async void SaveQuestionnaire() + private async void SaveQuestionnaire() { var multipleChoiceQuestions = new List(); multipleChoiceQuestions.AddRange(AddedQuestions.OfType()); multipleChoiceQuestions.AddRange(Questions.OfType()); - foreach (MultipleChoiceQuestion q in multipleChoiceQuestions) + foreach (var q in multipleChoiceQuestions) q.ObjectsToString(); - foreach (Question q in AddedQuestions) + foreach (var q in AddedQuestions) try { await _questionnaireService.AddQuestion(Questionnaire.Id, q); } catch (Exception) { - ValidationError = $"Er is iets niet goedgegaan tijdens het toevoegen van de vraag(en)"; + ValidationError = "Er is iets niet goedgegaan tijdens het toevoegen van de vraag(en)"; PopupIsOpen = true; } AddedQuestions.Clear(); - foreach (Question q in RemovedQuestions) + foreach (var q in RemovedQuestions) try { await _questionnaireService.RemoveQuestion(q.Id); } catch (Exception) { - ValidationError = $"Er is iets niet goedgegaan tijdens het verwijderen van de vraag(en)"; + ValidationError = "Er is iets niet goedgegaan tijdens het verwijderen van de vraag(en)"; PopupIsOpen = true; } @@ -199,35 +207,29 @@ public async void SaveQuestionnaire() _navigationService.NavigateTo("FestivalInfo", Questionnaire.Festival.Id); } - public bool HasAnswers(Question question) + private bool HasAnswers(Question question) { return question.Answers.Count == 0 && _offlineService.IsOnline; } - public async void OpenFileWindow(Question question) + private async void OpenFileWindow(Question question) { - OpenFileDialog fileDialog = new OpenFileDialog(); + var fileDialog = new OpenFileDialog(); var dialog = fileDialog.ShowDialog(); // Check if a file has been selected. - if (dialog != null && dialog == true) - { - using (var stream = fileDialog.OpenFile()) - { - - var url = $"{_config["Urls:WebApp"]}/Upload/UploadFile"; - var response = await UploadImage(url, stream, fileDialog.SafeFileName); - var path = await response.Content.ReadAsStringAsync(); - - var drawQuestion = AddedQuestions.Where(q => q.Equals(question)).FirstOrDefault() as DrawQuestion; - drawQuestion.PicturePath = path; - MessageBox.Show("Het bestand is geupload."); - } - } + if (dialog == null || dialog != true) return; + await using var stream = fileDialog.OpenFile(); + var url = $"{_config["Urls:WebApp"]}/Upload/UploadFile"; + var response = await UploadImage(url, stream, fileDialog.SafeFileName); + var path = await response.Content.ReadAsStringAsync(); + + if (AddedQuestions.FirstOrDefault(q => q.Equals(question)) is DrawQuestion drawQuestion) drawQuestion.PicturePath = path; + MessageBox.Show("Het bestand is geupload."); } - public void AddOption(Question question) + private static void AddOption(Question question) { var option = (MultipleChoiceQuestion) question; @@ -239,9 +241,9 @@ private bool Filter(object item) return Search <= 0 || ((Question) item).Questionnaire.Id == Search; } - private async Task UploadImage(string url, Stream image, string fileName) + private static async Task UploadImage(string url, Stream image, string fileName) { - using (MemoryStream str = new MemoryStream()) + await using (var str = new MemoryStream()) using (var client = new HttpClient()) { diff --git a/src/UserInterface/ViewModels/RapportPreviewViewModel.cs b/src/UserInterface/ViewModels/RapportPreviewViewModel.cs index 9e2a525..65f7946 100644 --- a/src/UserInterface/ViewModels/RapportPreviewViewModel.cs +++ b/src/UserInterface/ViewModels/RapportPreviewViewModel.cs @@ -28,6 +28,7 @@ public class RapportPreviewViewModel : BaseValidationViewModel private readonly GraphSelectorFactory _graphFactory; private readonly IFrameNavigationService _navigationService; private readonly IConfiguration _config; + private readonly IEmployeeService _employeeService; private string _pdfHtml; private readonly Dictionary _imageSources = new Dictionary(); @@ -37,55 +38,81 @@ public RapportPreviewViewModel( IQuestionnaireService questionnaireService, IFestivalService festivalService, IConfiguration config, - GraphSelectorFactory graphSelector + GraphSelectorFactory graphSelector, + IEmployeeService employeeService ) { _questionnaireService = questionnaireService; _navigationService = navigationService; _graphFactory = graphSelector; _config = config; + _employeeService = employeeService; + SelectedFestival = festivalService.GetFestival((int)navigationService.Parameter); GeneratePdfCommand = new RelayCommand(SavePdf); - BackCommand = new RelayCommand(() => navigationService.NavigateTo("FestivalInfo", SelectedFestival.Id)); - - SelectedFestival = festivalService.GetFestival((int)navigationService.Parameter); + BackCommand = new RelayCommand(Back); GenerateReport(); - } public ObservableCollection Controls { get; set; } public Festival SelectedFestival { get; set; } - - + public ICommand GeneratePdfCommand { get; set; } public ICommand BackCommand { get; set; } - - + private void CreateReport() { // this has been done deliberately. _pdfHtml = ""; - _pdfHtml += $"

Rapport {SelectedFestival.FestivalName}

"; + + LoadStyles(); + + _pdfHtml += $""; + _pdfHtml += $"

Festispec rapportage {SelectedFestival.FestivalName}

"; + + CustomerDetails(); + + _pdfHtml += "

Datum

"; + _pdfHtml += $"

{DateTime.Today.ToShortDateString()}

"; } - private void GenerateReport() + private void LoadStyles() { + _pdfHtml += ""; + + _pdfHtml += ""; + } + + private void CustomerDetails() { - if(SelectedFestival.Questionnaires.Count == 0) - { - _navigationService.NavigateTo("FestivalInfo", SelectedFestival.Id); - return; - } + _pdfHtml += "

Klantgegevens

"; + _pdfHtml += $"

Naam: {SelectedFestival.Customer.CustomerName}

"; + _pdfHtml += $"

Adres: {SelectedFestival.Address}

"; + _pdfHtml += $"

KvK: {SelectedFestival.Customer.KvkNr}

"; + } + private void GenerateReport() + { + Questionnaire questionnaire = SelectedFestival.Questionnaires.FirstOrDefault(); - int questionnaireId = SelectedFestival.Questionnaires.FirstOrDefault().Id; - List questions = _questionnaireService.GetQuestionsFromQuestionnaire(questionnaireId); + List questions = _questionnaireService.GetQuestionsFromQuestionnaire(questionnaire.Id); Controls = new ObservableCollection(); CreateReport(); - Controls.Add(CreateLabel("Beschrijving")); + Controls.Add(CreateLabel("Beschrijving / Introductie")); + Controls.Add(new TextBox + { + Height = 150, + Width = 700, + Margin = new Thickness(10), + AcceptsReturn = true, + AcceptsTab = true, + TextWrapping = TextWrapping.Wrap + }); + + Controls.Add(CreateLabel("Advies")); Controls.Add(new TextBox { Height = 150, @@ -96,6 +123,8 @@ private void GenerateReport() TextWrapping = TextWrapping.Wrap }); + Controls.Add(CreateLabel("Vragen")); + foreach (Question question in questions) AddQuestionToReport(question); } @@ -124,7 +153,7 @@ private void AddQuestionToReport(Question question) if (chartValues.Count < 1) return; - var lineControl = question.GraphType switch + Control lineControl = question.GraphType switch { GraphType.Line => new LineChartControl(chartValues), GraphType.Pie => new PieChartControl(chartValues), @@ -152,7 +181,11 @@ private void SavePdf() { foreach (FrameworkElement chart in Controls) AddControlToPdf(chart); - + + int questionnaireId = SelectedFestival.Questionnaires.FirstOrDefault().Id; + List questions = _questionnaireService.GetQuestionsFromQuestionnaire(questionnaireId); + GenerateReadout(questions); + var renderer = new HtmlToPdf(); string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string renderPath = Path.Combine(path, $"Rapport {SelectedFestival.FestivalName}.pdf"); @@ -168,7 +201,6 @@ private void SavePdf() } } - private void AddAnswers(IEnumerable answers) { foreach (Answer answer in answers) @@ -177,19 +209,32 @@ private void AddAnswers(IEnumerable answers) case FileAnswer fileAnswer: { DateTime date = fileAnswer.CreatedAt; - Label label = CreateLabel(date.ToString()); + Label label = CreateLabel($"Inspecteur: {GetEmployee(answer).Name} / {date.ToString()}"); Image image = CreateImage(fileAnswer); + var textBox = new TextBox + { + Height = 150, + Width = 700, + Margin = new Thickness(10), + AcceptsReturn = true, + AcceptsTab = true, + TextWrapping = TextWrapping.Wrap, + Text = fileAnswer.AnswerContents, + IsEnabled = false + }; + if (image != null) { Controls.Add(label); Controls.Add(image); - } + Controls.Add(textBox); + } break; } case StringAnswer stringAnswer: - Controls.Add(CreateTextboxFromStringAnswer(stringAnswer)); + Controls.Add(CreateTextBoxFromStringAnswer(stringAnswer)); break; } } @@ -201,12 +246,27 @@ private Image CreateImage(FileAnswer answer) if (answer.UploadedFilePath == null) return null; - var baseUri = new Uri(_config["Urls:WebApp"]); - var source = new BitmapImage(new Uri(baseUri, answer.UploadedFilePath)); - - image.Source = source; - _imageSources.Add(image, source.UriSource.ToString()); - return image; + + try + { + var baseUri = new Uri(_config["Urls:WebApp"]); + var source = new BitmapImage(new Uri(baseUri, answer.UploadedFilePath)); + + image.Source = source; + _imageSources.Add(image, source.UriSource.ToString()); + return image; + } + + catch (Exception) + { + OpenValidationPopup("Afbeelding is niet gevonden, vraag aan de administrator voor hulp."); + return null; + } + } + + private Employee GetEmployee(Answer answer) + { + return _employeeService.GetEmployee(answer.PlannedInspection.Employee.Id); } private void AddControlToPdf(FrameworkElement control) @@ -252,7 +312,7 @@ private static Label CreateLabel(string text) }; } - private static TextBox CreateTextboxFromStringAnswer(StringAnswer answer) + private static TextBox CreateTextBoxFromStringAnswer(StringAnswer answer) { return new TextBox { @@ -262,8 +322,41 @@ private static TextBox CreateTextboxFromStringAnswer(StringAnswer answer) AcceptsReturn = true, AcceptsTab = true, TextWrapping = TextWrapping.Wrap, - Text = answer.AnswerContents.Replace("\n", "
") + Text = answer.AnswerContents.Replace("\n", "
"), + IsEnabled = false }; } + + private void GenerateReadout(IEnumerable questions) + { + _pdfHtml += "
"; + _pdfHtml += "

Bijlage

"; + _pdfHtml += "

Ruwe data

"; + foreach(Question question in questions) + { + _pdfHtml += $"

{question.Contents}

"; + ReadoutAnswers(question.Answers.ToList()); + } + } + + private void ReadoutAnswers(IEnumerable answers) + { + foreach(Answer answer in answers) + { + _pdfHtml += answer switch + { + FileAnswer fileAnswer => $"

{GetEmployee(fileAnswer).Name}: {fileAnswer.UploadedFilePath}", + StringAnswer stringAnswer => $"

{GetEmployee(stringAnswer).Name}: {stringAnswer.AnswerContents}

", + NumericAnswer numericAnswer => $"

{GetEmployee(numericAnswer).Name}: {numericAnswer.IntAnswer}

", + MultipleChoiceAnswer multiplechoiceAnswer => $"

{GetEmployee(multiplechoiceAnswer).Name}: {((MultipleChoiceQuestion)multiplechoiceAnswer.Question).OptionCollection[multiplechoiceAnswer.MultipleChoiceAnswerKey].Value}

", + _ => "" + }; + } + } + + private void Back() + { + _navigationService.NavigateTo("FestivalInfo", SelectedFestival.Id); + } } -} \ No newline at end of file +} diff --git a/src/UserInterface/Views/Controls/LineChartControl.xaml.cs b/src/UserInterface/Views/Controls/LineChartControl.xaml.cs index e5bf84a..fe0545a 100644 --- a/src/UserInterface/Views/Controls/LineChartControl.xaml.cs +++ b/src/UserInterface/Views/Controls/LineChartControl.xaml.cs @@ -2,7 +2,6 @@ using Festispec.Models; using LiveCharts; using LiveCharts.Wpf; -using Separator = LiveCharts.Wpf.Separator; namespace Festispec.UI.Views.Controls { diff --git a/src/UserInterface/Views/Controls/PieChartControl.xaml.cs b/src/UserInterface/Views/Controls/PieChartControl.xaml.cs index 7db568a..0c38f95 100644 --- a/src/UserInterface/Views/Controls/PieChartControl.xaml.cs +++ b/src/UserInterface/Views/Controls/PieChartControl.xaml.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using Festispec.Models; using LiveCharts; @@ -15,7 +14,7 @@ public PieChartControl(List values) SeriesCollection = new SeriesCollection(); - foreach (GraphableSeries graphableSeries in values) + foreach (var graphableSeries in values) SeriesCollection.Add( new PieSeries { @@ -30,17 +29,18 @@ public PieChartControl(List values) public SeriesCollection SeriesCollection { get; set; } - public Func PointLabel { get; set; } - - private void Chart_OnDataClick(object sender, ChartPoint chartpoint) + private void Chart_OnDataClick(object sender, ChartPoint chartPoint) { - var chart = (PieChart) chartpoint.ChartView; + var chart = (PieChart) chartPoint.ChartView; //clear selected slice. - foreach (PieSeries series in chart.Series) + foreach (var seriesView in chart.Series) + { + var series = (PieSeries) seriesView; series.PushOut = 0; + } - var selectedSeries = (PieSeries) chartpoint.SeriesView; + var selectedSeries = (PieSeries) chartPoint.SeriesView; selectedSeries.PushOut = 8; } } diff --git a/src/UserInterface/Views/Customer/CreateCustomerPage.xaml b/src/UserInterface/Views/Customer/CreateCustomerPage.xaml index 3ca47ae..9567c07 100644 --- a/src/UserInterface/Views/Customer/CreateCustomerPage.xaml +++ b/src/UserInterface/Views/Customer/CreateCustomerPage.xaml @@ -104,6 +104,10 @@