private void ViewCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            //deep read the currently selected calibration
            LinearCalibration lc = LinearCalibration.GetAllLC("[IDCalibration] = " +
                                                              ((LinearCalibration)cbLCSelection.SelectedItem).CalibrationID, true)?.Single();
            CalibrationViewDialog cvDlg = new CalibrationViewDialog(ref lc);

            cvDlg.Show(); //just to show it, no results are necessary
        }
        public void CalcKaliumValue()
        {
            LinearCalibration lc;

            if (!lcDict.ContainsKey(KaliumCalibration))
            {
                lc = LinearCalibration.GetAllLC("[IDCalibration] = " + KaliumCalibration, true).FirstOrDefault();
                lcDict.Add(KaliumCalibration, lc);
            }
            else
            {
                lc = lcDict[KaliumCalibration];
            }
            KDry = lc.ValueToConcentration(KaliumValue, KaliumDiapason - 1) * KaliumVolume
                   / (2 * SampleCorrectedDryWeight);
        }
 private void FillData()
 {
     lcList.Clear();
     foreach (LinearCalibration clbr in LinearCalibration.GetAllLC("[CalibrationType] = N'" + type + "'"))
     {
         lcList.Add(clbr);
     }
     try
     {
         cbLCSelection.SelectedIndex = lcList.IndexOf(lcList.First(p => p.CalibrationID == CalibrationNumber));
     }
     catch
     {
         cbLCSelection.SelectedIndex = 0;
     }
 }
        private void EditCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            //deep read the currently selected calibration
            LinearCalibration lc = LinearCalibration.GetAllLC("[IDCalibration] = " +
                                                              ((LinearCalibration)cbLCSelection.SelectedItem).CalibrationID, true)?.Single();
            CalibrationDataDialog cldDlg = new CalibrationDataDialog(ref lc);

            if (cldDlg.ShowDialog() == true)
            {
                try
                {
                    lc.Update();
                    CALogger.WriteToLogFile(string.Format("Изменена калибровка ID{0};{1} - {2}",
                                                          lc.CalibrationID, lc.Description, lc.CalibrationType.ToString()));
                    FillData();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + " в " + ex.Source, "Ошибка");
                }
            }
        }