public override void LoadDefaults() { Reports.Clear(); Secretaries.Clear(); HandledViewReportsCount = 0; IsLoaded = true; }
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(); } }
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; } }
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 })); }
public void SetFromExternalDataSource(IEnumerable <SecretaryData> secretaries) { Secretaries.Clear(); secretaries.ToList().ForEach(item => Secretaries.Add(item.PlanetId, item)); IsLoaded = true; }