public void ThenTheSampleWithWrongLocationDontAddToSorting()
        {
            MSDatabaseConnector _msBDConnectorLW = new MSDatabaseConnector(Config.MSDbLW);
            string command1   = $@"select TOP(1) s.TEXT_ID from test t with (nolock)
            inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
            where t.status='I' and t.ANALYSIS='HELICOBACTER_PYLORI_ДНК' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = 'HELIX-SPB' ";
            var    result_spb = _msBDConnectorLW.QueryExecutorScalar(command1);
            string command2   = $@"select TOP(1) s.TEXT_ID from test t with (nolock)
            inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
            where t.status='I' and t.ANALYSIS='HELICOBACTER_PYLORI_ДНК' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = 'HELIX-MSK' ";
            var    result_msk = _msBDConnectorLW.QueryExecutorScalar(command2);

            BDSortingPage sortingPage = new BDSortingPage();

            sortingPage.IsSampleCodeFieldActive();
            // Добавление образца с локацией Санкт-Петербург
            sortingPage.CodeInputField.SendKeys(result_spb);
            sortingPage.CodeInputField.SendKeys(Keys.Enter);
            sortingPage.IsSampleCodeFieldActive();
            // Добавление образца с локацией Москва
            sortingPage.CodeInputField.SendKeys(result_msk);
            sortingPage.CodeInputField.SendKeys(Keys.Enter);
            sortingPage.IsSampleCodeFieldActive();

            sortingPage.EndBatch();
        }
Example #2
0
        public void WhenIConfirmParent_BatchIdForStartSorting()
        {
            BDMainPage BDMain = new BDMainPage();

            BDMain.OpenSorting();
            IsTrue(BDMain.AssertOpenSorting(), "Заголовок рабочего места не найден");

            BDSortingPage sortingPage = new BDSortingPage();

            sortingPage.AssertTheButtonIsVisible();
            sortingPage.ClickCreateBatch();
            sortingPage.AssertTheConfirmBatchFieldIsVisible();
            sortingPage.SetParentBatchID();
        }
        public void ThenIFill_OutTheSorting_PlanchetBySamplesOfTest(int count, string testname)
        {
            MSDatabaseConnector _msBDConnectorLW = new MSDatabaseConnector(Config.MSDbLW);
            string        command     = $@"select TOP({count}) s.TEXT_ID from test t with (nolock)
            inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
            where t.status='I' and t.ANALYSIS='{testname}' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = 'HELIX-SPB' ";
            var           result      = _msBDConnectorLW.QueryExecutor(command);
            BDSortingPage sortingPage = new BDSortingPage();

            sortingPage.IsSampleCodeFieldActive();

            foreach (string i in result)
            {
                sortingPage.CodeInputField.SendKeys(i);
                sortingPage.CodeInputField.SendKeys(Keys.Enter);
                sortingPage.IsSampleCodeFieldActive();
            }
        }
Example #4
0
        public void ThenIFill_OutTheSorting_PlanchetBySamplesOwnOfUnionTestWithBiomaterialAndLocationAndVKAndOKOAndPKO(int count, string own, string union, List <String> testname, string bm, string location, List <String> VKName, List <String> OKOName, List <String> PKOName)
        {
            //переходим в РМ сортировка
            BDMainPage BDMain = new BDMainPage();

            BDMain.OpenSorting();
            IsTrue(BDMain.AssertOpenSorting(), "Заголовок рабочего места не найден");
            // создаем новый бэтч
            BDSortingPage sortingPage = new BDSortingPage();

            sortingPage.AssertTheButtonIsVisible();
            sortingPage.ClickCreateBatch();
            sortingPage.AssertTheConfirmBatchFieldIsVisible();
            sortingPage.SetParentBatchID();
            // подтверждаем своим ШК
            BDPlanshetPositionPage bDPlanshetPositionPage = new BDPlanshetPositionPage();

            IsTrue(bDPlanshetPositionPage.AssertConfirmBatchWindow(), "Нет окна для подтверждения установки планшета");
            bDPlanshetPositionPage.ConfirmUsercodeInPlanshetPositionPage();
            {
                int countOfTests = testname.Count();
                MSDatabaseConnector _msBDConnectorLW = new MSDatabaseConnector(Config.MSDbLW);
                string command = "";

                if (own == "only") // для случая, когда образец назначен ТОЛЬКО на тест/тесты
                {
                    if (countOfTests == 1)
                    {
                        command = $@"USE LW08v6
                    select TOP({count}) s.TEXT_ID
                    from
                    (select SAMPLE_NUMBER, count(ANALYSIS) as TestCommonCount
                    from [LW08v6].[dbo].[TEST] t with (nolock) 
                    group by SAMPLE_NUMBER
                    having count(ANALYSIS) = 1) MonoSamples
                    join TEST t on t.SAMPLE_NUMBER = MonoSamples.SAMPLE_NUMBER
                    join SAMPLE s on S.SAMPLE_NUMBER = t.SAMPLE_NUMBER
                    where t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' 
                    and s.LOCATION = '{location}' and t.ANALYSIS='{testname[0]}' and s.SAMPLE_TYPE ='{bm}'";
                    }
                    if (countOfTests == 2)
                    {
                        if (union == "")
                        {
                            command = $@"USE LW08v6
                    select TOP({count}) s.TEXT_ID as Sample
                    from TEST t
                    join SAMPLE s on t.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                    where  t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and s.SAMPLE_TYPE ='{bm}'
                    and t.ANALYSIS = '{testname[0]}' 
                    and exists (select top 1 1 from TEST t1 where  t1.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                    and t1.ANALYSIS = '{testname[1]}') 
                    and not exists (select top 1 1 from TEST t1 where  t1.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                    and t1.ANALYSIS not in  ('{testname[0]}', '{testname[1]}'))";
                        }
                        else if (union == "on")
                        {
                            command = $@"USE LW08v6 
                    select top({count}) s.TEXT_ID, s.STATUS, t.STATUS, s.RECD_DATE, s.ORDER_NUM, s.sample_type, t.ANALYSIS from test t with(nolock)
                    inner join SAMPLE s with(nolock) on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    where t.status='I' and t.ANALYSIS='{testname[0]}' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and sample_type='{bm}'
                    union
                    select top({count}) s.TEXT_ID, s.STATUS, t.STATUS, s.RECD_DATE, s.ORDER_NUM, s.sample_type, t.ANALYSIS from test t with(nolock)
                    inner join SAMPLE s with(nolock) on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    where t.status='I' and t.ANALYSIS='{testname[1]}' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and sample_type='{bm}'";
                        }
                    }
                }

                if (countOfTests == 2) // если 2 теста в коллекции, выполняем скрипт:
                {
                    if (union == "")
                    {
                        command = $@"USE LW08v6
                    select TOP({count}) Sample
                    from
                    (select s.TEXT_ID as Sample, t.ANALYSIS as Test
                    from TEST t
                    join SAMPLE s on t.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                    where  t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and s.SAMPLE_TYPE ='{bm}'
                    and t.ANALYSIS in ('{testname[0]}', '{testname[1]}')
                    group by TEXT_ID, ANALYSIS) sub
                    group by Sample
                    having count(Test) = 2";
                    }
                    else if (union == "on")
                    {
                        command = $@"USE LW08v6 
                    select top({count}) s.TEXT_ID from test t with(nolock)
                    inner join SAMPLE s with(nolock) on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    where t.status='I' and t.ANALYSIS='{testname[0]}' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and sample_type='{bm}'
                    union
                    select top({count}) s.TEXT_ID from test t with(nolock)
                    inner join SAMPLE s with(nolock) on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    where t.status='I' and t.ANALYSIS='{testname[1]}' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and sample_type='{bm}'";
                    }
                }
                else if (countOfTests == 1) // если 1 тест в коллекции, выполняем скрипт:
                {
                    command = $@"USE LW08v6
                SELECT TOP({count}) s.TEXT_ID FROM test t with (nolock)
                inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                WHERE t.status='I' and t.ANALYSIS='{testname[0]}' 
                and s.TEMPLATE = 'smp_in' and s.status='I' and s.SAMPLE_TYPE ='{bm}' 
                and s.LOCATION = '{location}'";
                }
                else if (countOfTests == 3) // если 3 теста в коллекции, выполняем скрипт:
                {
                    command = $@"USE LW08v6
                select TOP ({count})Sample
                from
                (select s.TEXT_ID as Sample, t.ANALYSIS as Test
                from TEST t
                join SAMPLE s on t.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                where  t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and s.SAMPLE_TYPE ='{bm}'
                and t.ANALYSIS in ('{testname[0]}', '{testname[1]}','{testname[2]}')
                group by TEXT_ID, ANALYSIS) sub
                group by Sample
                having count(Test) = 3";
                }


                var result = _msBDConnectorLW.QueryExecutor(command);

                //sortingPage.IsSampleCodeFieldActive(); // закомментировано. 110719 стало зависать. Ранее работало.
                sortingPage.CodeInputField.WaitForClickability();

                foreach (string i in result)
                {
                    sortingPage.CodeInputField.SendKeys(i);
                    sortingPage.CodeInputField.SendKeys(Keys.Enter);
                    //sortingPage.IsSampleCodeFieldActive(); // закомментировано. 110719 стало зависать. Ранее работало.
                    sortingPage.CodeInputField.WaitForClickability();
                    if (sortingPage.FieldWithUsercodePlaceholder.Exists())
                    {
                        sortingPage.FieldWithUsercodePlaceholder.SendKeys(Config.UserBarCode);
                        sortingPage.FieldWithUsercodePlaceholder.SendKeys(Keys.Enter);
                    }
                }
                if (sortingPage.CompleteAddSamplesButton.Exists() && !sortingPage.CompleteAddSamplesButtonDisable.Disabled)
                {
                    sortingPage.CompleteAddSamplesButton.Click();
                    sortingPage.ConfirmEndOfSamplesButton.Click();
                }
                else if (sortingPage.CompleteAddSamplesButton.Exists() && sortingPage.CompleteAddSamplesButtonDisable.Disabled)
                {
                    sortingPage.CodeInputField.SendKeys(Config.UserBarCode);  //
                    sortingPage.CodeInputField.SendKeys(Keys.Enter);
                }
                else if (sortingPage.CompleteBatchButton.Exists())
                {
                    sortingPage.CompleteBatchButton.Click();
                    sortingPage.ConfirmEndOfSamplesButton.Click();
                }
                System.Threading.Thread.Sleep(500);

                if (sortingPage.CodeInputField.Exists())
                {
                    sortingPage.CodeInputField.WaitForAvailability();
                    sortingPage.CodeInputField.WaitForVisibility();
                    sortingPage.CodeInputField.WaitForClickability();
                }
                // Подтверждается раскапывание ВК
                if (VKName[0] != "")
                {
                    foreach (string j in VKName)
                    {
                        sortingPage.SetValueOfKM(j);
                        Debug.WriteLine("Раскапан " + j);
                    }
                    //     sortingPage.SetValueOfKM(VKName);
                }
                // Подтверждается раскапывание ОКО
                if (OKOName[0] != "")
                {
                    foreach (string k in OKOName)
                    {
                        sortingPage.SetValueOfKM(k);
                        Debug.WriteLine("Раскапан " + k);
                    }
                }
                // Подтверждается раскапывание ПКО
                if (PKOName[0] != "")
                {
                    foreach (string m in PKOName)
                    {
                        sortingPage.SetValueOfKM(m);
                        Debug.WriteLine(DateTime.Now + "Раскапан " + m);
                    }
                }
            }
        }
        public void ThenTheSampleDontAddToSortingBatch()
        {
            BDSortingPage sortingPage = new BDSortingPage();

            IsTrue(sortingPage.AssertTheFirstCellIsGrey(), "ячейка не серого цвета");
        }
        public void ThenICheckTitleForCanceledBatch()
        {
            BDSortingPage sortingPage = new BDSortingPage();

            IsTrue(sortingPage.AssertCanseledBatchTitle(), "Не найден заголовок об отмененном бэтче");
        }
Example #7
0
        public void ThenITryToAddASampleOfTestAndLocationAndBiomaterialResultsInSortingWorkplace(string test, string location, string bm, string type, string wp)
        {
            BDMainPage BDMain = new BDMainPage();

            if (wp == "sorting")
            {
                BDMain.OpenSorting();
                IsTrue(BDMain.AssertOpenSorting(), "Заголовок рабочего места не найден");
                // создаем новый бэтч
                BDSortingPage sortingPage = new BDSortingPage();
                sortingPage.AssertTheButtonIsVisible();
                sortingPage.ClickCreateBatch();
                sortingPage.AssertTheConfirmBatchFieldIsVisible();
                sortingPage.SetParentBatchID();
                // подтверждаем своим ШК
                BDPlanshetPositionPage bDPlanshetPositionPage = new BDPlanshetPositionPage();
                IsTrue(bDPlanshetPositionPage.AssertConfirmBatchWindow(), "Нет окна для подтверждения установки планшета");
                bDPlanshetPositionPage.ConfirmUsercodeInPlanshetPositionPage();
                MSDatabaseConnector _msBDConnectorLW = new MSDatabaseConnector(Config.MSDbLW);
                string command = "";
                if (type == "with")
                {
                    command = $@"select top 1 s.TEXT_ID
                    from test t with (nolock)
                    inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    left join RESULT r on s.SAMPLE_NUMBER = r.SAMPLE_NUMBER
                    where t.status='A' and s.TEMPLATE = 'smp_in' and r.RESULT_NUMBER is not NULL and r.ENTRY is not NULL 
                    and s.LOCATION = '{location}' and t.ANALYSIS = '{test}' and s.SAMPLE_TYPE ='{bm}'";
                }
                else if (type == "without")
                {
                    command = $@"select top 1 s.TEXT_ID from test t 
                    inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    inner join [RESULT] r on s.SAMPLE_NUMBER = r.SAMPLE_NUMBER
                    where t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I'
                    and s.LOCATION = '{location}'and t.ANALYSIS = '{test}'and s.SAMPLE_TYPE ='{bm}'";
                }
                var result = _msBDConnectorLW.QueryExecutor(command);
                sortingPage.CodeInputField.WaitForClickability();

                foreach (string i in result)
                {
                    sortingPage.CodeInputField.SendKeys(i);
                    sortingPage.CodeInputField.SendKeys(Keys.Enter);
                    Thread.Sleep(1500);
                }
            }
            else if (wp == "isolation")
            {
                BDMain.OpenDNKWorkplace();
                IsTrue(BDMain.AssertOpenDNKWorkplace(), "Заголовок рабочего места не найден");
                BDIsolationDNKPage bDIsolationDNKPage = new BDIsolationDNKPage();
                bDIsolationDNKPage.AssertTheButtonIsVisible();
                bDIsolationDNKPage.ClickCreateBatch();
                bDIsolationDNKPage.AssertBatchIsCreated();
                bDIsolationDNKPage.SetParentBatchID();
                BDPlanshetPositionPage bDPlanshetPositionPage = new BDPlanshetPositionPage();
                Thread.Sleep(500);
                // подтверждаем своим ШК
                IsTrue(bDPlanshetPositionPage.AssertConfirmBatchWindow(), "Нет окна для подтверждения установки планшета");
                bDPlanshetPositionPage.ConfirmUsercodeInPlanshetPositionPage();
                // bDPlanshetPositionPage.NewWindowConfirmUsercode();

                MSDatabaseConnector _msBDConnectorLW = new MSDatabaseConnector(Config.MSDbLW);
                string command = "";
                if (type == "with")
                {
                    command = $@"select top 1 s.TEXT_ID
                    from test t with (nolock)
                    inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    left join RESULT r on s.SAMPLE_NUMBER = r.SAMPLE_NUMBER
                    where t.status='A' and s.TEMPLATE = 'smp_in' and r.RESULT_NUMBER is not NULL and r.ENTRY is not NULL 
                    and s.LOCATION = '{location}' and t.ANALYSIS = '{test}' and s.SAMPLE_TYPE ='{bm}'";
                }
                else if (type == "without")
                {
                    command = $@"select top 1 s.TEXT_ID from test t 
                    inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    inner join [RESULT] r on s.SAMPLE_NUMBER = r.SAMPLE_NUMBER
                    where t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I'
                    and s.LOCATION = '{location}'and t.ANALYSIS = '{test}'and s.SAMPLE_TYPE ='{bm}'";
                }
                var result = _msBDConnectorLW.QueryExecutor(command);
                bDIsolationDNKPage.AddSample(result);
            }
        }
        public void ThenITryToFill_OutTheSorting_PlanchetBySamplesOfTestWithBiomaterialAndLocationAndVKAndOKOAndPKO(int count, string own, List <String> testname, string bm, string location, List <String> VKName, List <String> OKOName, List <String> PKOName)
        {
            //переходим в РМ сортировка
            BDMainPage BDMain = new BDMainPage();

            BDMain.OpenSorting();
            IsTrue(BDMain.AssertOpenSorting(), "Заголовок рабочего места не найден");
            // создаем новый бэтч
            BDSortingPage sortingPage = new BDSortingPage();

            sortingPage.AssertTheButtonIsVisible();
            sortingPage.ClickCreateBatch();
            sortingPage.AssertTheConfirmBatchFieldIsVisible();
            sortingPage.SetParentBatchID();
            // подтверждаем своим ШК
            BDPlanshetPositionPage bDPlanshetPositionPage = new BDPlanshetPositionPage();

            IsTrue(bDPlanshetPositionPage.AssertConfirmBatchWindow(), "Нет окна для подтверждения установки планшета");
            bDPlanshetPositionPage.ConfirmUsercodeInPlanshetPositionPage();
            {
                int countOfTests = testname.Count();
                MSDatabaseConnector _msBDConnectorLW = new MSDatabaseConnector(Config.MSDbLW);
                string command = "";

                if (own == "only") // для случая, когда образец назначен ТОЛЬКО на тест/тесты
                {
                    if (countOfTests == 1)
                    {
                        command = $@"USE LW08v6
                    select TOP({count}) s.TEXT_ID
                    from
                    (select SAMPLE_NUMBER, count(ANALYSIS) as TestCommonCount
                    from [LW08v6].[dbo].[TEST] t with (nolock) 
                    group by SAMPLE_NUMBER
                    having count(ANALYSIS) = 1) MonoSamples
                    join TEST t on t.SAMPLE_NUMBER = MonoSamples.SAMPLE_NUMBER
                    join SAMPLE s on S.SAMPLE_NUMBER = t.SAMPLE_NUMBER
                    where t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' 
                    and s.LOCATION = '{location}' and t.ANALYSIS='{testname[0]}' and s.SAMPLE_TYPE ='{bm}'";
                    }
                    if (countOfTests == 2)
                    {
                        command = $@"USE LW08v6
                    select TOP({count}) s.TEXT_ID as Sample
                    from TEST t
                    join SAMPLE s on t.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                    where  t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and s.SAMPLE_TYPE ='{bm}'
                    and t.ANALYSIS = '{testname[0]}' 
                    and exists (select top 1 1 from TEST t1 where  t1.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                    and t1.ANALYSIS = '{testname[1]}') 
                    and not exists (select top 1 1 from TEST t1 where  t1.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                    and t1.ANALYSIS not in  ('{testname[0]}', '{testname[1]}'))";
                    }
                }

                if (countOfTests == 2) // если 2 теста в коллекции, выполняем скрипт:
                {
                    command = $@"USE LW08v6
                select TOP({count}) Sample
                from
                (select s.TEXT_ID as Sample, t.ANALYSIS as Test
                from TEST t
                join SAMPLE s on t.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                where  t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and s.SAMPLE_TYPE ='{bm}'
                and t.ANALYSIS in ('{testname[0]}', '{testname[1]}')
                group by TEXT_ID, ANALYSIS) sub
                group by Sample
                having count(Test) = 2";
                }
                else if (countOfTests == 1) // если 1 тест в коллекции, выполняем скрипт:
                {
                    command = $@"USE LW08v6
                SELECT TOP({count}) s.TEXT_ID FROM test t with (nolock)
                inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                WHERE t.status='I' and t.ANALYSIS='{testname[0]}' 
                and s.TEMPLATE = 'smp_in' and s.status='I' and s.SAMPLE_TYPE ='{bm}' 
                and s.LOCATION = '{location}'";
                }
                else if (countOfTests == 3) // если 3 теста в коллекции, выполняем скрипт:
                {
                    command = $@"USE LW08v6
                select TOP ({count})Sample
                from
                (select s.TEXT_ID as Sample, t.ANALYSIS as Test
                from TEST t
                join SAMPLE s on t.SAMPLE_NUMBER = s.SAMPLE_NUMBER
                where  t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' and s.LOCATION = '{location}' and s.SAMPLE_TYPE ='{bm}'
                and t.ANALYSIS in ('{testname[0]}', '{testname[1]}','{testname[2]}')
                group by TEXT_ID, ANALYSIS) sub
                group by Sample
                having count(Test) = 3";
                }


                var result = _msBDConnectorLW.QueryExecutor(command);


                //sortingPage.IsSampleCodeFieldActive(); // закомментировано. 110719 стало зависать. Ранее работало.
                sortingPage.CodeInputField.WaitForClickability();

                foreach (string i in result)
                {
                    sortingPage.CodeInputField.SendKeys(i);
                    sortingPage.CodeInputField.SendKeys(Keys.Enter);
                    //sortingPage.IsSampleCodeFieldActive(); // закомментировано. 110719 стало зависать. Ранее работало.
                    //sortingPage.CodeInputField.WaitForClickability();
                    IsTrue(sortingPage.DNASampleMessage.Exists(), "Не появилось сообщение об ошибке");
                }
            }
        }
Example #9
0
        public void WhenBeingInWorkplaceIAddSampleOfTestAndLocationAndBiomaterialResults(string wp, int count, string test, string location, string bm, string type)
        {
            // ОПИСЫВАЕТ ДОБАВЛЕНИЕ В ОТКРЫТОЕ РМ СОРТИРОВКА/ВЫДЕЛЕНИЕ НЕСКОЛЬКИХ ОБРАЗЦОВ, КОТОРЫХ ЕЩЕ НЕ ДОБАВЛЯЛИ.
            // ПРОСТО ДОБАВЛЕНИЕ, ПОПЫТКА. НЕГАТИВНЫЙ КЕЙС.
            BDMainPage BDMain = new BDMainPage();

            if (wp == "sorting")
            {
                IsTrue(BDMain.AssertOpenSorting(), "Заголовок рабочего места не найден");
                MSDatabaseConnector _msBDConnectorLW = new MSDatabaseConnector(Config.MSDbLW);
                string command = "";
                if (type == "with") // выбор образцов с результатами, которые еще НЕ были добавлены в базу BD
                {
                    command = $@"select top 1 s.TEXT_ID
                    from test t with (nolock)
                    inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    left join RESULT r on s.SAMPLE_NUMBER = r.SAMPLE_NUMBER
                    where t.status='A' and s.TEMPLATE = 'smp_in' and r.RESULT_NUMBER is not NULL and r.ENTRY is not NULL 
                    and s.LOCATION = '{location}' and t.ANALYSIS = '{test}' and s.SAMPLE_TYPE ='{bm}'
                    and s.SAMPLE_NUMBER not in (select [LwSampleNumber] from [BatchDropperStab].[dbo].[Samples] )";
                }
                else if (type == "without") // выбор образцов без результатов, которые еще НЕ были добавлены в базу BD
                {
                    command = $@"select top 1 s.TEXT_ID from test t 
                    inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    inner join [RESULT] r on s.SAMPLE_NUMBER = r.SAMPLE_NUMBER
                    where t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I'
                    and s.LOCATION = '{location}'and t.ANALYSIS = '{test}'and s.SAMPLE_TYPE ='{bm}'
                    and s.SAMPLE_NUMBER not in (select [LwSampleNumber] from [BatchDropperStab].[dbo].[Samples] )";
                }
                var           result      = _msBDConnectorLW.QueryExecutor(command);
                BDSortingPage sortingPage = new BDSortingPage();
                sortingPage.CodeInputField.WaitForClickability();

                foreach (string i in result)
                {
                    sortingPage.CodeInputField.SendKeys(i);
                    sortingPage.CodeInputField.SendKeys(Keys.Enter);
                }
            }
            else if (wp == "isolation")
            {
                IsTrue(BDMain.AssertOpenDNKWorkplace(), "Заголовок рабочего места не найден");
                MSDatabaseConnector _msBDConnectorLW = new MSDatabaseConnector(Config.MSDbLW);
                string command = "";
                if (type == "with") // выбор образцов с результатами, которые еще НЕ были добавлены в базу BD
                {
                    command = $@"select top 1 s.TEXT_ID
                    from test t with (nolock)
                    inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    left join RESULT r on s.SAMPLE_NUMBER = r.SAMPLE_NUMBER
                    where t.status='A' and s.TEMPLATE = 'smp_in' and r.RESULT_NUMBER is not NULL and r.ENTRY is not NULL 
                    and s.LOCATION = '{location}' and t.ANALYSIS = '{test}' and s.SAMPLE_TYPE ='{bm}'
                    and s.SAMPLE_NUMBER not in (select [LwSampleNumber] from [BatchDropperStab].[dbo].[Samples] )";
                }
                else if (type == "without") // выбор образцов без результатов, которые еще НЕ были добавлены в базу BD
                {
                    command = $@"select top 1 s.TEXT_ID from test t 
                    inner join SAMPLE s on t.SAMPLE_NUMBER=s.SAMPLE_NUMBER
                    inner join [RESULT] r on s.SAMPLE_NUMBER = r.SAMPLE_NUMBER
                    where t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I'
                    and s.LOCATION = '{location}'and t.ANALYSIS = '{test}'and s.SAMPLE_TYPE ='{bm}'
                    and s.SAMPLE_NUMBER not in (select [LwSampleNumber] from [BatchDropperStab].[dbo].[Samples] )";
                }
                var result = _msBDConnectorLW.QueryExecutor(command);
                BDIsolationDNKPage isolationDNKPage = new BDIsolationDNKPage();
                isolationDNKPage.AddSample(result);
            }
        }
Example #10
0
        public void ThenICheckValidNotificationAboutExperimentMode()
        {
            BDSortingPage bDSortingPage = new BDSortingPage();

            IsTrue(bDSortingPage.AssertExpModeMessage(), "Предупредительное сообщение отсутствует");
        }
        public void ThenIFill_OutTheIsolation_PlanchetBySamplesOfTestWithBiomaterialFromFirstLocationAndSecondLocationAndVKAndOKOAndPKO(int count, string testname, string bm, string location1, string location2, List <String> VKName, List <String> OKOName, List <String> PKOName)
        {
            //переходим в РМ сортировка
            BDMainPage BDMain = new BDMainPage();

            BDMain.OpenSorting();
            IsTrue(BDMain.AssertOpenSorting(), "Заголовок рабочего места не найден");
            // создаем новый бэтч
            BDSortingPage sortingPage = new BDSortingPage();

            sortingPage.AssertTheButtonIsVisible();
            sortingPage.ClickCreateBatch();
            sortingPage.AssertTheConfirmBatchFieldIsVisible();
            sortingPage.SetParentBatchID();
            // подтверждаем своим ШК
            BDPlanshetPositionPage bDPlanshetPositionPage = new BDPlanshetPositionPage();

            IsTrue(bDPlanshetPositionPage.AssertConfirmBatchWindow(), "Нет окна для подтверждения установки планшета");
            bDPlanshetPositionPage.ConfirmUsercodeInPlanshetPositionPage();
            {
                //int countOfTests = testname.Count();
                MSDatabaseConnector _msBDConnectorLW = new MSDatabaseConnector(Config.MSDbLW);
                string command1 = "";
                command1 = $@"USE LW08v6
                    select TOP({count}) s.TEXT_ID
                    from
                    (select SAMPLE_NUMBER, count(ANALYSIS) as TestCommonCount
                    from [LW08v6].[dbo].[TEST] t with (nolock) 
                    group by SAMPLE_NUMBER
                    having count(ANALYSIS) = 1) MonoSamples
                    join TEST t on t.SAMPLE_NUMBER = MonoSamples.SAMPLE_NUMBER
                    join SAMPLE s on S.SAMPLE_NUMBER = t.SAMPLE_NUMBER
                    where t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' 
                    and s.LOCATION = '{location1}' and t.ANALYSIS='{testname}' and s.SAMPLE_TYPE ='{bm}'";
                string command2 = "";
                command2 = $@"USE LW08v6
                    select TOP({count}) s.TEXT_ID
                    from
                    (select SAMPLE_NUMBER, count(ANALYSIS) as TestCommonCount
                    from [LW08v6].[dbo].[TEST] t with (nolock) 
                    group by SAMPLE_NUMBER
                    having count(ANALYSIS) = 1) MonoSamples
                    join TEST t on t.SAMPLE_NUMBER = MonoSamples.SAMPLE_NUMBER
                    join SAMPLE s on S.SAMPLE_NUMBER = t.SAMPLE_NUMBER
                    where t.status='I' and s.TEMPLATE = 'smp_in' and s.status='I' 
                    and s.LOCATION = '{location2}' and t.ANALYSIS='{testname}' and s.SAMPLE_TYPE ='{bm}'";

                var result1 = _msBDConnectorLW.QueryExecutor(command1); // образцы для первой локации
                var result2 = _msBDConnectorLW.QueryExecutor(command2); // образцы для второй локации
                //result.AddRange(result2); //объединить списки

                sortingPage.CodeInputField.WaitForClickability();

                foreach (string i in result1)
                {
                    sortingPage.CodeInputField.SendKeys(i);
                    sortingPage.CodeInputField.SendKeys(Keys.Enter);
                    sortingPage.CodeInputField.WaitForClickability();
                    IsFalse(sortingPage.AssertSampleFromAnotherLocationMessage(location1), $"Что то пришло не так, не проходят пробы из локации {location1}");
                    if (sortingPage.FieldWithUsercodePlaceholder.Exists())
                    {
                        sortingPage.FieldWithUsercodePlaceholder.SendKeys(Config.UserBarCode);
                        sortingPage.FieldWithUsercodePlaceholder.SendKeys(Keys.Enter);
                    }
                }
                foreach (string n in result2)
                {
                    sortingPage.CodeInputField.SendKeys(n);
                    sortingPage.CodeInputField.SendKeys(Keys.Enter);
                    sortingPage.CodeInputField.WaitForClickability();
                    IsTrue(sortingPage.AssertSampleFromAnotherLocationMessage(location2), $"Что то пришло не так, не так - не приходит ошибка о добавлении пробы из локации {location2}");
                    if (sortingPage.FieldWithUsercodePlaceholder.Exists())
                    {
                        sortingPage.FieldWithUsercodePlaceholder.SendKeys(Config.UserBarCode);
                        sortingPage.FieldWithUsercodePlaceholder.SendKeys(Keys.Enter);
                    }
                }
                if (sortingPage.CompleteAddSamplesButton.Exists() && !sortingPage.CompleteAddSamplesButtonDisable.Disabled)
                {
                    sortingPage.CompleteAddSamplesButton.Click();
                    sortingPage.ConfirmEndOfSamplesButton.Click();
                }
                else if (sortingPage.CompleteAddSamplesButton.Exists() && sortingPage.CompleteAddSamplesButtonDisable.Disabled)
                {
                    sortingPage.CodeInputField.SendKeys(Config.UserBarCode);  //
                    sortingPage.CodeInputField.SendKeys(Keys.Enter);
                }
                else if (sortingPage.CompleteBatchButton.Exists())
                {
                    sortingPage.CompleteBatchButton.Click();
                    sortingPage.ConfirmEndOfSamplesButton.Click();
                }
                System.Threading.Thread.Sleep(500);

                if (sortingPage.CodeInputField.Exists())
                {
                    sortingPage.CodeInputField.WaitForAvailability();
                    sortingPage.CodeInputField.WaitForVisibility();
                    sortingPage.CodeInputField.WaitForClickability();
                }
                // Подтверждается раскапывание ВК
                if (VKName[0] != "")
                {
                    foreach (string j in VKName)
                    {
                        sortingPage.SetValueOfKM(j);
                        Debug.WriteLine("Раскапан " + j);
                    }
                    //     sortingPage.SetValueOfKM(VKName);
                }
                // Подтверждается раскапывание ОКО
                if (OKOName[0] != "")
                {
                    foreach (string k in OKOName)
                    {
                        sortingPage.SetValueOfKM(k);
                        Debug.WriteLine("Раскапан " + k);
                    }
                }
                // Подтверждается раскапывание ПКО
                if (PKOName[0] != "")
                {
                    foreach (string m in PKOName)
                    {
                        sortingPage.SetValueOfKM(m);
                        Debug.WriteLine(DateTime.Now + "Раскапан " + m);
                    }
                }
            }
        }