private static void MergeLocalsAndParameters(BasicBlock succ, FMap <ILocalDefinition, Microsoft.Cci.Analysis.Instruction> currentLocals, FMap <IParameterDefinition, Microsoft.Cci.Analysis.Instruction> currentParameters) { foreach (var p in currentLocals) { Microsoft.Cci.Analysis.Instruction existing; if (succ.LocalDefs.TryGetValue(p.Key, out existing)) { PushMerge(existing, p.Value); } else { var mergeInstruction = new Instruction() { Operand1 = p.Value }; succ.LocalDefs = succ.LocalDefs.Insert(p.Key, mergeInstruction); } } foreach (var p in currentParameters) { Microsoft.Cci.Analysis.Instruction existing; if (succ.ParamDefs.TryGetValue(p.Key, out existing)) { PushMerge(existing, p.Value); } else { var mergeInstruction = new Instruction() { Operand1 = p.Value }; succ.ParamDefs = succ.ParamDefs.Insert(p.Key, mergeInstruction); } } }
/// <summary> /// 查询模板明细 /// </summary> /// <param name="BannerDTO"></param> /// <param name="id_ortmpls"></param> /// <returns></returns> public FMap getNewOrderTemplateDTO2(Ent4BannerDTO BannerDTO, string[] id_ortmpls) { remplRes = ciOrdQeryService.getOrTemplateCache(id_ortmpls, BaseEmsView.BaseEmsInfoContext["CiEnContextDTO"] as CiEnContextDTO); //string json = remplRes.serializeJson(); FMap map2 = new FMap(); if (remplRes != null) { map2 = remplRes.TemplItm; } //诊疗医疗单的开单模式赋值 if (map2 != null && BaseEmsView.BaseEmsInfoContext.ContainsKey(ICiOrdNSysParamConst.OPDiagTreatTmplOrOpenMode)) { foreach (string keyId in map2.Keys) { FArrayList list = map2[keyId] as FArrayList; foreach (NewOrderTemplateDTO templateDTO in list) { if (templateDTO.Ui_flag == "6")//治疗医疗单 { FArrayList itmdolist = templateDTO.Itemlist; foreach (OrTplNItmDO itmdo in itmdolist) { itmdo.Opdiagtreattmploropenmode = (string)BaseEmsView.BaseEmsInfoContext[ICiOrdNSysParamConst.OPDiagTreatTmplOrOpenMode]; } } } } } return(map2); }
public OrderTemplateListViewModel(string id_srvtpl) { this.qryService = XapServiceMgr.find <ICiOrdQryService>(); OrderTemplateDTO orderTemplateDto = this.qryService.getSrvortplitemAggDOS(id_srvtpl); FMap aggMap = orderTemplateDto.Srvortplitemaggdo; FArrayList srvagg = aggMap["SrvortplitemAggDO"] as FArrayList; FMap freqmap = orderTemplateDto.Freqdefdo; FArrayList freqList = freqmap["FreqDefDO"] as FArrayList; FMap measMap = orderTemplateDto.Measdocdo; FArrayList measList = measMap["MeasDocDO"] as FArrayList; XapDataList <SrvortplitemAggDO> xaplist = new XapDataList <SrvortplitemAggDO>(); if (srvagg != null) { foreach (SrvortplitemAggDO agg in srvagg) { agg.setFreqdefdo(freqList); agg.setmeasList(measList); xaplist.Add(agg); } } SrvortplitemAggDOList = xaplist; }
protected override ciordems.d.EmsOrDrug[] Convert2Drugs(iih.ci.ord.dto.d.CiOrAggAndRelInfo info, object viewModel) { if (viewModel == null || !(viewModel is XapDataList <EmsPathgyItemDO>)) { return(null); } XapDataList <EmsPathgyItemDO> drugList = viewModel as XapDataList <EmsPathgyItemDO>; CiOrderDO ord = info.OrAggDO.getParentDO(); FMap orSrvMmMap = info.OrSrvMmMap; List <EmsOrDrug> szDrugs = new List <EmsOrDrug>(); Dictionary <String, object> tmpCacheSrv = new Dictionary <string, object>(); // 处理医嘱带过来的信息 EmsPathgyItemDO consItemDO = null; if (drugList.Count > 0) { consItemDO = drugList[0]; tmpCacheSrv.Add(consItemDO.Id_srv, consItemDO); // szDrugs.Add(EmsOrDrugFromEmsPathgyItemDO(consItemDO)); } // 处理附加项 szDrugs.AddRange(ToEmsOrDrugs(info.OrAggDO, tmpCacheSrv, info.OrSrvMmMap, info.BlSrvMap)); return(szDrugs.ToArray()); }
/// <summary> /// Constructs removing of placeholders from version-fields. /// </summary> /// <param name="sc">User script where it used.</param> /// <param name="fmap">Map of used fields.</param> /// <returns></returns> protected string scVersion(string sc, FMap fmap) { if (fmap[Fields.Type.Number] != null) { string rev = (req.StepCfgData.revType == RevNumber.Type.Raw)? String.Empty : ", $(Revision)"; string raw = "#[var tpl = $(tpl.Replace(\"{0}\", \"$(ver.Replace('.', ', ')){1}\"))]{2}"; sc = sc.Replace("!ReplaceVersion!", String.Format(raw, fmap[Fields.Type.Number], rev, LINE_BREAK)); } else { sc = sc.Replace("!ReplaceVersion!", String.Empty); } string ver = String.Empty; if (fmap[Fields.Type.NumberWithRevString] != null) { ver += String.Format(".Replace(\"{0}\", \"$(ver).$(Revision)\")", fmap[Fields.Type.NumberWithRevString]); } if (fmap[Fields.Type.NumberString] != null) { ver += String.Format(".Replace(\"{0}\", \"$(ver)\")", fmap[Fields.Type.NumberString]); } if (ver.Length > 0) { return(sc.Replace("!ReplaceVerString!", String.Format("#[var tpl = $(tpl{0})]", ver))); } return(sc.Replace("!ReplaceVerString!", String.Empty)); }
/// <summary> /// 获取特殊病提示消息 /// </summary> /// <param name="ctx">患者就诊环境</param> /// <param name="drugList">EmsOrDrug对象集合</param> /// <returns>特殊病诊断提示信息</returns> public string GetSpecialDiseaseJudgeRst(CiEnContextDTO ctx, List <EmsOrDrug> drugList) { FMap mmMap = new FMap(); // 非特殊病患者,直接返回空串 if (!CiEnContextUtil.IsHpSpecillPat(ctx.Ent4BannerDTO)) { return(""); } foreach (EmsOrDrug drug in drugList) { if (drug.Fg_selfpay == FBoolean.True) { continue; } mmMap.Add(drug.Id_mm, drug.Name_srv + "[" + drug.Name_mm + "]"); } if (mmMap.Count == 0) { return(""); } string specialMsg = this.ciOrdMedicalInsuranceService.GetSpecialDiseaseJudgeRst(ctx, mmMap); if (!string.IsNullOrEmpty(specialMsg)) { specialMsg += "请录入!"; } return(specialMsg); }
public prescriptionListViewModel(string id_tpl) { this.qryService = XapServiceMgr.find <ICiOrdQryService>(); //SrvortplitemAggDO[] agg = this.qryService.getSrvortplitemAggDOS(id_tpl); //if (agg != null && agg.Length>0) //{ // this.SrvortplitemAggDOList = new XapAggDO<SrvortplitemAggDO>(this.qryService, agg[0]); //} OrderTemplateDTO orderTemplateDto = this.qryService.getSrvortplitemAggDOS(id_tpl); FMap fmap = orderTemplateDto.Srvortplitemaggdo; FArrayList srvagg = fmap["SrvortplitemAggDO"] as FArrayList; FMap freqmap = orderTemplateDto.Freqdefdo; FArrayList freqList = freqmap["FreqDefDO"] as FArrayList; FMap measMap = orderTemplateDto.Measdocdo; FArrayList measList = measMap["MeasDocDO"] as FArrayList; if (srvagg != null) { SrvortplitemAggDOList = new XapAggDO <SrvortplitemAggDO>(this.qryService, (SrvortplitemAggDO)srvagg[0]); SrvortplitemAggDOList.AggDO.setFreqdefdo(freqList); SrvortplitemAggDOList.AggDO.setmeasList(measList); } }
/// <summary> /// 获取特殊病判断结果 /// </summary> /// <param name="ctx">就诊环境</param> /// <param name="mmMap">物品对象集合key 物品id ,value 物品名称</param> /// <returns>医保特殊病判断结果信息</returns> public string GetSpecialDiseaseJudgeRst(CiEnContextDTO ctx, FMap mmMap) { object[] param = { ctx, mmMap }; si.url = url_r; string rtn = si.invoke <string>("getSpecialDiseaseJudgeRst", param.ToArray()); return(rtn); }
/// <summary> /// 获取特殊病判断结果 /// </summary> /// <param name="ctx">就诊环境</param> /// <param name="id_mms">物品id数组</param> /// <returns></returns> public FMap GetSpecialDiseaseJudgeRstMap(CiEnContextDTO ctx, string[] id_mms) { object[] param = { ctx, id_mms }; si.url = url_r; FMap rtn = si.invoke <FMap>("getSpecialDiseaseJudgeRstMap", param.ToArray()); return(rtn); }
/// <summary> /// Add sources that are disposable on entry, such as byref disposables /// </summary> /// <param name="dictionary"></param> private IEnumerable <Instruction> InitialSources(FMap <IParameterDefinition, Instruction> initialParameters) { foreach (var p in this.currentMethod.Parameters) { Instruction initialDummyInit; if (p.IsByReference && !p.IsOut && IsDisposableType(p.Type) && initialParameters.TryGetValue(p, out initialDummyInit)) { yield return(initialDummyInit); } } }
/// <summary> /// 编辑医嘱内容时候需要将 医嘱内容转化为医嘱项目 /// </summary> public virtual void EditOrder(CiOrderDO ciOrderDO) { FMap fmap = this.ciOrdQryService.getCiEmsDTO(new string[] { ciOrderDO.Id_or }); this.ciEmsDTO = fmap[ciOrderDO.Id_or] as CiEmsDTO; this.ciEmsDTO.SetUpdated(); this.uiEmsDTO.Status = DOStatus.UPDATED; this.uiEmsDTO.MedSrvDO = XapServiceMgr.find <IMedsrvMDOCrudService>().findById(ciEmsDTO.Id_srv); // 处理分拣费用项目 HandleExpenseItems(ciEmsDTO); }
public bool oldLoad() { if (this.GetEnt4BannerDTO() == null) { return(false); } this.errorMsgString = ""; try { idor2EmsDTOMap.Clear(); idor2OrderDOMap.Clear(); { FMap2 rtnMap = iCiOrdQryService.getOrdFeebill(GetEnt4BannerDTO().Id_ent, GetEnt4BannerDTO().Code_entp); if (rtnMap != null && rtnMap.Keys.Count > 0 && rtnMap.Keys.Contains("orders") && rtnMap.Keys.Contains("emses")) { FArrayList ordList = rtnMap["orders"] as FArrayList; FArrayList emsList = rtnMap["emses"] as FArrayList; FMap blsrvmap = rtnMap["blsrvdes"] as FMap; CiOrderDO[] szOrders = ordList.Cast <CiOrderDO>().ToArray(); CiEmsDTO[] szEmses = emsList.Cast <CiEmsDTO>().ToArray(); // 装配UI数据 List <CiOrdFeeSrvDTO> list = OrdFeeBillListFrom(szOrders, szEmses, blsrvmap); if (null != list && list.Count > 0) { this.tableDatasource = list.ToArray(); // 控件不支持,不应该直接改写对象 } else { tableDatasource.Clear(); } } else { this.errorMsgString = "获取费用清单数据失败"; return(false); } } } catch (XapServiceException e) { this.errorMsgString = e.ErrorMsg.Message; } catch (Exception e) { this.errorMsgString = e.Message; } return(false); }
/// <summary> /// /// </summary> /// <param name="dto"></param> /// <returns></returns> private SrvMatchEmsRstDTO GetSrvMatchEmsParamDTO(SrvMatchEmsParamDTO dto) { //EmsMatchRstDTO r = bdSrvService.getmedSrvMatchEms(dto); IEmsManagementService service = XapServiceMgr.find <IEmsManagementService>(); FMap map = service.medSrvMatchEms(new SrvMatchEmsParamDTO[] { dto }); SrvMatchEmsRstDTO r = null; if (map != null) { r = (SrvMatchEmsRstDTO)map[dto.Id_srv]; } return(r); }
/// <summary> /// /// </summary> /// <param name="paramDto"></param> /// <returns></returns> public SrvMatchEmsRstDTO getSrvMatchEmsParamDTO(SrvMatchEmsParamDTO paramDto) { //EmsMatchRstDTO emsMatchRstDTO = sheetModel.getmedSrvMatchEms(paramDto); IEmsManagementService service = XapServiceMgr.find <IEmsManagementService>(); FMap map = service.medSrvMatchEms(new SrvMatchEmsParamDTO[] { paramDto }); SrvMatchEmsRstDTO r = null; if (map != null) { r = (SrvMatchEmsRstDTO)map[paramDto.Id_srv]; } return(r); }
/// <summary> /// 查询医嘱模板明细数据 /// </summary> /// <param name="idortmpls"></param> public void LoadOrTplNItmDOs(List <String> idortmpls) { for (int i = idortmpls.Count - 1; i >= 0; i--) { if (this.DicOrTplNItm.ContainsKey(idortmpls[i])) { idortmpls.RemoveAt(i); } } if (idortmpls != null && idortmpls.Count > 0) { OrderTemplateRstDTO remplRes = orTmplApplyService.getOrTemplateCache(idortmpls.ToArray(), BaseEmsView.BaseEmsInfoContext["CiEnContextDTO"] as CiEnContextDTO); FMap fMap = null; if (remplRes != null) { fMap = remplRes.TemplItm; } //诊疗医疗单的开单模式赋值 if (fMap != null) { if (BaseEmsView.BaseEmsInfoContext.ContainsKey(ICiOrdNSysParamConst.OPDiagTreatTmplOrOpenMode)) { foreach (string keyId in fMap.Keys) { FArrayList list = fMap[keyId] as FArrayList; foreach (NewOrderTemplateDTO templateDTO in list) { if (templateDTO.Ui_flag == "6")//治疗医疗单 { FArrayList itmdolist = templateDTO.Itemlist; foreach (OrTplNItmDO itmdo in itmdolist) { itmdo.Opdiagtreattmploropenmode = (string)BaseEmsView.BaseEmsInfoContext[ICiOrdNSysParamConst.OPDiagTreatTmplOrOpenMode]; } } } } } foreach (string keyId in fMap.Keys) { FArrayList list = fMap[keyId] as FArrayList; if (!this.DicOrTplNItm.ContainsKey(keyId)) { this.DicOrTplNItm.Add(keyId, list); } } } } }
/// <summary> /// 总量单位 /// </summary> /// <param name="rowDataSource"></param> /// <param name="ctrl"></param> protected override void editorWillAppear(Object rowDataSource, XBaseUserRender ctrl) { XComboBoxUnit xComboBoxUnit = ctrl as XComboBoxUnit; EmsOrDrug drug = rowDataSource as EmsOrDrug; if (null != drug) { //if (xComboBoxUnit.ValueUnit.Length > 0) //{ Dictionary <object, string> items = new Dictionary <object, string>(); //items.Add(drug.Id_unit_sale, drug.Name_unit_sale); FMap fmap = drug.Relativefieldmap; if (fmap == null) { if (drug.Id_unit_sale != null) { items.Add(drug.Id_unit_sale, drug.Name_unit_sale); } else { items.Add("", drug.Name_unit_sale); } } else { string idstr = (string)fmap[CiDictCodeConst.EMSORDRUG_RELATIVE_FIELD_ID_MEASDOC]; string namestr = (string)fmap[CiDictCodeConst.EMSORDRUG_RELATIVE_FIELD_MEASDOC_NAME]; string factorstr = (string)fmap["factor"]; if (!string.IsNullOrEmpty(idstr) && !string.IsNullOrEmpty(namestr) && !string.IsNullOrEmpty(factorstr)) { string[] ids = idstr.Split(new char[] { ',' }); string[] names = namestr.Split(new char[] { ',' }); string[] factors = factorstr.Split(','); for (int i = 0; i < ids.Length; i++) { if (!items.ContainsKey(ids[i] + "," + factors[i])) { items.Add(ids[i] + "," + factors[i], names[i]); } } } } xComboBoxUnit.DataSource = items; //} xComboBoxUnit.ValueText = (drug.Quan_cur == null ? "0" : drug.Quan_cur.ToString()); xComboBoxUnit.ValueUnit = (drug.Name_unit_sale == null ? "" : drug.Name_unit_sale); } }
/// <summary> /// 获取控件相关的数据,不涉及界面(不读写界面元素)。 /// </summary> protected override void OnLoadData() { if (!string.IsNullOrWhiteSpace(this.id_ortmpl)) { FMap map = this.model.getNewOrderTemplateDTO2(this.Ent4BannerDTO, new string[] { this.id_ortmpl }); if (map != null) { FArrayList templList = map[this.id_ortmpl] as FArrayList; if (templList != null) { templateDtoArray = templList.Cast <NewOrderTemplateDTO>().ToArray(); } } } }
private static Analysis.Instruction ReadLocation(FMap <ILocalDefinition, Analysis.Instruction> currentLocals, FMap <IParameterDefinition, Analysis.Instruction> currentParameters, object localOrParameter) { Analysis.Instruction result; var local = localOrParameter as ILocalDefinition; if (local != null) { currentLocals.TryGetValue(local, out result); return(result); } var param = localOrParameter as IParameterDefinition; if (param != null) { currentParameters.TryGetValue(param, out result); return(result); } return(null); }
public void Move(MoveDir dir, FMap fMap) { //bounds and wall checks List <Point> adj = fMap.Adjacent(Pos); foreach (Point a in adj) { switch (dir) { case MoveDir.N: if (a.Y < Pos.Y) { UpdatePosition(a, dir); return; } break; case MoveDir.W: if (a.X < Pos.X) { UpdatePosition(a, dir); return; } break; case MoveDir.S: if (a.Y > Pos.Y) { UpdatePosition(a, dir); return; } break; case MoveDir.E: if (a.X > Pos.X) { UpdatePosition(a, dir); return; } break; } } }
/// <summary> /// 加载数据 /// </summary> public void Reload() { if (string.IsNullOrEmpty(Id_ent) || string.IsNullOrEmpty(Code_entp)) { tableDataSource.Clear(); return; } OrderOperateDTO operateDTO = new OrderOperateDTO(); operateDTO.EnContext = new CiEnContextDTO() { Id_en = this.Id_ent, Code_entp = this.Code_entp }; OrderRstDTO orderRstDTO = orderActionLoad.exec(new OrderOperateDTO[] { operateDTO })[0]; List <CiOrderDO> lstCiOrderDOs = new List <CiOrderDO>(); if (orderRstDTO.Document != null && orderRstDTO.Document.Count > 0) { //FArrayList tmpOrderList = new FArrayList(); //tmpOrderList.deSerializeJson(System.Text.Encoding.UTF8.GetString(Convert.FromBase64String((orderRstDTO.DocumentString)))); foreach (Object order in orderRstDTO.Document) { lstCiOrderDOs.Add(order as CiOrderDO); } } tableDataSource = new XapDataList <CiOrderDO>(orderItemMService, lstCiOrderDOs.ToArray()); // 获取服务类型显示名称 if (DicSrvtp.Count <= 0) { FMap mapSrvtp = new FMap(); mapSrvtp = orderRstDTO.Extension["SrvTpNameMap"] as FMap; if (mapSrvtp != null) { foreach (KeyValuePair <string, object> kv in mapSrvtp.ToDictionary()) { DicSrvtp.Add(kv.Key, kv.Value.ToString()); } } } }
/// <summary> /// Generate script for `C# struct` variant. /// </summary> /// <returns></returns> protected string genCSharpStruct() { Func <string, string, bool, string> left = delegate(string _indent, string _name, bool isNum) { if (isNum) { return(String.Format("{0}public static readonly System.Version {1}", _indent, _name)); } return(String.Format("{0}public const string {1}", _indent, _name)); }; Func <string, bool, string> right = delegate(string _name, bool isNum) { if (isNum) { return(String.Format(String.Format("= new System.Version({0});", PAT_FIELD_VALUE), _name)); } return(String.Format(String.Format("= \"{0}\";", PAT_FIELD_VALUE), _name)); }; TFieldsMap fld = fields(left, right, new String(' ', INDENT_SIZE * 2)); string fname = fld.Value; FMap fmap = new FMap() { map = fld.Key }; string sc = scVariables(Resource.ScriptMain); sc = sc.Replace("!Revision!", scRevision()); sc = scVersion(sc, fmap); sc = sc.Replace("!SCM!", scScm(fmap, ref fname)); string tpl = Resource.CSharpStructTpl .Replace("!Namespace!", req.StepStruct.namspace) .Replace("!StructName!", req.StepStruct.name); tpl = String.Format("{0}{1}{2}", Resource.Header, LINE_BREAK, tpl); return(sc.Replace("!Template!", tpl.Replace("!Items!", fname))); }
/// <summary> /// 获取费用项目备注信息保存后 /// </summary> /// <param name="ciorder"></param> /// <returns></returns> public List <string> getBlSrvDesListAftSave(CiOrderDO ciorder) { List <string> ids = new List <string>(); ids.Add(ciorder.Id_or); FMap srvFMap = ordMaintainService.getCiOrderBlSrvDesByIdors(ids.ToArray()); List <string> msglist = new List <string>(); int i = 1; foreach (string id_srv in srvFMap.Keys) { MedSrvDO medsrv = srvFMap[id_srv] as MedSrvDO; // PO:费用备注信息提示是对收费项目提示信息,药品不需提示。控制条件bd_srv,fg_bl = Y and fg_mm =N if (medsrv == null || medsrv.Fg_bl == FBoolean.False || medsrv.Fg_mm == FBoolean.True) { continue; } msglist.Add(i + "、" + medsrv.Name + ":" + medsrv.Des); i++; } return(msglist); }
private static void UpdateLocation(ref FMap <ILocalDefinition, Analysis.Instruction> currentLocals, ref FMap <IParameterDefinition, Analysis.Instruction> currentParameters, object localOrParameter, Analysis.Instruction newValue) { Contract.Requires(currentParameters != null); Contract.Requires(currentLocals != null); Contract.Ensures(Contract.ValueAtReturn(out currentParameters) != null); Contract.Ensures(Contract.ValueAtReturn(out currentLocals) != null); var local = localOrParameter as ILocalDefinition; if (local != null) { currentLocals = currentLocals.Insert(local, newValue); return; } var param = localOrParameter as IParameterDefinition; if (param != null) { currentParameters = currentParameters.Insert(param, newValue); return; } }
/// <summary> /// 总量单位 /// </summary> /// <param name="rowDataSource"></param> /// <param name="ctrl"></param> protected override void editorWillAppear(Object rowDataSource, XBaseUserRender ctrl) { XComboBoxUnit xComboBoxUnit = ctrl as XComboBoxUnit; CiOrdFeeSrvDTO drug = rowDataSource as CiOrdFeeSrvDTO; if (null != drug) { Dictionary <object, string> items = new Dictionary <object, string>(); FMap fmap = null;// drug.Relativefieldmap; if (fmap == null) { if (!string.IsNullOrEmpty(drug.Id_unit_sale)) { items.Add(drug.Id_unit_sale, drug.Name_unit_sale); } } else { string idstr = (string)fmap[CiDictCodeConst.EMSORDRUG_RELATIVE_FIELD_ID_MEASDOC]; string namestr = (string)fmap[CiDictCodeConst.EMSORDRUG_RELATIVE_FIELD_MEASDOC_NAME]; if (!string.IsNullOrEmpty(idstr)) { string[] ids = idstr.Split(new char[] { ',' }); string[] names = namestr.Split(new char[] { ',' }); for (int i = 0; i < ids.Length; i++) { items.Add(ids[i], names[i]); } } } xComboBoxUnit.DataSource = items; xComboBoxUnit.ValueText = (drug.Quan_total_medu == null ? "0" : drug.Quan_total_medu.ToString()); xComboBoxUnit.ValueUnit = (drug.Name_unit_sale == null ? "" : drug.Name_unit_sale); } }
/// <summary> /// Generate script for `C++ macro definitions` variant. /// </summary> /// <returns></returns> protected string genCppDefinitions() { Func <string, string, bool, string> left = delegate(string _indent, string _name, bool isNum) { if (isNum) { return(String.Empty); } return(String.Format("{0}#define {1}", _indent, _name)); }; Func <string, bool, string> right = delegate(string _name, bool isNum) { if (isNum) { return(String.Empty); } return(String.Format(String.Format("L\"{0}\";", PAT_FIELD_VALUE), _name)); }; TFieldsMap fld = fields(left, right, String.Empty); string fname = fld.Value; FMap fmap = new FMap() { map = fld.Key }; string sc = scVariables(Resource.ScriptMain); sc = sc.Replace("!Revision!", scRevision()); sc = scVersion(sc, fmap); sc = sc.Replace("!SCM!", scScm(fmap, ref fname)); string tpl = Resource.CppDefineTpl; tpl = String.Format("{0}{1}{2}", Resource.Header, LINE_BREAK, tpl); return(sc.Replace("!Template!", tpl.Replace("!Items!", fname))); }
/// <summary> /// 获取控件相关的数据,不涉及界面(不读写界面元素)。 /// </summary> protected override void OnLoadData() { if (!string.IsNullOrWhiteSpace(modeltype)) { this.treeKeyModel = this.model.loadTreeModel(this.modeltype); } isLoaded = true; FArrayList modelIds = this.model.getModelIdByModelType(this.modeltype); modelMap = this.model.getNewOrderTemplateDTO2(this.BannerDTO, modelIds.Cast <string>().ToArray()); foreach (string keyId in modelMap.Keys) { FArrayList list = modelMap[keyId] as FArrayList; if (this.parentFrame.cacheModelItem == null) { this.parentFrame.cacheModelItem = new Dictionary <string, FArrayList>(); } if (!this.parentFrame.cacheModelItem.ContainsKey(keyId)) { this.parentFrame.cacheModelItem.Add(keyId, list); } } }
/// <summary> /// 根据 医嘱 id_or 取得 医嘱的信息 CiEmsDTO /// </summary> /// <param name="id_or"></param> /// <returns></returns> public CiEmsDTO getCiEmsDTO(string id_or) { FMap fmap = qryService.getCiEmsDTO(new string[] { id_or }); return(fmap[id_or] as CiEmsDTO); }
/// <summary> /// Generate script for `C++ macro definitions` variant. /// </summary> /// <returns></returns> protected string genCppDefinitions() { Func<string, string, bool, string> left = delegate(string _indent, string _name, bool isNum) { if(isNum) { return String.Empty; } return String.Format("{0}#define {1}", _indent, _name); }; Func<string, bool, string> right = delegate(string _name, bool isNum) { if(isNum) { return String.Empty; } return String.Format(String.Format("L\"{0}\";", PAT_FIELD_VALUE), _name); }; TFieldsMap fld = fields(left, right, String.Empty); string fname = fld.Value; FMap fmap = new FMap() { map = fld.Key }; string sc = scVariables(Resource.ScriptMain); sc = sc.Replace("!Revision!", scRevision()); sc = scVersion(sc, fmap); sc = sc.Replace("!SCM!", scScm(fmap, ref fname)); string tpl = Resource.CppDefineTpl; tpl = String.Format("{0}{1}{2}", Resource.Header, LINE_BREAK, tpl); return sc.Replace("!Template!", tpl.Replace("!Items!", fname)); }
private static void ComputeDataFlowThroughLocals(ControlAndDataFlowGraph <BasicBlock, Instruction> cdg) { FMap <ILocalDefinition, Microsoft.Cci.Analysis.Instruction> currentLocals; var todo = new Queue <BlockPC>(); var seen = new HashSet <BlockPC>(); var startBlock = cdg.RootBlocks[0]; FMap <IParameterDefinition, Microsoft.Cci.Analysis.Instruction> currentParameters = new FMap <IParameterDefinition, Microsoft.Cci.Analysis.Instruction>(k => k.Index); var initialLocation = GetStartLocation(startBlock); // push parameters onto start block foreach (var arg in cdg.MethodBody.MethodDefinition.Parameters) { var initialOp = new InitialParameterAssignment(arg, initialLocation); var initialDef = new Instruction() { Operation = initialOp }; currentParameters = currentParameters.Insert(arg, initialDef); } startBlock.ParamDefs = currentParameters; todo.Enqueue(new BlockPC(startBlock.Offset.Singleton())); while (todo.Count > 0) { var currentPC = todo.Dequeue(); if (seen.Contains(currentPC)) { continue; } seen.Add(currentPC); var block = cdg.CurrentBlock(currentPC); Contract.Assume(block != null); currentLocals = block.LocalDefs; currentParameters = block.ParamDefs; foreach (var instr in block.Instructions) { if (instr.IsMergeNode) { continue; } switch (instr.Operation.OperationCode) { case OperationCode.Starg: case OperationCode.Starg_S: // without pdb we seem to have no parameter info. var pdef = (IParameterDefinition)instr.Operation.Value; if (pdef != null) { currentParameters = currentParameters.Insert(pdef, instr.Operand1); } break; case OperationCode.Stloc: case OperationCode.Stloc_0: case OperationCode.Stloc_1: case OperationCode.Stloc_2: case OperationCode.Stloc_3: case OperationCode.Stloc_S: var ldef = (ILocalDefinition)instr.Operation.Value; currentLocals = currentLocals.Insert(ldef, instr.Operand1); break; case OperationCode.Ldloc: case OperationCode.Ldloc_0: case OperationCode.Ldloc_1: case OperationCode.Ldloc_2: case OperationCode.Ldloc_3: case OperationCode.Ldloc_S: // save the source in Aux { currentLocals.TryGetValue((ILocalDefinition)instr.Operation.Value, out instr.Aux); break; } case OperationCode.Ldarg: case OperationCode.Ldarg_0: case OperationCode.Ldarg_1: case OperationCode.Ldarg_2: case OperationCode.Ldarg_3: case OperationCode.Ldarg_S: // save the source in Aux var pdef2 = (IParameterDefinition)instr.Operation.Value; if (pdef2 == null) { // this parameter. Assume it's never overwritten } else { currentParameters.TryGetValue(pdef2, out instr.Aux); } break; case OperationCode.Stind_I: case OperationCode.Stind_I1: case OperationCode.Stind_I2: case OperationCode.Stind_I4: case OperationCode.Stind_I8: case OperationCode.Stind_R4: case OperationCode.Stind_R8: case OperationCode.Stind_Ref: { var location = cdg.LocalOrParameter(instr.Operand1); UpdateLocation(ref currentLocals, ref currentParameters, location, (Analysis.Instruction)instr.Operand2); break; } case OperationCode.Ldind_I: case OperationCode.Ldind_I1: case OperationCode.Ldind_I2: case OperationCode.Ldind_I4: case OperationCode.Ldind_I8: case OperationCode.Ldind_R4: case OperationCode.Ldind_R8: case OperationCode.Ldind_Ref: case OperationCode.Ldind_U1: case OperationCode.Ldind_U2: case OperationCode.Ldind_U4: { // save the read value in Aux var location = cdg.LocalOrParameter(instr.Operand1); instr.Aux = ReadLocation(currentLocals, currentParameters, location); break; } case OperationCode.Call: case OperationCode.Callvirt: { // update byref / out parameters var methodRef = instr.Operation.Value as IMethodReference; var args = instr.Operand2 as Instruction[]; if (args != null && methodRef != null) { foreach (var p in methodRef.Parameters) { if (p.IsByReference && p.Index < args.Length) { var arg = args[p.Index]; if (arg != null) { var loc = cdg.LocalOrParameter(arg); var syntheticOp = new CallByRefAssignment(instr, p); UpdateLocation(ref currentLocals, ref currentParameters, loc, new Instruction() { Operation = syntheticOp, Type = p.Type }); } } } } break; } } instr.PostLocalDefs = currentLocals; instr.PostParamDefs = currentParameters; } foreach (var succ in cdg.Successors(currentPC)) { MergeLocalsAndParameters(cdg.CurrentBlock(succ), currentLocals, currentParameters); todo.Enqueue(succ); } } }
/// <summary> /// Generate script for `C++ struct` variant. /// </summary> /// <returns></returns> protected string genCppStruct() { Func <string, string, bool, string> leftRef = delegate(string _indent, string _name, bool isNum) { if (isNum) { return(String.Format("{0}static System::Version^ const {1}", _indent, _name)); } return(String.Format("{0}static System::String^ const {1}", _indent, _name)); }; Func <string, bool, string> rightRef = delegate(string _name, bool isNum) { if (isNum) { return(String.Format(String.Format("= gcnew System::Version({0});", PAT_FIELD_VALUE), _name)); } return(String.Format(String.Format("= \"{0}\";", PAT_FIELD_VALUE), _name)); }; Func <string, string, bool, string> left = delegate(string _indent, string _name, bool isNum) { if (isNum) { return(String.Format("{0}{1}{2}", _indent, Resource.CppStructNumTpl, LINE_BREAK) .Replace("!FieldName!", _name) .Replace("!VerNum!", String.Format(PAT_FIELD_VALUE, _name))); } return(String.Format("{0}const std::wstring {1}", _indent, _name)); }; Func <string, bool, string> right = delegate(string _name, bool isNum) { if (isNum) { return(String.Empty); } return(String.Format(String.Format("= L\"{0}\";", PAT_FIELD_VALUE), _name)); }; bool clr = (req.StepStruct.fnumber == StepStruct.NumberType.SystemVersion); TFieldsMap fld = fields( (clr)? leftRef : left, (clr)? rightRef : right, new String(' ', INDENT_SIZE * 2)); string fname = fld.Value; FMap fmap = new FMap() { map = fld.Key }; string sc = scVariables(Resource.ScriptMain); sc = sc.Replace("!Revision!", scRevision()); sc = scVersion(sc, fmap); sc = sc.Replace("!SCM!", scScm(fmap, ref fname)); string tpl = Resource.CppStructTpl .Replace("!Namespace!", req.StepStruct.namspace) .Replace("!StructName!", req.StepStruct.name); tpl = String.Format("{0}{1}{2}", Resource.Header, LINE_BREAK, tpl); if (clr) { tpl = tpl.Replace("!KWRef!", "ref ") .Replace("!DefVariable!", String.Empty) .Replace("!IncString!", String.Empty); } else { tpl = tpl.Replace("!KWRef!", String.Empty) .Replace("!DefVariable!", " " + req.StepStruct.name) .Replace("!IncString!", String.Format("{1}{0}{1}", "#include <string>", LINE_BREAK)); } return(sc.Replace("!Template!", tpl.Replace("!Items!", fname))); }
/// <summary> /// Constructs removing of placeholders from version-fields. /// </summary> /// <param name="sc">User script where it used.</param> /// <param name="fmap">Map of used fields.</param> /// <returns></returns> protected string scVersion(string sc, FMap fmap) { if(fmap[Fields.Type.Number] != null) { string rev = (req.StepCfgData.revType == RevNumber.Type.Raw)? String.Empty : ", $(Revision)"; string raw = "#[var tpl = $(tpl.Replace(\"{0}\", \"$(ver.Replace('.', ', ')){1}\"))]{2}"; sc = sc.Replace("!ReplaceVersion!", String.Format(raw, fmap[Fields.Type.Number], rev, LINE_BREAK)); } else { sc = sc.Replace("!ReplaceVersion!", String.Empty); } string ver = String.Empty; if(fmap[Fields.Type.NumberWithRevString] != null) { ver += String.Format(".Replace(\"{0}\", \"$(ver).$(Revision)\")", fmap[Fields.Type.NumberWithRevString]); } if(fmap[Fields.Type.NumberString] != null) { ver += String.Format(".Replace(\"{0}\", \"$(ver)\")", fmap[Fields.Type.NumberString]); } if(ver.Length > 0) { return sc.Replace("!ReplaceVerString!", String.Format("#[var tpl = $(tpl{0})]", ver)); } return sc.Replace("!ReplaceVerString!", String.Empty); }
/// <summary> /// Constructs SCM calculation. /// </summary> /// <param name="fmap">Map of used fields.</param> /// <param name="fields">List of fields from user script where it used.</param> /// <param name="empty">Empty value for user script.</param> /// <returns></returns> protected string scScm(FMap fmap, ref string fields, string empty = "-") { if (req.StepCfgData.scm != StepCfgData.SCMType.None) { // to modify the 'Informational' fields: string inf = String.Format("{0} [ {1} ]", fmap[Fields.Type.NumberWithRevString] ?? fmap[Fields.Type.NumberString] ?? empty, fmap[Fields.Type.BranchSha1] ?? empty); if (fmap[Fields.Type.Informational] != null) { fields = fields.Replace(fmap[Fields.Type.Informational], inf); } if (fmap[Fields.Type.InformationalFull] != null) { fields = fields.Replace(fmap[Fields.Type.InformationalFull], String.Format("{0} /'{1}':{2}", inf, fmap[Fields.Type.BranchName] ?? empty, fmap[Fields.Type.BranchRevCount] ?? empty)); } } string scm = String.Empty; if (req.StepCfgData.scm == StepCfgData.SCMType.Git) { string cData = String.Empty; string cEmpty = String.Empty; if (fmap[Fields.Type.BranchName] != null) { cData += String.Format(".Replace(\"{0}\", \"#[var bName]\")", fmap[Fields.Type.BranchName]); cEmpty += String.Format(".Replace(\"{0}\", \"{1}\")", fmap[Fields.Type.BranchName], empty); } if (fmap[Fields.Type.BranchSha1] != null) { cData += String.Format(".Replace(\"{0}\", \"#[var bSha1]\")", fmap[Fields.Type.BranchSha1]); cEmpty += String.Format(".Replace(\"{0}\", \"{1}\")", fmap[Fields.Type.BranchSha1], empty); } if (fmap[Fields.Type.BranchRevCount] != null) { cData += String.Format(".Replace(\"{0}\", \"#[var bRevCount]\")", fmap[Fields.Type.BranchRevCount]); cEmpty += String.Format(".Replace(\"{0}\", \"{1}\")", fmap[Fields.Type.BranchRevCount], empty); } scm = Resource.ScriptScmGit; if (cData.Length > 0) { scm = scm.Replace("!RScmData!", String.Format("{0} #[var tpl = $(tpl{1})]", LINE_BREAK, cData)); scm = scm.Replace("!RScmEmpty!", String.Format("#[var tpl = $(tpl{0})]", cEmpty)); } else { scm = scm.Replace("!RScmData!", String.Empty); scm = scm.Replace("!RScmEmpty!", String.Empty); } return(scm + LINE_BREAK); } return(scm); }
/// <summary> /// Generate script for `C++ struct` variant. /// </summary> /// <returns></returns> protected string genCppStruct() { Func<string, string, bool, string> leftRef = delegate(string _indent, string _name, bool isNum) { if(isNum) { return String.Format("{0}static System::Version^ const {1}", _indent, _name); } return String.Format("{0}static System::String^ const {1}", _indent, _name); }; Func<string, bool, string> rightRef = delegate(string _name, bool isNum) { if(isNum) { return String.Format(String.Format("= gcnew System::Version({0});", PAT_FIELD_VALUE), _name); } return String.Format(String.Format("= \"{0}\";", PAT_FIELD_VALUE), _name); }; Func<string, string, bool, string> left = delegate(string _indent, string _name, bool isNum) { if(isNum) { return String.Format("{0}{1}{2}", _indent, Resource.CppStructNumTpl, LINE_BREAK) .Replace("!FieldName!", _name) .Replace("!VerNum!", String.Format(PAT_FIELD_VALUE, _name)); } return String.Format("{0}const std::wstring {1}", _indent, _name); }; Func<string, bool, string> right = delegate(string _name, bool isNum) { if(isNum) { return String.Empty; } return String.Format(String.Format("= L\"{0}\";", PAT_FIELD_VALUE), _name); }; bool clr = (req.StepStruct.fnumber == StepStruct.NumberType.SystemVersion); TFieldsMap fld = fields( (clr)? leftRef : left, (clr)? rightRef : right, new String(' ', INDENT_SIZE * 2)); string fname = fld.Value; FMap fmap = new FMap() { map = fld.Key }; string sc = scVariables(Resource.ScriptMain); sc = sc.Replace("!Revision!", scRevision()); sc = scVersion(sc, fmap); sc = sc.Replace("!SCM!", scScm(fmap, ref fname)); string tpl = Resource.CppStructTpl .Replace("!Namespace!", req.StepStruct.namspace) .Replace("!StructName!", req.StepStruct.name); tpl = String.Format("{0}{1}{2}", Resource.Header, LINE_BREAK, tpl); if(clr) { tpl = tpl.Replace("!KWRef!", "ref ") .Replace("!DefVariable!", String.Empty) .Replace("!IncString!", String.Empty); } else { tpl = tpl.Replace("!KWRef!", String.Empty) .Replace("!DefVariable!", " " + req.StepStruct.name) .Replace("!IncString!", String.Format("{1}{0}{1}", "#include <string>", LINE_BREAK)); } return sc.Replace("!Template!", tpl.Replace("!Items!", fname)); }
/// <summary> /// Generate script for `C# struct` variant. /// </summary> /// <returns></returns> protected string genCSharpStruct() { Func<string, string, bool, string> left = delegate(string _indent, string _name, bool isNum) { if(isNum) { return String.Format("{0}public static readonly System.Version {1}", _indent, _name); } return String.Format("{0}public const string {1}", _indent, _name); }; Func<string, bool, string> right = delegate(string _name, bool isNum) { if(isNum) { return String.Format(String.Format("= new System.Version({0});", PAT_FIELD_VALUE), _name); } return String.Format(String.Format("= \"{0}\";", PAT_FIELD_VALUE), _name); }; TFieldsMap fld = fields(left, right, new String(' ', INDENT_SIZE * 2)); string fname = fld.Value; FMap fmap = new FMap() { map = fld.Key }; string sc = scVariables(Resource.ScriptMain); sc = sc.Replace("!Revision!", scRevision()); sc = scVersion(sc, fmap); sc = sc.Replace("!SCM!", scScm(fmap, ref fname)); string tpl = Resource.CSharpStructTpl .Replace("!Namespace!", req.StepStruct.namspace) .Replace("!StructName!", req.StepStruct.name); tpl = String.Format("{0}{1}{2}", Resource.Header, LINE_BREAK, tpl); return sc.Replace("!Template!", tpl.Replace("!Items!", fname)); }
/// <summary> /// Constructs SCM calculation. /// </summary> /// <param name="fmap">Map of used fields.</param> /// <param name="fields">List of fields from user script where it used.</param> /// <param name="empty">Empty value for user script.</param> /// <returns></returns> protected string scScm(FMap fmap, ref string fields, string empty = "-") { if(req.StepCfgData.scm != StepCfgData.SCMType.None) { // to modify the 'Informational' fields: string inf = String.Format("{0} [ {1} ]", fmap[Fields.Type.NumberWithRevString]?? fmap[Fields.Type.NumberString]?? empty, fmap[Fields.Type.BranchSha1]?? empty); if(fmap[Fields.Type.Informational] != null) { fields = fields.Replace(fmap[Fields.Type.Informational], inf); } if(fmap[Fields.Type.InformationalFull] != null) { fields = fields.Replace(fmap[Fields.Type.InformationalFull], String.Format("{0} /'{1}':{2}", inf, fmap[Fields.Type.BranchName]?? empty, fmap[Fields.Type.BranchRevCount]?? empty)); } } string scm = String.Empty; if(req.StepCfgData.scm == StepCfgData.SCMType.Git) { string cData = String.Empty; string cEmpty = String.Empty; if(fmap[Fields.Type.BranchName] != null) { cData += String.Format(".Replace(\"{0}\", \"#[var bName]\")", fmap[Fields.Type.BranchName]); cEmpty += String.Format(".Replace(\"{0}\", \"{1}\")", fmap[Fields.Type.BranchName], empty); } if(fmap[Fields.Type.BranchSha1] != null) { cData += String.Format(".Replace(\"{0}\", \"#[var bSha1]\")", fmap[Fields.Type.BranchSha1]); cEmpty += String.Format(".Replace(\"{0}\", \"{1}\")", fmap[Fields.Type.BranchSha1], empty); } if(fmap[Fields.Type.BranchRevCount] != null) { cData += String.Format(".Replace(\"{0}\", \"#[var bRevCount]\")", fmap[Fields.Type.BranchRevCount]); cEmpty += String.Format(".Replace(\"{0}\", \"{1}\")", fmap[Fields.Type.BranchRevCount], empty); } scm = Resource.ScriptScmGit; if(cData.Length > 0) { scm = scm.Replace("!RScmData!", String.Format("{0} #[var tpl = $(tpl{1})]", LINE_BREAK, cData)); scm = scm.Replace("!RScmEmpty!", String.Format("#[var tpl = $(tpl{0})]", cEmpty)); } else { scm = scm.Replace("!RScmData!", String.Empty); scm = scm.Replace("!RScmEmpty!", String.Empty); } return scm + LINE_BREAK; } return scm; }