private void SaveData() { var dept = new SysDepartment(); if (DeptID > 0) { dept.LoadByIdentity(DeptID); SetData(dept); dept.Update(); } else { SetData(dept); //班级初始化 dept.IsDeleted = false; var rootDept = new SysDepartment(SysConsts.RootDeptID); rootDept.Load(); dept.BaseDeptName = rootDept.Name; dept.BaseDeptID = rootDept.ID; dept.ParentID = rootDept.ID; dept.ParentName = rootDept.Name; dept.Add(); } }
protected void rpList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = int.Parse(e.CommandArgument.ToString()); if (e.CommandName == "Delete") { var dept = new SysDepartment(id); dept.Load(); dept.IsDeleted = true; dept.Update(); LoadData(); } }