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 static void Finalize_process(long idbatch, string process, string sgtProcess) { CTrace_batchFactory faTrace_batch = new CTrace_batchFactory(); // --- get a process existing CTrace_batch oTrace_batch = new LimsProject.BusinessLayer.Modules.ModProcessBatch().GetLastProcessBatch(process, idbatch); CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(process)); if (oTrace_batch == null) { oTrace_batch = new CTrace_batch(); oTrace_batch.Date_in = Comun.GetDate(); oTrace_batch.Usernew = Comun.GetUser(); oTrace_batch.Idbatch = idbatch; } oTrace_batch.Date_out = Comun.GetDate(); oTrace_batch.Cod_process = process; //oTrace_batch.Cod_module = modulo; oTrace_batch.Useredit = Comun.GetUser(); oTrace_batch.Status_process = Convert.ToChar(LimsProcess.Status_Process.Finished); if (!faTrace_batch.Update(oTrace_batch)) { faTrace_batch.Insert(oTrace_batch); } // --- create a new process Initialize_process(idbatch, sgtProcess); }
public void InitCombos() { CProcessFactory faProcess = new CProcessFactory(); var ProcessQuery = from table in faProcess.GetAll() select new CItemGenericCombo { codigo = table.Idprocess.ToString(), descripcion = table.Name_process }; cbProcess.AssignData(new List <CItemGenericCombo>(ProcessQuery)); cbProcess.Refresh(); //cbUnidadMedida1.FormAbout = Comun.Formulario.fmMeasurementUnit; //cbUnidadMedida1.EventShowForm += Comun.OpenForm; CProcess_stageFactory faProcess_stage = new CProcess_stageFactory(); var StageQuery = from table in faProcess_stage.GetAll() select new CItemGenericCombo { codigo = table.Idprocess_stage.ToString(), descripcion = table.Name_process_stage }; cbStage.AssignData(new List <CItemGenericCombo>(StageQuery)); cbStage.Refresh(); }
public void InitCombos() { CProcessFactory faProcess = new CProcessFactory(); var ProcessQuery = from table in faProcess.GetAll() select new CItemGenericCombo { codigo = table.Idprocess.ToString(), descripcion = table.Name_process }; cbProcess.AssignData(new List<CItemGenericCombo>(ProcessQuery)); cbProcess.Refresh(); //cbUnidadMedida1.FormAbout = Comun.Formulario.fmMeasurementUnit; //cbUnidadMedida1.EventShowForm += Comun.OpenForm; CProcess_stageFactory faProcess_stage = new CProcess_stageFactory(); var StageQuery = from table in faProcess_stage.GetAll() select new CItemGenericCombo { codigo = table.Idprocess_stage.ToString(), descripcion = table.Name_process_stage }; cbStage.AssignData(new List<CItemGenericCombo>(StageQuery)); cbStage.Refresh(); }
void InitComboFilterAthorization() { // --- dates deFrom.EditValue = Comun.GetDate(); deUntil.EditValue = Comun.GetDate(); // --- process user system CProcess_user_systemFactory faProcess_user_system = new CProcess_user_systemFactory(); CProcessFactory faProces = new CProcessFactory(); CAreaFactory faArea = new CAreaFactory(); List<CProcessAuthorization> lstHistory = new List<CProcessAuthorization>(); lstHistory.Add(new CProcessAuthorization { Cod_area = "0000", Nom_area = "Historial" }); var history = from c in lstHistory select new { c.Cod_area, c.Nom_area }; var areasByUser = (from p in faProcess_user_system.GetAll() join c in faArea.GetAll() on p.Cod_area equals c.Cod_area where p.Iduser == Comun.User_system.Iduser select new { c.Cod_area, c.Nom_area }).Distinct(); cbAuthorizationWait.Properties.DataSource = areasByUser.ToList(); cbAuthorizationWait.Properties.DisplayMember = "Nom_area"; cbAuthorizationWait.Properties.ValueMember = "Cod_area"; cbAuthorizationWait.EditValue = areasByUser.ToList()[0].Cod_area; cbAuthorizationApproved.Properties.DataSource = areasByUser.Concat(history).ToList(); cbAuthorizationApproved.Properties.DisplayMember = "Nom_area"; cbAuthorizationApproved.Properties.ValueMember = "Cod_area"; cbAuthorizationApproved.EditValue = areasByUser.ToList()[0].Cod_area; }
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); } }
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); } }
public static void Finalize_process(long idbatch, string process, string sgtProcess) { CTrace_batchFactory faTrace_batch = new CTrace_batchFactory(); // --- get a process existing CTrace_batch oTrace_batch = new LimsProject.BusinessLayer.Modules.ModProcessBatch().GetLastProcessBatch(process, idbatch); CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(process)); if (oTrace_batch == null) { oTrace_batch = new CTrace_batch(); oTrace_batch.Date_in = Comun.GetDate(); oTrace_batch.Usernew = Comun.GetUser(); oTrace_batch.Idbatch = idbatch; } oTrace_batch.Date_out = Comun.GetDate(); oTrace_batch.Cod_process = process; //oTrace_batch.Cod_module = modulo; oTrace_batch.Useredit = Comun.GetUser(); oTrace_batch.Status_process = Convert.ToChar(LimsProcess.Status_Process.Finished); if (!faTrace_batch.Update(oTrace_batch)) faTrace_batch.Insert(oTrace_batch); // --- create a new process Initialize_process(idbatch, sgtProcess); }