private void ConvertCustom(CustomElement c1, Custom c2) { c2.C0 = c1.C0; c2.C1 = c1.C1; c2.C2 = c1.C2; c2.C3 = c1.C3; c2.C4 = c1.C4; c2.C5 = c1.C5; c2.C6 = c1.C6; c2.C7 = c1.C7; c2.C8 = c1.C8; c2.C9 = c1.C9; c2.C10 = c1.C10; c2.C11 = c1.C11; c2.C12 = c1.C12; c2.C13 = c1.C13; c2.C14 = c1.C14; c2.C15 = c1.C15; c2.C16 = c1.C16; c2.C17 = c1.C17; c2.C18 = c1.C18; c2.C19 = c1.C19; c2.C20 = c1.C20; c2.C21 = c1.C21; c2.C22 = c1.C22; c2.C23 = c1.C23; c2.C24 = c1.C24; c2.C25 = c1.C25; c2.C26 = c1.C26; c2.C27 = c1.C27; c2.C28 = c1.C28; c2.C29 = c1.C29; c2.C30 = c1.C30; c2.C31 = c1.C31; c2.C32 = c1.C32; c2.C33 = c1.C33; c2.C34 = c1.C34; c2.C35 = c1.C35; c2.C36 = c1.C36; c2.C37 = c1.C37; c2.C38 = c1.C38; c2.C39 = c1.C39; c2.C40 = c1.C40; c2.C41 = c1.C41; c2.C42 = c1.C42; c2.C43 = c1.C43; c2.C44 = c1.C44; c2.C45 = c1.C45; c2.C46 = c1.C46; c2.C47 = c1.C47; c2.C48 = c1.C48; c2.C49 = c1.C49; }
private void FillCustom(CustomElement custom, IExportElement data) { PropertyInfo[] props = data.GetType().GetProperties(); foreach (PropertyInfo prop in props) { PropertyInfo prop1 = custom.GetType().GetProperty(prop.Name); if (prop1 != null) { prop.SetValue(data, prop1.GetValue(custom), null); } } }
private void SetProperty(string propName, object value, CustomElement element) { try { PropertyInfo pro = element.GetType().GetProperty(propName); if (pro != null) { pro.SetValue(element, value, null); } } catch (Exception ex) { throw ex; } }
//将内部数据转换成通讯数据 private void ItemConvert(LabReport lr, List<IFillElement> ItemList) { bool cb = false; ItemElement item = null; CustomElement custom = new CustomElement(); foreach (IFillElement element in ItemList) { item = element as ItemElement; if (item != null) { if (!lr.SuperList.Contains(item.SuperNo)) { lr.SuperList.Add(item.SuperNo); } if (this.ConvertCustom(item, custom)) { cb = true; continue; } if (this.IsItemLegal(item)) { lr.ItemList.Add(item); } } } if (cb) { lr.CustomList.Add(custom); } }
private bool InnerHandleGene(LabReport report, LabPK RK) { bool result = false; GeneCustom ci = null; CustomElement custom = null; List<IFillElement> items = null; List<LabPK> PKList = new List<LabPK>(3); this.PKDAL.InitKey(RK, PKList); foreach (LabPK key in PKList) { ci = new GeneCustom(); custom = new CustomElement(); result = this.GeneCustomHandler.HandleElement(ci, key); if (result) { this.GeneConvert(custom, ci); items = new List<IFillElement>(5); result = this.ItemHandler.HandleElement(items, key, typeof(ItemElement)); if (result) { this.GeneConvert(custom, report.SuperList, items); } } else { break; } report.CustomList.Add(custom); } return result; }
private void GSItemConvert(List<IFillElement> ls, List<CustomElement> customs) { GSItem item = null; string propName = null; CustomElement blood = new CustomElement(); CustomElement marrow = new CustomElement(); foreach (IFillElement element in ls) { item = element as GSItem; if (item != null) { propName = GetPropNameByIndex(item.ItemNo); this.SetProperty(propName, item.BloodValue.ToString(), blood); this.SetProperty(propName, item.MarrowValue.ToString(), marrow); } } customs.Add(blood); customs.Add(marrow); }
private void GeneConvert(CustomElement custom, ItemElement item, int index) { string propName = null; propName = GetPropNameByIndex(index); this.SetProperty(propName, item.CName, custom); string[] values = item.Result.Split(new char[] { ';' }); if (values.Length > 1) { index++; propName = GetPropNameByIndex(index); this.SetProperty(propName, values[0], custom); index++; propName = GetPropNameByIndex(index); this.SetProperty(propName, values[0], custom); } }
private void GeneConvert(CustomElement custom, List<int> superList, List<IFillElement> ls) { //排序 ls.Sort((x, y) => { ItemElement x1 = x as ItemElement; ItemElement y1 = y as ItemElement; if (x1 != null && y1 != null) { return x1.DispOrder - y1.DispOrder; } else { return 0; } }); //转换 int index = 5; ItemElement item = null; foreach (IFillElement ele in ls) { item = ele as ItemElement; if (item != null) { if (!superList.Contains(item.SuperNo)) { superList.Add(item.SuperNo); } this.GeneConvert(custom, item, index); index = index + 3; } } }
private void GeneConvert(CustomElement custom, GeneCustom item) { custom.C0 = item.SampleNo; custom.C1 = item.Name; custom.C2 = item.Age; custom.C3 = item.Relation; custom.C4 = item.EqualCount; }
private bool ConvertCustom(ItemElement item, CustomElement custom) { string key = Item2CustomMap[item.ItemNo] as string; if (key != null) { this.SetProperty(key, item.Result, custom); return true; } return false; }