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); } }
public bool Is_law_right() { CTemplate_method_aaFactory faTemplate_method_aa = new CTemplate_method_aaFactory(); CTemplate_method_aa oTemplate_method_aa = faTemplate_method_aa.GetByPrimaryKey(new CTemplate_method_aaKeys(Idtemplate_method)); // --- recorring law columns for (int i = 0; i < ListSamples.Count; i++) { CBatch_detail_aa_twofold row = ListSamples[i]; decimal law1 = Convert.ToDecimal(row.Law1); decimal law2 = Convert.ToDecimal(row.Law2); if (law1 <= oTemplate_method_aa.Law_limit_bottom || law1 >= oTemplate_method_aa.Law_limit_top) { ComunForm.Send_message("Formulario de QaQc", TypeMsg.error, "Error: la ley esta fuera de los límites permitidos."); return(false); } if (law2 <= oTemplate_method_aa.Law_limit_bottom || law1 >= oTemplate_method_aa.Law_limit_top) { ComunForm.Send_message("Formulario de QaQc", TypeMsg.error, "Error: la ley esta fuera de los límites permitidos."); return(false); } } return(true); }
public void GetSd() { // --- calculate sd List <double> lstMrLaw = new List <double>(); List <double> lstBlkLaw = new List <double>(); for (int i = 0; i < pivot.Count; i++) { int flag_mri = Convert.ToInt32(pivot[i].Flag_mri); CBatch_detail_aa_twofold current_row = pivot[i]; if (flag_mri == 1) { if (current_row.Law1 != null && current_row.ToString().Trim().Length != 0) { // -- blk double law_blk = Convert.ToDouble(current_row.Law1); lstBlkLaw.Add(law_blk); } if (current_row.Law2 != null && current_row.ToString().Trim().Length != 0) { // -- mr double law_mr = Convert.ToDouble(current_row.Law2); lstMrLaw.Add(law_mr); } } } Mri_measured = Convert.ToDouble(Standard_desviation(lstMrLaw)); Lrb_measured = Convert.ToDouble(Standard_desviation(lstBlkLaw)); }
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()); }
public bool RowIsMri(CBatch_detail_aa_twofold current_row) { if (Convert.ToInt32(current_row.Flag_mri) == 1) { return(true); } return(false); }
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 void ApplyQaQcRow(CBatch_detail_aa_twofold current_row) { //if (Contain_all_reading(current_row)) { ApplyQaqcMrBlk(current_row); ApplyQaQcParity(current_row); ApplyQaQcTryApprove(current_row); //ApplyQaqcSumary(); } }
void registerVariables(CBatch_detail_aa_twofold current_row) { parser = new MathParserNet.Parser(); // --- register functions parser.RegisterCustomDoubleFunction("deter_dilu", Deter_Dilu); // --- register variables //parser.AddVariable("", Convert.ToDouble()); parser.AddVariable("weight1", Convert.ToDouble(current_row.Weight1)); parser.AddVariable("weight2", Convert.ToDouble(current_row.Weight2)); parser.AddVariable("volumen1", Convert.ToDouble(current_row.Volumen1)); parser.AddVariable("volumen2", Convert.ToDouble(current_row.Volumen2)); if (current_row.Reading1 != null && current_row.Reading1.Trim() != "") { parser.AddVariable("reading1", current_row.Reading1); } else { parser.AddVariable("reading1", 0); } if (current_row.Reading2 != null && current_row.Reading2.Trim() != "") { parser.AddVariable("reading2", current_row.Reading2); } else { parser.AddVariable("reading2", 0); } parser.AddVariable("dilu2", Convert.ToDouble(current_row.Dilu2)); parser.AddVariable("dilu3", Convert.ToDouble(current_row.Dilu3)); parser.AddVariable("flag_dilu2", Convert.ToDouble(current_row.Flag_dilu2)); parser.AddVariable("flag_dilu3", Convert.ToDouble(current_row.Flag_dilu3)); parser.AddVariable("fum", Convert.ToDouble(current_row.Fum)); parser.AddVariable("calc_dilu2", "deter_dilu(dilu2, flag_dilu2)"); parser.AddVariable("calc_dilu3", "deter_dilu(dilu3, flag_dilu3)"); parser.AddVariable("factor1", "volumen1/weight1*calc_dilu2*calc_dilu3*fum"); parser.AddVariable("factor2", "volumen2/weight2*calc_dilu2*calc_dilu3*fum"); parser.AddVariable("law1", "reading1*factor1"); parser.AddVariable("law2", "reading2*factor2"); parser.AddVariable("Result_analysis", "(law1+law2)/2"); AssignValues(current_row); }
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); }
bool Contain_all_reading(CBatch_detail_aa_twofold current_row) { string evalReading1 = current_row.Reading1; string evalReading2 = current_row.Reading2; if (evalReading1 == null || evalReading2 == null) { return(false); } if (evalReading1.Trim().Length == 0) { return(false); } if (evalReading2.Trim().Length == 0) { return(false); } return(true); }
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); } }
public void ApplyQaQcTryApprove(CBatch_detail_aa_twofold current_row) { if (Convert.ToInt32(current_row.Flag_mri) == 0) { if ((current_row.Qaqc_par == 1 && current_row.Qaqc_error == 0) || (current_row.Qaqc_par == 1 && current_row.Qaqc_error == 1) || (current_row.Qaqc_par == 1 && current_row.Qaqc_error == 2)) { current_row.Qaqc_status_result = 2; // set as right (plausible) current_row.Qaqc_approve = true; } else if ((current_row.Qaqc_par == 2 && current_row.Qaqc_error == 4) || current_row.Qaqc_par == 2 && current_row.Qaqc_error == 5) { current_row.Qaqc_status_result = 4; // set as right (incorrecta plausible) current_row.Qaqc_approve = true; } else if ((current_row.Qaqc_par == 4 && current_row.Qaqc_error == 4) || current_row.Qaqc_par == 4 && current_row.Qaqc_error == 5) { current_row.Qaqc_status_result = 4; // set as right with errors current_row.Qaqc_approve = true; } else if ((current_row.Qaqc_par == 5 && current_row.Qaqc_error == 4) || current_row.Qaqc_par == 5 && current_row.Qaqc_error == 5) { current_row.Qaqc_status_result = 4; // set as right with errors current_row.Qaqc_approve = true; } else { ///si llegó aqui es que no hubo un paso previo para aprobar ///(ingresar una observación o mandar un reensayo) y levantar la observación ///que tiene como muestra incorrecta. current_row.Qaqc_status_result = 1; // set as unright (incorrecta) current_row.Qaqc_approve = false; } } }
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()); }
public void ApplyQaQcParity(CBatch_detail_aa_twofold current_row) { ///Qaqc_par ///--------- ///1: diferencia de lecturas dentro del factor de repetibilidad ///2: diferencia de lecturas fuera del factor de repetibilidad ///3: reservado para mri ///4: lecturas fuera del límite mínimo y máximo ///5: lecturas vacias int flag_mri = Convert.ToInt32(current_row.Flag_mri); if (flag_mri == 0) { decimal max_reading = -100; decimal min_reading = 0; decimal reading1 = 0; decimal reading2 = 0; if (decimal.TryParse(current_row.Reading1, out reading1) && decimal.TryParse(current_row.Reading2, out reading2)) { // --- ambas lecturas son decimales // --- get min and max if (reading1 >= max_reading) { max_reading = reading1; } if (reading2 >= max_reading) { max_reading = reading2; } min_reading = max_reading; if (reading1 <= min_reading) { min_reading = reading1; } if (reading2 <= min_reading) { min_reading = reading2; } // --- verificar que están dentro del límite de lecturas if (min_reading < oTemplate_method_aa.Reading_min || max_reading > oTemplate_method_aa.Reading_max) { current_row.Qaqc_par = 4; // purple } else { if (Math.Abs(max_reading - min_reading) <= Factor_repetibility) { current_row.Qaqc_par = 1; // dentro del factor de repetibilidad } else { current_row.Qaqc_par = 2; // fuera del factor de repetibilidad } } } else { // --- una o ambas lecturas no son decimales if (decimal.TryParse(current_row.Reading1, out reading1)) { // --- la lectura 1 es decimal if (reading1 < oTemplate_method_aa.Reading_min || reading1 > oTemplate_method_aa.Reading_max) { current_row.Qaqc_par = 4; } } else if (decimal.TryParse(current_row.Reading2, out reading2)) { // --- la lectura 2 es decimal if (reading2 < oTemplate_method_aa.Reading_min || reading2 > oTemplate_method_aa.Reading_max) { current_row.Qaqc_par = 4; } } else { // --- ambas lecturas no son decimales current_row.Qaqc_par = 5; // 5: para designar que no se tiene muestras } } SetTypeErrorParity(current_row); } else { current_row.Qaqc_par = 3; // reservado para mri (sin imagen) } }
public void ApplyQaqcMrBlk(CBatch_detail_aa_twofold current_row) { int flag_mri = Convert.ToInt32(current_row.Flag_mri); // only work with rows that are reference material if (flag_mri == 1) { long idbatch = Convert.ToInt64(pivot[0].Idbatch); CBatchFactory faBatch = new CBatchFactory(); CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(idbatch)); GetSd(); // recuperate the blk decimal value_blk = Convert.ToDecimal(current_row.Reading1); // blk if (current_row.Reading1 != null) { if (value_blk <= Max_value_blk) { current_row.Qaqc_blk = 1; // --- correcto oBatch.Flag_correct_lrb = true; oBatch.Lrb_measured = Convert.ToDecimal(Lrb_measured); } if (value_blk > Max_value_blk) { current_row.Qaqc_blk = 2; // --- error en el blanco oBatch.Flag_correct_lrb = false; oBatch.Lrb_measured = Convert.ToDecimal(Lrb_measured); } } // mri if (current_row.Reading2 != null) { // ley mri +- repetibilidad*2 <= ley conocida + reproducibilidad decimal min = Law_fixed - Factor_reproducibility; decimal max = Law_fixed + Factor_reproducibility; decimal law_mr = Convert.ToDecimal(current_row.Law2); decimal value = law_mr; if (value >= min && value <= max) { current_row.Qaqc_mr = 1; // correcto oBatch.Flag_correct_mri = true; oBatch.Mri_measured = Convert.ToDecimal(Mri_measured); } if (value < min || value > max) { current_row.Qaqc_mr = 2; // error en el mri oBatch.Flag_correct_mri = false; oBatch.Mri_measured = Convert.ToDecimal(Mri_measured); } } faBatch.Update(oBatch); } else { // no es mri current_row.Qaqc_blk = 3; current_row.Qaqc_mr = 3; } }
public void SetTypeErrorParity(CBatch_detail_aa_twofold current_row) { ///qaqc_error = ( ///0:sin errores, ///1:sin error con texto, ///2:sin error con reensayo, ///3:con error no aprobado, ///4:con error aprobado con observacion, ///5:con error aprobado con reensayo /// // --- current status bool Flag_parity = false; bool Flag_approve_with_retest = false; bool Flag_approve_with_text = false; Flag_parity = false; // 1=true, 2=false if (Convert.ToInt32(current_row.Qaqc_par) == 1) Flag_parity = true; Flag_approve_with_text = false; if (current_row.Qaqc_approve_text.Trim().Length > 0) Flag_approve_with_text = true; Flag_approve_with_retest = false; // Qaqc_idretest: >0 (idtemplate_method) if (Convert.ToBoolean(current_row.Qaqc_tmp_retest)) Flag_approve_with_retest = true; if (Flag_parity) { current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithoutError); if (Flag_approve_with_text) current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithoutErrorWithText); if (Flag_approve_with_retest) current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithoutErrorWithRetest); } else { current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithErrorNotApproved); if (Flag_approve_with_text) current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithErrorApprovedWithText); if (Flag_approve_with_retest) current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithErrorApprovedWithRetest); } }
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()); }
/// <summary> /// This function verify if all reading of repetitions are complete /// </summary> /// <param name="current_row"></param> /// <returns></returns> bool Contain_all_reading(CBatch_detail_aa_twofold current_row) { object evalReading1 = current_row.Reading1; object evalReading2 = current_row.Reading2; if (evalReading1 == null || evalReading2 == null) return false; if (evalReading1.ToString().Trim().Length == 0) return false; if (evalReading2.ToString().Trim().Length == 0) return false; return true; }
public bool RowIsMri(CBatch_detail_aa_twofold current_row) { if (Convert.ToInt32(current_row.Flag_mri) == 1) return true; return false; }
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); } }
// --- insert sample came from retest full batch public void CallSaveFromRetestFullBatch(int idtemplate_method, long idrecep_sample, long idrecep_sample_detail, long idrecep_sample_detail_elem, long cod_interno, string str_cod_interno, string user, CCorrelative correlative, int?previus_parity) { Correlative = correlative; CBatch_detail_aa_twofold oBatch_detail_aa_twofold = new CBatch_detail_aa_twofold(); CTemplate_method oTemplate_method = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(idtemplate_method)); CTemplate_method_aa oTemplate_method_aa = new CTemplate_method_aaFactory().GetByPrimaryKey(new CTemplate_method_aaKeys(idtemplate_method)); CRecep_sample_detail oRecep_sample_detail = new CRecep_sample_detailFactory().GetByPrimaryKey(new CRecep_sample_detailKeys(idrecep_sample_detail)); CDescription_sample oDescription_sample = new CDescription_sampleFactory().GetByPrimaryKey(new CDescription_sampleKeys(oRecep_sample_detail.Cod_des_sample)); oBatch_detail_aa_twofold.Idtemplate_method = idtemplate_method; oBatch_detail_aa_twofold.Idrecep_sample = idrecep_sample; oBatch_detail_aa_twofold.Idrecep_sample_detail = idrecep_sample_detail; oBatch_detail_aa_twofold.Idrecep_sample_detail_elem = idrecep_sample_detail_elem; oBatch_detail_aa_twofold.Idunit_result = oTemplate_method_aa.Idunit_result; oBatch_detail_aa_twofold.Weight1 = oTemplate_method_aa.Weight; oBatch_detail_aa_twofold.Weight2 = oTemplate_method_aa.Weight; oBatch_detail_aa_twofold.Volumen1 = oTemplate_method_aa.Volumen; oBatch_detail_aa_twofold.Volumen2 = oTemplate_method_aa.Volumen; oBatch_detail_aa_twofold.Dilu2 = oTemplate_method_aa.Dilution2; oBatch_detail_aa_twofold.Dilu3 = oTemplate_method_aa.Dilution3; oBatch_detail_aa_twofold.Flag_dilu2 = false; oBatch_detail_aa_twofold.Flag_dilu3 = false; oBatch_detail_aa_twofold.Flag_mri = 0; oBatch_detail_aa_twofold.Fum = methods.GetFactorConvertionUM(idtemplate_method); oBatch_detail_aa_twofold.Qaqc_blk = 3; oBatch_detail_aa_twofold.Qaqc_par = 3; oBatch_detail_aa_twofold.Qaqc_mr = 3; oBatch_detail_aa_twofold.Qaqc_error = 0; oBatch_detail_aa_twofold.Qaqc_approve = false; oBatch_detail_aa_twofold.Qaqc_review = false; oBatch_detail_aa_twofold.Qaqc_has_retest = 0; oBatch_detail_aa_twofold.Qaqc_tmp_retest = 0; oBatch_detail_aa_twofold.Qaqc_tmp_retest_idmethod = 0; oBatch_detail_aa_twofold.Qaqc_approve_text = ""; oBatch_detail_aa_twofold.Qaqc_review_text = ""; oBatch_detail_aa_twofold.Qaqc_par_prev_batch = previus_parity; oBatch_detail_aa_twofold.Cod_interno = cod_interno; oBatch_detail_aa_twofold.Cod_sample = str_cod_interno; oBatch_detail_aa_twofold.Cod_des_sample = oRecep_sample_detail.Cod_des_sample; oBatch_detail_aa_twofold.Order_des_sample = oDescription_sample.Priority_order; // --- control sample control_sample.Idtemplate_method = idtemplate_method; //control_sample.Idrecep_sample = idrecep_sample; //control_sample.Idrecep_sample_detail = idrecep_sample_detail; //control_sample.Idrecep_sample_detail_elem = idrecep_sample_detail_elem; control_sample.Weight1 = oTemplate_method_aa.Weight; control_sample.Weight2 = oTemplate_method_aa.Weight; control_sample.Volumen1 = oTemplate_method_aa.Volumen; control_sample.Volumen2 = oTemplate_method_aa.Volumen; control_sample.Dilu2 = oTemplate_method_aa.Dilution2; control_sample.Dilu3 = oTemplate_method_aa.Dilution3; control_sample.Flag_dilu2 = false; control_sample.Flag_dilu3 = false; control_sample.Flag_mri = 1; control_sample.Fum = methods.GetFactorConvertionUM(idtemplate_method); control_sample.Qaqc_blk = 3; control_sample.Qaqc_par = 3; control_sample.Qaqc_mr = 3; control_sample.Qaqc_error = 0; control_sample.Qaqc_approve = false; control_sample.Qaqc_review = false; control_sample.Qaqc_tmp_retest_idmethod = 0; control_sample.Qaqc_approve_text = ""; control_sample.Qaqc_review_text = ""; SaveInBatch(oBatch_detail_aa_twofold, user); }
private void SaveInBatch(CBatch_detail_aa_twofold oBatch_detail_aa_twofold, string user) { // --- get batch int idtemplate_method = Convert.ToInt32(oBatch_detail_aa_twofold.Idtemplate_method); long origin_batch = -1; if (Enabled_retest) { origin_batch = Convert.ToInt64(oRetest.Origin_batch); } long idbatch = Convert.ToInt64(GetBatchAvailable(idtemplate_method, user, origin_batch)); CBatch oBatch = new CBatchFactory().GetByPrimaryKey(new CBatchKeys(idbatch)); int num_free_places = GetNumFreePlacesInBatch(idbatch, idtemplate_method); if (num_free_places >= 1) { if (!Convert.ToBoolean(oBatch.Has_sample_control)) // batch no tiene mri { long index_mri = GetIndexMriPredecessor(idbatch, Convert.ToInt64(oBatch_detail_aa_twofold.Cod_interno)); if (index_mri > 0)// --- el batch no tiene mri y en sus predecesores debe existir uno { if (num_free_places >= 2) { // --- insert mri control_sample.Cod_interno = index_mri; control_sample.Idbatch = idbatch; control_sample.Cod_sample = Comun.FormatCorrelativeCode(Correlative.Prefix + Correlative.Cod_serie, index_mri, Convert.ToInt32(Correlative.Num_digits)); if (faBatch_detail_aa_twofold.Insert(control_sample)) { oBatch.Has_sample_control = true; new CBatchFactory().Update(oBatch); } // --- insert sample CBatch_detail_aa_twofoldFactory faBatch_detail_aa_towfold = new CBatch_detail_aa_twofoldFactory(); oBatch_detail_aa_twofold.Idbatch = idbatch; faBatch_detail_aa_towfold.Insert(oBatch_detail_aa_twofold); SaveRetest(idbatch); } if (num_free_places == 1) { // --- insert mri control_sample.Cod_interno = index_mri; control_sample.Idbatch = idbatch; control_sample.Cod_sample = Comun.FormatCorrelativeCode(Correlative.Prefix + Correlative.Cod_serie, index_mri, Convert.ToInt32(Correlative.Num_digits)); if (faBatch_detail_aa_twofold.Insert(control_sample)) { oBatch.Has_sample_control = true; new CBatchFactory().Update(oBatch); } // --- search batch to sample SaveInBatch(oBatch_detail_aa_twofold, user); } } else // --- index_mri = 0; entonces la bandeja no lleva mri { oBatch_detail_aa_twofold.Idbatch = idbatch; faBatch_detail_aa_twofold.Insert(oBatch_detail_aa_twofold); SaveRetest(idbatch); } } else { oBatch_detail_aa_twofold.Idbatch = idbatch; faBatch_detail_aa_twofold.Insert(oBatch_detail_aa_twofold); SaveRetest(idbatch); } } }
public void MoveToExistBatch(List <CBatch> lst, CBatch_detail_aa_twofold sample) { LinkedList <CBatch> linked_list = new LinkedList <CBatch>(lst); InsertBatch(linked_list.First, sample); }
public void SetTypeErrorParity(CBatch_detail_aa_twofold current_row) { ///qaqc_error = ( ///0:sin errores, ///1:sin error con texto, ///2:sin error con reensayo, ///3:con error no aprobado, ///4:con error aprobado con observacion, ///5:con error aprobado con reensayo /// // --- current status bool Flag_parity = false; bool Flag_approve_with_retest = false; bool Flag_approve_with_text = false; Flag_parity = false; // 1=true, 2=false if (Convert.ToInt32(current_row.Qaqc_par) == 1) { Flag_parity = true; } Flag_approve_with_text = false; if (current_row.Qaqc_approve_text.Trim().Length > 0) { Flag_approve_with_text = true; } Flag_approve_with_retest = false; // Qaqc_idretest: >0 (idtemplate_method) if (Convert.ToBoolean(current_row.Qaqc_tmp_retest)) { Flag_approve_with_retest = true; } if (Flag_parity) { current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithoutError); if (Flag_approve_with_text) { current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithoutErrorWithText); } if (Flag_approve_with_retest) { current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithoutErrorWithRetest); } } else { current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithErrorNotApproved); if (Flag_approve_with_text) { current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithErrorApprovedWithText); } if (Flag_approve_with_retest) { current_row.Qaqc_error = Comun.GetStatusErrorParity(Comun.StatusErrorParity.WithErrorApprovedWithRetest); } } }
void AssignValues(CBatch_detail_aa_twofold current_row) { CSignificantValue oSignificantValue = new CSignificantValue(Convert.ToInt32(current_row.Idtemplate_method)); string factor1 = "", factor2 = "", reading1 = "", reading2 = "", law1 = "", law2 = ""; double law_avg; //law_avg = parser.SimplifyDouble("Result_analysis"); object evalReading1 = current_row.Reading1; object evalReading2 = current_row.Reading2; if (current_row.Reading1 != null) { reading1 = current_row.Reading1; } if (current_row.Reading2 != null) { reading2 = current_row.Reading2; } factor1 = current_row.Factor1; law1 = current_row.Law1; factor2 = current_row.Factor2; law2 = current_row.Law2; double reading_value1 = 0; double reading_value2 = 0; if (double.TryParse(current_row.Reading1, out reading_value1)) { law1 = parser.SimplifyDouble("law1").ToString(); factor1 = parser.DicVar["factor1"].FloatNumber.ToString(); oSignificantValue.ApplySignificant2(factor1, reading1, law1); current_row.Law1 = oSignificantValue.Law; current_row.Factor1 = oSignificantValue.Factor; current_row.Reading1 = oSignificantValue.Reading; } if (double.TryParse(current_row.Reading2, out reading_value2)) { law2 = parser.SimplifyDouble("law2").ToString(); factor2 = parser.DicVar["factor2"].FloatNumber.ToString(); oSignificantValue.ApplySignificant2(factor2, reading2, law2); current_row.Law2 = oSignificantValue.Law; current_row.Factor2 = oSignificantValue.Factor; current_row.Reading2 = oSignificantValue.Reading; } // --- the avg law convert to significative value // --- calculate only the rows aren't mri if (!RowIsMri(current_row)) { if (Contain_all_reading(current_row)) { law_avg = parser.SimplifyDouble("Result_analysis"); current_row.Result_analysis = Convert.ToDecimal(law_avg); current_row.Str_result_analysis = oSignificantValue.GetReportLaw(law_avg); } } else { current_row.Result_analysis = Convert.ToDecimal(current_row.Law2_long); current_row.Str_result_analysis = current_row.Law2; } }
public void CallSaveSampleBatchWithRetest(int idtemplate_method, long idrecep_sample, long idrecep_sample_detail, long idrecep_sample_detail_elem, long cod_interno, string str_cod_interno, string user, CCorrelative correlative, int Qaqc_par_prev_batch, long origin_batch) { Correlative = correlative; CBatch_detail_aa_twofold oBatch_detail_aa_twofold = new CBatch_detail_aa_twofold(); oTemplate_method = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(idtemplate_method)); CTemplate_method_aa oTemplate_method_aa = new CTemplate_method_aaFactory().GetByPrimaryKey(new CTemplate_method_aaKeys(idtemplate_method)); CRecep_sample_detail oRecep_sample_detail = new CRecep_sample_detailFactory().GetByPrimaryKey(new CRecep_sample_detailKeys(idrecep_sample_detail)); CDescription_sample oDescription_sample = new CDescription_sampleFactory().GetByPrimaryKey(new CDescription_sampleKeys(oRecep_sample_detail.Cod_des_sample)); if (oTemplate_method_aa != null) { oBatch_detail_aa_twofold.Idtemplate_method = idtemplate_method; oBatch_detail_aa_twofold.Idrecep_sample = idrecep_sample; oBatch_detail_aa_twofold.Idrecep_sample_detail = idrecep_sample_detail; oBatch_detail_aa_twofold.Idrecep_sample_detail_elem = idrecep_sample_detail_elem; oBatch_detail_aa_twofold.Idunit_result = oTemplate_method_aa.Idunit_result; oBatch_detail_aa_twofold.Weight1 = oTemplate_method_aa.Weight; oBatch_detail_aa_twofold.Weight2 = oTemplate_method_aa.Weight; oBatch_detail_aa_twofold.Volumen1 = oTemplate_method_aa.Volumen; oBatch_detail_aa_twofold.Volumen2 = oTemplate_method_aa.Volumen; oBatch_detail_aa_twofold.Dilu2 = oTemplate_method_aa.Dilution2; oBatch_detail_aa_twofold.Dilu3 = oTemplate_method_aa.Dilution3; oBatch_detail_aa_twofold.Flag_dilu2 = false; oBatch_detail_aa_twofold.Flag_dilu3 = false; oBatch_detail_aa_twofold.Cod_des_sample = oRecep_sample_detail.Cod_des_sample; oBatch_detail_aa_twofold.Order_des_sample = oDescription_sample.Priority_order; oBatch_detail_aa_twofold.Flag_mri = 0; oBatch_detail_aa_twofold.Fum = methods.GetFactorConvertionUM(idtemplate_method); oBatch_detail_aa_twofold.Qaqc_blk = 3; oBatch_detail_aa_twofold.Qaqc_par = 3; oBatch_detail_aa_twofold.Qaqc_mr = 3; oBatch_detail_aa_twofold.Qaqc_error = 0; oBatch_detail_aa_twofold.Qaqc_approve = false; oBatch_detail_aa_twofold.Qaqc_review = false; oBatch_detail_aa_twofold.Qaqc_has_retest = 0; oBatch_detail_aa_twofold.Qaqc_tmp_retest = 0; oBatch_detail_aa_twofold.Qaqc_tmp_retest_idmethod = 0; oBatch_detail_aa_twofold.Qaqc_approve_text = ""; oBatch_detail_aa_twofold.Qaqc_review_text = ""; oBatch_detail_aa_twofold.Qaqc_par_prev_batch = Qaqc_par_prev_batch; oBatch_detail_aa_twofold.Cod_interno = cod_interno; oBatch_detail_aa_twofold.Cod_sample = str_cod_interno; control_sample.Idtemplate_method = idtemplate_method; //control_sample.Idrecep_sample = idrecep_sample; //control_sample.Idrecep_sample_detail = idrecep_sample_detail; //control_sample.Idrecep_sample_detail_elem = idrecep_sample_detail_elem; control_sample.Weight1 = oTemplate_method_aa.Weight; control_sample.Weight2 = oTemplate_method_aa.Weight; control_sample.Volumen1 = oTemplate_method_aa.Volumen; control_sample.Volumen2 = oTemplate_method_aa.Volumen; control_sample.Dilu2 = oTemplate_method_aa.Dilution2; control_sample.Dilu3 = oTemplate_method_aa.Dilution3; control_sample.Flag_dilu2 = false; control_sample.Flag_dilu3 = false; control_sample.Flag_mri = 1; control_sample.Fum = methods.GetFactorConvertionUM(idtemplate_method); control_sample.Qaqc_blk = 3; control_sample.Qaqc_par = 3; control_sample.Qaqc_mr = 3; control_sample.Qaqc_error = 0; control_sample.Qaqc_approve = false; control_sample.Qaqc_review = false; control_sample.Qaqc_tmp_retest_idmethod = 0; control_sample.Qaqc_approve_text = ""; control_sample.Qaqc_review_text = ""; Enabled_retest = true; oRetest.Idrecep_sample_detail = idrecep_sample_detail; oRetest.Idrecep_sample_detail_elem = idrecep_sample_detail_elem; oRetest.Origin_batch = origin_batch; oRetest.Useredit1 = user; oRetest.Usernew = user; oRetest.Type_retest = 'R'; oRetest.Status = true; // --- save in batch SaveInBatch(oBatch_detail_aa_twofold, user); } }
void registerVariables(CBatch_detail_aa_twofold current_row) { parser = new MathParserNet.Parser(); // --- register functions parser.RegisterCustomDoubleFunction("deter_dilu", Deter_Dilu); // --- register variables //parser.AddVariable("", Convert.ToDouble()); parser.AddVariable("weight1", Convert.ToDouble(current_row.Weight1)); parser.AddVariable("weight2", Convert.ToDouble(current_row.Weight2)); parser.AddVariable("volumen1", Convert.ToDouble(current_row.Volumen1)); parser.AddVariable("volumen2", Convert.ToDouble(current_row.Volumen2)); if (current_row.Reading1 != null && current_row.Reading1.Trim() != "") parser.AddVariable("reading1", current_row.Reading1); else parser.AddVariable("reading1", 0); if (current_row.Reading2 != null && current_row.Reading2.Trim() != "") parser.AddVariable("reading2", current_row.Reading2); else parser.AddVariable("reading2", 0); parser.AddVariable("dilu2", Convert.ToDouble(current_row.Dilu2)); parser.AddVariable("dilu3", Convert.ToDouble(current_row.Dilu3)); parser.AddVariable("flag_dilu2", Convert.ToDouble(current_row.Flag_dilu2)); parser.AddVariable("flag_dilu3", Convert.ToDouble(current_row.Flag_dilu3)); parser.AddVariable("fum", Convert.ToDouble(current_row.Fum)); parser.AddVariable("calc_dilu2", "deter_dilu(dilu2, flag_dilu2)"); parser.AddVariable("calc_dilu3", "deter_dilu(dilu3, flag_dilu3)"); parser.AddVariable("factor1", "volumen1/weight1*calc_dilu2*calc_dilu3*fum"); parser.AddVariable("factor2", "volumen2/weight2*calc_dilu2*calc_dilu3*fum"); parser.AddVariable("law1", "reading1*factor1"); parser.AddVariable("law2", "reading2*factor2"); parser.AddVariable("Result_analysis", "(law1+law2)/2"); AssignValues(current_row); }
void AssignValues(CBatch_detail_aa_twofold current_row) { CSignificantValue oSignificantValue = new CSignificantValue(Convert.ToInt32(current_row.Idtemplate_method)); string factor1 = "", factor2 = "", reading1 = "", reading2 = "", law1 = "", law2 = ""; double law_avg; //law_avg = parser.SimplifyDouble("Result_analysis"); object evalReading1 = current_row.Reading1; object evalReading2 = current_row.Reading2; if (current_row.Reading1 != null) reading1 = current_row.Reading1; if (current_row.Reading2 != null) reading2 = current_row.Reading2; factor1 = current_row.Factor1; law1 = current_row.Law1; factor2 = current_row.Factor2; law2 = current_row.Law2; double reading_value1 = 0; double reading_value2 = 0; if (double.TryParse(current_row.Reading1, out reading_value1)) { law1 = parser.SimplifyDouble("law1").ToString(); factor1 = parser.DicVar["factor1"].FloatNumber.ToString(); oSignificantValue.ApplySignificant2(factor1, reading1, law1); current_row.Law1 = oSignificantValue.Law; current_row.Factor1 = oSignificantValue.Factor; current_row.Reading1 = oSignificantValue.Reading; } if (double.TryParse(current_row.Reading2, out reading_value2)) { law2 = parser.SimplifyDouble("law2").ToString(); factor2 = parser.DicVar["factor2"].FloatNumber.ToString(); oSignificantValue.ApplySignificant2(factor2, reading2, law2); current_row.Law2 = oSignificantValue.Law; current_row.Factor2 = oSignificantValue.Factor; current_row.Reading2 = oSignificantValue.Reading; } // --- the avg law convert to significative value // --- calculate only the rows aren't mri if (!RowIsMri(current_row)) { if (Contain_all_reading(current_row)) { law_avg = parser.SimplifyDouble("Result_analysis"); current_row.Result_analysis = Convert.ToDecimal(law_avg); current_row.Str_result_analysis = oSignificantValue.GetReportLaw(law_avg); } } else { current_row.Result_analysis = Convert.ToDecimal(current_row.Law2_long); current_row.Str_result_analysis = current_row.Law2; } }
public void ApplyQaQcParity(CBatch_detail_aa_twofold current_row) { ///Qaqc_par ///--------- ///1: diferencia de lecturas dentro del factor de repetibilidad ///2: diferencia de lecturas fuera del factor de repetibilidad ///3: reservado para mri ///4: lecturas fuera del límite mínimo y máximo ///5: lecturas vacias int flag_mri = Convert.ToInt32(current_row.Flag_mri); if (flag_mri == 0) { decimal max_reading = -100; decimal min_reading = 0; decimal reading1 = 0; decimal reading2 = 0; if (decimal.TryParse(current_row.Reading1, out reading1) && decimal.TryParse(current_row.Reading2, out reading2)) { // --- ambas lecturas son decimales // --- get min and max if (reading1 >= max_reading) max_reading = reading1; if (reading2 >= max_reading) max_reading = reading2; min_reading = max_reading; if (reading1 <= min_reading) min_reading = reading1; if (reading2 <= min_reading) min_reading = reading2; // --- verificar que están dentro del límite de lecturas if (min_reading < oTemplate_method_aa.Reading_min || max_reading > oTemplate_method_aa.Reading_max) current_row.Qaqc_par = 4; // purple else { if (Math.Abs(max_reading - min_reading) <= Factor_repetibility) current_row.Qaqc_par = 1; // dentro del factor de repetibilidad else current_row.Qaqc_par = 2; // fuera del factor de repetibilidad } } else { // --- una o ambas lecturas no son decimales if (decimal.TryParse(current_row.Reading1, out reading1)) { // --- la lectura 1 es decimal if (reading1 < oTemplate_method_aa.Reading_min || reading1 > oTemplate_method_aa.Reading_max) current_row.Qaqc_par = 4; } else if (decimal.TryParse(current_row.Reading2, out reading2)) { // --- la lectura 2 es decimal if (reading2 < oTemplate_method_aa.Reading_min || reading2 > oTemplate_method_aa.Reading_max) current_row.Qaqc_par = 4; } else { // --- ambas lecturas no son decimales current_row.Qaqc_par = 5; // 5: para designar que no se tiene muestras } } SetTypeErrorParity(current_row); } else current_row.Qaqc_par = 3; // reservado para mri (sin imagen) }