private void mItmAddStaff_Click(object sender, EventArgs e) { string returnValue = string.Empty; string companyId = string.Empty; string subCompanyId = string.Empty; string departmentId = string.Empty; string workgroupId = string.Empty; TreeNode treeNode = this.tvOrganize.SelectedNode; while (treeNode != null) { string id = string.Empty; if (treeNode.Tag is DataRow) { id = (treeNode.Tag as DataRow)[BaseOrganizeEntity.FieldId].ToString(); } else { id = treeNode.Tag.ToString(); } if (BaseBusinessLogic.GetProperty(this.DTOrganize, id, BaseOrganizeEntity.FieldCategory).ToUpper() == "Company".ToUpper()) { if (string.IsNullOrEmpty(companyId)) { companyId = id; } } else if (BaseBusinessLogic.GetProperty(this.DTOrganize, id, BaseOrganizeEntity.FieldCategory).ToUpper() == "SubCompany".ToUpper()) { if (string.IsNullOrEmpty(subCompanyId)) { subCompanyId = id; } } else if (BaseBusinessLogic.GetProperty(this.DTOrganize, id, BaseOrganizeEntity.FieldCategory).ToUpper() == "Department".ToUpper()) { if (string.IsNullOrEmpty(departmentId)) { departmentId = id; } } else if (BaseBusinessLogic.GetProperty(this.DTOrganize, id, BaseOrganizeEntity.FieldCategory).ToUpper() == "WorkGroup".ToUpper()) { if (string.IsNullOrEmpty(workgroupId)) { workgroupId = id; } } treeNode = treeNode.Parent; } FrmStaffAdd frmStaffAdd = new FrmStaffAdd(companyId, subCompanyId, departmentId, workgroupId); if (frmStaffAdd.ShowDialog(this) == DialogResult.OK) { returnValue = frmStaffAdd.EntityId; } }
private void btnLikeAdd_Click(object sender, EventArgs e) { BaseStaffEntity entity = GetEntity(); entity.Id = null; FrmStaffAdd frmModuleAdd = new FrmStaffAdd(entity); frmModuleAdd.ShowDialog(); }
public string Add() { FrmStaffAdd frmStaffAdd = new FrmStaffAdd(); if (frmStaffAdd.ShowDialog(this) == DialogResult.OK) { // 记录当前选中的主键 this.CurrentEntityId = frmStaffAdd.EntityId; // 加载窗体 this.FormOnLoad(); } return(this.CurrentEntityId); }