Пример #1
0
 public override void LoadDefaults()
 {
     Reports.Clear();
     Secretaries.Clear();
     HandledViewReportsCount = 0;
     IsLoaded = true;
 }
Пример #2
0
        public override void LoadSave(object obj)
        {
            SecretaryServiceSave save = obj as SecretaryServiceSave;

            if (save != null)
            {
                if (save.reports == null)
                {
                    save.reports = new List <ReportInfoSave>();
                }
                if (save.secretaries == null)
                {
                    save.secretaries = new List <SecretaryInfoSave>();
                }

                Reports.Clear();
                save.reports.ForEach(reportSave => Reports.Add(reportSave.managerId, new ReportInfo(reportSave)));
                Secretaries.Clear();
                save.secretaries.ForEach(secSave => Secretaries.Add(secSave.generatorId, new SecretaryInfo(secSave)));
                HandledViewReportsCount = save.handledViewReportsCount;
                IsLoaded = true;
            }
            else
            {
                LoadDefaults();
            }
        }
Пример #3
0
 public SecretaryInfo GetSecretaryInfo(int generatorId)
 {
     if (!Secretaries.ContainsKey(generatorId))
     {
         Secretaries.Add(generatorId, new SecretaryInfo(generatorId));
     }
     return(Secretaries[generatorId]);
 }
Пример #4
0
 public void Load(string file)
 {
     if (!IsLoaded)
     {
         Secretaries.Clear();
         var listItems = JsonConvert.DeserializeObject <List <SecretaryJsonData> >(Resources.Load <TextAsset>(file).text);
         listItems.ForEach(item => Secretaries.Add(item.planetId, new SecretaryData(item)));
         IsLoaded = true;
     }
 }
Пример #5
0
 public EnhancementInfo CopyOfWeekDay(int weekday) => new EnhancementInfo
 {
     EquipId     = EquipId,
     Secretaries = Secretaries.Where(x => (x.WeekDays & (1 << weekday)) != 0).ToList(),
     Ranges      = Ranges,
     CostItem1   = CostItem1,
     CostItem2   = CostItem2,
     CostItem3   = CostItem3,
     CostItem4   = CostItem4
 };
Пример #6
0
 public void Initialize()
 {
     Persons   = SqlPerson.GetAllPersons();
     Companies = SqlCompany.GetAllCompanies();
     Companies.ForEach((c) => c.InitState = InitializationState.INITIALIZATION_NEEDED);
     Chanceries = SqlChancery.GetAllChanceries();
     Chanceries.ForEach((c) => c.InitState = InitializationState.INITIALIZATION_NEEDED);
     Directors = SqlDirector.GetAllDirectors();
     Directors.ForEach((d) => d.InitState = InitializationState.INITIALIZATION_NEEDED);
     Secretaries = SqlSecretary.GetAllSecretaries();
     Secretaries.ForEach((s) => s.InitState = InitializationState.INITIALIZATION_NEEDED);
     MainSecretaries = SqlMainSecretary.GetAllMainSecretaries();
     MainSecretaries.ForEach((ms) => ms.InitState = InitializationState.INITIALIZATION_NEEDED);
     Documents = SqlDocument.GetAllDocuments();
     Documents.ForEach((d) => d.InitState = InitializationState.INITIALIZATION_NEEDED);
     CompanyTypes  = SqlCompanyType.GetAllCompanyTypes();
     DocumentTypes = SqlDocumentType.GetAllDocumentTypes();
     Markers       = SqlMarker.GetAllMarkers();
 }
Пример #7
0
        public void Initialize(Person connectedPerson)
        {
            ConnectedPerson = connectedPerson;
            SchoolEntities schoolData = new SchoolEntities();

            // School basic information
            var schoolInfo = schoolData.SchoolInfo;

            // Get the principal information
            var principal = schoolData.Persons.FirstOrDefault(person => person.isPrincipal && !person.User.isDisabled);

            if (principal != null)
            {
                PrincipalName  = principal.firstName + " " + principal.lastName;
                PrincipalEmail = principal.email;
            }

            // Get the secretaries information
            Secretaries.Clear();
            schoolData.Persons.Where(person => person.isSecretary && !person.User.isDisabled).ToList()
            .ForEach(person => Secretaries.Add(new SecretaryInfo()
            {
                Name = person.firstName + " " + person.lastName, Phone = person.phoneNumber
            }));

            // Get the teachers information
            Teachers.Clear();
            schoolData.Persons.Where(person => person.isTeacher && !person.User.isDisabled).ToList()
            .ForEach(person => Teachers.Add(new TeacherInfo()
            {
                Name         = person.firstName + " " + person.lastName,
                CoursesNames = GetTeacherCourseNames(person.Teacher),
                Email        = person.email,
                Phone        = person.phoneNumber
            }));
        }
Пример #8
0
 public void SetFromExternalDataSource(IEnumerable <SecretaryData> secretaries)
 {
     Secretaries.Clear();
     secretaries.ToList().ForEach(item => Secretaries.Add(item.PlanetId, item));
     IsLoaded = true;
 }
Пример #9
0
 public SecretaryData GetSecretaryData(PlanetId planetId)
 => Secretaries.ContainsKey(planetId.Id) ? Secretaries[planetId.Id] : null;
        private void SeedEmployees(IMongoCollection <Employee> collection)
        {
            int numberOfSous = 20;

            string[] namesSosus = new string[] { "Sofie Jensen", "Søren Larsen", "Sarah Hansen", "Susanne Himmelblå", "Simon Bjermand Kjær", "Simon Schou Jensen", "Selma Jakobsen", "Susan Kristensen", "Stine Olsen", "Sandra Toft", "Silke Rasmusen", "Siff Andersen", "Sophie Loft", "Sol-Solvej Solskin", "Simone Kjær", "Sabrina Møller Andersen", "Sara Christensen", "Sascha Madsen", "Sidsel Lund Sørensen", "Sten Steensen" };

            List <Sosu> sosus = new List <Sosu>();

            for (int i = 1; i < numberOfSous + 1; i++)
            {
                Sosu s = new Sosu(namesSosus[i - 1]);
                s.EmployeeNumber = i;
                sosus.Add(s);
            }

            collection.InsertMany(sosus);

            int numberOfDoctors = 5;

            string[] namesDoctor = new string[5] {
                "Danny Boy", "Dirk Passer", "David Davidson", "Diana Jensen", "Daniel Danielsen"
            };

            List <Doctors> doctors = new List <Doctors>();

            for (int i = numberOfSous + 1; i < numberOfSous + numberOfDoctors + 1; i++)
            {
                Doctors d = new Doctors(namesDoctor[i - numberOfSous - 1]);
                d.EmployeeNumber = i;
                doctors.Add(d);
            }

            collection.InsertMany(doctors);

            int numberOfNurses = 20;

            string[] namesNurses = new string[20] {
                "Niels Nielsen", "Nikolaj Nikolajsen", "Niklas Landin", "Natasha Romanoff", "Natalia Alianovna Romanova", "Nicki Sørensen", "Niller Nielsen", "Noah Overbyen", "Nik Petersen", "Nora Andersen", "Nadai Jensen", "Nikita Mortensen Bækgaard", "Nanna Louise Johansen", "Nelly Winston", "Naja Madsen", "Neville Longbottom", "Norbit Albertrise", "No Name", "Nairobi Kenya", "Norge Nordmand"
            };

            List <Nurses> nurses = new List <Nurses>();

            for (int i = numberOfSous + numberOfDoctors + 1; i < numberOfSous + numberOfDoctors + numberOfNurses + 1; i++)
            {
                Nurses n = new Nurses(namesNurses[i - numberOfSous - numberOfDoctors - 1]);
                n.EmployeeNumber = i;
                nurses.Add(n);
            }

            collection.InsertMany(nurses);


            int numberOfMidwifes = 10;

            string[] namesMidwifes = new string[10] {
                "Malfoy Draco", "Mille Madsen", "Mads Madsen", "Marie Toft", "Malene Sørensen", "Morten Mortensen", "Martin Frederiksen", "Marcus Nielsen", "Maja Mikkelsen", "Maria Loft Nielsen"
            };

            List <Midwifes> midwifes = new List <Midwifes>();

            for (int i = numberOfSous + numberOfDoctors + numberOfNurses + 1; i < numberOfSous + numberOfDoctors + numberOfNurses + numberOfMidwifes + 1; i++)
            {
                Midwifes m = new Midwifes(namesMidwifes[i - numberOfSous - numberOfDoctors - numberOfNurses - 1]);
                m.EmployeeNumber = i;
                midwifes.Add(m);
            }

            collection.InsertMany(midwifes);


            int numberOfSecretaries = 4;

            string[] namesSecretaries = new string[4] {
                "Simba Kongesøn", "Signe Mikkelsen", "Sune Orlater", "Søren Krag"
            };

            List <Secretaries> secretaries = new List <Secretaries>();

            for (int i = numberOfSous + numberOfDoctors + numberOfNurses + numberOfMidwifes + 1; i < numberOfSous + numberOfDoctors + numberOfNurses + numberOfMidwifes + numberOfSecretaries + 1; i++)
            {
                Secretaries ss = new Secretaries(namesSecretaries[i - numberOfSous - numberOfDoctors - numberOfNurses - numberOfMidwifes - 1]);
                ss.EmployeeNumber = i;
                secretaries.Add(ss);
            }

            collection.InsertMany(secretaries);
        }
        private void SeedData(ModelBuilder mb)
        {
            int numberOfSous = 20;

            string[] namesSosus = new string[] { "Sofie Jensen", "Søren Larsen", "Sarah Hansen", "Susanne Himmelblå", "Simon Bjermand Kjær", "Simon Schou Jensen", "Selma Jakobsen", "Susan Kristensen", "Stine Olsen", "Sandra Toft", "Silke Rasmusen", "Siff Andersen", "Sophie Loft", "Sol-Solvej Solskin", "Simone Kjær", "Sabrina Møller Andersen", "Sara Christensen", "Sascha Madsen", "Sidsel Lund Sørensen", "Sten Steensen" };

            List <Sosu> sosus = new List <Sosu>();

            for (int i = 1; i < numberOfSous + 1; i++)
            {
                Sosu s = new Sosu(namesSosus[i - 1]);
                s.EmployeeId = i;
                sosus.Add(s);
            }

            mb.Entity <Sosu>().HasData(sosus);


            int numberOfDoctors = 5;

            string[] namesDoctor = new string[5] {
                "Danny Boy", "Dirk Passer", "David Davidson", "Diana Jensen", "Daniel Danielsen"
            };

            List <Doctors> doctors = new List <Doctors>();

            for (int i = numberOfSous + 1; i < numberOfSous + numberOfDoctors + 1; i++)
            {
                Doctors d = new Doctors(namesDoctor[i - numberOfSous - 1]);
                d.EmployeeId = i;
                doctors.Add(d);
            }

            mb.Entity <Sosu>().HasData(doctors);


            int numberOfNurses = 20;

            string[] namesNurses = new string[20] {
                "Niels Nielsen", "Nikolaj Nikolajsen", "Niklas Landin", "Natasha Romanoff", "Natalia Alianovna Romanova", "Nicki Sørensen", "Niller Nielsen", "Noah Overbyen", "Nik Petersen", "Nora Andersen", "Nadai Jensen", "Nikita Mortensen Bækgaard", "Nanna Louise Johansen", "Nelly Winston", "Naja Madsen", "Neville Longbottom", "Norbit Albertrise", "No Name", "Nairobi Kenya", "Norge Nordmand"
            };

            List <Nurses> nurses = new List <Nurses>();

            for (int i = numberOfSous + numberOfDoctors + 1; i < numberOfSous + numberOfDoctors + numberOfNurses + 1; i++)
            {
                Nurses n = new Nurses(namesNurses[i - numberOfSous - numberOfDoctors - 1]);
                n.EmployeeId = i;
                nurses.Add(n);
            }

            mb.Entity <Nurses>().HasData(nurses);


            int numberOfMidwifes = 10;

            string[] namesMidwifes = new string[10] {
                "Malfoy Draco", "Mille Madsen", "Mads Madsen", "Marie Toft", "Malene Sørensen", "Morten Mortensen", "Martin Frederiksen", "Marcus Nielsen", "Maja Mikkelsen", "Maria Loft Nielsen"
            };

            List <Midwifes> midwifes = new List <Midwifes>();

            for (int i = numberOfSous + numberOfDoctors + numberOfNurses + 1; i < numberOfSous + numberOfDoctors + numberOfNurses + numberOfMidwifes + 1; i++)
            {
                Midwifes m = new Midwifes(namesMidwifes[i - numberOfSous - numberOfDoctors - numberOfNurses - 1]);
                m.EmployeeId = i;
                midwifes.Add(m);
            }

            mb.Entity <Midwifes>().HasData(midwifes);


            int numberOfSecretaries = 4;

            string[] namesSecretaries = new string[4] {
                "Simba Kongesøn", "Signe Mikkelsen", "Sune Orlater", "Søren Krag"
            };

            List <Secretaries> secretaries = new List <Secretaries>();

            for (int i = numberOfSous + numberOfDoctors + numberOfNurses + numberOfMidwifes + 1; i < numberOfSous + numberOfDoctors + numberOfNurses + numberOfMidwifes + numberOfSecretaries + 1; i++)
            {
                Secretaries ss = new Secretaries(namesSecretaries[i - numberOfSous - numberOfDoctors - numberOfNurses - numberOfMidwifes - 1]);
                ss.EmployeeId = i;
                secretaries.Add(ss);
            }

            mb.Entity <Secretaries>().HasData(secretaries);

            List <MaternityRoom> maternityRooms = new List <MaternityRoom>();

            for (int i = 1; i < 23; i++)
            {
                MaternityRoom maternityRoom = new MaternityRoom();
                maternityRoom.RoomNumber = i;
                maternityRooms.Add(maternityRoom);
            }
            mb.Entity <MaternityRoom>().HasData(maternityRooms);

            List <RestRoom4Hours> restRoom4Hours = new List <RestRoom4Hours>();

            for (int i = 23; i < 28; i++)
            {
                RestRoom4Hours restRoom4Hour = new RestRoom4Hours();
                restRoom4Hour.RoomNumber = i;
                restRoom4Hours.Add(restRoom4Hour);
            }
            mb.Entity <RestRoom4Hours>().HasData(restRoom4Hours);

            List <BirthRoom> birthRooms = new List <BirthRoom>();

            for (int i = 28; i < 43; i++)
            {
                BirthRoom birthRoom = new BirthRoom();
                birthRoom.RoomNumber = i;
                birthRooms.Add(birthRoom);
            }
            mb.Entity <BirthRoom>().HasData(birthRooms);

            List <Reservation> reservations = new List <Reservation>();

            for (int i = 1; i < 43; i++)
            {
                Reservation reservation = new Reservation();
                reservation.ReservationId = i;
                reservation.RoomId        = i;
                reservations.Add(reservation);
            }

            mb.Entity <Reservation>().HasData(reservations);
        }