Ejemplo n.º 1
0
 private void GenerateArchitects(int amount, DateTime insertData)
 {
     for (var i = 0; i < amount; i++)
     {
         Architects.Add(new Architect(Architects.Count + 1, insertData, _expirationDate));
     }
 }
Ejemplo n.º 2
0
        private void CreateHierarchy()
        {
            var architectsWithoutPrincipal =
                Architects.FindAll(a => a.PrincipalId == -2).OrderByDescending(a => a.Pesel).ToList();

            architectsWithoutPrincipal.ForEach(CalculatePrincipalId);
            _lastArchitectId = architectsWithoutPrincipal.Last().Id;
        }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
        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");
        }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
        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);
            });
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 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;
 }