Esempio n. 1
0
        private void SaveData()
        {
            var user = new SysUser();

            if (UserID > 0)
            {
                user.LoadByIdentity(UserID);
                SetData(user);
                user.Update();
            }
            else
            {
                SetData(user);
                //学生初始化
                user.UserType  = (int)SysUserType.Student;
                user.Password  = SysConsts.InitPassword.MD5Hash().ToUpper();
                user.RoleIDs   = "1";
                user.IsDeleted = false;

                var deptId = Convert.ToInt32(tbxDepartmentID.SelectedValue);
                var dept   = new SysDepartment(deptId);
                dept.Load();
                user.DepartmentID   = dept.ID;
                user.DepartmentName = dept.Name;
                user.BaseDeptID     = dept.BaseDeptID;
                user.BaseDeptName   = dept.BaseDeptName;
                user.DepartmentType = dept.DepartmentType;

                user.Add();
            }
        }
        private void SaveData()
        {
            var user = new SysUser();

            if (UserID > 0)
            {
                user.LoadByIdentity(UserID);
                SetData(user);
                user.Update();
            }
            else
            {
                SetData(user);
                //老师初始化
                user.UserType  = (int)SysUserType.Teacher;
                user.Password  = SysConsts.InitPassword.MD5Hash().ToUpper();
                user.RoleIDs   = "2";
                user.IsDeleted = false;

                var dept = new SysDepartment(SysConsts.TeacherDeptID);
                dept.Load();
                user.DepartmentID   = dept.ID;
                user.DepartmentName = dept.Name;
                user.BaseDeptID     = dept.BaseDeptID;
                user.BaseDeptName   = dept.BaseDeptName;
                user.DepartmentType = dept.DepartmentType;

                user.Add();
            }
        }