// 更新部门 public static void UpdateDepartment(string name, int ordinal, Homory.Model.State state, string meId, string pId = "") { var param = new object[] { name, ordinal, pId, meId, state < Homory.Model.State.审核 ? 0 : 1 }; var id = db.ExecProcReobject("__UpdateDepartment", param).ToString(); var objs = new object[] { "dept", "Department", "DeptID", id, "DeptParentID", "", "DeptDelFlag=0", "DeptSort" }; db.ExecProcReDataSet("pt_SortInsert", objs); }
protected string GenGradeName(Homory.Model.Department d) { int index = d.Ordinal - __Year - 1; var pdt = d.DepartmentRoot.ClassType; switch (pdt) { case ClassType.九年一贯制: return index < PJ.Length && index > -1 ? PJ[index] : string.Empty; case ClassType.初中: return index < J.Length && index > -1 ? J[index] : string.Empty; case ClassType.小学: return index < P.Length && index > -1 ? P[index] : string.Empty; case ClassType.幼儿园: return index < K.Length && index > -1 ? K[index] : string.Empty; case ClassType.高中: return index < S.Length && index > -1 ? S[index] : string.Empty; } return string.Empty; }
protected string GenerateTreeName(Homory.Model.Department department, int index, int level) { var part1 = level == 1 ? GenGradeName(department) : department.DisplayName; var part2 = level > 1 ? (department.DepartmentUser.Count(o => o.Type == DepartmentUserType.班级班主任 && o.State == State.启用) == 0 ? string.Empty : string.Format(" [{0}]", department.DepartmentUser.First(o => o.Type == DepartmentUserType.班级班主任 && o.State == State.启用).User.RealName)) : string.Empty; return string.Format("{0}{1}", part1, part2); }
protected string GenerateGridName(Homory.Model.Department department) { var part1 = GenGradeName(department); return part1; }
protected string GenerateTreeName(Homory.Model.Department department, int index, int level) { return level == 1 ? GenGradeName(department) : department.DisplayName; }
protected string GenerateTreeName(Homory.Model.Department department, int index, int level) { try { if (level == 1) return GenGradeName(department); var count = department.DepartmentUser.Count( o => o.Type == DepartmentUserType.班级学生 && o.State == State.启用); return count > 0 ? string.Format("{0} [{1}]", department.DisplayName, count ) : department.DisplayName; } catch { return string.Format("{0}-{1}-{2}", department.DisplayName, index, level); } }
// 更新用户兼职 public static void UpdateUserParttime(string userId, string deptId, int ordinal, Homory.Model.State state) { var param = new object[] { userId, deptId, ordinal, state < Homory.Model.State.审核 ? 0 : 1 }; db.ExecProcReDataSet("__UpdateUserParttime", param); }
// 更新用户 public static void UpdateUser(string name, bool sync, Homory.Model.State state, string account, string userId, string phone, string idCard, int ordinal) { var param = new object[] { name, (sync && state < Homory.Model.State.审核) ? 0 : 1, account, userId, phone, idCard, ordinal }; db.ExecProcReDataSet("__UpdateUser", param); }
// 新增用户 public static void InsertUserEx(string name, string password, bool sync, Homory.Model.State state, string account, string deptId, string userId, string phone, string idCard, int ordinal, int relState = 0, string groupId = "1000", string ex = "") { var id = IDCreator.CreateMaxStrID("Users"); var param = new object[] { id, name, password, (sync && state < Homory.Model.State.审核) ? 0 : 1, account, deptId, userId, phone, idCard, ordinal, relState, groupId, ex }; db.ExecProcReDataSet("__InsertUserEx", param); }
// 更新学校 public static void UpdateCampus(string unitId, string name, int ordinal, Homory.Model.State state) { var param = new object[] { unitId, name, ordinal, state < Homory.Model.State.审核 ? 0 : 1 }; db.ExecProcReDataSet("__UpdateCampus", param); db.ExecProcReDataSet("__UpdateStation", param); }