private void ActOnDepartmentModify(object sender, EventArgsDep e) { if (this.OnDepartmentModify != null) { OnDepartmentModify(this, e); } }
private void ActOnDepartmentDel(object sender, EventArgsDep e) { if (OnDepartmentDel != null) { OnDepartmentDel(this, e); } }
/// <summary> /// 修改系事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void pData_OnDepartmentModify(object sender, EventArgsDep e) { TreeNode tn = FindNodeInTree(e.OldDepName); if (tn != null) { tn.Text = e.NewDepName; } }
/// <summary> /// 处理删除系事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pData_OnDepartmentDel(object sender, EventArgsDep e) { TreeNode tn = FindNodeInTree(e.pobj.Name); treeView1.Nodes.Remove(tn); labelDepNumber.Text = "系数量:" + e.number.ToString(); labelClassNumber.Text = "班级数量:" + pData.ClassNumber.ToString(); labelStudentNumber.Text = "学生数量:" + pData.StudentNumber.ToString(); }
/// <summary> /// 删除一个系 /// </summary> /// <param name="obj">系对象</param> /// <returns>成功:true;失败:false</returns> internal bool DelDepartment(Department obj) { if (DepList.Remove(obj))//删除成功 { EventArgsDep e = new EventArgsDep(); e.pobj = obj; e.number = DepartmentNumber; ActOnDepartmentDel(this, e); return(true); } return(false); }
/// <summary> /// 修改系的名称 /// </summary> /// <param name="oldName">旧名字</param> /// <param name="NewName">新名字</param> internal void ModifyDepartment(string oldName, string NewName) { Department dep = FindDepartmentByName(oldName); dep.Name = NewName; EventArgsDep e = new EventArgsDep(); e.pobj = dep; e.OldDepName = oldName; e.NewDepName = NewName; e.number = DepartmentNumber; ActOnDepartmentModify(this, e); }
/// <summary> /// 增加系 /// </summary> /// <param name="obj">对象</param> /// <returns>成功:true;不成功:false</returns> internal bool AddDepartment(Department obj) { if (FindDepartmentByName(obj.Name) == null) { DepList.Add(obj); EventArgsDep e = new EventArgsDep(); e.number = DepartmentNumber; e.pobj = obj; ActOnDepartmentAdd(this, e); return(true); } return(false); }
/// <summary> /// 处理增加系事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pData_OnDepartmentAdd(object sender, EventArgsDep e) { treeView1.Nodes.Add(e.pobj.Name); this.labelDepNumber.Text = "系数量:" + e.number.ToString("##"); }