public static void FillTranData(IKeyForm currfrm, ITranslateableInterFace ifrm, ref CMenuItem mnu, ref UpdateData data, bool TranData) { if (data == null) { data = new UpdateData(); } if (TranData) { ifrm.NeedUpdateData = data.Clone() as UpdateData;//传入 } ifrm.TranData = mnu.CopyTranDatas(); //上个页面查询条件下传 if (currfrm != null && currfrm is ITranslateableInterFace && (currfrm as ITranslateableInterFace).TranData != null) { if (ifrm.TranData == null) { ifrm.TranData = new List <DataTranMapping>(); } if (ifrm.TranData != null) { List <DataTranMapping> prevdata = (currfrm as ITranslateableInterFace).TranData; for (int i = 0; i < prevdata.Count; i++) { DataTranMapping inputdata = prevdata[i]; var mp = ifrm.TranData.Where(a => a.FromDataPoint.Name == inputdata.ToDataPoint); if (mp.Count() == 0) { ifrm.TranData.Add(inputdata); } else { mp.First().FromDataPoint.Text = inputdata.FromDataPoint.Text; } if (!data.Items.ContainsKey(inputdata.ToDataPoint)) { data.Items.Add(inputdata.ToDataPoint, new UpdateItem(inputdata.ToDataPoint, inputdata.FromDataPoint.Text)); } data.Items[inputdata.ToDataPoint].text = inputdata.FromDataPoint.Text; } } } #region 输数据不为空 if (mnu.TranDataMapping != null) { for (int i = 0; i < mnu.TranDataMapping.Count; i++) { DataTranMapping dtm = mnu.TranDataMapping[i]; if (currfrm != null && currfrm is IKeyForm && currfrm.strKey == dtm.FromDataPoint.Name)//如果匹配到关键字,传送到下一个界面 { string val = currfrm.strRowId; if (mnu.Params != null && mnu.Params.Trim().Length > 0) { if (val.Trim().Length == 0) { val = mnu.Params; } } if (data.Items.ContainsKey(dtm.ToDataPoint)) { data.Items[dtm.ToDataPoint].value = val; } else { data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, val)); } //break; } else { string strPoint = dtm.FromDataPoint.Name.Replace("{", "").Replace("}", ""); if (GlobalShare.DataPointMappings.ContainsKey(strPoint))//如果是数据点,传数据 { if (!TranData) { continue; } //暂时无法处理 if (currfrm is ITranslateableInterFace)//获得该界面的所有数据 { UpdateData currframedata = (currfrm as ITranslateableInterFace).GetCurrFrameData(); if (currframedata.Items.ContainsKey(strPoint))//如果数据中包括要传送的数据点 { if (data.Items.ContainsKey(dtm.ToDataPoint)) { data.Items[dtm.ToDataPoint].value = currframedata.Items[strPoint].value; } else { data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, currframedata.Items[strPoint].value)); //dtm.FromDataPoint = currframedata.Items[dtm.FromDataPoint.Name].value; } dtm.FromDataPoint.Text = currframedata.Items[strPoint].value; } } else//如果是顶层菜单传入,并且是系统的用户常量 { if (GlobalShare.UserAppInfos.First().Value.appinfo.UserInfo.Items.ContainsKey(strPoint)) { UpdateData ud = GlobalShare.UserAppInfos.First().Value.appinfo.UserInfo; if (data.Items.ContainsKey(strPoint)) { data.Items[dtm.ToDataPoint].value = ud.Items[strPoint].value; } else { data.Items.Add(dtm.ToDataPoint, new UpdateItem(strPoint, ud.Items[strPoint].value)); //dtm.FromDataPoint = currframedata.Items[dtm.FromDataPoint.Name].value; } dtm.FromDataPoint.Text = ud.Items[strPoint].value; } } } else//传常量 { if (data.Items.ContainsKey(dtm.ToDataPoint)) { data.Items[dtm.ToDataPoint].value = dtm.FromDataPoint.Text; } else { data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, dtm.FromDataPoint.Name)); } } } } } #endregion if (!TranData) { return; } //关键字下传 if (currfrm == null) { return; } if (data == null) { data = new UpdateData(); } if (data.Items.ContainsKey(currfrm.strKey) && currfrm.strRowId != "") { data.Items[currfrm.strKey].value = currfrm.strRowId; } else { if (!data.Items.ContainsKey(currfrm.strKey)) { data.Items.Add(currfrm.strKey, new UpdateItem(currfrm.strKey, currfrm.strRowId)); } } }
public static void FillTranData(IKeyForm currfrm, ITranslateableInterFace ifrm, CMenuItem mnu, ref UpdateData data) { if (data == null) { data = new UpdateData(); } ifrm.NeedUpdateData = data;//传入 ifrm.TranData = mnu.TranDataMapping; #region if (mnu.TranDataMapping != null) { for (int i = 0; i < mnu.TranDataMapping.Count; i++) { DataTranMapping dtm = mnu.TranDataMapping[i]; if (currfrm != null && currfrm.strKey == dtm.FromDataPoint.Name)//如果匹配到关键字,传送到下一个界面 { //break; } else { if (GlobalShare.DataPointMappings.ContainsKey(dtm.FromDataPoint.Name))//如果是数据点,传数据 { //暂时无法处理 if (currfrm is ITranslateableInterFace)//获得该界面的所有数据 { UpdateData currframedata = (currfrm as ITranslateableInterFace).GetCurrFrameData(); if (currframedata.Items.ContainsKey(dtm.FromDataPoint.Name))//如果数据中包括要传送的数据点 { if (data.Items.ContainsKey(dtm.ToDataPoint)) { data.Items[dtm.ToDataPoint].value = currframedata.Items[dtm.FromDataPoint.Name].value; } else { data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, currframedata.Items[dtm.FromDataPoint.Name].value)); } } } } else//传常量 { if (data.Items.ContainsKey(dtm.ToDataPoint)) { data.Items[dtm.ToDataPoint].value = dtm.FromDataPoint.Text; } else { data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, dtm.FromDataPoint.Text)); } } } } } #endregion //关键字下传 if (data == null) { data = new UpdateData(); } if (data.Items.ContainsKey(currfrm.strKey) && currfrm.strRowId != "") { data.Items[currfrm.strKey].value = currfrm.strRowId; } else { data.Items.Add(currfrm.strKey, new UpdateItem(currfrm.strKey, currfrm.strRowId)); } }