private void GetChildData(MD_GuideLineFieldGroup _fg, TreeObj_GuideLineFieldGroup _group) { _fg.Fields = new List <MD_GuideLineFieldName>(); foreach (TreeObj_GuidelLineFieldItem _fitem in _group.Children) { MD_GuideLineFieldName _fn = _fitem.FieldData; _fg.Fields.Add(_fn); } }
private static void GetFieldNamesFromMeta(string metaStr, Dictionary <string, MD_GuideLineFieldGroup> dict, List <MD_GuideLineFieldGroup> ret) { RegexOptions options = RegexOptions.None; Regex regeMeta = new Regex(@"<FN>[^<]{1,}</FN>", options); MatchCollection _mc = regeMeta.Matches(metaStr); foreach (Match _m in _mc) { string _s2 = _m.Value.Substring(4, _m.Length - 9); string[] _s3 = _s2.Split(':'); if (_s3.Length > 1) { string _fname = _s3[0].ToUpper(); string _orifname = _s3[0]; string _title = _s3[1]; int _order = (_s3.Length > 2) ? int.Parse((_s3[2] == "") ? "0" : _s3[2]) : 0; int _width = (_s3.Length > 3) ? int.Parse((_s3[3] == "") ? "100" : _s3[3]) : 100; string _center = (_s3.Length > 4) ? _s3[4] : "LEFT"; if (_center == "1") { _center = "CENTER"; } if (_center == "0") { _center = "LEFT"; } string _display = (_s3.Length > 5) ? _s3[5] : ""; string _group = (_s3.Length > 6) ? _s3[6] : "DEFAULT"; bool _canHide = (_s3.Length > 7) ? ((_s3[7] == "0") ? false : true) : false; MD_GuideLineFieldName _gfn = new MD_GuideLineFieldName(_orifname, _fname, _title, _order, _width, _center, _display, _canHide); if (dict.ContainsKey(_group)) { MD_GuideLineFieldGroup _glg = dict[_group]; if (_glg.Fields == null) { _glg.Fields = new List <MD_GuideLineFieldName>(); } _glg.Fields.Add(_gfn); } else { MD_GuideLineFieldGroup _glg = new MD_GuideLineFieldGroup(_group, "(默认组)", "CENTER", 1, false, "SHOW"); ret.Add(_glg); dict.Add(_group, _glg); _glg.Fields = new List <MD_GuideLineFieldName>(); _glg.Fields.Add(_gfn); } } } }
private void Copy_FieldDefine() { List <MD_GuideLineFieldGroup> _fieldLists = new List <MD_GuideLineFieldGroup>(); foreach (TreeObj_GuidelLineFieldItem _item in _treeData) { TreeObj_GuideLineFieldGroup _group = _item as TreeObj_GuideLineFieldGroup; MD_GuideLineFieldGroup _fg = _group.GroupData; GetChildData(_fg, _group); _fieldLists.Add(_fg); } ClipPad_Fields = _fieldLists; RaiseMenuChanged(); }
/// <summary> /// 添加字段组 /// </summary> private void AddFieldGroup() { string _gname = string.Format("GROUP{0}", _treeData.Count + 1); MD_GuideLineFieldGroup _fg = new MD_GuideLineFieldGroup(_gname, "新建组", "CENTER", 0, false, "SHOW"); TreeObj_GuideLineFieldGroup _treeFG = new TreeObj_GuideLineFieldGroup(_fg); TreeObj_GuidelLineFieldItem _item = _treeFG as TreeObj_GuidelLineFieldItem; this._treeData.Add(_item); this.treeList1.DataSource = null; this.treeList1.DataSource = _treeData; this._haveChange = true; RaiseDataChanged(); }
private void SaveData() { this._guideLine.GuideLineName = this.TE_Name.EditValue.ToString(); this._guideLine.GuideLineMethod = this.TE_SF.EditValue.ToString(); this._guideLine.DisplayOrder = int.Parse(this.TE_ORDER.EditValue.ToString()); this._guideLine.Description = (this.te_Description.EditValue == null) ? "" : this.te_Description.EditValue.ToString(); this.treeList1.PostEditor(); this.gridView2.PostEditor(); this.gridView3.PostEditor(); _fgList = new List <MD_GuideLineFieldGroup>(); foreach (TreeObj_GuidelLineFieldItem _item in _treeData) { TreeObj_GuideLineFieldGroup _group = _item as TreeObj_GuideLineFieldGroup; MD_GuideLineFieldGroup _fg = _group.GroupData; GetChildData(_fg, _group); _fgList.Add(_fg); } //注:对于老系统的strYN参数的特殊处理 foreach (MD_GuideLineParameter _p in this.gridParameter.DataSource as IList <MD_GuideLineParameter> ) { if (_p.ParameterName == "strYN") { XtraMessageBox.Show("为了与旧系统的兼容需要,参数名称不可以是strYN!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } // ------------------------------------------ this._guideLine.GuideLineMeta = MC_GuideLine.CreateMeta(_fgList, this.gridParameter.DataSource as IList <MD_GuideLineParameter>, this.gridDetail.DataSource as IList <MD_GuideLineDetailDefine>); using (MetaDataServiceClient _mdc = new MetaDataServiceClient()) { if (_mdc.SaveGuideLine(MC_GuideLine.GetGuideLineDefineData(this._guideLine))) { XtraMessageBox.Show("保存成功!"); _haveChange = false; this.RaiseMenuChanged(); } } }
public static List <MD_GuideLineFieldGroup> GetFieldGroupsFromMeta(string _metaStr) { List <MD_GuideLineFieldGroup> _ret = new List <MD_GuideLineFieldGroup>(); Dictionary <string, MD_GuideLineFieldGroup> _dict = new Dictionary <string, MD_GuideLineFieldGroup>(); RegexOptions options = RegexOptions.None; Regex regeMeta = new Regex(@"<FG>[^<]{1,}</FG>", options); MatchCollection _mc = regeMeta.Matches(_metaStr); foreach (Match _m in _mc) { string _s2 = _m.Value.Substring(4, _m.Length - 9); string[] _s3 = _s2.Split(':'); if (_s3.Length > 1) { string _name = _s3[0].ToUpper(); string _title = _s3[1]; int _order = (_s3.Length > 2) ? int.Parse((_s3[2] == "") ? "0" : _s3[2]) : 0; string _align = (_s3.Length > 3) ? _s3[3] : "LEFT"; bool _hide = (_s3.Length > 4) ? (int.Parse(_s3[4]) > 0) : false; string _status = (_s3.Length > 5) ? _s3[5] : "SHOW"; MD_GuideLineFieldGroup _glg = new MD_GuideLineFieldGroup(_name, _title, _align, _order, _hide, _status); _glg.Fields = new List <MD_GuideLineFieldName>(); _dict.Add(_name, _glg); _ret.Add(_glg); } } GetFieldNamesFromMeta(_metaStr, _dict, _ret); if (_ret.Count < 1) { MD_GuideLineFieldGroup _glg = new MD_GuideLineFieldGroup("DEFAULT", "(默认组)", "CENTER", 1, false, "SHOW"); _glg.Fields = new List <MD_GuideLineFieldName>(); _ret.Add(_glg); _dict.Add("DEFAULT", _glg); } foreach (MD_GuideLineFieldGroup _group in _ret) { _group.Fields.Sort((g1, g2) => { return(g1.DisplayOrder.CompareTo(g2.DisplayOrder)); }); } _ret.Sort((g1, g2) => { return(g1.DisplayOrder.CompareTo(g2.DisplayOrder)); }); return(_ret); }
/// <summary> /// 取指标组的定义 /// </summary> /// <param name="metaStr">元数据</param> /// <returns></returns> public static List <MD_GuideLineFieldGroup> GetFieldGroupsFromMeta(string metaStr) { List <MD_GuideLineFieldGroup> ret = new List <MD_GuideLineFieldGroup>(); Dictionary <string, MD_GuideLineFieldGroup> dict = new Dictionary <string, MD_GuideLineFieldGroup>(); RegexOptions options = RegexOptions.None; Regex regeMeta = new Regex(@"<FG>[^<]{1,}</FG>", options); MatchCollection mc = regeMeta.Matches(metaStr); foreach (Match m in mc) { string s2 = m.Value.Substring(4, m.Length - 9); string[] s3 = s2.Split(':'); if (s3.Length > 1) { string name = s3[0].ToUpper(); string title = s3[1]; int order = (s3.Length > 2) ? int.Parse((s3[2] == "") ? "0" : s3[2]) : 0; string align = (s3.Length > 3) ? s3[3] : "LEFT"; bool hide = (s3.Length > 4) && (int.Parse(s3[4]) > 0); string status = (s3.Length > 5) ? s3[5] : "SHOW"; MD_GuideLineFieldGroup glg = new MD_GuideLineFieldGroup(name, title, align, order, hide, status); glg.Fields = new List <MD_GuideLineFieldName>(); dict.Add(name, glg); ret.Add(glg); } } GetFieldNamesFromMeta(metaStr, dict, ret); if (ret.Count < 1) { MD_GuideLineFieldGroup glg = new MD_GuideLineFieldGroup("DEFAULT", "(默认组)", "CENTER", 1, false, "SHOW"); glg.Fields = new List <MD_GuideLineFieldName>(); ret.Add(glg); dict.Add("DEFAULT", glg); } foreach (MD_GuideLineFieldGroup group in ret) { group.Fields.Sort((g1, g2) => { return(g1.DisplayOrder.CompareTo(g2.DisplayOrder)); }); } ret.Sort((g1, g2) => { return(g1.DisplayOrder.CompareTo(g2.DisplayOrder)); }); return(ret); }
public TreeObj_GuideLineFieldGroup(MD_GuideLineFieldGroup data) { _groupData = data; _type = "GROUP"; this.children = new TreeObj_GuideLineFieldList(); }
private void ChangeBandStatus(GridBand _band) { if (_band.ImageIndex == -1) { return; } MD_GuideLineFieldGroup _group = _band.Tag as MD_GuideLineFieldGroup; int _fullWidth = 0; int _hideWidth = 0; foreach (MD_GuideLineFieldName _fn in _group.Fields) { _fullWidth += _fn.DisplayWidth; if (!_fn.CanHide) { _hideWidth += _fn.DisplayWidth; } } if (_hideWidth < 30) { _hideWidth = 30; } if (_band.ImageIndex == 1) { //展开 _band.Caption = _group.DisplayTitle; _band.ImageIndex = 0; _band.ImageAlignment = StringAlignment.Far; foreach (BandedGridColumn _bgc in _band.Columns) { if (_bgc.FieldName == "_BlankData") { _bgc.Visible = false; } else { _bgc.Visible = true; } } _band.Width = _fullWidth; } else { foreach (BandedGridColumn _bgc in _band.Columns) { if (_bgc.FieldName == "_BlankData") { _bgc.Visible = true; } else { MD_GuideLineFieldName _fn = _bgc.Tag as MD_GuideLineFieldName; if (_fn.CanHide) { _bgc.Visible = false; } else { _bgc.Visible = true; } } } if (_hideWidth > 30) { _band.Caption = _group.DisplayTitle; _band.ImageAlignment = StringAlignment.Far; } else { _band.Caption = ""; _band.ImageAlignment = StringAlignment.Center; } _band.Width = _hideWidth; _band.ImageIndex = 1; } }
/// <summary> /// 通过元数据添加Band /// </summary> /// <param name="_mtable"></param> virtual protected void CreateBandColumn(MD_GuideLineFieldGroup _group) { GridBand _band = this.bandedGridView1.Bands.Add(); _band.ImageIndex = 0; //_band.AppearanceHeader.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold); switch (_group.TextAlign) { case "CENTER": _band.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; break; case "RIGHT": _band.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Far; break; default: _band.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Near; break; } _band.Caption = _group.DisplayTitle; _band.Tag = _group; int i = 1; foreach (MD_GuideLineFieldName _fn in _group.Fields) { BandedGridColumn _col = this.bandedGridView1.Columns.Add(); SetColumnTextAlign(_col, _fn); SetColumnDisplayFormat(_col, _fn); _col.OptionsColumn.ReadOnly = true; _col.OptionsColumn.AllowSort = DefaultBoolean.True; _col.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; _col.Caption = _fn.DisplayTitle; _col.FieldName = _fn.FieldName.ToUpper(); _col.Visible = true; _col.VisibleIndex = i++; _col.Width = _fn.DisplayWidth; _col.Tag = _fn; this.bandedGridView1.Columns.Add(_col); _band.Columns.Add(_col); if (!FieldsDict.ContainsKey(_fn.FieldName)) { if (_group.DisplayTitle == "") { FieldsDict.Add(_fn.FieldName, _fn.DisplayTitle); } else { FieldsDict.Add(_fn.FieldName, string.Format("{0}_{1}", _group.DisplayTitle, _fn.DisplayTitle)); } } if (MergeColumns.Contains(_fn.FieldName)) { _col.OptionsColumn.AllowMerge = DefaultBoolean.True; } else { _col.OptionsColumn.AllowMerge = DefaultBoolean.False; } } if (_group.CanHide) { _band.ImageIndex = 0; _band.ImageAlignment = StringAlignment.Far; bool _needblank = true; foreach (MD_GuideLineFieldName _fn in _group.Fields) { if (!_fn.CanHide) { _needblank = false; } } if (_needblank) { //添加一个空列 BandedGridColumn _blankCol = this.bandedGridView1.Columns.Add(); _blankCol.OptionsColumn.ReadOnly = true; _blankCol.OptionsColumn.AllowSort = DefaultBoolean.False; _blankCol.AppearanceHeader.TextOptions.HAlignment = HorzAlignment.Center; _blankCol.Caption = "..."; _blankCol.FieldName = "_BlankData"; _blankCol.Visible = false; _blankCol.Width = 30; this.bandedGridView1.Columns.Add(_blankCol); _band.Columns.Add(_blankCol); } if (_group.DefaultStatus == "HIDE") { ChangeBandStatus(_band); } } else { _band.ImageIndex = -1; } }