//public BindingList<CSolution> GetLstChildSolution(int idsolution) //{ // List<CSolution> lst = new CSolutionFactory() // .GetAll().Where(c => c.Idpattern == idsolution && c.Status == true).ToList(); // return new BindingList<CSolution>(lst); //} //public BindingList<CSolution> GetLstChildMr(short idmr) //{ // List<CSolution> lst = new CSolutionFactory() // .GetAll().Where(c => c.Idpattern_mr == idmr && c.Status == true).ToList(); // return new BindingList<CSolution>(lst); //} public decimal?GetConcentrationPPM(short idmr_detail) { CMr_detailFactory faMr_detail = new CMr_detailFactory(); CMr_detail oMr_detail = faMr_detail.GetByPrimaryKey(new CMr_detailKeys(idmr_detail)); CSettings oSettings = new CSettings(); CConvert_unit_measurementFactory faCConvert_unit_measurement = new CConvert_unit_measurementFactory(); var query = ( from t in faCConvert_unit_measurement.GetAll() where t.Idunit2 == oSettings.GetUnitMeasureSolution() && t.Idunit1 == oMr_detail.Idunit1 select new { Concentration = oMr_detail.Nominal_value * t.Factor }).ToList(); foreach (var item in query) { if (item.Concentration != null) { return(Math.Round(Convert.ToDecimal(item.Concentration), 4)); } } decimal?num = null; return(num); }
public List <CCustom_solution> GetLstPatternSolution(short idelement) { CSettings oSettings = new CSettings(); List <CConvert_unit_measurement> lstConvertUnit = new CConvert_unit_measurementFactory().GetAll().Where(c => c.Idunit2 == oSettings.GetUnitMeasureSolution()).ToList(); List <CMr_detail> lstMr_detail = new CMr_detailFactory().GetAll().Where(c => c.Analyte == idelement).ToList(); List <CMr> lstMr = new CMrFactory().GetAll(); List <CSolution> lstSolution = new CSolutionFactory().GetAll().Where(c => c.Idelement == idelement).ToList(); // get reference material List <CCustom_solution> query1 = (from t1 in lstMr_detail join t2 in lstMr on t1.Idmr equals t2.Idmr join t3 in lstConvertUnit on t1.Idunit1 equals t3.Idunit1 select new CCustom_solution { Idmr = t2.Idmr, Idmr_detail = t1.Idmr_detail, Code = t2.Cod_mr, Lote = t2.Lot, Name = t2.Cod_mr, Purity = 100, IsPattern = true, Concentration = Convert.ToDecimal(t1.Nominal_value) * Convert.ToDecimal(t3.Factor), Name_group = "Material de Referencia y Sales" }).ToList <CCustom_solution>(); // get solutions List <CCustom_solution> query2 = (from t3 in lstSolution select new CCustom_solution { Idsolution = t3.Idsolution, Code = t3.Cod_solution, Name = t3.Solution_name, Lote = t3.Lote, Purity = Convert.ToDecimal(t3.Purity), IsPattern = false, Concentration = Convert.ToDecimal(t3.Concentration), Name_group = "Soluciones" }).ToList <CCustom_solution>(); List <CCustom_solution> lst = new List <CCustom_solution>(query1.Union(query2)); return(lst); }