private void InsertBatch(LinkedListNode <CBatch> node, CBatch_detail_aa_twofold sample)
        {
            if (node != null)
            {
                if (node.Next == null)
                {
                    CBatch batch = node.Value;
                    List <CBatch_detail_aa_twofold> lst_tmp_samples = new List <CBatch_detail_aa_twofold>();

                    // --- seleccionar la lista de muestras del batch
                    CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                    List <CBatch_detail_aa_twofold> lst_samples =
                        new List <CBatch_detail_aa_twofold>(
                            faBatch_detail_aa_twofold.GetAll()
                            .Where(c => c.Idbatch == batch.Idbatch))
                        .OrderBy(c => c.Cod_interno).ToList();

                    // --- asignar nuevo idbatch a la muestra entrante
                    sample.Idbatch = batch.Idbatch;
                    faBatch_detail_aa_twofold.Update(sample);
                }
                else if (node.Next != null)
                {
                    CBatch batch = node.Value;
                    List <CBatch_detail_aa_twofold> lst_tmp_samples = new List <CBatch_detail_aa_twofold>();

                    // --- seleccionar la lista de muestras del batch
                    CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                    List <CBatch_detail_aa_twofold> lst_samples =
                        new List <CBatch_detail_aa_twofold>(
                            faBatch_detail_aa_twofold.GetAll()
                            .Where(c => c.Idbatch == batch.Idbatch))
                        .OrderBy(c => c.Cod_interno).ToList();

                    // --- asignar nuevo idbatch a la muestra entrante
                    sample.Idbatch = batch.Idbatch;
                    faBatch_detail_aa_twofold.Update(sample);

                    // --- calcular el índice de la muestra a insertar
                    int i = lst_samples.Count - 1;

                    if (lst_samples[i].Flag_mri == 1)
                    {
                        i = i - 1;
                    }

                    CBatch_detail_aa_twofold sample_out = lst_samples[i];

                    // --- quitar la dirección del batch de la muestra saliente
                    sample_out.Idbatch = null;
                    faBatch_detail_aa_twofold.Update(sample_out);

                    InsertBatch(node.Next, sample_out);
                }
            }
        }
        public bool InterchangeSample(CBatch_detail_aa_twofold sample_drag, CBatch_detail_aa_twofold sample_drop)
        {
            long?idbatch_tmp = sample_drag.Idbatch;

            sample_drag.Idbatch = sample_drop.Idbatch;
            sample_drop.Idbatch = idbatch_tmp;

            CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
            bool result_drag = faBatch_detail_aa_twofold.Update(sample_drag);
            bool result_drop = faBatch_detail_aa_twofold.Update(sample_drop);

            return(result_drag && result_drop);
        }
Пример #3
0
        void ApplyCriteriaSort()
        {
            CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();

            // --- get by a criteria sort
            var query = GetListByCriteriaSort();

            // --- assign new order sample
            short count = 1;

            foreach (var varitem in query)
            {
                CBatch_detail_aa_twofold item = varitem as CBatch_detail_aa_twofold;
                item.Order_sample_batch = count;
                faBatch_detail_aa_twofold.Update(item);
                count++;
            }

            // --- get source data
            dtPivotBatch =
                new BindingList <CBatch_detail_aa_twofold>(
                    faBatch_detail_aa_twofold
                    .GetAll()
                    .Where(c => c.Idbatch == Idbatch && c.Idtemplate_method == Idtemplate_method).ToList());
        }
Пример #4
0
        public void UpdateStatusResult(long p_idbatch, long p_idrecep_sample_detail, long p_idrecep_sample_detail_elem, short p_status_result, string p_str_result_analysis, decimal p_result_analysis)
        {
            CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
            List <CBatch_detail_aa_twofold> lst =
                ListSamples.Where(c => c.Idbatch == p_idbatch &&
                                  c.Idrecep_sample_detail == p_idrecep_sample_detail &&
                                  c.Idrecep_sample_detail_elem == p_idrecep_sample_detail_elem).ToList();

            foreach (CBatch_detail_aa_twofold item in lst)
            {
                item.Qaqc_review        = true;
                item.Qaqc_status_result = p_status_result;
                faBatch_detail_aa_twofold.Update(item);
            }

            CRecep_sample_detail_elemFactory faRecep_sample_detail_elem = new CRecep_sample_detail_elemFactory();
            List <CRecep_sample_detail_elem> lst2 =
                faRecep_sample_detail_elem.GetAll().Where(c => c.Idrecep_sample_detail_elem == p_idrecep_sample_detail_elem).ToList();

            foreach (CRecep_sample_detail_elem item in lst2)
            {
                item.Str_result_analysis = p_str_result_analysis;
                item.Result_analysis     = p_result_analysis;
                faRecep_sample_detail_elem.Update(item);
            }
        }
Пример #5
0
        public void RetestBatch()
        {
            try
            {
                CBatchFactory faBatch = new CBatchFactory();
                CBatch        oBatch  = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch));

                // --- check parity
                for (int i = 0; i < ListSamples.Count; i++)
                {
                    CBatch_detail_aa_twofold        row = ListSamples[i];
                    CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();

                    if (Convert.ToInt32(row.Flag_mri) == 0)
                    {
                        // --- approved samples with additional retest mark
                        row.Qaqc_has_retest = 1;
                        faBatch_detail_aa_twofold.Update(row);

                        // --- save retest
                        string       cod_type_sample = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(Convert.ToInt32(row.Idtemplate_method))).Cod_type_sample;
                        CCorrelative oCorrelative    = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(cod_type_sample));

                        CBatchManager oBatchManager = new CBatchManager();

                        oBatchManager.CallSaveFromRetestFullBatch(
                            Convert.ToInt32(row.Idtemplate_method),
                            Convert.ToInt64(row.Idrecep_sample),
                            Convert.ToInt64(row.Idrecep_sample_detail),
                            Convert.ToInt64(row.Idrecep_sample_detail_elem),
                            Convert.ToInt64(row.Cod_interno),
                            row.Cod_sample,
                            Comun.GetUser(),
                            oCorrelative,
                            row.Qaqc_par);

                        // --- register as finished trace process
                        CProcess_Sample_Manage.Finalize_process(Convert.ToInt64(row.Idrecep_sample_detail_elem), LimsProcess.PROCESS_IN_READING, LimsProcess.PROCESS_APPROVE_SAMPLES);
                    }
                }

                // --- modify the batch status, put in other process
                CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(LimsProcess.PROCESS_APPROVE_SAMPLES));
                oBatch.Status_process    = Convert.ToChar(LimsProcess.Status_Process.Waiting);
                oBatch.Cod_module        = oProcess.Cod_module;
                oBatch.Cod_area          = oProcess.Cod_area;
                oBatch.Cod_process       = LimsProcess.PROCESS_APPROVE_SAMPLES;
                oBatch.User_approve_tray = Comun.GetUser();
                oBatch.Date_approve_tray = Comun.GetDate();
                faBatch.Update(oBatch);

                // --- register as finished trace batch
                Cprocess_Batch_Manage.Finalize_process(Idbatch, LimsProcess.PROCESS_IN_READING, LimsProcess.PROCESS_APPROVE_SAMPLES);
            }
            catch (Exception ex)
            {
                Comun.Save_log(ex.InnerException.ToString());
                throw new Exception("pivot data::approve::Error occured.", ex);
            }
        }
Пример #6
0
        public void Save(int position)
        {
            try
            {
                CBatch_detail_aa_twofold oBatch_detail_aa_twofold = ((BindingList <CBatch_detail_aa_twofold>)ListSamples)[position];

                CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                faBatch_detail_aa_twofold.Update(oBatch_detail_aa_twofold);

                long Idrecep_sample_detail_elem = Convert.ToInt64(oBatch_detail_aa_twofold.Idrecep_sample_detail_elem);

                // --- register in process,
                LimsProcess.Advance_process(Idbatch, Idrecep_sample_detail_elem, LimsProcess.PROCESS_IN_READING);
            }
            catch (Exception ex)
            {
                Comun.Save_log(ex.InnerException.ToString());
                //throw new Exception("pivot data row::update::Error occured.", ex);
            }
        }
Пример #7
0
        public void MovePositionRow(CBatch_detail_aa_twofold row_ini, CBatch_detail_aa_twofold row_end)
        {
            CBatch_detail_aa_twofoldFactory        faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
            BindingList <CBatch_detail_aa_twofold> lst = new BindingList <CBatch_detail_aa_twofold>(ListSamples);

            // --- copiar muestra drag como temporal
            CBatch_detail_aa_twofold tmp_row_ini = lst.Single(c => c.Cod_interno == row_ini.Cod_interno);
            CBatch_detail_aa_twofold tmp_row_end = lst.Single(c => c.Cod_interno == row_end.Cod_interno);

            // --- quitar muestra drag de la lista
            lst.Remove(tmp_row_ini);

            // --- obetener indice o posición a donde será movido
            int new_index_end = lst.IndexOf(tmp_row_end);

            // --- insertar la muestra que fue removida
            lst.Insert(new_index_end, tmp_row_ini);

            // --- reset orden de las muestras
            short count = 1;

            foreach (CBatch_detail_aa_twofold item in lst)
            {
                item.Order_sample_batch = count;
                count++;

                faBatch_detail_aa_twofold.Update(item);
            }

            // --- get source data
            dtPivotBatch =
                new BindingList <CBatch_detail_aa_twofold>(
                    faBatch_detail_aa_twofold
                    .GetAll()
                    .Where(c => c.Idbatch == Idbatch && c.Idtemplate_method == Idtemplate_method).ToList());
        }
Пример #8
0
        private void paNewTray_DragDrop(object sender, DragEventArgs e)
        {
            // --- get object column
            DevExpress.XtraTreeList.Nodes.TreeListNode nodo = (DevExpress.XtraTreeList.Nodes.TreeListNode)e.Data.GetData(typeof(DevExpress.XtraTreeList.Nodes.TreeListNode));

            CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
            CBatch_detail_aa_twofold sample = new CBatch_detail_aa_twofoldFactory().GetByPrimaryKey(new CBatch_detail_aa_twofoldKeys(Convert.ToInt64(nodo.GetValue("Idbatch_detail_aa"))));
            CBatchManager oBatchManager = new CBatchManager();
            long idbatch = Convert.ToInt64(oBatchManager.GetNewBatch(Idtemplate_method, Comun.GetUser(), Idbatch));
            sample.Idbatch = idbatch;
            faBatch_detail_aa_twofold.Update(sample);

            // --- refrescar arbol
            InitTreeBatch(Comun.StatusWork.Waiting);
        }
Пример #9
0
        public void Review()
        {
            try
            {
                CBatchFactory faBatch = new CBatchFactory();
                CBatch        oBatch  = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch));

                // --- save trace
                CRecep_sample_detail_elemFactory faRecep_sample_detail_elem = new CRecep_sample_detail_elemFactory();

                for (int i = 0; i < ListSamples.Count; i++)
                {
                    CBatch_detail_aa_twofold current_row = ListSamples[i];

                    int status_result = Convert.ToInt32(current_row.Qaqc_status_result);

                    if (Convert.ToInt32(current_row.Flag_mri) == 0)
                    {
                        // --- set how accepted sample
                        // Espera = 0,
                        // Incorrecto = 1,
                        // Plausible = 2,
                        // Aceptado = 3,
                        // IncorrectoPlausible = 4,
                        // Espera reensayos = 5
                        // --- save only the accept samples
                        long Idrecep_sample_detail_elem = Convert.ToInt64(current_row.Idrecep_sample_detail_elem);

                        if (Convert.ToBoolean(oBatch.Flag_correct_mri) && Convert.ToBoolean(oBatch.Flag_correct_lrb))
                        {
                            if (status_result == Convert.ToInt32(Comun.Status_result.Plausible))
                            {
                                current_row.Qaqc_status_result = Convert.ToInt16(Comun.Status_result.Aceptado);
                            }

                            Qaqc oQaqc = new Qaqc();
                            if (!oQaqc.IsRetest(Idrecep_sample_detail_elem, Idbatch))
                            {
                                // --- save final element law
                                if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado))
                                {
                                    CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem));
                                    oRecep_sample_detail_elem.Result_analysis     = current_row.Result_analysis;
                                    oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString();
                                    oRecep_sample_detail_elem.With_result         = true;
                                    if (current_row.Str_result_analysis == null)
                                    {
                                        oRecep_sample_detail_elem.With_result = false;
                                    }
                                    faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem);
                                }
                                CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                                faBatch_detail_aa_twofold.Update(current_row);
                            }
                            else// --- es un reensayo
                            {
                                if (!oQaqc.ExistsResultPendingSel(Idrecep_sample_detail_elem, Idbatch))
                                {
                                    // --- si no está pendiente de seleccionar entre varios análisis
                                    // --- save final element law
                                    if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado))
                                    {
                                        CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem));
                                        oRecep_sample_detail_elem.Result_analysis     = current_row.Result_analysis;
                                        oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString();
                                        oRecep_sample_detail_elem.With_result         = true;
                                        if (current_row.Str_result_analysis == null)
                                        {
                                            oRecep_sample_detail_elem.With_result = false;
                                        }
                                        faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem);
                                    }
                                    CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                                    faBatch_detail_aa_twofold.Update(current_row);
                                }
                            }

                            // --- save retest
                            if (current_row.Qaqc_tmp_retest == 1)
                            {
                                string       cod_type_sample = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(Convert.ToInt32(current_row.Idtemplate_method))).Cod_type_sample;
                                CCorrelative oCorrelative    = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(cod_type_sample));

                                CBatchManager oBatchManager = new CBatchManager();

                                oBatchManager.CallSaveSampleBatchWithRetest(
                                    Convert.ToInt32(current_row.Idtemplate_method),
                                    Convert.ToInt64(current_row.Idrecep_sample),
                                    Convert.ToInt64(current_row.Idrecep_sample_detail),
                                    Convert.ToInt64(current_row.Idrecep_sample_detail_elem),
                                    Convert.ToInt64(current_row.Cod_interno),
                                    current_row.Cod_sample,
                                    Comun.GetUser(),
                                    oCorrelative, Convert.ToInt32(current_row.Qaqc_par), Idbatch);
                            }

                            // --- register as finished trace process
                            CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS);
                        }
                        else
                        {
                            // --- the samples pertain to batch with full batch retest
                            CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS);
                        }
                    }
                }

                // --- modify the batch status, put in other process
                CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(LimsProcess.PROCESS_ACCEPT_RESULTS));
                oBatch.Status_process   = Convert.ToChar(LimsProcess.Status_Process.Waiting);
                oBatch.Cod_module       = oProcess.Cod_module;
                oBatch.Cod_area         = oProcess.Cod_area;
                oBatch.Cod_process      = LimsProcess.PROCESS_ACCEPT_RESULTS;
                oBatch.User_review_tray = Comun.GetUser();
                oBatch.Date_review_tray = Comun.GetDate();
                faBatch.Update(oBatch);

                // --- register as finished trace batch
                Cprocess_Batch_Manage.Finalize_process(Idbatch, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS);
            }
            catch (Exception ex)
            {
                Comun.Save_log(ex.InnerException.ToString());
                throw new Exception("pivot data::approve::Error occured.", ex);
            }
        }
Пример #10
0
        void ApplyCriteriaSort()
        {
            CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();

            // --- get by a criteria sort
            var query = GetListByCriteriaSort();

            // --- assign new order sample
            short count = 1;
            foreach (var varitem in query)
            {
                CBatch_detail_aa_twofold item = varitem as CBatch_detail_aa_twofold;
                item.Order_sample_batch = count;
                faBatch_detail_aa_twofold.Update(item);
                count++;
            }

            // --- get source data
            dtPivotBatch =
                new BindingList<CBatch_detail_aa_twofold>(
                    faBatch_detail_aa_twofold
                    .GetAll()
                    .Where(c => c.Idbatch == Idbatch && c.Idtemplate_method == Idtemplate_method).ToList());
        }
Пример #11
0
        public void UpdateStatusResult(long p_idbatch, long p_idrecep_sample_detail, long p_idrecep_sample_detail_elem, short p_status_result, string p_str_result_analysis, decimal p_result_analysis)
        {
            CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
            List<CBatch_detail_aa_twofold> lst =
                ListSamples.Where(c => c.Idbatch == p_idbatch
                    && c.Idrecep_sample_detail == p_idrecep_sample_detail
                    && c.Idrecep_sample_detail_elem == p_idrecep_sample_detail_elem).ToList();

            foreach (CBatch_detail_aa_twofold item in lst)
            {
                item.Qaqc_review = true;
                item.Qaqc_status_result = p_status_result;
                faBatch_detail_aa_twofold.Update(item);
            }

            CRecep_sample_detail_elemFactory faRecep_sample_detail_elem = new CRecep_sample_detail_elemFactory();
            List<CRecep_sample_detail_elem> lst2 =
                faRecep_sample_detail_elem.GetAll().Where(c => c.Idrecep_sample_detail_elem == p_idrecep_sample_detail_elem).ToList();

            foreach (CRecep_sample_detail_elem item in lst2)
            {
                item.Str_result_analysis = p_str_result_analysis;
                item.Result_analysis = p_result_analysis;
                faRecep_sample_detail_elem.Update(item);
            }
        }
Пример #12
0
        public void Save(int position)
        {
            try
            {
                CBatch_detail_aa_twofold oBatch_detail_aa_twofold = ((BindingList<CBatch_detail_aa_twofold>)ListSamples)[position];

                CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                faBatch_detail_aa_twofold.Update(oBatch_detail_aa_twofold);

                long Idrecep_sample_detail_elem = Convert.ToInt64(oBatch_detail_aa_twofold.Idrecep_sample_detail_elem);

                // --- register in process,
                LimsProcess.Advance_process(Idbatch, Idrecep_sample_detail_elem, LimsProcess.PROCESS_IN_READING);

            }
            catch (Exception ex)
            {
                Comun.Save_log(ex.InnerException.ToString());
                //throw new Exception("pivot data row::update::Error occured.", ex);
            }
        }
Пример #13
0
        public void Review()
        {
            try
            {
                CBatchFactory faBatch = new CBatchFactory();
                CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch));

                // --- save trace
                CRecep_sample_detail_elemFactory faRecep_sample_detail_elem = new CRecep_sample_detail_elemFactory();

                for (int i = 0; i < ListSamples.Count; i++)
                {
                    CBatch_detail_aa_twofold current_row = ListSamples[i];

                    int status_result = Convert.ToInt32(current_row.Qaqc_status_result);

                    if (Convert.ToInt32(current_row.Flag_mri) == 0)
                    {
                        // --- set how accepted sample
                        // Espera = 0,
                        // Incorrecto = 1,
                        // Plausible = 2,
                        // Aceptado = 3,
                        // IncorrectoPlausible = 4,
                        // Espera reensayos = 5
                        // --- save only the accept samples
                        long Idrecep_sample_detail_elem = Convert.ToInt64(current_row.Idrecep_sample_detail_elem);

                        if (Convert.ToBoolean(oBatch.Flag_correct_mri) && Convert.ToBoolean(oBatch.Flag_correct_lrb))
                        {

                            if (status_result == Convert.ToInt32(Comun.Status_result.Plausible))
                                current_row.Qaqc_status_result = Convert.ToInt16(Comun.Status_result.Aceptado);

                            Qaqc oQaqc = new Qaqc();
                            if (!oQaqc.IsRetest(Idrecep_sample_detail_elem, Idbatch))
                            {
                                // --- save final element law
                                if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado))
                                {
                                    CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem));
                                    oRecep_sample_detail_elem.Result_analysis = current_row.Result_analysis;
                                    oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString();
                                    oRecep_sample_detail_elem.With_result = true;
                                    if (current_row.Str_result_analysis == null)
                                        oRecep_sample_detail_elem.With_result = false;
                                    faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem);
                                }
                                CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                                faBatch_detail_aa_twofold.Update(current_row);
                            }
                            else// --- es un reensayo
                            {
                                if (!oQaqc.ExistsResultPendingSel(Idrecep_sample_detail_elem, Idbatch))
                                {
                                    // --- si no está pendiente de seleccionar entre varios análisis
                                    // --- save final element law
                                    if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado))
                                    {
                                        CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem));
                                        oRecep_sample_detail_elem.Result_analysis = current_row.Result_analysis;
                                        oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString();
                                        oRecep_sample_detail_elem.With_result = true;
                                        if (current_row.Str_result_analysis == null)
                                            oRecep_sample_detail_elem.With_result = false;
                                        faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem);
                                    }
                                    CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                                    faBatch_detail_aa_twofold.Update(current_row);
                                }
                            }

                            // --- save retest
                            if (current_row.Qaqc_tmp_retest == 1)
                            {
                                string cod_type_sample = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(Convert.ToInt32(current_row.Idtemplate_method))).Cod_type_sample;
                                CCorrelative oCorrelative = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(cod_type_sample));

                                CBatchManager oBatchManager = new CBatchManager();

                                oBatchManager.CallSaveSampleBatchWithRetest(
                                    Convert.ToInt32(current_row.Idtemplate_method),
                                    Convert.ToInt64(current_row.Idrecep_sample),
                                    Convert.ToInt64(current_row.Idrecep_sample_detail),
                                    Convert.ToInt64(current_row.Idrecep_sample_detail_elem),
                                    Convert.ToInt64(current_row.Cod_interno),
                                    current_row.Cod_sample,
                                    Comun.GetUser(),
                                    oCorrelative, Convert.ToInt32(current_row.Qaqc_par), Idbatch);
                            }

                            // --- register as finished trace process
                            CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS);
                        }
                        else
                        {
                            // --- the samples pertain to batch with full batch retest
                            CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS);
                        }

                    }
                }

                // --- modify the batch status, put in other process
                CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(LimsProcess.PROCESS_ACCEPT_RESULTS));
                oBatch.Status_process = Convert.ToChar(LimsProcess.Status_Process.Waiting);
                oBatch.Cod_module = oProcess.Cod_module;
                oBatch.Cod_area = oProcess.Cod_area;
                oBatch.Cod_process = LimsProcess.PROCESS_ACCEPT_RESULTS;
                oBatch.User_review_tray = Comun.GetUser();
                oBatch.Date_review_tray = Comun.GetDate();
                faBatch.Update(oBatch);

                // --- register as finished trace batch
                Cprocess_Batch_Manage.Finalize_process(Idbatch, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS);

            }
            catch (Exception ex)
            {
                Comun.Save_log(ex.InnerException.ToString());
                throw new Exception("pivot data::approve::Error occured.", ex);
            }
        }
Пример #14
0
        public void RetestBatch()
        {
            try
            {
                CBatchFactory faBatch = new CBatchFactory();
                CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch));

                // --- check parity
                for (int i = 0; i < ListSamples.Count; i++)
                {
                    CBatch_detail_aa_twofold row = ListSamples[i];
                    CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();

                    if (Convert.ToInt32(row.Flag_mri) == 0)
                    {
                        // --- approved samples with additional retest mark
                        row.Qaqc_has_retest = 1;
                        faBatch_detail_aa_twofold.Update(row);

                        // --- save retest
                        string cod_type_sample = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(Convert.ToInt32(row.Idtemplate_method))).Cod_type_sample;
                        CCorrelative oCorrelative = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(cod_type_sample));

                        CBatchManager oBatchManager = new CBatchManager();

                        oBatchManager.CallSaveFromRetestFullBatch(
                            Convert.ToInt32(row.Idtemplate_method),
                            Convert.ToInt64(row.Idrecep_sample),
                            Convert.ToInt64(row.Idrecep_sample_detail),
                            Convert.ToInt64(row.Idrecep_sample_detail_elem),
                            Convert.ToInt64(row.Cod_interno),
                            row.Cod_sample,
                            Comun.GetUser(),
                            oCorrelative,
                            row.Qaqc_par);

                        // --- register as finished trace process
                        CProcess_Sample_Manage.Finalize_process(Convert.ToInt64(row.Idrecep_sample_detail_elem), LimsProcess.PROCESS_IN_READING, LimsProcess.PROCESS_APPROVE_SAMPLES);
                    }
                }

                // --- modify the batch status, put in other process
                CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(LimsProcess.PROCESS_APPROVE_SAMPLES));
                oBatch.Status_process = Convert.ToChar(LimsProcess.Status_Process.Waiting);
                oBatch.Cod_module = oProcess.Cod_module;
                oBatch.Cod_area = oProcess.Cod_area;
                oBatch.Cod_process = LimsProcess.PROCESS_APPROVE_SAMPLES;
                oBatch.User_approve_tray = Comun.GetUser();
                oBatch.Date_approve_tray = Comun.GetDate();
                faBatch.Update(oBatch);

                // --- register as finished trace batch
                Cprocess_Batch_Manage.Finalize_process(Idbatch, LimsProcess.PROCESS_IN_READING, LimsProcess.PROCESS_APPROVE_SAMPLES);

            }
            catch (Exception ex)
            {
                Comun.Save_log(ex.InnerException.ToString());
                throw new Exception("pivot data::approve::Error occured.", ex);
            }
        }
Пример #15
0
        public void MovePositionRow(CBatch_detail_aa_twofold row_ini, CBatch_detail_aa_twofold row_end)
        {
            CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
            BindingList<CBatch_detail_aa_twofold> lst = new BindingList<CBatch_detail_aa_twofold>(ListSamples);

            // --- copiar muestra drag como temporal
            CBatch_detail_aa_twofold tmp_row_ini = lst.Single(c => c.Cod_interno == row_ini.Cod_interno);
            CBatch_detail_aa_twofold tmp_row_end = lst.Single(c => c.Cod_interno == row_end.Cod_interno);

            // --- quitar muestra drag de la lista
            lst.Remove(tmp_row_ini);

            // --- obetener indice o posición a donde será movido
            int new_index_end = lst.IndexOf(tmp_row_end);

            // --- insertar la muestra que fue removida
            lst.Insert(new_index_end, tmp_row_ini);

            // --- reset orden de las muestras
            short count = 1;
            foreach (CBatch_detail_aa_twofold item in lst)
            {
                item.Order_sample_batch = count;
                count++;

                faBatch_detail_aa_twofold.Update(item);
            }

            // --- get source data
            dtPivotBatch =
                new BindingList<CBatch_detail_aa_twofold>(
                    faBatch_detail_aa_twofold
                    .GetAll()
                    .Where(c => c.Idbatch == Idbatch && c.Idtemplate_method == Idtemplate_method).ToList());
        }