/**
         * Controller to handle selection of a table row
         */

        public void handleTableRowSelection()
        {
            try {
                Cursor.Current = Cursors.WaitCursor;

                var selectedRow = this.view.PatientsTable.DataGrid.SelectedRows.Count > 0
                ? this.view.PatientsTable.DataGrid.SelectedRows[0]
                : null;

                if (selectedRow != null)
                {
                    int id = (int)selectedRow.Cells[0].Value;

                    this.patients.ForEach(async(item) => {
                        if (item.Id == id)
                        {
                            this.view.SelectedPatient        = item;
                            this.view.PatientLabelValue.Text = item.FullName;

                            this.selectedChart = await this.readPatientChart();
                            await this.readPatientChartDocs(this.selectedChart.Id);
                            await this.readAllergens(this.selectedChart.Id);
                        }
                    });
                }

                Cursor.Current = Cursors.Arrow;
            } catch (Exception e) {
                string caption = "Problem në lexim";
                MessageBox.Show(e.Message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
 public AnalysisController(AnalysisNurse view)
 {
     this.view               = view;
     this.patientModel       = new Models.Patient();
     this.patientChartModel  = new Models.PatientChart();
     this.chartDocumentModel = new Models.ChartDocument();
 }
 public PatientChartsController(OperatorPatientCharts view)
 {
     this.view               = view;
     this.patientModel       = new Models.Patient();
     this.patientChartModel  = new Models.PatientChart();
     this.chartDocumentModel = new Models.ChartDocument();
     this.allergenModel      = new Models.Allergen();
     this.counter            = 0;
     this.pageCount          = 1;
 }
        private async Task <Models.PatientChart> readPatientChart()
        {
            try {
                if (this.view.SelectedPatient == null)
                {
                    throw new Exception("Nuk është zgjedhur asnjë pacient");
                }

                Cursor.Current = Cursors.WaitCursor;

                Models.PatientChart chart = await patientChartModel.readPatientChart(this.view.SelectedPatient.Id);

                if (chart == null)
                {
                    throw new Exception("Nuk u gjet asnjë kartelë");
                }

                return(chart);
            } catch (Exception e) {
                throw e;
            }
        }