Exemplo n.º 1
0
        // Update tool Selection
        private void ToolDataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            if (ToolDataGrid.SelectedIndex != -1)
            {
                // Get toolData from ToolDataGrid
                ToolModel selectedTool = (ToolModel)ToolDataGrid.SelectedItems[0];

                // Get toolID from toolData
                toolID = selectedTool.ToolID;

                // Load ToolData from SQLite DB
                var toolData = SqliteDataAcces.LoadToolDataByID(toolID);

                // Fill tool information
                functionTextBlock.Text = toolData.Function;
                typeTextBlock.Text     = toolData.Type;
                holderTextBlock.Text   = toolData.Holder;
                machineTextBlock.Text  = toolData.Machine;
                diameterTextBlock.Text = toolData.Diameter.ToString("F");
                lengthTextBlock.Text   = toolData.Length.ToString("F");
                storageTextBlock.Text  = toolData.Storage;
                locationTextBlock.Text = toolData.Location;

                holderVendorTextBlock.Text = toolData.HolderVendor;
                holderArtTextBlock.Text    = toolData.HolderArt;

                extensionVendorTextBlock.Text = toolData.ExtensionVendor;
                extensionArtTextBlock.Text    = toolData.ExtensionArt;

                toolVendorTextBlock.Text = toolData.ToolVendor;
                toolArtTextBlock.Text    = toolData.ToolArt;
            }
        }
Exemplo n.º 2
0
        private string CreateToolID()
        {
            string toolID = null;

            // Get code for holder type
            if (TypeComboBox.Text == "Milling")
            {
                List <string> holderCode = SqliteDataAcces.SearchSingleValueByText("HolderCode_mill", "Holders", "HolderName", HolderComboBox.Text);
                toolID += holderCode[0];
            }
            else
            {
                List <string> holderCode = SqliteDataAcces.SearchSingleValueByText("HolderCode_turn", "Holders", "HolderName", HolderComboBox.Text);
                toolID += holderCode[0];
            }

            // Get code for diameter and length
            toolID += GetDiameter();
            toolID += GetLength();

            // Get code for function type
            if (TypeComboBox.Text == "Milling")
            {
                List <string> functionCode = SqliteDataAcces.SearchSingleValueByText("FunctionCode", "ToolFunctions_milling", "Function", FunctionComboBox.Text);
                toolID += functionCode[0];
            }
            else
            {
                List <string> functionCode = SqliteDataAcces.SearchSingleValueByText("FunctionCode", "ToolFunctions_turning", "Function", FunctionComboBox.Text);
                toolID += functionCode[0];
            }
            return(toolID);
        }
Exemplo n.º 3
0
        private void ApplyFiltersToCaseListAndRefresh()
        {
            var listFilteredCases = listAllCaseEntry.ToList();

            if (chkOnlyShowUncompleted.IsChecked == true)
            {
                listFilteredCases = listAllCaseEntry.Where(x => !(IsCaseEvaluated(x))).ToList();
            }

            // Filter by date
            listFilteredCases = dtFilterDate.Text != "" ? listFilteredCases.Where(x => x.DateTimeModifiedObject.Date >= dtFilterDate.Value).ToList() : listFilteredCases.ToList();
            var listResults = new List <CaseEntry>();

            // Filter by Author ID
            if (cmbAuthor.SelectedIndex != -1)
            {
                var listFilter = SqliteDataAcces.GetCaseEntryFilterAuthorID(cmbAuthor.SelectedValue.ToString());
                listFilteredCases = listFilteredCases.Where(x => listFilter.ToList()
                                                            .FindIndex(c => c.CaseNumber == x.CaseNumber) != -1).ToList();
            }

            // Filter by case number, this trumps all filters and will return even if the case does not satisfy the other filters
            var stCaseNum = txtFilterCaseNumber.Text;

            if (stCaseNum != "")
            {
                listFilteredCases = listAllCaseEntry.Where(x => x.CaseNumber == stCaseNum).ToList();
            }

            RefreshCaseListUI(listFilteredCases);
        }
Exemplo n.º 4
0
        private void submitEvaluation()
        {
            CaselyUserData caselyUserData = new CaselyUserData()
            {
                CaseNumber = cmbCaseNumber.SelectedValue.ToString(), Service = cmbService.Text, Evaluation = cmbSelfEvaluation.Text, EvaluationComment = txtSelfEvalComments.Text
            };

            // Save the evaluation and other data for the case, essentially completing it.
            SqliteDataAcces.UpdateCompletedCase(caselyUserData);
            // Update in-memory list of caselyUserDatas, that way do not have to go back to the database again to load.
            foreach (var pc in listAllCaselyUserData)
            {
                if (pc.CaseNumber == caselyUserData.CaseNumber)
                {
                    pc.Evaluation        = caselyUserData.Evaluation;
                    pc.EvaluationComment = caselyUserData.EvaluationComment;
                    pc.Service           = caselyUserData.Service;
                }
            }
            cmbSelfEvaluation.Text = "";
            var indx = cmbCaseNumber.SelectedIndex;

            // cmbService.Focus();
            ApplyFiltersToCaseListAndRefresh();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Loads the last two versions of the report. Use LoadCaseData to refresh UI as it loads the diagnosis for the case as well.
        /// </summary>
        private void RefreshComparison()
        {
            if (cmbCaseNumber.SelectedValue != null && cmbVersion.SelectedIndex != -1)
            {
                wbDiffText.Text = "";
                string html     = "";
                var    listCase = SqliteDataAcces.GetListCaseEntry(cmbCaseNumber.SelectedValue.ToString());

                // gets the case entrys, groups them by author and then selects the last two author entries to compare.
                var       dt             = DateTime.Parse(cmbVersion.SelectedItem.ToString());
                CaseEntry residentEntry  = listCase.Where(x => x.DateTimeModifiedObject == dt).First();
                CaseEntry attendingEntry = listCase.Last();


                html += DiffToHTML(residentEntry.Interpretation, attendingEntry.Interpretation, "Interpretation");
                html += DiffToHTML(residentEntry.Material, attendingEntry.Material, "Material");
                html += DiffToHTML(residentEntry.History, attendingEntry.History, "History");
                html += DiffToHTML(residentEntry.Gross, attendingEntry.Gross, "Gross");
                html += DiffToHTML(residentEntry.Microscopic, attendingEntry.Microscopic, "Microscopic");
                html += DiffToHTML(residentEntry.TumorSynoptic, attendingEntry.TumorSynoptic, "Tumor Synoptic");
                html += DiffToHTML(residentEntry.Comment, attendingEntry.Comment, "Comment");
                html  = "<head><style>INS {background-color: powderblue;}DEL  {color: #ff5151;}</style></head>" + html;

                wbDiffText.Text = html;
            }
            else
            {
                wbDiffText.Text = "";
            }
        }
Exemplo n.º 6
0
        private void AcceptInput(object sender, RoutedEventArgs e)
        {
            if (!inputCorrect)
            {
                MessageBox.Show("Description field can't be empty.", "Invalid description input", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            else
            {
                // create new tool instance
                ToolModel updateTool = new ToolModel();


                if (SqliteDataAcces.SearchDataByText("ToolID", "Tools", "ToolID", toolID).ToList().Count == 0)
                {
                    MessageBox.Show("Tool not found in database.", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                else
                {
                    // Assign info to updateTool
                    updateTool.ToolID          = Convert.ToInt32(toolID);
                    updateTool.Storage         = StorageTextBox.Text;
                    updateTool.Location        = LocationTextBox.Text;
                    updateTool.Description     = DescriptionTextBox.Text;
                    updateTool.HolderVendor    = HolderVendorComboBox.Text;
                    updateTool.HolderArt       = HolderArtTextBox.Text;
                    updateTool.ExtensionVendor = ExtensionVendorComboBox.Text;
                    updateTool.ExtensionArt    = ExtensionArtTextBox.Text;
                    updateTool.ToolVendor      = ToolVendorComboBox.Text;
                    updateTool.ToolArt         = ToolArtTextBox.Text;



                    // Write new tool to Database and check if succesfull
                    bool writingSuccesFull = SqliteDataAcces.UpdateToolRecord(updateTool);

                    if (writingSuccesFull)
                    {
                        MessageBox.Show($"Changes succesfully written to database.", "Succesfull", MessageBoxButton.OK, MessageBoxImage.Information);

                        //Close window
                        raiseClosingEvent = false;
                        Close();

                        //Refresh data grid
                        ((MainWindow)Owner).SetDataGrid();
                    }
                    else
                    {
                        MessageBox.Show($"Failed update tool!", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    }
                }
            }
        }
Exemplo n.º 7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            listStaff                   = new ObservableCollection <Staff>(SqliteDataAcces.GetListAuthor());
            cmbAuthor.ItemsSource       = listStaff;
            cmbAuthor.SelectedValuePath = "AuthorID";

            lbFilteredCaseEntry.ItemsSource       = listFilteredCaseEntry;
            lbFilteredCaseEntry.SelectedValuePath = "CaseNumber";
            listAllCaseEntries     = SqliteDataAcces.GetListAllCaseEntries();
            listAllCaselyUserDatas = SqliteDataAcces.GetAllCaselyUserData();
            SearchDatabase();
        }
Exemplo n.º 8
0
 public WindowReportEditor()
 {
     InitializeComponent();
     txtCaseNumber.Text = SqliteDataAcces.CaseNumberPrefix;
     foreach (var a in SqliteDataAcces.GetListAuthor())
     {
         cmbAuthor.Items.Add(a.AuthorID);
     }
     foreach (var a in SqliteDataAcces.GetUniqueService())
     {
         cmbService.Items.Add(a);
     }
 }
Exemplo n.º 9
0
        private void refreshCaseData()
        {
            RefreshComparison();
            var cn          = cmbCaseNumber.SelectedValue;
            var lastService = cmbService.Text; // save the last service so that we do not have to keep entering it for each eval

            if (cn != null)
            {
                var caselyUserData = SqliteDataAcces.GetCaselyUserData(cn.ToString());
                cmbSelfEvaluation.Text   = caselyUserData.Evaluation != null ? caselyUserData.Evaluation : "";
                txtSelfEvalComments.Text = caselyUserData.EvaluationComment != null ? caselyUserData.EvaluationComment : "";
                cmbService.Text          = caselyUserData.Service != null ? caselyUserData.Service : lastService;
            }
        }
Exemplo n.º 10
0
        private void ConnectOrUpdateDB()
        {
            var isValid = SqliteDataAcces.CreateOrUpdateDatabase();

            tbDBPath.Text = SqliteDataAcces.DBPath;
            if (!(isValid))
            {
                ActivateButtons(false);
            }
            else
            {
                ActivateButtons(true);
                tbDBPath.Text = SqliteDataAcces.DBPath;
            }
        }
Exemplo n.º 11
0
 private void RefreshComboBoxes(object sender, EventArgs e)
 {
     // Load function list data and assign to combobox
     if (TypeComboBox.Text == "Milling")
     {
         List <string> functionData = SqliteDataAcces.SearchDataByNumeric("Function", "ToolFunctions_milling", "ToolTypeID", "1");
         functionData = functionData.OrderBy(q => q).Distinct().ToList();
         FunctionComboBox.ItemsSource = functionData;
     }
     else if (TypeComboBox.Text == "Turning")
     {
         List <string> functionData = SqliteDataAcces.SearchDataByNumeric("Function", "ToolFunctions_turning", "ToolTypeID", "2");
         functionData = functionData.OrderBy(q => q).Distinct().ToList();
         FunctionComboBox.ItemsSource = functionData;
     }
 }
Exemplo n.º 12
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // load the names of authors
            listStaff                       = new ObservableCollection <Staff>(SqliteDataAcces.GetListAuthor());
            cmbAuthor.ItemsSource           = listStaff;
            cmbAuthor.SelectedValuePath     = "AuthorID";
            cmbCaseNumber.ItemsSource       = listFilteredCaseEntry;
            cmbCaseNumber.SelectedValuePath = "CaseNumber";
            dtFilterDate.Text               = "";
            wbDiffText.Text                 = "<h3><b>Casely is loading! Please be patient :)</b></h3>";
            // load all the cases from the database
            listAllCaseEntry = await GetAllCaseEntryAsync();

            listAllCaselyUserData = await GetAllCaselyUserDataAsync();

            RefreshCaseListUI(listAllCaseEntry);
            cmbService.ItemsSource        = suggestionService;
            cmbSelfEvaluation.ItemsSource = suggestionEvaluation;
            allCasesLoaded = true;
            ApplyFiltersToCaseListAndRefresh();

            // instantiate keyboard shortcuts
            RoutedCommand cmndSettingnext = new RoutedCommand();

            cmndSettingnext.InputGestures.Add(new KeyGesture(Key.N, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(cmndSettingnext, btnNextCase_Click));

            RoutedCommand cmndSettingPrev = new RoutedCommand();

            cmndSettingPrev.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(cmndSettingPrev, btnPreviousCase_Click));

            RoutedCommand cmndSettingService = new RoutedCommand();

            cmndSettingService.InputGestures.Add(new KeyGesture(Key.R, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(cmndSettingService, focusService));

            RoutedCommand cmndSettingEval = new RoutedCommand();

            cmndSettingEval.InputGestures.Add(new KeyGesture(Key.E, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(cmndSettingEval, focusEvaluation));

            RoutedCommand cmndSettingEvalComments = new RoutedCommand();

            cmndSettingEvalComments.InputGestures.Add(new KeyGesture(Key.W, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(cmndSettingEvalComments, focusSelfEvalComments));
        }
Exemplo n.º 13
0
        // Seach tool by user input
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            if (SearchBox.Text != "Search Tool..." && SearchBox.Text.Length > 0)
            {
                // Check if only numbers
                bool digitsOnly = SearchBox.Text.All(char.IsDigit);

                // Load data from SQLite
                var input = SqliteDataAcces.LoadAllToolData();

                // Create new collection
                var searchData = new ObservableCollection <ToolModel>();

                // Apply filter for every item
                foreach (var item in input)
                {
                    if (digitsOnly)
                    {
                        if (item.ToolID.ToString().Contains(SearchBox.Text))
                        {
                            searchData.Add(item);
                        }
                    }
                    else
                    {
                        string[] searchValues = SearchBox.Text.ToLower().Split(null);
                        int      hitCounter   = 0;

                        foreach (string value in searchValues)
                        {
                            if (item.Description.ToLower().Contains(value))
                            {
                                hitCounter += 1;
                            }

                            if (hitCounter == searchValues.Length)
                            {
                                searchData.Add(item);
                            }
                        }
                    }
                }
                //Display data
                ToolDataGrid.DataContext = searchData;
            }
        }
Exemplo n.º 14
0
        private void InitializeVendorComboBox()
        {
            // Load function list data and assign to combobox
            List <string> holderVendorData    = SqliteDataAcces.LoadListData("HolderVendor", "Tools");
            List <string> extensionVendorData = SqliteDataAcces.LoadListData("ExtensionVendor", "Tools");
            List <string> toolVendorData      = SqliteDataAcces.LoadListData("ToolVendor", "Tools");

            // Combine vendorData
            var vendorData = holderVendorData.Concat(extensionVendorData)
                             .Concat(toolVendorData)
                             .ToList();

            // Sort data and Remove duplicates
            vendorData = vendorData.OrderBy(q => q).Distinct().ToList();

            // Assign data to vendor comboboxes
            HolderVendorComboBox.ItemsSource    = vendorData;
            ExtensionVendorComboBox.ItemsSource = vendorData;
            ToolVendorComboBox.ItemsSource      = vendorData;
        }
Exemplo n.º 15
0
 private void RefreshCaseEntry()
 {
     if (txtCaseNumber.Text != SqliteDataAcces.CaseNumberPrefix && txtCaseNumber.Text != "")
     {
         CaseEntry ce = SqliteDataAcces.GetCaseEntryLatestVersion(txtCaseNumber.Text);
         if (ce != null)
         {
             txtInterpretation.Text = ce.Interpretation;
             txtResultEntry.Text    = ce.Result;
             txtComment.Text        = ce.Comment;
             txtTumorSynoptic.Text  = ce.TumorSynoptic;
             message.Text           = $"Case entry found by: {ce.AuthorID} ({ce.DateModifiedString} {ce.TimeModifiedString})";
         }
         hasCaseNumberChanged = false;
     }
     else
     {
         message.Text = $"No case entry found";
     }
 }
Exemplo n.º 16
0
        private void InitializeComboBox()
        {
            // Load machine list data and assign to combobox
            List <string> machineData = SqliteDataAcces.LoadListData("Machine", "Tools");

            machineData = machineData.OrderBy(q => q).Distinct().ToList();
            machineComboBox.ItemsSource = machineData;

            // Load type list data and assign to combobox
            List <string> typeData = SqliteDataAcces.LoadComboBoxData("Type", "Machine", machineComboBox.Text);

            typeData = typeData.OrderBy(q => q).Distinct().ToList();
            typeComboBox.ItemsSource = typeData;

            // Load type list data and assign to combobox
            List <string> functionData = SqliteDataAcces.LoadComboBoxData("Function", "Type", typeComboBox.Text);

            functionData = functionData.OrderBy(q => q).Distinct().ToList();
            functionComboBox.ItemsSource = functionData;
        }
Exemplo n.º 17
0
        private void cmbCaseNumber_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            disableVersionChangeevent = true;
            btnPreviousCase.IsEnabled = cmbCaseNumber.SelectedIndex > 0;
            btnNextCase.IsEnabled     = cmbCaseNumber.SelectedIndex < cmbCaseNumber.Items.Count - 1;
            if (cmbCaseNumber.SelectedIndex == -1)
            {
                return;
            }
            var listDateModified = SqliteDataAcces.GetCaseEntryListDateTimeModified(cmbCaseNumber.SelectedValue.ToString());

            cmbVersion.Items.Clear();
            foreach (var l in listDateModified)
            {
                cmbVersion.Items.Add(l.ToString("MM-dd-yyyy HH:mm:ss"));
            }
            cmbVersion.SelectedIndex = cmbVersion.Items.Count - 1;
            refreshCaseData();
            disableVersionChangeevent = false;
        }
Exemplo n.º 18
0
        private void btnImportData_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog theDialog = new OpenFileDialog();

            theDialog.Title  = "Open Excel File";
            theDialog.Filter = "Excel files (.xls)|*.xls";
            ChangeStatusText("Importing data. Please wait...");
            if (theDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try {
                    var softText = File.ReadAllText(theDialog.FileName);
                    CaselyData.SoftPathExcelConvert sc = new SoftPathExcelConvert();
                    var importedData = sc.importSoftPathCSVData(theDialog.FileName);

                    var caselyUserDataEntriesToAdd = new List <CaseEntry>();
                    int casesImportedCount         = 0;
                    int casesAlreadImported        = 0;
                    foreach (var d in importedData)
                    {
                        // Import the cases only if there is not already a report version by both the attending and the resident.
                        if (!(SqliteDataAcces.HasMultipleAuthorEntries(d.CaseNumber)))
                        {
                            caselyUserDataEntriesToAdd.Add(d);
                            casesImportedCount++;
                        }
                        else
                        {
                            casesAlreadImported++;
                        }
                    }
                    SqliteDataAcces.BatchInsertNewCaseEntry(caselyUserDataEntriesToAdd);


                    System.Windows.Forms.MessageBox.Show($"{casesImportedCount/2} cases imported. {casesAlreadImported} already existed in Casely.");
                } catch (Exception ex) {
                    System.Windows.MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                }
                ChangeStatusText("");
            }
        }
Exemplo n.º 19
0
 private void btnAddCase_Click(object sender, RoutedEventArgs e)
 {
     if (txtCaseNumber.Text.Trim() == "" || txtCaseNumber.Text == SqliteDataAcces.CaseNumberPrefix)
     {
         MessageBox.Show("Please enter a case number");
     }
     else if (cmbService.Text == "")
     {
         MessageBox.Show("Please choose a service");
     }
     else if (cmbAuthor.Text == "")
     {
         MessageBox.Show("Please choose an author");
     }
     else
     {
         CaselyUserData pc = new CaselyUserData();
         pc.CaseNumber = txtCaseNumber.Text;
         pc.Service    = cmbService.Text;
         CaseEntry ce          = new CaseEntry();
         DateTime  currentTime = DateTime.Now;
         ce.AuthorID           = cmbAuthor.Text;
         ce.CaseNumber         = txtCaseNumber.Text;
         ce.Interpretation     = txtInterpretation.Text;
         ce.Result             = txtResultEntry.Text;
         ce.Comment            = txtComment.Text;
         ce.TumorSynoptic      = txtTumorSynoptic.Text;
         ce.DateModifiedString = dtCreated.Value.GetValueOrDefault().ToString("yyyy-MM-dd");
         ce.TimeModifiedString = dtCreated.Value.GetValueOrDefault().ToString("HH:mm:ss");
         SqliteDataAcces.InsertNewCaseEntry(ce, pc);
         txtInterpretation.Text = "";
         txtComment.Text        = "";
         txtResultEntry.Text    = "";
         txtTumorSynoptic.Text  = "";
         txtCaseNumber.Text     = SqliteDataAcces.CaseNumberPrefix;
         MessageBox.Show("Case Added");
         dtCreated.Value = DateTime.Now;
     }
 }
Exemplo n.º 20
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            bool deleteSuccesFull;

            var result = MessageBox.Show($"Are you sure you want to delete tool: {toolID}?", "Delete Tool", MessageBoxButton.YesNo, MessageBoxImage.Question);

            // If the no button was pressed ...
            if (result == MessageBoxResult.Yes)
            {
                deleteSuccesFull = SqliteDataAcces.DeleteToolData(toolID);

                if (deleteSuccesFull)
                {
                    MessageBox.Show($"Tool {toolID} succesfully deleted.", "Succesfull", MessageBoxButton.OK, MessageBoxImage.Information);
                    SetDataGrid();
                }
                else
                {
                    MessageBox.Show($"Failed to delete Tool {toolID}!", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }
Exemplo n.º 21
0
        //
        // ---Handle Comboboxes---
        //
        private void InitializeComboBox()
        {
            // Load Type list data and assign to combobox
            List <string> typeData = SqliteDataAcces.LoadListData("ToolType", "ToolTypes");

            typeData = typeData.OrderBy(q => q).Distinct().ToList();
            TypeComboBox.ItemsSource = typeData;

            // Load Holder list data and assign to combobox
            List <string> holderData = SqliteDataAcces.LoadListData("HolderName", "Holders");

            holderData = holderData.OrderBy(q => q).Distinct().ToList();
            HolderComboBox.ItemsSource = holderData;

            // Load machine list data and assign to combobox
            List <string> machineData = SqliteDataAcces.LoadListData("MachineName", "Machines");

            machineData = machineData.OrderBy(q => q).Distinct().ToList();
            MachineComboBox.ItemsSource = machineData;

            // Load function list data and assign to combobox
            List <string> holderVendorData    = SqliteDataAcces.LoadListData("HolderVendor", "Tools");
            List <string> extensionVendorData = SqliteDataAcces.LoadListData("ExtensionVendor", "Tools");
            List <string> toolVendorData      = SqliteDataAcces.LoadListData("ToolVendor", "Tools");

            // Combine vendorData
            var vendorData = holderVendorData.Concat(extensionVendorData)
                             .Concat(toolVendorData)
                             .ToList();

            // Sort data and Remove duplicates
            vendorData = vendorData.OrderBy(q => q).Distinct().ToList();

            // Assign data to vendor comboboxes
            HolderVendorComboBox.ItemsSource    = vendorData;
            ExtensionVendorComboBox.ItemsSource = vendorData;
            ToolVendorComboBox.ItemsSource      = vendorData;
        }
Exemplo n.º 22
0
        private void FillForm()
        {
            //Get data from selected tool
            selectedTool = SqliteDataAcces.LoadToolDataByID(Convert.ToInt32(toolID));

            //Fill in readonly data
            ToolTextBlock.Text       = $"Edit Tool - {toolID}";
            TypeTextBlock.Text       = selectedTool.Type;
            FunctionTextBlock.Text   = selectedTool.Function;
            HolderTextBlock.Text     = selectedTool.Holder;
            MachineTextBlock.Text    = selectedTool.Machine;
            DiameterTextBlock.Text   = selectedTool.Diameter.ToString("F");
            LengthTextBlock.Text     = selectedTool.Length.ToString("F");
            StorageTextBox.Text      = selectedTool.Storage;
            LocationTextBox.Text     = selectedTool.Location;
            DescriptionTextBox.Text  = selectedTool.Description;
            HolderArtTextBox.Text    = selectedTool.HolderArt;
            ExtensionArtTextBox.Text = selectedTool.ExtensionArt;
            ToolArtTextBox.Text      = selectedTool.ToolArt;

            if (selectedTool.HolderVendor != "-" && selectedTool.HolderVendor != "")
            {
                HolderVendorComboBox.Text         = selectedTool.HolderVendor;
                HolderVendorComboBox.SelectedItem = selectedTool.HolderVendor;
            }
            if (selectedTool.ExtensionVendor != "-" && selectedTool.ExtensionVendor != "")
            {
                ExtensionVendorComboBox.Text         = selectedTool.ExtensionVendor;
                ExtensionVendorComboBox.SelectedItem = selectedTool.ExtensionVendor;
            }
            if (selectedTool.ToolVendor != "-" && selectedTool.ToolVendor != "")
            {
                ToolVendorComboBox.Text         = selectedTool.ToolVendor;
                ToolVendorComboBox.SelectedItem = selectedTool.ToolVendor;
            }
        }
Exemplo n.º 23
0
 private List <CaseEntry> SearchByAuthor(string authorID)
 {
     return(SqliteDataAcces.GetCaseEntryFilterAuthorID(authorID));
 }
Exemplo n.º 24
0
 private List <CaseEntry> SearchFilterByInterpretation(string searchTerms)
 {
     return(SqliteDataAcces.FilterCaseEntryInterpretation(searchTerms, Properties.Settings.Default.UserID));
 }
Exemplo n.º 25
0
 private List <CaseEntry> SearchFilterByTumorSynoptic(string searchTerms)
 {
     return(SqliteDataAcces.FilterCaseEntryTumorSynoptic(searchTerms, Properties.Settings.Default.UserID));
 }
Exemplo n.º 26
0
 private List <CaselyUserData> SearchFilterByEvaluationComment(string searchTerms)
 {
     return(SqliteDataAcces.FilterCaseEntryEvaluationComment(searchTerms));
 }
Exemplo n.º 27
0
        private async Task <List <CaselyUserData> > GetAllCaselyUserDataAsync()
        {
            var result = await Task.Run(() => SqliteDataAcces.GetAllCaselyUserData());

            return(result);
        }
Exemplo n.º 28
0
        private async Task <List <CaseEntry> > GetAllCaseEntryAsync()
        {
            var result = await Task.Run(() => SqliteDataAcces.GetListAllCaseEntries());

            return(result);
        }
Exemplo n.º 29
0
        //
        // ---Create new tool when accepting input---
        //
        private void AcceptInput(object sender, RoutedEventArgs e)
        {
            bool userInputOK = CheckUserInput();

            if (userInputOK == false)
            {
                MessageBox.Show("Invalid input", "Invalid input", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            else
            {
                // create new tool instance
                ToolModel newTool = new ToolModel();

                // Create new toolID
                string toolID = CreateToolID();

                if (SqliteDataAcces.SearchDataByText("ToolID", "Tools", "ToolID", toolID).ToList().Count > 0)
                {
                    ToolModel existingTool = SqliteDataAcces.SearchDataByText("Description", "Tools", "ToolID", toolID)[0];
                    MessageBox.Show($"Tool already exists!\n\nToolID: {existingTool.ToolID}\nDescription: {existingTool.Description}", "Existing tool", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                else
                {
                    // Assign info to newTool
                    newTool.ToolID          = Convert.ToInt32(toolID);
                    newTool.Description     = DescriptionTextBox.Text;
                    newTool.Type            = TypeComboBox.Text;
                    newTool.Function        = FunctionComboBox.Text;
                    newTool.Diameter        = Convert.ToDouble(DiameterTextBox.Text);
                    newTool.Length          = Convert.ToDouble(LengthTextBox.Text);
                    newTool.Holder          = HolderComboBox.Text;
                    newTool.Machine         = MachineComboBox.Text;
                    newTool.Storage         = StorageTextBox.Text;
                    newTool.HolderVendor    = HolderVendorComboBox.Text;
                    newTool.HolderArt       = HolderArtTextBox.Text;
                    newTool.ExtensionVendor = ExtensionVendorComboBox.Text;
                    newTool.ExtensionArt    = ExtensionArtTextBox.Text;
                    newTool.ToolVendor      = ToolVendorComboBox.Text;
                    newTool.ToolArt         = ToolArtTextBox.Text;

                    // Write new tool to Database and check if succesfull
                    bool writingSuccesFull = SqliteDataAcces.NewToolRecord(newTool);

                    if (writingSuccesFull)
                    {
                        MessageBox.Show($"Succesfully created new tool.", "Succesfull", MessageBoxButton.OK, MessageBoxImage.Information);

                        // Close window
                        raiseClosingEvent = false;
                        Close();

                        //Refresh data grid
                        ((MainWindow)Owner).SetDataGrid();
                    }
                    else
                    {
                        MessageBox.Show($"Failed to create new tool!", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    }
                }
            }
        }
Exemplo n.º 30
0
        public void refreshSuggestions()
        {
            List <string> standardSuggestOS = new List <string>();

            standardSuggestOS.Add("Gastrointestinal");
            standardSuggestOS.Add("Gynecological");
            standardSuggestOS.Add("Cardiovascular");
            standardSuggestOS.Add("Dermatological");
            standardSuggestOS.Add("Genitourinary");
            standardSuggestOS.Add("Hematological");
            standardSuggestOS.Add("Bone and soft tissue");
            standardSuggestOS.Add("Hepatobiliary");
            standardSuggestOS.Add("Nervous");
            standardSuggestOS.Add("Pulmonary");
            standardSuggestOS.Add("Endocrine");
            suggestionOrganSystem = new List <string>(SqliteDataAcces.GetListOrganSystem());
            foreach (string st in standardSuggestOS)
            {
                if (suggestionOrganSystem.IndexOf(st) == -1)
                {
                    suggestionOrganSystem.Add(st);
                }
            }
            // adds standard suggestions for diagnostic category
            List <string> standardSuggestCategory = new List <string>();

            standardSuggestCategory.Add("Benign");
            standardSuggestCategory.Add("Malignant");
            standardSuggestCategory.Add("Infectious");
            standardSuggestCategory.Add("Normal");
            suggestionCategory = new List <string>(SqliteDataAcces.GetUniqueDiagnosticCategory());
            foreach (string st in standardSuggestCategory)
            {
                if (suggestionCategory.IndexOf(st) == -1)
                {
                    suggestionCategory.Add(st);
                }
            }


            suggestionDiagnosis  = new List <string>(SqliteDataAcces.GetUniqueDiagnosis().Where(x => x.ToString().Trim() != ""));
            suggestionOrgan      = new List <string>(SqliteDataAcces.GetListOrgan().Where(x => x.ToString().Trim() != ""));
            suggestionEvaluation = new ObservableCollection <string>(SqliteDataAcces.GetUniqueEvaluations().Where(x => x.ToString().Trim() != ""));
            suggestionService    = new ObservableCollection <string>(SqliteDataAcces.GetUniqueService().Where(x => x.ToString().Trim() != ""));
            var listeval = new List <string>()
            {
                "NA", "1 - Style changes",
                "2 - Grammar and spelling", "3 - Interpretation - Minor diagnostic alteration", "3 - Microscopic - Minor diagnostic alteration",
                "4 - Interpretation - Major diagnostic alteration", "4 - Interpretation - Major diagnostic alteration", "1 - Perfect"
            };

            foreach (var lv in listeval)
            {
                if (!(suggestionEvaluation.Contains(lv)))
                {
                    suggestionEvaluation.Add(lv);
                }
            }
            suggestionEvaluation = new ObservableCollection <string>(suggestionEvaluation.OrderBy(x => x.ToString()));

            var listService = new List <string>()
            {
                "Routine", "Frozen", "Biopsy"
            };

            foreach (var lv in listService)
            {
                if (!(suggestionService.Contains(lv)))
                {
                    suggestionService.Add(lv);
                }
            }
        }