bool UpdateMetaDataInfo() { var fields = this.lboxFields.Tag as List <MetaDataColumnInfo>; if (null == fields || 0 == fields.Count) { Wrapper.ShowDialog("字符参数为空"); return(false); } var dt = fields[0]; MetaDataInfo mdi = new MetaDataInfo(); //-->克隆出数据。 mdi.Item = fields.CloneList <MetaDataColumnInfo>(); mdi.table_comment = dt.table_comment; mdi.table_name = dt.table_name; mdi.table_type = dt.table_type; foreach (var data in mdi.Item) { data.table_comment = string.Empty; data.table_name = string.Empty; data.table_type = string.Empty; } var xml = IDesignFramework.GetCurrentXmlTemplate(); var ci = IDesignFramework.GetControlInfoByControlName(this.CurrentSelectedControlName); if (null == ci) { Wrapper.ShowDialog("找不着控件信息。"); return(false); } ci.MetaData = ci.MetaData.IsNullOrEmpty() ? _TableName : ci.MetaData; ci.ColumnName = ci.ColumnName.IsNullOrEmpty() ? _SaveField : ci.ColumnName; ci.ControlDataSourceTableName = mdi.table_name; //-->判断tableName是否已经增加了 MetaDataInfo old_mdi = IDesignFramework.GetMetaDataInfoByTableName(mdi.table_name); if (null == old_mdi) { xml.MetaDataItem.Add(mdi); } else { //-->判断列是否已经存在。 foreach (var column in mdi.Item) { var col = old_mdi.Item.Where(p => p.column_name.Equals(column.column_name)).GetFirst <MetaDataColumnInfo>(); if (null != col) { old_mdi.Item.Remove(col); } old_mdi.Item.Add(column); } } IDesignFramework.UpdateCurrentTemplate(); return(true); }
/// <summary> /// 查检是否保存 /// </summary> public bool CheckSave() { if (null == _CurrentDataTable) { Wrapper.ShowDialog("请选择绑定的表。"); return(false); } //-->给控件属性赋值 //-->判断是否选择了。如果没有选择的话,就不要这条记录 var dt = _CurrentDataTable[0]; //-->xml 控件信息设置 var xml = IDesignFramework.GetCurrentXmlTemplate(); var ci = IDesignFramework.GetControlInfoByControlName(this.CurrentSelectedControlName); if (null != ci) { ci.MetaData = dt.table_name; ci.ColumnName = string.Join("|", from p in _CurrentDataTable where p.IsChoose == true select p.column_name); //ci.ControlDataSourceTableName = dt.table_name; } //-->xaml 控件属性 var columns = from p in _CurrentDataTable where p.IsChoose == true select string.Format("{0}{1}{2}{1}{4}", p.column_comment, ConstantCollection.Separator_Wavy_line, p.column_name, ConstantCollection.Separator_Wavy_line, p.data_type); string fields = string.Join(",", columns); string result = string.Format("{0}{1}{2}", dt.table_name, ConstantCollection.Separator_Sub_section_number, fields); //foreach (var data in _CurrentDataTable) //{ // data.IsChoose = false; // data.IsHide = false; //} AddTableToXml(xml, _CurrentDataTable); IDesignFramework.UpdateCurrentTemplate(); _EvaluationContent = new XElement("DataSource", result); return(true); }
void tv_MetaData_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { var tv = sender as TreeView; var item = tv.SelectedItem as TreeViewItem; var column = item.Tag as MetaDataColumnInfo; if (null == column) { Wrapper.ShowDialog("请选择一张表的字段。"); return; } var ci = IDesignFramework.GetControlInfoByControlName(CurrentSelectedControlName); ci.ColumnName = column.column_name; ci.Comment = column.column_comment; ci.MetaData = ((tv.GetParentItem(tv.SelectedItem) as TreeViewItem).Tag as MetaDataInfo).table_name; EvaluationContent = new XElement("DataSource", string.Format("{0}|{1}|{2}", ci.MetaData, ci.ColumnName, ci.Comment)); IDesignFramework.UpdateCurrentTemplate(); }
void SetParameterSelectedValue(ParameterSelected ps, ParamInfo pi) { var _target_ci = IDesignFramework.GetControlInfoByControlName(pi.TargetCtrlName); if (null == _target_ci) { return; } var _target_mdi = IDesignFramework.GetMetaDataInfoByTableName(_target_ci.MetaData); if (null == _target_mdi) { return; } var _target_mdc = _target_mdi.Item.Where(p => p.column_name.Equals(pi.TargetFieldName)).GetFirst <MetaDataColumnInfo>(); if (null == _target_mdc) { return; } ps.InitLoadValue = pi; ps.Text = _target_mdc.column_comment; }
bool UpdateXml() { if (null == metadata_username) { Wrapper.ShowDialog("请选择要关联的用户名字段!"); return(false); } if (null == metadata_password) { Wrapper.ShowDialog("请选择要关联的密码字段!"); return(false); } var fields = xtnTableField.Fields; if (null == fields || 0 == fields.Count) { Wrapper.ShowDialog("字符参数为空"); return(false); } var dt = fields[0]; var mdi = new MetaDataInfo(); //-->克隆出数据。 mdi.Item = fields.CloneList <MetaDataColumnInfo>(); mdi.table_comment = dt.table_comment; mdi.table_name = dt.table_name; mdi.table_type = dt.table_type; foreach (var data in mdi.Item) { data.table_comment = string.Empty; data.table_name = string.Empty; data.table_type = string.Empty; } var xml = IDesignFramework.GetCurrentXmlTemplate(); var ci = IDesignFramework.GetControlInfoByControlName(this.CurrentSelectedControlName); if (null == ci) { Wrapper.ShowDialog("找不着控件信息。"); return(false); } ci.MetaData = ci.MetaData.IsNullOrEmpty() ? _TableName : ci.MetaData; ci.ColumnName = string.Format("{0}|{1}", _UserField, _PasswordField); ci.ControlDataSourceTableName = mdi.table_name; //-->判断tableName是否已经增加了 var old_mdi = IDesignFramework.GetMetaDataInfoByTableName(mdi.table_name); if (null == old_mdi) { xml.MetaDataItem.Add(mdi); } IDesignFramework.UpdateCurrentTemplate(); string value = string.Format("{0}|{1}|{2}", this.xtnTableField.TableName, _UserField, _PasswordField); _EvaluationContent = new XElement("DataAssociated", value); return(true); }