private void ActOnClassModify(object sender, EventArgsClass e) { if (this.OnClassModify != null) { OnClassModify(this, e); } }
private void ActOnClassDel(object sender, EventArgsClass e) { if (OnClassDel != null) { OnClassDel(this, e); } }
/// <summary> /// 修改班级事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void pData_OnClassModify(object sender, EventArgsClass e) { TreeNode tn = FindNodeInTreeUsingQueue(e.OldClassName); if (tn != null) { tn.Text = e.NewClassName; } }
/// <summary> /// 处理增加班级事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pData_OnClassAdd(object sender, EventArgsClass e) { TreeNode node = this.FindNodeInTreeUsingQueue(e.depobj.Name); node.Nodes.Add(e.clsobj.Name); treeView1.CollapseAll(); node.Expand(); this.labelClassNumber.Text = "班级数量:" + e.number.ToString("##");; }
/// <summary> /// 在某个系中删除一个班级 /// </summary> /// <param name="depobj">系对象</param> /// <param name="clsobj">班级对象</param> /// <returns>成功:true;失败:false</returns> internal bool DelClass(Department depobj, clsClass clsobj) { if (depobj.DelCalss(clsobj))//删除成功 { EventArgsClass e = new EventArgsClass(); e.depobj = depobj; e.number = ClassNumber; e.clsobj = clsobj; ActOnClassDel(this, e); return(true); } return(false); }
/// <summary> /// 处理删除班级事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pData_OnClassDel(object sender, EventArgsClass e) { TreeNode tndep = FindNodeInTree(e.depobj.Name); //班级所在系对应的树节点 TreeNode tncls = FindNodeInTree(e.clsobj.Name); if (tncls == null) { return; } tndep.Nodes.Remove(tncls); labelClassNumber.Text = "班级数量:" + e.number.ToString("00"); labelStudentNumber.Text = "学生数量:" + pData.StudentNumber.ToString("00"); }
/// <summary> /// 在系中增加一个班级 /// </summary> /// <param name="dep">系的对象</param> /// <param name="cls">班级对象</param> /// <returns>成功:true;失败:false</returns> internal bool AddClass(Department dep, clsClass cls) { if (dep.AddClass(cls))//成功 { EventArgsClass e = new EventArgsClass(); e.depobj = dep; e.clsobj = cls; e.number = this.ClassNumber; ActOnClassAdd(this, e); return(true); } return(false); }
/// <summary> /// 修改系中某个班级的名称 /// </summary> /// <param name="dep">班级所在的系</param> /// <param name="OldName">班级的旧名</param> /// <param name="NewName">班级的新名</param> /// <returns>成功:Ture;失败:false</returns> internal bool ModifyClass(Department dep, string OldName, string NewName) { clsClass clsobj = FindClassByName(dep, OldName); if (clsobj == null) //如果没有找到班级 { return(false); } clsobj.Name = NewName; EventArgsClass e = new EventArgsClass(); e.depobj = dep; e.clsobj = clsobj; e.OldClassName = OldName; e.NewClassName = NewName; e.number = ClassNumber; ActOnClassModify(this, e); return(true); }