Exemple #1
0
        private void addResultRows()
        {
            HraModelChangedEventArgs args = new HraModelChangedEventArgs(null);

            args.Persist = false;

            ClearExistingResults();

            if (geneticTest.IsASOTest)
            {
                this.ResultSignificanceNegativeButton.Enabled = false;
                this.ResultSignificanceNegativeButton.Visible = false;

                List <GeneticTestResult> geneticTestResults = geneticTest.owningPMH.RelativeOwningPMH.owningFHx.
                                                              GetUniqueNonNegativeGeneticTestResults(
                    geneticTest.owningPMH.RelativeOwningPMH.relativeID);

                geneticTestResults.Sort(gtrc);

                if (geneticTestResults.Count > 0)
                {
                    flowLayoutPanel1.Controls.Add(new GeneticTestingASOResultRowHeader());
                    this.ResultSignificanceNegativeButton.Visible = true;
                    this.ResultSignificanceNegativeButton.Enabled = true;
                    this.ResultSignificanceNegativeButton.Text    = "Set results Not Found.";

                    this.addResultButton.Visible = false;
                    this.addResultButton.Enabled = false;
                }
                foreach (GeneticTestResult gtr in geneticTestResults)
                {
                    GeneticTestResult geneticTestResult = new GeneticTestResult(geneticTest);
                    geneticTestResult.geneName              = gtr.geneName;
                    geneticTestResult.testInstanceID        = geneticTest.instanceID;
                    geneticTestResult.ASOResultSignificance = gtr.resultSignificance;
                    geneticTestResult.ASOMutationName       = gtr.mutationName;
                    geneticTestResult.ASOMutationAA         = gtr.mutationAA;
                    geneticTestResult.relativeIDofRelative  =
                        gtr.owningGeneticTest.owningPMH.RelativeOwningPMH.relativeID;
                    geneticTestResult.instanceIDofRelative =
                        gtr.owningGeneticTest.instanceID;
                    geneticTestResult.ASOResult = "Unknown";

                    geneticTest.GeneticTestResults.Add(geneticTestResult);

                    GeneticTestingASOResultRow row = new GeneticTestingASOResultRow(geneticTestResult, false);
                    flowLayoutPanel1.Controls.Add(row);
                }
            }
            else
            {
                List <String> geneList = SessionManager.Instance.MetaData.GeneticTests.GetGenesInPanel(geneticTest.panelID);
                if (geneList.Count > 0)
                {
                    flowLayoutPanel1.Controls.Add(new GeneticTestingResultRowHeader());
                    this.ResultSignificanceNegativeButton.Visible = true;
                    this.ResultSignificanceNegativeButton.Enabled = true;
                }
                geneList.Sort();
                foreach (String geneName in geneList)
                {
                    GeneticTestResult gtr = geneticTest
                                            .GeneticTestResults
                                            .SingleOrDefault(
                        r =>
                        ((GeneticTestResult)r).instanceID == geneticTest.instanceID &&
                        ((GeneticTestResult)r).instanceID != 0);


                    if (gtr == null)
                    {
                        gtr = new GeneticTestResult(geneticTest);
                        gtr.testInstanceID = geneticTest.instanceID;
                    }

                    gtr.geneName = geneName;

                    //TODO turn genetic test results into HRAList and use AddToList
                    geneticTest.GeneticTestResults.Add(gtr);

                    Control gtrr = null;
                    if (geneticTest.IsASOTest)
                    {
                        gtrr = new GeneticTestingASOResultRow(gtr, false);
                    }
                    else
                    {
                        gtrr = new GeneticTestingResultRow(gtr, false);
                    }
                    flowLayoutPanel1.Controls.Add(gtrr);
                }
            }

            DoScroll(ScrollEnum.Grow);
        }
Exemple #2
0
        private void GeneticTestChanged(object sender, HraModelChangedEventArgs e)
        {
            if (e.updatedMembers.Contains(geneticTest.GetMemberByName("panelID")))
            {
                if (
                    geneticTest.IsASOTest &&
                    !geneticTest.owningPMH.RelativeOwningPMH.owningFHx
                    .HasUniqueNonNegativeGeneticTestResults(
                        geneticTest.owningPMH.RelativeOwningPMH.relativeID))
                {
                    MessageBox.Show(
                        "This option is only valid for family histories with a known mutation.  " +
                        "Please enter a positive mutation for a relative of this individual before proceeding.",
                        "No known positive mutations in this family.",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);

                    this.addResultButton.Visible = true;
                    this.addResultButton.Enabled = true;

                    return;
                }
                addResultRows();
            }
            if (e.updatedMembers.Contains(geneticTest.GetMemberByName("GeneticTestResults")))
            {
                if (geneticTest.status == "Pending")
                {
                    foreach (Control c in flowLayoutPanel1.Controls)
                    {
                        if (c is GeneticTestingASOResultRow)
                        {
                            GeneticTestingASOResultRow rr = (GeneticTestingASOResultRow)c;
                            rr.SignalTetstObject();
                        }
                        else if (c is GeneticTestingResultRow)
                        {
                            GeneticTestingResultRow rr = (GeneticTestingResultRow)c;
                            rr.SignalTetstObject();
                        }
                    }
                }
                geneticTest.status = "Complete";
                //statusComboBox.Enabled = false;
                statusComboBox.SelectedItem = "Complete";
                this.panelComboBox.Enabled  = false;

                HraModelChangedEventArgs args = new HraModelChangedEventArgs(geneticTestingView);
                args.updatedMembers.Add(geneticTest.GetMemberByName("status"));

                geneticTest.SignalModelChanged(args);

                this.resultsSummary.Text = geneticTest.GetResultSummaryText();
                this.ResultSignificanceNegativeButton.Visible = false;
                this.ResultSignificanceNegativeButton.Enabled = false;
            }
            if (e.updatedMembers.Contains(geneticTest.GetMemberByName("status")))
            {
                if (geneticTest.status.Contains("Informed"))
                {
                    this.geneticTest.GeneticTest_isPtAware = 1;
                }
                if (geneticTest.status == "Complete")
                {
                    this.geneticTest.GeneticTest_isPtAware = 0;
                }
            }
        }
        private void FillControls()
        {
            testYearComboBox.Items.AddRange(UIUtils.getYearList());

            testMonthComboBox.Text = geneticTest.testMonth;
            testYearComboBox.Text = geneticTest.testYear;
            DateTime temp_date;
            if (DateTime.TryParse(geneticTest.testMonth + "/" + geneticTest.testDay + "/" + geneticTest.testYear, new CultureInfo("en-US"), DateTimeStyles.None, out temp_date))
            {
                dateTimePicker1.Value = temp_date;
            }
            String panelName = geneticTest.GetPanelName();
            panelComboBox.Text = panelName;
            statusComboBox.Text = geneticTest.status;
            resultsSummary.Text = geneticTest.GetResultSummaryText();
            if (string.IsNullOrEmpty(geneticTest.GeneticTest_accession) == false)
            {
                textBox1.Text = geneticTest.GeneticTest_accession;
            }
            //if (geneticTest.panelID > 0)
            if(geneticTest.GeneticTestResults.Count>0)
            {
                this.panelComboBox.Enabled = false;
            }

            //if (
            //    geneticTest.status == "Complete" &&
            //    !geneticTest.GeneticTestResults
            //        .Select(tr => tr.resultSignificance)
            //        .All(str => string.IsNullOrEmpty(str))
            //    )
            //{
            //    this.statusComboBox.Enabled = false;
            //}

            //if (
            //    geneticTest.IsASOTest &&
            //    geneticTest.GeneticTestResults
            //        .Select(tr => tr.ASOResult)
            //        .All(str => !string.IsNullOrEmpty(str)))
            //{
            //    this.statusComboBox.Enabled = false;
            //}

            flowLayoutPanel1.Controls.Clear();
            if (geneticTest.GeneticTestResults.Count > 0)
            {
                this.addResultButton.Enabled = true;

                if (this.geneticTest.IsASOTest)
                {
                    flowLayoutPanel1.Controls.Add(new GeneticTestingASOResultRowHeader());
                }
                else
                {
                    flowLayoutPanel1.Controls.Add(new GeneticTestingResultRowHeader());
                }

                List<string> genes = new List<string>();
                geneticTest.GeneticTestResults.Sort(gtrc);
                foreach (GeneticTestResult geneticTestResult in geneticTest.GeneticTestResults)
                {
                    Boolean canDelete = genes.Contains(geneticTestResult.geneName) ||
                                        string.IsNullOrEmpty(geneticTestResult.geneName);
                    genes.Add(geneticTestResult.geneName);

                    Control newRow = null;
                    if (geneticTest.IsASOTest)
                    {
                        newRow = new GeneticTestingASOResultRow(geneticTestResult, canDelete);
                    }
                    else
                    {
                        newRow = new GeneticTestingResultRow(geneticTestResult, canDelete);
                    }

                    if (!geneticTestingView.canModify)
                    {
                        newRow.Enabled = false;
                    }
                    flowLayoutPanel1.Controls.Add(newRow);
                }
            }

            if (!string.IsNullOrEmpty(geneticTest.testDay))
            {
                DisableDateTimeDropdowns();
            }

            DoScroll(ScrollEnum.Grow);
        }
Exemple #4
0
        private void FillControls()
        {
            testYearComboBox.Items.AddRange(UIUtils.getYearList());

            testMonthComboBox.Text = geneticTest.testMonth;
            testYearComboBox.Text  = geneticTest.testYear;
            DateTime temp_date;

            if (DateTime.TryParse(geneticTest.testMonth + "/" + geneticTest.testDay + "/" + geneticTest.testYear, new CultureInfo("en-US"), DateTimeStyles.None, out temp_date))
            {
                dateTimePicker1.Value = temp_date;
            }
            String panelName = geneticTest.GetPanelName();

            panelComboBox.Text  = panelName;
            statusComboBox.Text = geneticTest.status;
            resultsSummary.Text = geneticTest.GetResultSummaryText();
            if (string.IsNullOrEmpty(geneticTest.GeneticTest_accession) == false)
            {
                textBox1.Text = geneticTest.GeneticTest_accession;
            }
            //if (geneticTest.panelID > 0)
            if (geneticTest.GeneticTestResults.Count > 0)
            {
                this.panelComboBox.Enabled = false;
            }

            //if (
            //    geneticTest.status == "Complete" &&
            //    !geneticTest.GeneticTestResults
            //        .Select(tr => tr.resultSignificance)
            //        .All(str => string.IsNullOrEmpty(str))
            //    )
            //{
            //    this.statusComboBox.Enabled = false;
            //}

            //if (
            //    geneticTest.IsASOTest &&
            //    geneticTest.GeneticTestResults
            //        .Select(tr => tr.ASOResult)
            //        .All(str => !string.IsNullOrEmpty(str)))
            //{
            //    this.statusComboBox.Enabled = false;
            //}

            flowLayoutPanel1.Controls.Clear();
            if (geneticTest.GeneticTestResults.Count > 0)
            {
                this.addResultButton.Enabled = true;

                if (this.geneticTest.IsASOTest)
                {
                    flowLayoutPanel1.Controls.Add(new GeneticTestingASOResultRowHeader());
                }
                else
                {
                    flowLayoutPanel1.Controls.Add(new GeneticTestingResultRowHeader());
                }


                List <string> genes = new List <string>();
                geneticTest.GeneticTestResults.Sort(gtrc);
                foreach (GeneticTestResult geneticTestResult in geneticTest.GeneticTestResults)
                {
                    Boolean canDelete = genes.Contains(geneticTestResult.geneName) ||
                                        string.IsNullOrEmpty(geneticTestResult.geneName);
                    genes.Add(geneticTestResult.geneName);

                    Control newRow = null;
                    if (geneticTest.IsASOTest)
                    {
                        newRow = new GeneticTestingASOResultRow(geneticTestResult, canDelete);
                    }
                    else
                    {
                        newRow = new GeneticTestingResultRow(geneticTestResult, canDelete);
                    }

                    if (!geneticTestingView.canModify)
                    {
                        newRow.Enabled = false;
                    }
                    flowLayoutPanel1.Controls.Add(newRow);
                }
            }

            if (!string.IsNullOrEmpty(geneticTest.testDay))
            {
                DisableDateTimeDropdowns();
            }

            DoScroll(ScrollEnum.Grow);
        }
        private void addResultRows()
        {
            HraModelChangedEventArgs args = new HraModelChangedEventArgs(null);
            args.Persist = false;

            ClearExistingResults();

            if (geneticTest.IsASOTest)
            {
                this.ResultSignificanceNegativeButton.Enabled = false;
                this.ResultSignificanceNegativeButton.Visible = false;

                List<GeneticTestResult> geneticTestResults = geneticTest.owningPMH.RelativeOwningPMH.owningFHx.
                    GetUniqueNonNegativeGeneticTestResults(
                    geneticTest.owningPMH.RelativeOwningPMH.relativeID);

                geneticTestResults.Sort(gtrc);

                if (geneticTestResults.Count > 0)
                {
                    flowLayoutPanel1.Controls.Add(new GeneticTestingASOResultRowHeader());
                    this.ResultSignificanceNegativeButton.Visible = true;
                    this.ResultSignificanceNegativeButton.Enabled = true;
                    this.ResultSignificanceNegativeButton.Text = "Set results Not Found.";

                    this.addResultButton.Visible = false;
                    this.addResultButton.Enabled = false;
                }
                foreach (GeneticTestResult gtr in geneticTestResults)
                {
                    GeneticTestResult geneticTestResult = new GeneticTestResult(geneticTest);
                    geneticTestResult.geneName = gtr.geneName;
                    geneticTestResult.testInstanceID = geneticTest.instanceID;
                    geneticTestResult.ASOResultSignificance = gtr.resultSignificance;
                    geneticTestResult.ASOMutationName = gtr.mutationName;
                    geneticTestResult.ASOMutationAA = gtr.mutationAA;
                    geneticTestResult.relativeIDofRelative =
                        gtr.owningGeneticTest.owningPMH.RelativeOwningPMH.relativeID;
                    geneticTestResult.instanceIDofRelative =
                        gtr.owningGeneticTest.instanceID;
                    geneticTestResult.ASOResult = "Unknown";

                    geneticTest.GeneticTestResults.Add(geneticTestResult);

                    GeneticTestingASOResultRow row = new GeneticTestingASOResultRow(geneticTestResult, false);
                    flowLayoutPanel1.Controls.Add(row);
                }
            }
            else
            {
                List<String> geneList = SessionManager.Instance.MetaData.GeneticTests.GetGenesInPanel(geneticTest.panelID);
                if (geneList.Count > 0)
                {
                    flowLayoutPanel1.Controls.Add(new GeneticTestingResultRowHeader());
                    this.ResultSignificanceNegativeButton.Visible = true;
                    this.ResultSignificanceNegativeButton.Enabled = true;
                }
                geneList.Sort();
                foreach (String geneName in geneList)
                {
                    GeneticTestResult gtr = geneticTest
                        .GeneticTestResults
                        .SingleOrDefault(
                            r =>
                                ((GeneticTestResult)r).instanceID == geneticTest.instanceID &&
                                ((GeneticTestResult)r).instanceID!=0);

                    if (gtr == null)
                    {
                        gtr = new GeneticTestResult(geneticTest);
                        gtr.testInstanceID = geneticTest.instanceID;
                    }

                    gtr.geneName = geneName;

                    //TODO turn genetic test results into HRAList and use AddToList
                    geneticTest.GeneticTestResults.Add(gtr);

                    Control gtrr = null;
                    if (geneticTest.IsASOTest)
                    {
                        gtrr = new GeneticTestingASOResultRow(gtr, false);
                    }
                    else
                    {
                        gtrr = new GeneticTestingResultRow(gtr, false);
                    }
                    flowLayoutPanel1.Controls.Add(gtrr);
                }
            }

            DoScroll(ScrollEnum.Grow);
        }