Exemplo n.º 1
0
        public void UpdateDepartment(DepartmentModel department)
        {
            int index = Departments.IndexOf(Departments.FirstOrDefault(d => d.Id == department.Id));

            Departments[index] = department.Clone();
            UpdateWorkers();
        }
        public async Task GetDepartmentsAsync()
        {
            OperationInProgress = true;
            Departments         = await DepartmentsProvider.GetDepartmentsAsync();

            SelectedDeparment   = Departments?.FirstOrDefault();
            OperationInProgress = false;
        }
Exemplo n.º 3
0
        private void _depModelService_DepartmentsRemoved(object sender, IDepartmentModelCollectionChangedEventArgs e)
        {
            var findDepartment = Departments.FirstOrDefault(em => em.Id == e.Department.Id);

            if (findDepartment != null)
            {
                Departments.Remove(findDepartment);
            }
        }
Exemplo n.º 4
0
        public DepartmentManagerViewModel()
        {
            base.Name          = "ПОДРАЗДЕЛЕНИЯ";
            base.Icon          = "Departments.png";
            SelectedDepartment = Departments.FirstOrDefault();

            /*Departments.Add(new Department(1, "1", "1", 0));
            *  Departments.Add(new Department(2, "2", "2", 0));
            *  Departments.Add(new Department(3, "3", "3", 0));*/
        }
Exemplo n.º 5
0
    public string GetPatientsInDepartmentRoom(string department, int roomNumber)
    {
        var currentRoom = Departments
                          .FirstOrDefault(d => d.Type == department)
                          .Rooms[roomNumber - 1];

        return(String
               .Join(Environment.NewLine, currentRoom.Patients.Select(p => p.Name)
                     .OrderBy(p => p)));
    }
Exemplo n.º 6
0
        public void SelectDepartment(string departmentName)
        {
            IWebElement departmentToSelect = Departments.FirstOrDefault(item => item.Text.Contains(departmentName));

            if (!departmentToSelect.Enabled)
            {
                ExpandAllDepartments();
            }
            departmentToSelect.Click();
        }
Exemplo n.º 7
0
        private void _emplModelService_EmployeeAdded(object sender, IEmployeeModelCollectionChangedEventArgs e)
        {
            if (OpenedDepartment != null && e.Employee.DepartmentId != OpenedDepartment.Id)
            {
                return;
            }

            Employees.Add(new EmployeeViewModel(e.Employee)
            {
                Department = Departments.FirstOrDefault(dep => dep.Id == e.Employee.DepartmentId)
            });
        }
Exemplo n.º 8
0
        public async Task OnCompanyChangeAsync(ChangeEventArgs args)
        {
            var companyId = (string)args.Value;

            if (companyId == string.Empty)
            {
                Employee.DepartmentId = null;
            }

            Departments = await OrgStructureService.GetDepartmentsByCompanyIdAsync(companyId);

            Employee.DepartmentId = Departments.FirstOrDefault()?.Id;
        }
Exemplo n.º 9
0
        private Department InitDefaultDepartment()
        {
            var config = _sysConfigRepository.Query(new Hashtable()).FirstOrDefault(x => x.Name == ConstStrings.DataSyncDefaultDepartment);

            if (config != null && !string.IsNullOrWhiteSpace(config.Value))
            {
                return(Departments.FirstOrDefault(x => x.DepartmentID == config.Value.ToInt32()));
            }
            else
            {
                return(Departments.First());
            }
        }
Exemplo n.º 10
0
 public string RemovePeople(int id)
 {
     try
     {
         var item = Peoples.FirstOrDefault(i => i.PeopleID == id);
         Departments.FirstOrDefault(i => i.DepartmentID == item.DepartmentID).People.Remove(item);
         Organizations.FirstOrDefault(i => i.OrganizationID == item.OrganizationID).People.Remove(item);
         Positions.FirstOrDefault(i => i.PositionID == item.PositionID).People.Remove(item);
         Peoples.Remove(item);
         SaveChanges();
         return("Запись успешно удалена");
     }
     catch (Exception ex) { return(ex.Message); }
 }
Exemplo n.º 11
0
    public string GetPatientsInDepartment(string department)
    {
        var currentDepartment = Departments
                                .FirstOrDefault(d => d.Type == department);
        var notEmptyRooms = currentDepartment
                            .Rooms
                            .Where(r => r.Patients.Count > 0)
                            .ToList();
        var patients = notEmptyRooms
                       .Select(e => String.Join(Environment.NewLine, e.Patients.Select(p => p.Name))
                               .ToString());

        return(String
               .Join(Environment.NewLine, patients));
    }
Exemplo n.º 12
0
    public void AccommodatePatientWithHealingDoctor(Patient patient, string department, Doctor doctor)
    {
        var currentDepartment = Departments
                                .FirstOrDefault(d => d.Type == department);

        currentDepartment
        .AccommodatePatient(patient);

        if (!Doctors.Any(d => d.FirstName == doctor.FirstName))
        {
            AddDoctor(doctor);
        }

        Doctors
        .FirstOrDefault(d => d.FirstName == doctor.FirstName)
        .AddPatient(patient);
    }
Exemplo n.º 13
0
        public AspirantSelectLists(Aspirant aspirant, AspiranturaContext context)
        {
            Statuses     = Helper.GetStatuses();
            Studyforms   = Helper.GetStudyForms();
            Specialities = Helper.GetSpecialities(context);
            Departments  = Helper.GetDepartments(context);
            Prepods      = Helper.GetPrepods(context);

            if (aspirant != null)
            {
                selectedStatus     = Statuses.FirstOrDefault(k => k.Value == (int)aspirant.StatusType);
                selectedStudyform  = Studyforms.FirstOrDefault(k => k.Value == (int)aspirant.StudyForm);
                selectedSpeciality = Specialities.FirstOrDefault(k => k.Value == aspirant.SpecialityId);  // возможно нужна проверка на null
                selectedDepartment = Departments.FirstOrDefault(k => k.Value == aspirant.DepartmentId);
                selectedPrepod     = Prepods.FirstOrDefault(k => k.Value == aspirant.PrepodId);
            }
        }
Exemplo n.º 14
0
 public string RemoveDepartmentOrOrganization(int id, string nameTable)
 {
     try
     {
         if (nameTable == "Department")
         {
             var item = Departments.FirstOrDefault(i => i.DepartmentID == id);
             Departments.Remove(item);
         }
         else if (nameTable == "Organization")
         {
             var item = Organizations.FirstOrDefault(i => i.OrganizationID == id);
             Organizations.Remove(item);
         }
         SaveChanges();
         return("Запись успешно удалена");
     }
     catch (Exception ex) { return(ex.Message); }
 }
Exemplo n.º 15
0
 public string EditDepartmentOrOrganization(int id, string title, string nameTable)
 {
     try
     {
         if (nameTable == "Department")
         {
             var item = Departments.FirstOrDefault(i => i.DepartmentID == id);
             item.Title = title;
         }
         else if (nameTable == "Organization")
         {
             var item = Organizations.FirstOrDefault(i => i.OrganizationID == id);
             item.Title = title;
         }
         SaveChanges();
         return("Запись успешно изменена");
     }
     catch (Exception ex) { return(ex.Message); }
 }
Exemplo n.º 16
0
        /// <summary>
        /// Получение информации об отделе
        /// </summary>
        /// <param name="name">имя отдела</param>
        /// <returns></returns>
        private bool GetDepartmentItem(string name)
        {
            try
            {
                Department dep = Departments.FirstOrDefault(item => item.Name.Equals(name));

                if (dep != null)
                {
                    departmentEventsArgs.DisplayDep = dep;
                    modelDeptHandler(this, departmentEventsArgs);
                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw e;
            }

            return(false);
        }
Exemplo n.º 17
0
 public string EditPeople(int id, string firstName, string lastName, string middleName, string phone, string phoneVoIP, int idDep, int IdOrg, int IdPos)
 {
     try
     {
         var item = Peoples.FirstOrDefault(i => i.PeopleID == id);
         Departments.FirstOrDefault(i => i.DepartmentID == item.DepartmentID).People.Remove(item);
         Organizations.FirstOrDefault(i => i.OrganizationID == item.OrganizationID).People.Remove(item);
         Positions.FirstOrDefault(i => i.PositionID == item.PositionID).People.Remove(item);
         item.FirstName      = firstName;
         item.LastName       = lastName;
         item.MiddleName     = middleName;
         item.Phone          = phone;
         item.PhoneVoIP      = phoneVoIP;
         item.PositionID     = IdPos;
         item.OrganizationID = IdOrg;
         item.DepartmentID   = idDep;
         Departments.FirstOrDefault(i => i.DepartmentID == idDep).People.Add(item);
         Organizations.FirstOrDefault(i => i.OrganizationID == IdOrg).People.Add(item);
         Positions.FirstOrDefault(i => i.PositionID == IdPos).People.Add(item);
         SaveChanges();
         return("Запись успешно изменена");
     }
     catch (Exception ex) { return(ex.Message); }
 }
Exemplo n.º 18
0
 public string AddPeople(string firstName, string lastName, string middleName, string phone, string phoneVoIP, int idDep, int IdOrg, int IdPos)
 {
     try
     {
         People people = new People()
         {
             FirstName      = firstName,
             LastName       = lastName,
             MiddleName     = middleName,
             Phone          = phone,
             PhoneVoIP      = phoneVoIP,
             PositionID     = IdPos,
             OrganizationID = IdOrg,
             DepartmentID   = idDep,
         };
         Peoples.Add(people);
         Departments.FirstOrDefault(i => i.DepartmentID == idDep).People.Add(people);
         Organizations.FirstOrDefault(i => i.OrganizationID == IdOrg).People.Add(people);
         Positions.FirstOrDefault(i => i.PositionID == IdPos).People.Add(people);
         SaveChanges();
         return("Запись успешно добавлена");
     }
     catch (Exception ex) { return(ex.Message); }
 }
Exemplo n.º 19
0
 /// <summary>
 /// Метод, находящий нужное отделение в коллекции по его ID.
 /// </summary>
 /// <param name="id_Department">Id отделения</param>
 /// <returns>Найденное отделение</returns>
 private Department GetDepartment(int id_Department)
 {
     return(Departments.FirstOrDefault(e => e.ID == id_Department) as Department);
 }
Exemplo n.º 20
0
        private async Task CompanyChangedAsync(ChangeEventArgs args)
        {
            Departments = await OrgStructureService.GetDepartmentsByCompanyIdAsync(args.Value.ToString());

            Employee.DepartmentId = Departments.FirstOrDefault()?.Id;
        }
Exemplo n.º 21
0
        //Заполнение всех списков значениями
        private async void GetTables() => await Task.Run(() =>
        {
            Organizations = (List <Organization>)NirsSystem.GetListObject <Organization>();
            if (Organizations == null)
            {
                Organizations = new List <Organization>();
            }
            Organizations.Insert(0, new Organization {
                OrganizationId = 0, OrganizationName = "(пусто)"
            });
            SelectedOrganization = Organizations.FirstOrDefault(u => u.OrganizationId == _author.OrganizationId);
            OnPropertyChanged("Organizations");
            OnPropertyChanged("SelectedOrganization");

            Faculties = (List <Faculty>)NirsSystem.GetListObject <Faculty>();
            if (Faculties == null)
            {
                Faculties = new List <Faculty>();
            }
            Faculties.Insert(0, new Faculty {
                FacultyId = 0, FacultyName = "(пусто)"
            });
            SelectedFaculty = Faculties.FirstOrDefault(u => u.FacultyId == _author.FacultyId);
            OnPropertyChanged("Faculties");
            OnPropertyChanged("SelectedFaculty");

            Departments = (List <Department>)NirsSystem.GetListObject <Department>();
            if (Departments == null)
            {
                Departments = new List <Department>();
            }
            Departments.Insert(0, new Department {
                DepartmentId = 0, DepartmentName = "(пусто)"
            });
            SelectedDepartment = Departments.FirstOrDefault(u => u.DepartmentId == _author.DepartmentId);
            OnPropertyChanged("Departments");
            OnPropertyChanged("SelectedDepartment");

            Groups = (List <Group>)NirsSystem.GetListObject <Group>();
            if (Groups == null)
            {
                Groups = new List <Group>();
            }
            Groups.Insert(0, new Group {
                GroupId = 0, GroupName = "(пусто)"
            });
            SelectedGroup = Groups.FirstOrDefault(u => u.GroupId == _author.GroupId);
            OnPropertyChanged("Groups");
            OnPropertyChanged("SelectedGroup");

            Positions = (List <Position>)NirsSystem.GetListObject <Position>();
            if (Positions == null)
            {
                Positions = new List <Position>();
            }
            Positions.Insert(0, new Position {
                PositionId = 0, PositionName = "(пусто)"
            });
            SelectedPosition = Positions.FirstOrDefault(u => u.PositionId == _author.PositionId);
            OnPropertyChanged("Positions");
            OnPropertyChanged("SelectedPosition");

            AcademicDegrees = (List <AcademicDegree>)NirsSystem.GetListObject <AcademicDegree>();
            if (AcademicDegrees == null)
            {
                AcademicDegrees = new List <AcademicDegree>();
            }
            AcademicDegrees.Insert(0, new AcademicDegree {
                AcademicDegreeId = 0, AcademicDegreeName = "(пусто)"
            });
            SelectedAcademicDegree = AcademicDegrees.FirstOrDefault(u => u.AcademicDegreeId == _author.AcademicDegreeId);
            OnPropertyChanged("AcademicDegrees");
            OnPropertyChanged("SelectedAcademicDegree");
        });