protected override void OnEdit(object sender, EventArgs args) { EditModelFrm frm = new EditModelFrm(); ColumnSetNode columnSetNode = (ColumnSetNode)this.Reslove(typeof(ColumnSetNode), this.ColumnSetName); frm.UpdateModel(this, columnSetNode); if (frm.ShowDialog() == DialogResult.OK) { this.Children.Clear(); //更新模型 IList <EditModelFrm.FieldItem> items = frm.FieldItems; foreach (EditModelFrm.FieldItem item in items) { FieldNode node = NodeFactory.CreateNode <FieldNode>();// new FieldNode(); node.Name = item.Name; node.ColumnName = item.ColumnName; node.Description = item.Description; node.NullAble = item.NullAble; node.SystemType = SchemaUtility.GetSystemType(DBGlobalService.DbType, item.SystemType); node.Parent = this; } } base.OnEdit(sender, args); }
private void CreateWcfBaseCCFLowService_Click(object sender, EventArgs args) { ColumnSetNode columnSetNode = (ColumnSetNode)base.Reslove(typeof(ColumnSetNode), this.ColumnSetName); var service = new GenBaseCCFlowService((ModelType)this.DataInfo, columnSetNode); StringBuilder builder = new StringBuilder(); service.Generate(builder); this.OnGenerate(this, builder); }
private void CreateEditView_Click(object sender, EventArgs args) { ColumnSetNode columnSetNode = (ColumnSetNode)base.Reslove(typeof(ColumnSetNode), this.ColumnSetName); GenEditView view = new GenEditView((ModelType)this.DataInfo, columnSetNode); StringBuilder builder = new StringBuilder(); view.Generate(builder); this.OnGenerate(this, builder); }
void CreateWcfDtoToViewModel_Click(object sender, EventArgs args) { ColumnSetNode columnSetNode = (ColumnSetNode)this.Reslove(typeof(ColumnSetNode), this.ColumnSetName); var gen = new GenConverWcfDtoTotViewMode((ModelType)this.DataInfo, columnSetNode); StringBuilder builder = new StringBuilder(); gen.Generate(builder); this.OnGenerate(this, builder); }
void CreateEF_Click(object sender, EventArgs args) { ColumnSetNode columnSetNode = (ColumnSetNode)this.Reslove(typeof(ColumnSetNode), this.ColumnSetName); var table = this.Reslove(typeof(TableNode), null); var gen = new GenEFEntity((ModelType)this.DataInfo, columnSetNode, table as TableNode); StringBuilder builder = new StringBuilder(); gen.Generate(builder); this.OnGenerate(this, builder); }
public GenEFMap(ModelType model, ColumnSetNode columnSetNode) { this.Model = model; this.ColumnSetNode = columnSetNode; }
protected override void OnRefresh(object sender, EventArgs args) { try { return; this._dataTableSet.Children.Clear(); DataSet ds = SqlHelper.ExecuteDataset(this.ConnectionString, CommandType.Text, this.Content); List <DBModelNode> modelNodeList = new List <DBModelNode>(); List <ColumnSetNode> columnSetNodeList = new List <ColumnSetNode>(); #region [构造ColumnSetNode ModelNode] foreach (DataTable dataTable in ds.Tables) { ColumnSetType columnSet = new ColumnSetType(); ColumnSetNode columnSetNode = new ColumnSetNode(); columnSetNode.Name = dataTable.TableName; columnSetNodeList.Add(columnSetNode); DBModelNode modelNode = new DBModelNode(); modelNode.Name = dataTable.TableName; modelNode.ColumnSetName = dataTable.TableName; modelNodeList.Add(modelNode); foreach (DataColumn dataColumn in dataTable.Columns) { ColumnNode columnNode = NodeFactory.CreateNode <ColumnNode>();// new ColumnNode(); columnNode.AllowDBNull = dataColumn.AllowDBNull; columnNode.DbType = SchemaUtility.GetDbType(DBGlobalService.DbType, dataColumn.DataType.Name).ToString(); columnNode.Description = ""; columnNode.IsPK = false; columnNode.Name = dataColumn.ColumnName; columnNode.Precision = 0; columnNode.Scale = 0; columnNode.Size = 0; columnNode.SystemType = dataColumn.DataType; columnNode.Parent = columnSetNode; FieldNode fieldNode = NodeFactory.CreateNode <FieldNode>();// new FieldNode(); fieldNode.Description = ""; fieldNode.Name = dataColumn.ColumnName; fieldNode.ColumnName = dataColumn.ColumnName; fieldNode.NullAble = dataColumn.AllowDBNull; fieldNode.SystemType = dataColumn.DataType; fieldNode.Parent = modelNode; } columnSetNode.Parent = this._dataTableSet; } #endregion var hasModel = from n in this._modelSet.Children join m in modelNodeList on ((DBModelNode)n).ColumnSetName equals m.ColumnSetName where n is DBModelNode select n; #region 更新存在的模型 foreach (DBModelNode modelNode in hasModel) { var columnSet = from colset in columnSetNodeList where colset.Name == modelNode.ColumnSetName select colset; ColumnSetNode csNode = columnSet.First(); foreach (BaseNode node in modelNode.Children) { FieldNode fieldNode = node as FieldNode; if (fieldNode == null) { continue; } if (string.IsNullOrWhiteSpace(fieldNode.ColumnName)) { continue; } var column = from col in csNode.Children where col.Name == fieldNode.Name select col; bool needModify = true; ColumnNode colNode = (ColumnNode)column.FirstOrDefault(); if (colNode != null && colNode.Name.Equals(fieldNode.ColumnName) && colNode.SystemType.Equals(fieldNode.SystemType) && colNode.AllowDBNull.Equals(fieldNode.NullAble)) { needModify = false; } fieldNode.OnColumnModify(needModify); } //添加不存在的字段 DBModelNode newModelNode = modelNodeList.Find((m) => { return(m.ColumnSetName.Equals(modelNode.ColumnSetName)); }); for (int i = 0; i < newModelNode.Children.Count; i++) { if (newModelNode.Children[i] is FieldNode) { FieldNode fNode = (FieldNode)newModelNode.Children[i]; var exsitNode = modelNode.Children.FirstOrDefault((n) => (n is FieldNode) && n.Name.Equals(fNode.Name) ); if (exsitNode == null) { fNode.Parent = null; modelNode.Children.Add(fNode); i--; } } } } #endregion #region 插入不存在的模型 var hasModelNameList = from n in hasModel select((DBModelNode)n).ColumnSetName; foreach (DBModelNode m in modelNodeList) { if (!hasModelNameList.Contains(m.ColumnSetName)) { m.Parent = this._modelSet; } } #endregion base.OnRefresh(sender, args); } catch (Exception ex) { MessageBox.Show("错误:" + ex.Message); } }
public GenConvertViewModelToWcfDto(ModelType model, ColumnSetNode columnSetNode) { this.Model = model; this.ColumnSetNode = columnSetNode; }
public GenBaseService(ModelType model, ColumnSetNode columnSetNode) { this.Model = model; this.ColumnSetNode = columnSetNode; }
public GenConverDtoTotEF(ModelType model, ColumnSetNode columnSetNode) { this.Model = model; this.ColumnSetNode = columnSetNode; }
public GenEditView(ModelType model, ColumnSetNode columnSetNode) { this.Model = model; this.ColumnSetNode = columnSetNode; }
public GenActions(ModelType model, ColumnSetNode columnSetNode) { this.Model = model; this.ColumnSetNode = columnSetNode; }
protected override void OnRefresh(object sender, EventArgs args) { try { return; this._dataTableSet.Children.Clear(); DataSet ds = SqlHelper.ExecuteDataset(this.ConnectionString, CommandType.Text, this.Content); List<DBModelNode> modelNodeList = new List<DBModelNode>(); List<ColumnSetNode> columnSetNodeList = new List<ColumnSetNode>(); #region [构造ColumnSetNode ModelNode] foreach (DataTable dataTable in ds.Tables) { ColumnSetType columnSet = new ColumnSetType(); ColumnSetNode columnSetNode = new ColumnSetNode(); columnSetNode.Name = dataTable.TableName; columnSetNodeList.Add(columnSetNode); DBModelNode modelNode = new DBModelNode(); modelNode.Name = dataTable.TableName; modelNode.ColumnSetName = dataTable.TableName; modelNodeList.Add(modelNode); foreach (DataColumn dataColumn in dataTable.Columns) { ColumnNode columnNode = NodeFactory.CreateNode<ColumnNode>();// new ColumnNode(); columnNode.AllowDBNull = dataColumn.AllowDBNull; columnNode.DbType = SchemaUtility.GetDbType(DBGlobalService.DbType,dataColumn.DataType.Name).ToString(); columnNode.Description = ""; columnNode.IsPK = false; columnNode.Name = dataColumn.ColumnName; columnNode.Precision = 0; columnNode.Scale = 0; columnNode.Size = 0; columnNode.SystemType = dataColumn.DataType; columnNode.Parent = columnSetNode; FieldNode fieldNode = NodeFactory.CreateNode<FieldNode>();// new FieldNode(); fieldNode.Description = ""; fieldNode.Name = dataColumn.ColumnName; fieldNode.ColumnName = dataColumn.ColumnName; fieldNode.NullAble = dataColumn.AllowDBNull; fieldNode.SystemType = dataColumn.DataType; fieldNode.Parent = modelNode; } columnSetNode.Parent = this._dataTableSet; } #endregion var hasModel = from n in this._modelSet.Children join m in modelNodeList on ((DBModelNode)n).ColumnSetName equals m.ColumnSetName where n is DBModelNode select n; #region 更新存在的模型 foreach (DBModelNode modelNode in hasModel) { var columnSet = from colset in columnSetNodeList where colset.Name == modelNode.ColumnSetName select colset; ColumnSetNode csNode = columnSet.First(); foreach (BaseNode node in modelNode.Children) { FieldNode fieldNode = node as FieldNode; if (fieldNode == null) continue; if (string.IsNullOrWhiteSpace(fieldNode.ColumnName)) continue; var column = from col in csNode.Children where col.Name == fieldNode.Name select col; bool needModify = true; ColumnNode colNode = (ColumnNode)column.FirstOrDefault(); if (colNode != null && colNode.Name.Equals(fieldNode.ColumnName) && colNode.SystemType.Equals(fieldNode.SystemType) && colNode.AllowDBNull.Equals(fieldNode.NullAble)) { needModify = false; } fieldNode.OnColumnModify(needModify); } //添加不存在的字段 DBModelNode newModelNode = modelNodeList.Find((m) => { return m.ColumnSetName.Equals(modelNode.ColumnSetName); }); for (int i = 0; i < newModelNode.Children.Count; i++) { if (newModelNode.Children[i] is FieldNode) { FieldNode fNode = (FieldNode)newModelNode.Children[i]; var exsitNode = modelNode.Children.FirstOrDefault((n) => (n is FieldNode) && n.Name.Equals(fNode.Name) ); if (exsitNode == null) { fNode.Parent = null; modelNode.Children.Add(fNode); i--; } } } } #endregion #region 插入不存在的模型 var hasModelNameList = from n in hasModel select ((DBModelNode)n).ColumnSetName; foreach (DBModelNode m in modelNodeList) { if (!hasModelNameList.Contains(m.ColumnSetName)) { m.Parent = this._modelSet; } } #endregion base.OnRefresh(sender, args); } catch (Exception ex) { MessageBox.Show("错误:" + ex.Message); } }
public GenViewModel_EditPage(ModelType model, ColumnSetNode columnSet) { this.Model = model; this.ColumnSet = columnSet; }
public GenEFEntity(ModelType model, ColumnSetNode columnSetNode ,TableNode tableNode) { this.Model = model; this.ColumnSetNode = columnSetNode; this.tableNode = tableNode; }