/// <summary> /// 弹出继承选择对话框 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnInhert_Click(object sender, EventArgs e) { bool isEntity = IsEntity(); SelectAttributeType sat = null; if (this._bindDataNode.NodeType == NodeType.BPEntity) { sat = new SelectAttributeType(OperateTypeEnum.Return, this._currentProj.RefrenceList, false); if (sat.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.tbInhertGuid.Text = sat.SelectedType.Guid; this.cbList.Checked = sat.SelectedType.IsList; this.ckIsEntity.Checked = sat.SelectedType.IsEntity; this.tbReturnType.Text = sat.SelectedType.TypeName; if (sat.SelectedType.IsList) { this.tbInhertClass.Text = "List<" + sat.SelectedType.TypeName + ">"; } else { this.tbInhertClass.Text = sat.SelectedType.TypeName; } } } else { sat = new SelectAttributeType(OperateTypeEnum.Inhert, this._currentProj.RefrenceList, isEntity); if (sat.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (sat.SelectedType.Guid != this._bindDataNode.Guid) { this.tbInhertGuid.Text = sat.SelectedType.Guid; this.tbInhertClass.Text = sat.SelectedType.TypeName; } else { MessageBox.Show("模型不能继承自身", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex == 4 && e.RowIndex >= 0) { DataGridViewRow r = this.dataGridView1.Rows[e.RowIndex]; //如果当前编码不能编辑,则无需弹出菜单 if (r.Cells[1].ReadOnly) return; if (r.Cells[3].EditedFormattedValue != null) { string strDataType = r.Cells[3].EditedFormattedValue.ToString(); if (string.IsNullOrEmpty(strDataType)) { MessageBox.Show("请选择属性类型"); } else { bool isEntity = IsEntity(); SelectAttributeType sat = null; if (strDataType == "基础类型") { sat = new SelectAttributeType(OperateTypeEnum.Common, this._currentProj.RefrenceList, isEntity); } else if (strDataType == "引用类型") { sat = new SelectAttributeType(OperateTypeEnum.Refrence, this._currentProj.RefrenceList, isEntity); } else if (strDataType == "聚合类型") { sat = new SelectAttributeType(OperateTypeEnum.Composition, this._currentProj.RefrenceList, isEntity); } if (sat.ShowDialog() == System.Windows.Forms.DialogResult.OK) { r.Cells[4].Value = sat.SelectedType.TypeName; r.Cells[6].Value = sat.SelectedType.Guid; if (string.IsNullOrEmpty(sat.SelectedType.Guid) && sat.SelectedType.TypeName == "string") { r.Cells[7].ReadOnly = false; r.Cells[7].Value = "100"; } else { r.Cells[7].ReadOnly = true; r.Cells[7].Value = string.Empty; } } } } else { MessageBox.Show("请选择属性类型"); } } }