Beispiel #1
0
        public override void RemoveElement(int id)
        {
            logger.Info($"Выполняется удаления работника...");
            if (HospitalManager.GetRoleCurrentEmployee() != UserRole.Менеджер)
            {
                throw new Exception("Удалять пользователей может только менеджер");
            }

            Employee employee = FindById(id);

            if (employee is null)
            {
                throw new ArgumentException("Выбранного пользователя нет в базе");
            }

            if (employee.Role == UserRole.Менеджер)
            {
                logger.Info($"Попытка удаления менеджера {employee}...");
                if (employee.Profile.Priority == UserPriority.Высокий)
                {
                    throw new Exception("Нельзя удалить главного менеджера");
                }
                if (HospitalManager.GetPriorityCurrentUser() <= employee.Profile.Priority)
                {
                    throw new Exception("Уровень вашего доступа недостаточен для удаления выбранного пользователя");
                }
            }
            base.RemoveElement(id);
            logger.Info($"Работник удален");
        }
Beispiel #2
0
        public ActionResult <Customer> Post(Customer customer)
        {
            try
            {
                if (customer.CustomerID != null && customer.CustomerID.Trim().Length > 0)
                {
                    customer.Condition = "2";
                }
                else
                {
                    customer.CTypeID = "6";
                }


                bool isSaved = new HospitalManager().HospitalManagement(customer);

                if (isSaved)
                {
                    return(Ok("1"));
                }
                //return Ok(JsonConvert.SerializeObject(customer));
            }
            catch (Exception ex)
            {
                return(BadRequest());
            }

            return(BadRequest());
        }
Beispiel #3
0
        public override void AddElement(Employee employee)
        {
            logger.Info($"Выполняется добаление работника {employee}...");
            if (HospitalManager.MainManagerIsNull())
            {
                logger.Info("Выполняется добавление главного менеджера...");
                if (employee.Role == UserRole.Менеджер && employee.Profile.Priority == UserPriority.Высокий)
                {
                    ValidateElement(employee);
                    employee.Id         = ++NextId;
                    employee.Profile.Id = employee.Id;

                    base.AddElement(employee);
                    logger.Info($"Главный менеджер добавлен {employee}");
                }
                else
                {
                    throw new ArgumentException("Вы пытаетесь добавить главного менеджера с несоответсвующими параметрами");
                }
            }
            else
            {
                if (HospitalManager.GetRoleCurrentEmployee() != UserRole.Менеджер)
                {
                    throw new Exception("Добавлять новых сотрудников может только менеджер");
                }

                ValidateElement(employee);
                employee.Id         = ++NextId;
                employee.Profile.Id = employee.Id;

                base.AddElement(employee);
                logger.Info($"Работник {employee} добавлен");
            }
        }
 public HospitalManagementView(HospitalManager hospMgr)
 {
     units = new ObservableCollection<UnitView>();
     employees = new ObservableCollection<Employee>();
     HospManager = hospMgr;
     UpdateHierarchyList();
 }
Beispiel #5
0
 public HospitalManagementView(HospitalManager hospMgr)
 {
     units       = new ObservableCollection <UnitView>();
     employees   = new ObservableCollection <Employee>();
     HospManager = hospMgr;
     UpdateHierarchyList();
 }
            // create a new ImageView for each item referenced by the Adapter
            public override View GetView(int position, View convertView, ViewGroup parent)
            {
                var view = (convertView ??
                            context.LayoutInflater.Inflate(
                                Resource.Layout.PlannerGridItem,
                                parent,
                                false)) as LinearLayout;
                DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;
                Calendar           cal = dfi.Calendar;
                int week = cal.GetWeekOfYear(dt [position], dfi.CalendarWeekRule, dfi.FirstDayOfWeek);

                if (position == 0)
                {
                    setts.weekOfStart = week;
                    Common.SetSettings(setts);
                }

                (view.FindViewById <TextView> (Resource.Id.txtDate)).Text = dt [position].ToString("dd MMMMM") + "\n" +
                                                                            DateTimeFormatInfo.CurrentInfo.DayNames [(int)dt [position].DayOfWeek];
//					"Date: " + dt [position].ToString("d") +"\n" +
//					dt [position].DayOfWeek.ToString() + " = " +((int)dt [position].DayOfWeek).ToString() + "\n" +
//						                                                   "Week = " + week.ToString();//.ToString (); // ("yy-MM-dd");
//				view.SetPadding (8, 20, 8, 20);
                var txtHosps = view.FindViewById <TextView> (Resource.Id.txtHosps);

                txtHosps.Text = "";
                var chHosps = HospitalManager.GetChoosenHospitals(position / 5, dt [position].DayOfWeek);

                for (int h = 0; h < chHosps.Count; h++)
                {
                    txtHosps.Text = txtHosps.Text + chHosps [h].Name + "\n";
                }
                return(view);
            }
Beispiel #7
0
    // Start is called before the first frame update
    void Start()
    {
        SimulationModelInit();

        houseManager    = GameObject.Find("Residence").GetComponent <HouseManager>();
        gameManager     = GameObject.Find("Game Manager").GetComponent <GameManager>();
        strategy        = GameObject.Find("Game Manager").GetComponent <Strategy>();
        hospitalManager = GameObject.Find("Hospitals").GetComponent <HospitalManager>();
        agentMoveScript = GetComponent <AgentMove>();

        int randHospitalIdx = Random.Range(0, hospitalManager.hospitals.Count);

        hospitalToGo   = hospitalManager.hospitals[randHospitalIdx];
        hospitalScript = hospitalToGo.GetComponent <Hospital>();

        if (Random.Range(0.0f, 1.0f) < initalInfectedRate)
        {
            status = health_status.infected;
            GetComponent <MeshRenderer>().material = orange;
            infectedTimeStamp = 0;
            houseManager.IncreInfected();
        }
        else
        {
            status = health_status.healthy;
        }

        sympOnsetTime = Random.Range(5, 10);
    }
        public override Android.Views.View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent)
        {
            // Get our object for position
            var item = doctors[position];
            var hosp = HospitalManager.GetHospital(item.HospitalID);

            //Try to reuse convertView if it's not  null, otherwise inflate it from our item layout
            // gives us some performance gains by not always inflating a new view
            // will sound familiar to MonoTouch developers with UITableViewCell.DequeueReusableCell()
            var view = (convertView ??
                        context.LayoutInflater.Inflate(
                            Resource.Layout.DoctorsListItem,
                            parent,
                            false)) as LinearLayout;
            // Find references to each subview in the list item's view
            var txtDoctorFullName = view.FindViewById <TextView> (Resource.Id.txtDoctorFullName);
            var txtDocSpeciality  = view.FindViewById <TextView> (Resource.Id.txtDocSpeciality);
            var txtDocHospital    = view.FindViewById <TextView> (Resource.Id.txtDocHospital);

            Common.SetCheck(view, item);

            txtDoctorFullName.Text = item.SecondName + ' ' + item.FirstName + ' ' + item.ThirdName;
            txtDocSpeciality.Text  = item.Speciality;
            txtDocHospital.Text    = hosp.Name;
            //Finally return the view
            return(view);
        }
Beispiel #9
0
        public override void EditElement(int id, Employee newEmployee)
        {
            logger.Info($"Выполняется редактирование работника...");
            if (HospitalManager.GetRoleCurrentEmployee() != UserRole.Менеджер)
            {
                throw new FieldAccessException("Редактировать пользователей может только менеджер");
            }

            Employee employee = FindById(id);

            if (employee is null)
            {
                throw new ArgumentNullException("Выбранного пользователя нет в базе");
            }

            if (HospitalManager.GetPriorityCurrentUser() < employee.Profile.Priority)
            {
                throw new FieldAccessException("Уровень вашего доступа недостаточен для удаления выбранного пользователя");
            }

            newEmployee.Id = id;
            ValidateElement(newEmployee);
            logger.Info($"Редактирование работника {employee}...");
            employee.Edit(newEmployee);
            logger.Info("Редактирование завершено");
            Save();
        }
Beispiel #10
0
 private void diseaseBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!(diseaseBox.SelectedItem is null))
     {
         selectDisease = diseaseBox.SelectedItem as Disease;
         HospitalManager.GetInstance().TreatmentService.FilterByDisease(selectDisease.Id, true);
     }
 }
Beispiel #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            int hospitalID = Intent.GetIntExtra("HospitalID", 0);

            if (hospitalID > 0)
            {
                hospital = HospitalManager.GetHospital(hospitalID);
            }

            // set our layout to be the home screen
            SetContentView(Resource.Layout.HospitalDetails);
            hospitalName         = FindViewById <EditText>(Resource.Id.txtHospitalName);
            hospitalAdress       = FindViewById <EditText>(Resource.Id.txtHospitalAdress);
            hospitalNearestMetro = FindViewById <EditText>(Resource.Id.txtHospitalNearestMetro);
            hospitalRegPhone     = FindViewById <EditText>(Resource.Id.txtHospitalRegPhone);
            saveButton           = FindViewById <Button>(Resource.Id.btnSave);

            // find all our controls
            cancelDeleteButton = FindViewById <Button>(Resource.Id.btnCancelDelete);


            // set the cancel delete based on whether or not it's an existing task
            if (cancelDeleteButton != null)
            {
                cancelDeleteButton.Text = (hospital.ID == 0 ? "Отмена" : "Удалить");
            }

            // name
            if (hospitalName != null)
            {
                hospitalName.Text = hospital.Name;
            }

            // adress
            if (hospitalAdress != null)
            {
                hospitalAdress.Text = hospital.Adress;
            }

            // adress
            if (hospitalNearestMetro != null)
            {
                hospitalNearestMetro.Text = hospital.NearestMetro;
            }

            // adress
            if (hospitalRegPhone != null)
            {
                hospitalRegPhone.Text = hospital.RegPhone;
            }

            // button clicks
            cancelDeleteButton.Click += (sender, e) => { CancelDelete(); };
            saveButton.Click         += (sender, e) => { Save(); };
        }
Beispiel #12
0
        private void InitializeManagers()
        {
            Debug.Log("Initializing managers...");

            DateTimeManager.SetMode(configClock.Clock_Mode);

            AmmunationManager.CreateAmmunations();
            if (!configBlips.Show_Ammunations)
            {
                AmmunationManager.HideAmmunationBlips();
            }

            AtmManager.CreateATMs();
            if (!configBlips.Show_Atm)
            {
                AtmManager.HideATMBlips();
            }

            DoorManager.CreateDoors();
            if (configSettings.Unlock_All_Doors)
            {
                DoorManager.UnlockAll();
            }

            HospitalManager.CreateDefaultHospitalBlips();
            if (!configBlips.Show_Hospitals)
            {
                HospitalManager.HideHospitalBlips();
            }
            if (configSettings.Hospital_Spawn_OnDeath)
            {
                HospitalManager.EnableAllHospitals();
            }
            else
            {
                HospitalManager.DisableAllHospitals();
            }

            PoliceStationManager.CreateDefaultPoliceStationBlips();
            if (!configBlips.Show_PoliceStations)
            {
                PoliceStationManager.HidePoliceStationBlips();
            }
            if (configSettings.PoliceStation_Spawn_OnArrest)
            {
                PoliceStationManager.EnableAllPoliceStations();
            }
            else
            {
                PoliceStationManager.DisableAllPoliceStations();
            }

            StoreManager.CreateStores();
            if (!configBlips.Show_Stores)
            {
                StoreManager.HideStoreBlips();
            }
        }
Beispiel #13
0
 private void DoctorGridView_SelectionChanged(object sender, EventArgs e)
 {
     if (DoctorGridView.SelectedRows.Count > 0)
     {
         int doctorId = (int)DoctorGridView.SelectedRows[0].Cells["Id"].Value;
         _doctor = HospitalManager.GetInstance().EmployeeService.FindById(doctorId);
         profileBindingSource.DataSource = _doctor;
     }
 }
        public void RefreshList()
        {
            hospitals = HospitalManager.GetHospitals();

            // create our adapter
            hospitalList = new HospitalListAdapter(this, hospitals);

            //Hook up our adapter to our ListView
            lstHospitals.Adapter = hospitalList;
        }
Beispiel #15
0
        public void RefreshAvailableHospList()
        {
            availableHospitals = HospitalManager.GetAvailableHospitals(weekNum, (DayOfWeek)dayOfWeek);

            // create our adapter
            availableHospList = new HospitalListAdapter(this, availableHospitals);

            //Hook up our adapter to our ListView
            lstAvailableHosp.Adapter = availableHospList;
        }
Beispiel #16
0
 protected void CancelDelete()
 {
     progress = ProgressDialog.Show(this, "Обработка...", "Пожалуйста, подождите.", true);
     if (hospital.ID != 0)
     {
         HospitalManager.DeleteHospital(hospital.ID);
     }
     progress.Dismiss();
     Finish();
 }
Beispiel #17
0
        public void RefreshChoosenHospList()
        {
            choosenHospitals = HospitalManager.GetChoosenHospitals(weekNum, (DayOfWeek)dayOfWeek);

            // create our adapter
            choosenHospList = new HospitalListAdapter(this, choosenHospitals);

            //Hook up our adapter to our ListView
            lstChoosenHosp.Adapter = choosenHospList;
        }
Beispiel #18
0
        public override void RemoveElement(int id)
        {
            logger.Info($"Выполняется удаления заболевания...");
            if (HospitalManager.GetRoleCurrentEmployee() != UserRole.Врач)
            {
                throw new Exception("Удалять заболевания может только врач");
            }

            base.RemoveElement(id);
            logger.Info($"Заболевание удалено");
        }
Beispiel #19
0
        public override void RemoveElement(int id)
        {
            logger.Info($"Выполняется удаления диагноза...");
            if (HospitalManager.GetRoleCurrentEmployee() != UserRole.Врач)
            {
                throw new Exception("Удалять диагноз может только врач");
            }

            base.RemoveElement(id);
            logger.Info($"Диагноз удален");
        }
Beispiel #20
0
        public override void RemoveElement(int id)
        {
            logger.Info($"Выполняется удаления пациента...");
            if (HospitalManager.GetRoleCurrentEmployee() != UserRole.егистратор)
            {
                throw new Exception("Удалять пациентов может только регистратор");
            }

            base.RemoveElement(id);
            logger.Info($"Пациент удален");
        }
Beispiel #21
0
 private void searchDoctorBox_TextChanged(object sender, EventArgs e)
 {
     removeSorted.PerformClick();
     if (string.IsNullOrWhiteSpace(searchDoctorBox.Text))
     {
         HospitalManager.GetInstance().EmployeeService.FilterByRole(UserRole.Врач, true);
     }
     else
     {
         HospitalManager.GetInstance().EmployeeService.FilterByName(UserRole.Врач, searchDoctorBox.Text, true);
     }
 }
Beispiel #22
0
 protected void Save()
 {
     progress              = ProgressDialog.Show(this, "Обработка...", "Пожалуйста, подождите.", true);
     hospital.Name         = hospitalName.Text;
     hospital.Adress       = hospitalAdress.Text;
     hospital.NearestMetro = hospitalNearestMetro.Text;
     hospital.RegPhone     = hospitalRegPhone.Text;
     hospital.IsChosen     = false;
     HospitalManager.SaveHospital(hospital);
     progress.Dismiss();
     Finish();
 }
Beispiel #23
0
        public override void AddElement(Diagnosis diagnosis)
        {
            logger.Info($"Выполняется добаление диагноза {diagnosis}...");
            if (HospitalManager.GetRoleCurrentEmployee() != UserRole.Врач)
            {
                throw new Exception("Добавлять диагноз может только врач");
            }

            ValidateElement(diagnosis);
            diagnosis.Id = ++NextId;

            base.AddElement(diagnosis);
            logger.Info($"Диагноз {diagnosis} добавлен");
        }
Beispiel #24
0
        public override void AddElement(Visit visit)
        {
            logger.Info($"Выполняется добаление визита {visit}...");

            if (HospitalManager.GetRoleCurrentEmployee() != UserRole.егистратор)
            {
                throw new Exception("Добавлять новые визиты может только регистратор");
            }

            ValidateElement(visit);
            visit.Id = ++NextId;
            base.AddElement(visit);
            logger.Info($"Визит {visit} добавлен");
        }
Beispiel #25
0
        public override void AddElement(Treatment treatment)
        {
            logger.Info($"Выполняется добаление лечения {treatment}...");
            if (HospitalManager.GetRoleCurrentEmployee() != UserRole.Врач)
            {
                throw new Exception("Добавлять лечение может только врач");
            }

            ValidateElement(treatment);
            treatment.Id = ++NextId;

            base.AddElement(treatment);
            logger.Info($"лечение {treatment} добавлено");
        }
Beispiel #26
0
        private IActionResult getData(string analytic, string choice, string condition)
        {
            DataTable dt         = null;
            string    JSONString = string.Empty;

            switch (analytic)
            {
            case "1":
                dt         = new HospitalManager().HospitalData("1", choice, condition);
                JSONString = JsonConvert.SerializeObject(dt);
                return(Ok(JSONString));
            }
            return(null);
        }
Beispiel #27
0
 private void AddOrdEditVisitForm_Load(object sender, EventArgs e)
 {
     patientBox.Text = _patient.FullName;
     BindingDoctor();
     if (!(_visit is null))
     {
         createButton.Text = "Изменить";
         idLabel.Text      = _visit.Id.ToString();
         dateBox.Value     = _visit.Date;
         timeBox.Value     = new DateTime(_visit.Date.Year, _visit.Date.Month, _visit.Date.Day, _visit.Time.Hours, _visit.Time.Minutes, _visit.Time.Seconds);
         patientBox.Text   = HospitalManager.GetInstance().VisitService.GetPatient(_visit.Patient).FullName;
         doctorBox.Text    = HospitalManager.GetInstance().VisitService.GetDoctore(_visit.Doctor).FullName;
     }
 }
Beispiel #28
0
        public override void AddElement(Patient patient)
        {
            logger.Info($"Выполняется добаление пациента {patient}...");

            if (HospitalManager.GetRoleCurrentEmployee() != UserRole.егистратор)
            {
                throw new Exception("Добавлять новых пациентов может только регистратор");
            }

            ValidateElement(patient);
            patient.Id = ++NextId;

            base.AddElement(patient);
            logger.Info($"Пациент {patient} добавлен");
        }
Beispiel #29
0
 private void createButton_Click(object sender, EventArgs e)
 {
     try
     {
         HospitalManager.GetInstance().EmployeeService.AddElement(new Employee(
                                                                      loginBox.Text, passwordBox.Text, (UserRole)roleBox.SelectedItem, nameBox.Text, surnameBox.Text,
                                                                      (Genders)genderBox.SelectedItem, phoneBox.Text, dateBox.Value.Date,
                                                                      (UserPriority)priorityBox.SelectedItem));
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.PlannerHospitalsLists);

            weekNum   = Intent.GetIntExtra("WeekNum", 0);
            dayOfWeek = Intent.GetIntExtra("DayOfWeek", 0);

//			Toast.MakeText (this, String.Format ("WeekNum = {0}", weekNum), ToastLength.Short).Show ();
//			Toast.MakeText (this, String.Format ("DayOfWeek = {0}", dayOfWeek), ToastLength.Short).Show ();

            this.Title = (weekNum + 1).ToString() + " неделя, " + DateTimeFormatInfo.CurrentInfo.DayNames [dayOfWeek];

            lstChoosenHosp = FindViewById <ListView> (Resource.Id.lstChoosenHosp);
            if (lstChoosenHosp != null)
            {
                lstChoosenHosp.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
                    for (int p = 0; p < choosenHospitals[e.Position].planners.Count; p++)
                    {
                        if (choosenHospitals[e.Position].planners [p].weekNum == weekNum &&
                            choosenHospitals[e.Position].planners [p].dayOfWeek == (DayOfWeek)dayOfWeek)
                        {
                            choosenHospitals[e.Position].planners.RemoveAt(p);
                            HospitalManager.SaveHospital(choosenHospitals[e.Position]);
                        }
                    }
                    RefreshChoosenHospList();
                    RefreshAvailableHospList();
                };
            }

            lstAvailableHosp = FindViewById <ListView> (Resource.Id.lstAvailableHosp);
            if (lstAvailableHosp != null)
            {
                lstAvailableHosp.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => {
//					int p = availableHospitals[e.Position].planners.Count;
                    PlannerItem pItem = new PlannerItem {
                        weekNum = weekNum, dayOfWeek = (DayOfWeek)dayOfWeek
                    };
                    availableHospitals[e.Position].planners.Add(pItem);
                    HospitalManager.SaveHospital(availableHospitals[e.Position]);
                    RefreshChoosenHospList();
                    RefreshAvailableHospList();
                };
            }
        }
Beispiel #31
0
        private void BindingDoctor()
        {
            DoctorGridView.AutoGenerateColumns = false;
            AddColumnDoctor();

            profileBindingSource.DataSource = typeof(Employee);

            DoctorSource.DataSource = HospitalManager.GetInstance().EmployeeService.GetElement();
            DoctorSource.RemoveFilter();
            HospitalManager.GetInstance().EmployeeService.FilterByRole(UserRole.Врач, true);
            DoctorNavigator.BindingSource = DoctorSource;
            DoctorGridView.DataSource     = DoctorSource;

            viewProfile_CheckedChanged(null, null);
            AddBindingDataDoctor();
        }
 public HospitalManagementWindow(HospitalManager hospMgr)
 {
     InitializeComponent();
     HospView = new HospitalManagementView(hospMgr);
     AppMgr = hospMgr.AppManager;
 }