private void GenerateArchitects(int amount, DateTime insertData) { for (var i = 0; i < amount; i++) { Architects.Add(new Architect(Architects.Count + 1, insertData, _expirationDate)); } }
private void CreateHierarchy() { var architectsWithoutPrincipal = Architects.FindAll(a => a.PrincipalId == -2).OrderByDescending(a => a.Pesel).ToList(); architectsWithoutPrincipal.ForEach(CalculatePrincipalId); _lastArchitectId = architectsWithoutPrincipal.Last().Id; }
private void CreateUpdateFile(List <Architect> architects) { architects.ForEach(architect => { var id = Architects.FindIndex(a => a.Active == false && a.Pesel == architect.Pesel); _updates.Add($"UPDATE Pracownicy SET Specjalizacja='{architect.Specialization.ToString()}' WHERE ID_PRACOWNIK={id}"); }); WriteUpdates(); }
public void Write(string time) { File.AppendAllLines( $"{Resources.Global_Data_Path}architects_{time}.csv", new List <string>() { Resources.Generator_Architects_Csv_Header }, Encoding.UTF8); var dataModels = Architects.Cast <AbstractDataModel>().ToList(); WriteToCsv(dataModels, $"{Resources.Global_Data_Path}architects_{time}.csv"); WriteToBulk(dataModels, $"{Resources.Global_Data_Path}architects_{time}.bulk"); }
public void EmptyDataBase() { Walls.RemoveRange(Walls); Windows.RemoveRange(Windows); WallBeams.RemoveRange(WallBeams); Doors.RemoveRange(Doors); DecorativeColumns.RemoveRange(DecorativeColumns); Architects.RemoveRange(Architects); Administrators.RemoveRange(Administrators); Clients.RemoveRange(Clients); Designers.RemoveRange(Designers); SaveChanges(); }
private void UpdateCanSupervise(DateTime currentDate) { var amount = _rand.Next(1, 4); var architectsToUpdate = GetArchitectsToUpdate(amount); architectsToUpdate.ForEach(architect => { var updatedArchitect = architect.Copy(); updatedArchitect.CanSupervise = !updatedArchitect.CanSupervise; updatedArchitect.InsertDate = currentDate; updatedArchitect.Id = Architects.Count(); Architects.Add(updatedArchitect); IdMapper.Add(architect.Id, updatedArchitect.Id); DeactivateArchitect(currentDate, architect); }); }
private void UpdateSpecializationOfArchitect(DateTime currentDate, Architect architect, ICollection <Architect> updatedArchitects) { var updatedArchitect = architect.Copy(); updatedArchitect.InsertDate = currentDate; updatedArchitect.Specialization = updatedArchitect.Specialization switch { OBIEKT_BIUROWY => _rand.Next() % 2 == 0 ? OBIEKT_MIESZKALNY : OBIEKT_USLUGOWY, OBIEKT_MIESZKALNY => _rand.Next() % 2 == 0 ? OBIEKT_BIUROWY : OBIEKT_USLUGOWY, OBIEKT_USLUGOWY => _rand.Next() % 2 == 0 ? OBIEKT_MIESZKALNY : OBIEKT_BIUROWY, _ => throw new ArgumentOutOfRangeException() }; updatedArchitect.Id = Architects.Count(); Architects.Add(updatedArchitect); updatedArchitects.Add(updatedArchitect); architect.Active = false; architect.ExpirationDate = currentDate; IdMapper.Add(architect.Id, updatedArchitect.Id); }
private void ShuffleArchitects(ArchitectureTypeEnum type) { AvailableArchitects[type] = Architects.FindAll(a => a.Specialization == type); AvailableArchitects[type] = ShuffleList(AvailableArchitects[type]); var tmp = AvailableArchitects[type].ToList().GroupBy(a => a.Id).ToList(); }
private static ProxyResidente.ResidenteBE GetDataContract(Architects.Dominio.ResidenteBE Entity) { ProxyResidente.ResidenteBE dataContract = new ProxyResidente.ResidenteBE(); dataContract.N_IdResidente = Entity.N_IdResidente; dataContract.C_NumDocume = Entity.C_NumDocume; dataContract.C_Nombre = Entity.C_Nombre; dataContract.C_Apellidos = Entity.C_Apellidos; dataContract.D_FecNacimi = Entity.D_FecNacimi; dataContract.B_Estado = Entity.B_Estado; dataContract.C_Correo = Entity.C_Correo; dataContract.C_Clave = Entity.C_Clave; dataContract.N_TipoDoc = Entity.N_TipoDoc; return dataContract; }