コード例 #1
0
        private void addTestREsult(object sender, RoutedEventArgs e)
        {
            try
            {
                ITestResultRepository testResultRepository = new TestResultRepository(ConfigurationManager.ConnectionStrings["ConnectionPatientResults"].ConnectionString);

                var parameters = new[]
                {
                    new SqlParameter(StoredProcedureParameters.Id, PatientRepository.PatientId),
                    new SqlParameter(StoredProcedureParameters.NameOfTest, "Gneral Blood Test"),
                    new SqlParameter(StoredProcedureParameters.SpDateOfResult, Calendar.ToString()),
                    new SqlParameter(StoredProcedureParameters.Erythrocytes, Convert.ToDouble(txtErytrocites.Text)),
                    new SqlParameter(StoredProcedureParameters.Hemoglobin, Convert.ToDouble(txtHemoglobin.Text)),
                    new SqlParameter(StoredProcedureParameters.Hematocrit, Convert.ToDouble(txtHematocrit.Text)),
                    new SqlParameter(StoredProcedureParameters.ColorIndicator, Convert.ToDouble(txtColorIndecator.Text)),
                    new SqlParameter(StoredProcedureParameters.Mch, Convert.ToDouble(txtMCH.Text)),
                    new SqlParameter(StoredProcedureParameters.Mchc, Convert.ToDouble(txtMCHC.Text)),
                    new SqlParameter(StoredProcedureParameters.Mcv, Convert.ToDouble(txtMCV.Text)),
                    new SqlParameter(StoredProcedureParameters.Rdw, Convert.ToDouble(txtRDW.Text)),
                    new SqlParameter(StoredProcedureParameters.AverageSizeErythrocytes, Convert.ToDouble(txtAveregeSize.Text)),
                    new SqlParameter(StoredProcedureParameters.Platelets, Convert.ToDouble(txtPlteles.Text)),
                    new SqlParameter(StoredProcedureParameters.WhiteBloodCells, Convert.ToDouble(txtWhiteCells.Text)),
                    new SqlParameter(StoredProcedureParameters.Eosinophils, Convert.ToDouble(txtEosinophils.Text)),
                    new SqlParameter(StoredProcedureParameters.Lymphocytes, Convert.ToDouble(txtLimphocytes.Text))
                };
                testResultRepository.InsertGeneralBloodTestResultInfo(CommandType.StoredProcedure,
                                                                      StoredProcedureNames.SInsertpGeneralBloodTestResultInfo, parameters);

                txtErytrocites.Text    = string.Empty;
                txtHemoglobin.Text     = string.Empty;
                txtHematocrit.Text     = string.Empty;
                txtMCHC.Text           = string.Empty;
                txtColorIndecator.Text = string.Empty;
                txtMCH.Text            = string.Empty;
                txtMCV.Text            = string.Empty;
                txtRDW.Text            = string.Empty;
                txtAveregeSize.Text    = string.Empty;
                txtPlteles.Text        = string.Empty;
                txtWhiteCells.Text     = string.Empty;
                txtEosinophils.Text    = string.Empty;
                txtLimphocytes.Text    = string.Empty;

                generalBloodWindow.Visibility = Visibility.Hidden;
                MessageBox.Show("Thank you, general blood test result was succsesfully added");
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (InvalidDataException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }