Ejemplo n.º 1
0
        public void Traiter(TextWriter output)
        {
            output.WriteLine("- Connexion à TFS : ");
            TfsManager tfs = new TfsManager(TfsUrl);

            output.WriteLine("- Récupération des fichiers Specflow depuis TFS : ");
            string pathToFeatures = Path.Combine(Path.GetTempPath(), "SpecflowTfs_features_" + DateTime.Now.ToString("yyyyMMddhhmmss"));

            Directory.CreateDirectory(pathToFeatures);
            tfs.DownloadFiles(TfsFolder, "feature", pathToFeatures);

            string pathToTestRunConfig = Path.Combine(Path.GetTempPath(), "SpecflowTfs_testRunConfig_" + DateTime.Now.ToString("yyyyMMddhhmmss"));

            Directory.CreateDirectory(pathToTestRunConfig);
            tfs.DownloadFiles(TfsFolder, "testrunconfig", pathToTestRunConfig);

            string pathToTestProject = Path.Combine(Path.GetTempPath(), "SpecflowTfs_testProject_" + DateTime.Now.ToString("yyyyMMddhhmmss"));

            Directory.CreateDirectory(pathToTestProject);
            tfs.DownloadFiles(TfsFolder, "testrunconfig", pathToTestProject);

            MainBL.Analyser(NomProjet,
                            VersionProjet,
                            pathToFeatures,
                            string.Empty,
                            string.Empty,
                            output);
        }
Ejemplo n.º 2
0
        //Analyze Background Worker start. use Backgroun Worker to keep UI active while analizing.
        private void analyzeBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            hadError      = false;
            _mutationList = new List <Mutation>();
            int i = 1;

            foreach (string[] s in _mutationsDetailsList)
            {
                string chrom    = s[(int)XlsMinPlace.Chrom];
                int    position = Convert.ToInt32(s[(int)XlsMinPlace.Position]);
                string geneName = s[(int)XlsMinPlace.GeneName];
                char   refNuc   = s[(int)XlsMinPlace.Ref][0];
                char   varNuc   = s[(int)XlsMinPlace.Var][0];
                try
                {
                    Mutation tempMutation = MainBL.getMutationByDetails(chrom, position, refNuc, varNuc);
                    if (tempMutation == null)
                    {
                        tempMutation = new Mutation(chrom, position, geneName, refNuc, varNuc);
                    }
                    tempMutation.NumOfShows = Convert.ToInt16(s[(int)XlsMinPlace.NumOfShows]);
                    _mutationList.Add(tempMutation);
                    _analyzeBackgroundWorker.ReportProgress(i);
                    i++;
                }
                catch (Exception)
                {
                    hadError = true;
                    GeneralMethods.showErrorMessageBox("Something Went Wrong, Please try Again");
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public void NumOfPatientWithSameMutationTest()
        {
            int result   = MainBL.getNumOfPatientWithSameMutation("0");
            int expected = 0;

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 4
0
        //When save clicked, gets all patient details from textBoxs and save patient to database.
        private void _savePatientButton_Click(object sender, EventArgs e)
        {
            string testName      = _testNameTextBox.Text;
            string id            = _idTextBox.Text;
            string fName         = _firstNameTextBox.Text;
            string lName         = _lastNameTextBox.Text;
            string pathoNum      = _pathologicalNoTextBox.Text;
            string runNum        = _runNoTextBox.Text;
            string tumourSite    = _tumourSiteTextBox.Text;
            string diseaseLevel  = _diseaseLevelTextBox.Text;
            string prevTreatment = _previousTreatmentTextBox.Text;
            string currTreatment = _currentTreatmentTextBox.Text;
            string background    = _backgroundTextBox.Text;
            string conclusion    = _conclusionsTextBox1.Text;

            //validate textboxs text
            if (!(id.Equals("") || fName.Equals("") || lName.Equals("") || pathoNum.Equals("") || runNum.Equals("") || tumourSite.Equals("")))
            {
                //check if patient with same test name allready exist.
                Patient p = new Patient(testName, id, fName, lName, pathoNum, runNum, tumourSite, diseaseLevel, background, prevTreatment, currTreatment, conclusion);
                try
                {
                    //If Exist, show message for overwriting.
                    if (MainBL.patientExistByTestName(testNmae))
                    {
                        if (MessageBox.Show("TEST NAME allready exist, Overwrite?", "Notice", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            MainBL.updatePatient(testName, id, fName, lName, pathoNum, runNum, tumourSite, diseaseLevel, background, prevTreatment, currTreatment, conclusion);
                            _mainForm.CurrPatient  = p;
                            _mutationList          = MainBL.getMutationListByTestName(p.TestName);
                            _mainForm.MutationList = _mutationList;
                            MessageBox.Show("Patient saved successfully");
                        }
                    }
                    //If not Exist, insert new patient to database.
                    else
                    {
                        MainBL.addPatient(testName, id, fName, lName, pathoNum, runNum, tumourSite, diseaseLevel, prevTreatment, currTreatment, background, conclusion);
                        _mainForm.CurrPatient  = p;
                        _mainForm.MutationList = _mutationList;
                        foreach (Mutation m in _mutationList)
                        {
                            MainBL.addMatch(testName, m.MutId);
                        }
                        MessageBox.Show("Patient saved successfully");
                    }
                }
                catch (Exception)
                {
                    GeneralMethods.showErrorMessageBox("Something Went Wrong, Please try Again");
                }
            }
            else
            {
                ToolTip errorToolTip = new ToolTip();
                errorToolTip.SetToolTip(_savePatientButton, "digit only");
                errorToolTip.Show("Please Fill All Details", _savePatientButton, 800);
            }
            colorTextBoxs();
        }
Ejemplo n.º 5
0
        public void FalsePatientExistTest()
        {
            bool result   = MainBL.patientExistByTestName("000");
            bool expected = false;

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 6
0
        public void GetCosmicDetailsTest()
        {
            List <string> sl       = MainBL.getCosmicDetails("3", 178952085, 'A', 'G');
            bool          result   = (sl != null);
            bool          expected = true;

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 7
0
        public void FalseGetCosmicDetailsTest()
        {
            List <string> sl       = MainBL.getCosmicDetails("25", 0, 'A', 'A');
            bool          result   = (sl == null);
            bool          expected = true;

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 8
0
        public void GetGeneThatNotExistTest()
        {
            Gene g        = MainBL.getGene("TestGeneName", "TestChrom");
            bool result   = (g == null);
            bool expected = true;

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 9
0
        public void AddGeneTest()
        {
            MainBL.addGene("PIK3CA", "chr3");
            Gene g        = MainBL.getGene("PIK3CA", "chr3");
            bool result   = (g != null);
            bool expected = true;

            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 10
0
 //Get mutation list of patient by test name, and sets the list to the MutationUserControl in MainForm
 public void loadMutationDetails(Patient p)
 {
     try
     {
         _mutationList          = MainBL.getMutationListByTestName(_patient.TestName);
         _mainForm.MutationList = _mutationList;
         initPatientUC(_mutationList, _patient.TestName);
         _mainForm.MutationUC.initTable(_mutationList);
         _mainForm.ArticlesUC.initArticleUC(_mutationList);
     }
     catch (Exception)
     {
         GeneralMethods.showErrorMessageBox("Something Went Wrong, Please try Again");
     }
 }
Ejemplo n.º 11
0
 //Initialize the table with the details from the mutation list.
 public void initTable(List <Mutation> mutationList)
 {
     _mutationList = mutationList;
     if (_mutationList != null)
     {
         foreach (Mutation m in _mutationList)
         {
             DataGridViewRow tempRow = new DataGridViewRow();
             tempRow.CreateCells(mutationDataGridView);
             tempRow.Cells[0].Value  = m.Chrom;
             tempRow.Cells[1].Value  = m.Position;
             tempRow.Cells[2].Value  = m.GeneName;
             tempRow.Cells[3].Value  = m.Ref;
             tempRow.Cells[4].Value  = m.Var;
             tempRow.Cells[5].Value  = m.Strand;
             tempRow.Cells[6].Value  = m.RefCodon;
             tempRow.Cells[7].Value  = m.VarCodon;
             tempRow.Cells[8].Value  = m.RefAA;
             tempRow.Cells[9].Value  = m.VarAA;
             tempRow.Cells[10].Value = m.PMutationName;
             tempRow.Cells[11].Value = m.CMutationName;
             tempRow.Cells[12].Value = m.CosmicName;
             tempRow.Cells[13].Value = m.NumOfShows;
             try
             {
                 int historyNum = MainBL.getNumOfPatientWithSameMutation(m.MutId);
                 if (historyNum == 0)
                 {
                     tempRow.Cells[14] = new DataGridViewTextBoxCell();
                 }
                 tempRow.Cells[14].Value = historyNum;
                 if (!m.CosmicName.Equals("-----"))
                 {
                     tempRow.DefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#ABCDEF");
                 }
                 mutationDataGridView.Rows.Add(tempRow);
                 mutationDataGridView.PerformLayout();
             }
             catch (Exception)
             {
                 GeneralMethods.showErrorMessageBox("Something Went Wrong, Please try Again");
             }
         }
     }
 }
Ejemplo n.º 12
0
 //occurs when cell clicked in dataGridView, use only in history field,Open the history form for current mutation.
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 14)
     {
         string mutationId = _mutationList.ElementAt(e.RowIndex).MutId;
         try
         {
             List <Patient> patientList = MainBL.getPatientListWithMutation(mutationId);
             HistoryForm    hf          = new HistoryForm(patientList, _mainForm);
             _mainForm.Enabled = false;
             hf.Show();
         }
         catch (Exception)
         {
             GeneralMethods.showErrorMessageBox("Something Went Wrong, Please try Again");
         }
     }
 }
Ejemplo n.º 13
0
        //When search clicked, get the id from the idTextBox, search if patient with that id exist.
        //If exist creates a new SerchResultForm and show the results, If not, Shows appropriate message
        private void _searchPatientButton_Click(object sender, EventArgs e)
        {
            string patientId = idToLoadTextBox.Text;

            try
            {
                List <Patient> patientList = MainBL.getPatientListById(patientId);
                if (patientList != null)
                {
                    _mainForm.Enabled = false;
                    SearchResultForm srf = new SearchResultForm(patientList, _mainForm);
                    srf.Show();
                }
                else
                {
                    GeneralMethods.showErrorMessageBox("Wrong ID, No patient found.");
                }
            }
            catch (Exception)
            {
                GeneralMethods.showErrorMessageBox("Something Went Wrong, Please try Again");
            }
        }
Ejemplo n.º 14
0
        //static void Main(string[] args)
        //{
        //    string url = "http://localhost:8089";
        //    using (WebApp.Start(url))
        //    {
        //        Console.WriteLine("Server running on {0}", url);

        //        Console.WriteLine("-- Press <Enter> to quit --");
        //        Console.ReadLine();
        //    }
        //}

        static void Main(string[] args)
        {
            if (!args.Any())
            {
                ShowHelp();
                return;
            }

            string argProjectName    = args.FirstOrDefault(a => a.StartsWith("-projectName="));
            string argProjectVersion = args.FirstOrDefault(a => a.StartsWith("-projectVersion="));
            string argProjectFolder  = args.FirstOrDefault(a => a.StartsWith("-projectFolder="));
            string argMsTestDll      = args.FirstOrDefault(a => a.StartsWith("-testDll="));
            string argMsTestSetting  = args.FirstOrDefault(a => a.StartsWith("-testSetting="));

            if (string.IsNullOrEmpty(argProjectName) ||
                string.IsNullOrEmpty(argProjectVersion) ||
                string.IsNullOrEmpty(argProjectFolder) ||
                string.IsNullOrEmpty(argMsTestDll))
            {
                ShowHelp();
                return;
            }
            string nomProjet     = argProjectName.Split('=').Last();
            string versionProjet = argProjectVersion.Split('=').Last();
            string folderProjet  = argProjectFolder.Split('=').Last();
            string dllTestFile   = argMsTestDll.Split('=').Last();
            string testSetting   = string.IsNullOrEmpty(argMsTestSetting) ? string.Empty : argMsTestSetting.Split('=').Last();

            Console.WriteLine("--------------------------------------------------------------");
            Console.WriteLine("-> Nom projet : " + nomProjet);
            Console.WriteLine("-> Version projet : " + versionProjet);
            Console.WriteLine("-> Path vers *.features : " + folderProjet);
            Console.WriteLine("-> Path vers fichier DLL : " + dllTestFile);
            Console.WriteLine("-> Path vers test settings : " + testSetting);
            Console.WriteLine("--------------------------------------------------------------\n");

            Console.WriteLine("Traitement en cours...");
            try
            {
                MainBL.Analyser(
                    nomProjet,
                    versionProjet,
                    folderProjet,
                    dllTestFile,
                    testSetting,
                    Console.Out);
            }
            catch (ExceptionFonctionnelle ex)
            {
                Console.WriteLine(ex.Message);
                Journal.EcrireTraceErreur(ex.Message, ex);
            }
            catch (ExceptionTechnique ex)
            {
                Console.WriteLine(ex.Message);
                Journal.EcrireTraceCritique(ex.Message, ex);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Journal.EcrireTraceCritique(ex.Message, ex);
            }

            Console.WriteLine("\n\nAppuyer sur ENTREE pour fermer le programme.");
            Console.ReadLine();
        }