protected override void Recuperar_Registro() { CMeasurement_unit oMeasurement_unit = new CMeasurement_unit(); CMeasurement_unitFactory faMeasurement_unit = new CMeasurement_unitFactory(); oMeasurement_unit = faMeasurement_unit.GetByPrimaryKey(new CMeasurement_unitKeys(IDUnit)); if (oMeasurement_unit != null) { tbNameUnit.Text = oMeasurement_unit.Name_unit; tbDescription.Text = oMeasurement_unit.Description; cbConcentration_unit.EditValue = oMeasurement_unit.Concentration_unit; } }
void InitCombos() { // --- Init : measurement unit 1 CMeasurement_unitFactory faMeasurement_unit = new CMeasurement_unitFactory(); repUm1.DataSource = faMeasurement_unit.GetAll(); repUm1.DisplayMember = "Name_unit"; repUm1.ValueMember = "Idunit"; // --- Init : measurement unit 2 repUm2.DataSource = faMeasurement_unit.GetAll(); repUm2.DisplayMember = "Name_unit"; repUm2.ValueMember = "Idunit"; }
public void InitData() { #region init combos try { CMeasurement_unitFactory faMeasurement_unit = new CMeasurement_unitFactory(); cbUnit_result.Properties.DataSource = faMeasurement_unit.GetAll(); cbUnit_result.Properties.DisplayMember = "Name_unit"; cbUnit_result.Properties.ValueMember = "Idunit"; } catch (Exception ex) { ComunForm.Send_message(this.Text, TypeMsg.error, ex.Message); } #endregion }
protected override bool Grabar_Registro() { bool result = false; CMeasurement_unit oMeasurement_unit = new CMeasurement_unit(); CMeasurement_unitFactory faMeasurement_unit = new CMeasurement_unitFactory(); oMeasurement_unit.Idunit = IDUnit; oMeasurement_unit.Name_unit = tbNameUnit.Text; oMeasurement_unit.Description = tbDescription.Text; oMeasurement_unit.Concentration_unit = Convert.ToInt32(cbConcentration_unit.EditValue); if (!(result = faMeasurement_unit.Update(oMeasurement_unit))) { result = faMeasurement_unit.Insert(oMeasurement_unit); } return result; }
protected override bool Grabar_Registro() { bool result = false; CMeasurement_unit oMeasurement_unit = new CMeasurement_unit(); CMeasurement_unitFactory faMeasurement_unit = new CMeasurement_unitFactory(); oMeasurement_unit.Idunit = IDUnit; oMeasurement_unit.Name_unit = tbNameUnit.Text; oMeasurement_unit.Description = tbDescription.Text; oMeasurement_unit.Concentration_unit = Convert.ToInt32(cbConcentration_unit.EditValue); if (!(result = faMeasurement_unit.Update(oMeasurement_unit))) { result = faMeasurement_unit.Insert(oMeasurement_unit); } return(result); }
private void FormMaterialReference_Load(object sender, EventArgs e) { // --- Initialize material of reference CMrFactory faMr = new CMrFactory(); cbCodMR.Properties.DataSource = faMr.GetAll(); cbCodMR.Properties.ValueMember = "Idmr"; cbCodMR.Properties.DisplayMember = "Cod_mr"; // --- Initialize description sample cbDescription.Properties.DataSource = Comun.ListTypeMaterial; cbDescription.Properties.ValueMember = "IdTypeMaterial"; cbDescription.Properties.DisplayMember = "Description"; // --- Initialize type of analysis CDigestion_methodFactory faDigestion_method = new CDigestion_methodFactory(); repTypeDigestion.DataSource = faDigestion_method.GetAll(); repTypeDigestion.ValueMember = "Cod_digestion_method"; repTypeDigestion.DisplayMember = "Name_digestion_method"; // --- Initialize the type of material reference cbTypeMr.Properties.DataSource = Comun.ListMr; cbTypeMr.Properties.DisplayMember = "Den_TypeMr"; cbTypeMr.Properties.ValueMember = "IdTypeMr"; // --- Initialize in container grid element CElementFactory faElement = new CElementFactory(); repElement.DataSource = faElement.GetAll(); repElement.DisplayMember = "Cod_element"; repElement.ValueMember = "Idelement"; // --- Initialize in container grid unit measurement CMeasurement_unitFactory faMeasurement_unit = new CMeasurement_unitFactory(); repTypeUnit.DataSource = faMeasurement_unit.GetAll(); repTypeUnit.DisplayMember = "Name_unit"; repTypeUnit.ValueMember = "Idunit"; // --- Inititalize list statusMr lstStatusMr = new BindingList<CStatusMr>(); lstStatusMr.Add(new CStatusMr { IDStatusMr = true, Description = "Vigente" }); lstStatusMr.Add(new CStatusMr { IDStatusMr = false, Description = "No vigente" }); cbStatus.Properties.DataSource = lstStatusMr; cbStatus.Properties.DisplayMember = "Description"; cbStatus.Properties.ValueMember = "IDStatusMr"; // --- Initialize in container grid company CCompanyFactory faCompany = new CCompanyFactory(); List<CCompany> lstCompany = faCompany.GetAll().Where(c=> c.Type_company == 'P').ToList(); cbManufacturer.Properties.DataSource = lstCompany; cbManufacturer.Properties.DisplayMember = "Business_name"; cbManufacturer.Properties.ValueMember = "Idcompany"; cbCertifier.Properties.DataSource = lstCompany; cbCertifier.Properties.DisplayMember = "Business_name"; cbCertifier.Properties.ValueMember = "Idcompany"; // --- Initialize the grid GetDetailMaterialReference(); }
public List <CReception_template_method> GetMethodsDenominations(string cod_type_sample) { List <CTemplate_method> lstTemplate = new CTemplate_methodFactory().GetAll(); // --- get last version all methods by cod_type_sample var maxVersionTemplate = (from t1 in lstTemplate group t1 by new { t1.Cod_template_method, t1.Cod_type_sample } into grp select new { grp.Key.Cod_template_method, grp.Key.Cod_type_sample, MaxIdtemplate_method = grp.Max(c => c.Idtemplate_method) }).ToList().Where(q => q.Cod_type_sample == cod_type_sample).ToList(); List <CMeasurement_unit> lstMeasurement_unit = new CMeasurement_unitFactory().GetAll(); List <CElement> lstElement = new CElementFactory().GetAll(); // query absorción atómica var query_aa = (from p in new CTemplate_method_aaFactory().GetAll() from q in lstMeasurement_unit.Where(x => x.Idunit == p.Idunit_result) select new { Idtemplate_method = p.Idtemplate_method, Idunit_result = Convert.ToInt16(p.Idunit_result), Name_unit = q.Name_unit, Analisys_time = Convert.ToDecimal(p.Num_days) / Convert.ToDecimal(p.Num_samples) }).ToList(); // query vía clásica // query icp // query analisis de humedad var query_ah = (from p in new CTemplate_method_ahFactory().GetAll() from q in lstMeasurement_unit.Where(x => x.Idunit == p.Idunit_result) select new { Idtemplate_method = p.Idtemplate_method, Idunit_result = Convert.ToInt16(p.Idunit_result), Name_unit = q.Name_unit, Analisys_time = Convert.ToDecimal(0) }).ToList(); var queryTypeAnalysis = query_aa.Union(query_ah); List <CReception_template_method> lstCustom = (from t1 in lstTemplate from k in queryTypeAnalysis.Where(x => x.Idtemplate_method == t1.Idtemplate_method) join t3 in maxVersionTemplate on t1.Idtemplate_method equals t3.MaxIdtemplate_method join t4 in lstElement on t1.Idelement equals t4.Idelement select new CReception_template_method { Idelement = t1.Idelement, Idtemplate_method = t1.Idtemplate_method, Cod_template_method = t1.Cod_template_method, Abbreviation = t1.Abbreviation, Title = t1.Title, Type_analisys = t1.Type_analisys, Name_type_analisys = CaseNomTypeAnalysis(t1.Type_analisys), Cod_type_sample = t1.Cod_type_sample, Cost_method = t1.Cost_method, Idunit_result = k.Idunit_result, Name_unit = k.Name_unit, Analisys_time = k.Analisys_time, Cod_element = t4.Cod_element }).OrderBy(c => c.Cod_template_method).ToList <CReception_template_method>(); return(lstCustom); }
void Show_batch() { // --- show trace groups gbApprove.Visible = false; gbReview.Visible = false; gv2col_Qaqc_approve.ImageIndex = 0; gv2col_Qaqc_review.ImageIndex = 0; // --- show template method ShowDilution(); // --- show description method CBatchFactory faBatch = new CBatchFactory(); CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch)); laTitleModule.Text = String.Format("Bandeja {0} en Espera", Comun.FormatCorrelativeCode("B-", Convert.ToInt64(oBatch.Num_tray), 5)); if (oBatch.Status_process == 'W') { ucSignCloseTray.Title = "Cerrar bandeja"; ucSignCloseTray.Enabled = true; bgvBatchCalc2.OptionsBehavior.Editable = false; } if (oBatch.Status_process == 'P') { ucSignCloseTray.Title = "Cerrado("+oBatch.User_close_tray+")"; ucSignCloseTray.Enabled = false; bgvBatchCalc2.OptionsBehavior.Editable = true; } CTemplate_methodFactory faTemplate_method = new CTemplate_methodFactory(); oTemplate_method_current = faTemplate_method.GetByPrimaryKey(new CTemplate_methodKeys(Idtemplate_method)); tbCodMethod.Text = oTemplate_method_current.Cod_template_method; tbTitle.Text = oTemplate_method_current.Title; tbAbbreviation.Text = oTemplate_method_current.Abbreviation; #region <optimizar> CTemplate_method_aaFactory faTemplate_method_aa = new CTemplate_method_aaFactory(); oTemplate_method_aa_current = faTemplate_method_aa.GetByPrimaryKey(new CTemplate_method_aaKeys(Idtemplate_method)); deDate_allowed_error.DateTime = Convert.ToDateTime(oTemplate_method_aa_current.Date_allowed_error); CMr_detailFactory faMr_detail = new CMr_detailFactory(); CMr_detail oMr_detail = faMr_detail.GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(oTemplate_method_aa_current.Idmr_detail))); tbLawMri.Text = oMr_detail.Nominal_value.ToString(); CMrFactory faMr = new CMrFactory(); CMr oMr = faMr.GetByPrimaryKey(new CMrKeys( Convert.ToInt16(oMr_detail.Idmr) )); tbMri.Text = oMr.Cod_mr; CMeasurement_unitFactory faMeasure = new CMeasurement_unitFactory(); CMeasurement_unit oMeasurement_unit = faMeasure.GetByPrimaryKey(new CMeasurement_unitKeys(Convert.ToInt16(oMr_detail.Idunit1))); tbUnitMeasure.Text = oMeasurement_unit.Name_unit; #endregion // --- clear columns gcBachCalc.DataSource = null; // --- format the datatable with the number of repetitions oDataBatch = new CDataBatch(Idbatch, Idtemplate_method, Comun.StatusWork.Waiting, Comun.CriteriaSort.BySample); gcBachCalc.DataSource = oDataBatch.ListSamples; // --- show sd tbAbs.Value = oDataBatch.Absorbance; tbStd.Value = oDataBatch.StdVerification; tbAbs.BackColor = oDataBatch.ColorAbsorbance; tbStd.BackColor = oDataBatch.ColorStd; tbSdBlk.Text = oDataBatch.LrbMeasured.ToString(); tbSdBlk.BackColor = oDataBatch.ColorLrbMeasured; tbSdMr.Text = oDataBatch.MriMeasured.ToString(); tbSdMr.BackColor = oDataBatch.ColorMriMeasured; // --- show empty sample ShowParityEmptySample(false); }
void Show_batch_finished() { gbApprove.Visible = true; gbReview.Visible = true; gv2col_Qaqc_approve.ImageIndex = 0; gv2col_Qaqc_review.ImageIndex = 0; // --- show template method ShowDilution(); // --- show description method CTemplate_methodFactory faTemplate_method = new CTemplate_methodFactory(); CTemplate_method oTemplate_method = faTemplate_method.GetByPrimaryKey(new CTemplate_methodKeys(Idtemplate_method)); tbCodMethod.Text = oTemplate_method.Cod_template_method; tbTitle.Text = oTemplate_method.Title; tbAbbreviation.Text = oTemplate_method.Abbreviation; // --- get batch trace_batch CTrace_batchFactory faTrace_batch = new CTrace_batchFactory(); Dictionary<string, string> dtTrace_batch = new BusinessLayer.Modules.ModProcessBatch().GetCurrentAndBelow(Idbatch, LimsProcess.PROCESS_IN_READING); CBatchFactory faBatch = new CBatchFactory(); CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch)); laTitleModule.Text = String.Format("Bandeja {0} Aprobada\n ({1})" , "B-" + oBatch.Num_tray.ToString().PadLeft(5, '0') , dtTrace_batch["User_approved"].ToString()); laUser_approved.Text = dtTrace_batch["User_approved"].ToString(); laDate_approved.Text = dtTrace_batch["Date_approved"].ToString(); laUser_revised.Text = dtTrace_batch["User_revised"].ToString(); laDate_revised.Text = dtTrace_batch["Date_revised"].ToString(); #region <optimizar> 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)); deDate_allowed_error.DateTime = Convert.ToDateTime(oTemplate_method_aa.Date_allowed_error); CMr_detailFactory faMr_detail = new CMr_detailFactory(); CMr_detail oMr_detail = faMr_detail.GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(oTemplate_method_aa.Idmr_detail))); tbLawMri.Text = oMr_detail.Nominal_value.ToString(); CMrFactory faMr = new CMrFactory(); CMr oMr = faMr.GetByPrimaryKey(new CMrKeys( Convert.ToInt16(oMr_detail.Idmr) )); tbMri.Text = oMr.Cod_mr; CMeasurement_unitFactory faMeasure = new CMeasurement_unitFactory(); CMeasurement_unit oMeasurement_unit = faMeasure.GetByPrimaryKey(new CMeasurement_unitKeys(Convert.ToInt16(oMr_detail.Idunit1))); tbUnitMeasure.Text = oMeasurement_unit.Name_unit; #endregion // --- clear columns gcBachCalc.DataSource = null; // --- format the datatable with the number of repetitions if (cbAuthorizationApproved.EditValue.ToString() == "0000") oDataBatch = new CDataBatch(Idbatch, Idtemplate_method, Comun.StatusWork.Saved, Comun.CriteriaSort.BySample); else oDataBatch = new CDataBatch(Idbatch, Idtemplate_method, Comun.StatusWork.Management, Comun.CriteriaSort.BySample); gcBachCalc.DataSource = oDataBatch.ListSamples; // --- show sd tbAbs.Value = oDataBatch.Absorbance; tbStd.Value = oDataBatch.StdVerification; tbAbs.BackColor = oDataBatch.ColorAbsorbance; tbStd.BackColor = oDataBatch.ColorStd; tbSdBlk.Text = oDataBatch.LrbMeasured.ToString(); tbSdBlk.BackColor = oDataBatch.ColorLrbMeasured; tbSdMr.Text = oDataBatch.MriMeasured.ToString(); tbSdMr.BackColor = oDataBatch.ColorMriMeasured; // --- OPTIMIZAR A USER CONTROL paAuthorization.Visible = true; // --- show empty sample ShowParityEmptySample(true); }
private void FormMaterialReference_Load(object sender, EventArgs e) { // --- Initialize material of reference CMrFactory faMr = new CMrFactory(); cbCodMR.Properties.DataSource = faMr.GetAll(); cbCodMR.Properties.ValueMember = "Idmr"; cbCodMR.Properties.DisplayMember = "Cod_mr"; // --- Initialize description sample cbDescription.Properties.DataSource = Comun.ListTypeMaterial; cbDescription.Properties.ValueMember = "IdTypeMaterial"; cbDescription.Properties.DisplayMember = "Description"; // --- Initialize type of analysis CDigestion_methodFactory faDigestion_method = new CDigestion_methodFactory(); repTypeDigestion.DataSource = faDigestion_method.GetAll(); repTypeDigestion.ValueMember = "Cod_digestion_method"; repTypeDigestion.DisplayMember = "Name_digestion_method"; // --- Initialize the type of material reference cbTypeMr.Properties.DataSource = Comun.ListMr; cbTypeMr.Properties.DisplayMember = "Den_TypeMr"; cbTypeMr.Properties.ValueMember = "IdTypeMr"; // --- Initialize in container grid element CElementFactory faElement = new CElementFactory(); repElement.DataSource = faElement.GetAll(); repElement.DisplayMember = "Cod_element"; repElement.ValueMember = "Idelement"; // --- Initialize in container grid unit measurement CMeasurement_unitFactory faMeasurement_unit = new CMeasurement_unitFactory(); repTypeUnit.DataSource = faMeasurement_unit.GetAll(); repTypeUnit.DisplayMember = "Name_unit"; repTypeUnit.ValueMember = "Idunit"; // --- Inititalize list statusMr lstStatusMr = new BindingList <CStatusMr>(); lstStatusMr.Add(new CStatusMr { IDStatusMr = true, Description = "Vigente" }); lstStatusMr.Add(new CStatusMr { IDStatusMr = false, Description = "No vigente" }); cbStatus.Properties.DataSource = lstStatusMr; cbStatus.Properties.DisplayMember = "Description"; cbStatus.Properties.ValueMember = "IDStatusMr"; // --- Initialize in container grid company CCompanyFactory faCompany = new CCompanyFactory(); List <CCompany> lstCompany = faCompany.GetAll().Where(c => c.Type_company == 'P').ToList(); cbManufacturer.Properties.DataSource = lstCompany; cbManufacturer.Properties.DisplayMember = "Business_name"; cbManufacturer.Properties.ValueMember = "Idcompany"; cbCertifier.Properties.DataSource = lstCompany; cbCertifier.Properties.DisplayMember = "Business_name"; cbCertifier.Properties.ValueMember = "Idcompany"; // --- Initialize the grid GetDetailMaterialReference(); }