Beispiel #1
0
 public FrmSendEmail(string id)
     : this()
 {
     this.EntityId = id;
     staffEntity = DotNetService.Instance.StaffService.GetEntity(UserInfo, EntityId);
     UserEntity = DotNetService.Instance.UserService.GetEntity(UserInfo, staffEntity.UserId.ToString());
     this.txtEmailAddress.Text = UserEntity.Email;
 }
        /// <summary>
        /// 更新通讯密码
        /// </summary>
        /// <param name="oldPassword">原密码</param>
        /// <param name="newPassword">新密码</param>
        /// <param name="statusCode">返回状态码</param>
        /// <returns>影响行数</returns>
        public virtual int ChangeCommunicationPassword(string oldPassword, string newPassword, out string statusCode)
        {
            #if (DEBUG)
                int milliStart = Environment.TickCount;
            #endif

            int returnValue = 0;
            // 密码强度检查
            if (BaseSystemInfo.CheckPasswordStrength)
            {
                if (String.IsNullOrEmpty(newPassword))
                {
                    statusCode = StatusCode.PasswordCanNotBeNull.ToString();
                    return returnValue;
                }
            }
            // 加密密码
            if (BaseSystemInfo.ServerEncryptPassword)
            {
                oldPassword = this.EncryptUserPassword(oldPassword);
                newPassword = this.EncryptUserPassword(newPassword);
            }
            // 判断输入原始密码是否正确
            BaseUserEntity userEntity = new BaseUserEntity();
            userEntity.GetSingle(this.GetDataTableById(UserInfo.Id));
            if (userEntity.CommunicationPassword == null)
            {
                userEntity.CommunicationPassword = string.Empty;
            }
            // 密码错误
            if (!userEntity.CommunicationPassword.Equals(oldPassword))
            {
                statusCode = StatusCode.OldPasswordError.ToString();
                return returnValue;
            }
            // 更改密码
            returnValue = this.SetProperty(UserInfo.Id, new KeyValuePair<string, object>(BaseUserEntity.FieldCommunicationPassword, newPassword));
            if (returnValue == 1)
            {
                statusCode = StatusCode.ChangePasswordOK.ToString();
            }
            else
            {
                // 数据可能被删除
                statusCode = StatusCode.ErrorDeleted.ToString();
            }

            // 写入调试信息
            #if (DEBUG)
                int milliEnd = Environment.TickCount;
                Trace.WriteLine(DateTime.Now.ToString(BaseSystemInfo.TimeFormat) + " Ticks: " + TimeSpan.FromMilliseconds(milliEnd - milliStart).ToString() + " " + " BaseUserManager.ChangePassword(" + userEntity.Id + ")");
            #endif

            return returnValue;
        }
 /// <summary>
 /// 添加用户
 /// </summary>
 /// <param name="userEntity">用户实体</param>
 /// <param name="statusCode">状态码</param>
 /// <returns>主键</returns>
 public string Add(BaseUserEntity userEntity, out string statusCode)
 {
     string returnValue = string.Empty;
     this.BeforeAdd(userEntity, out statusCode);
     if (statusCode == StatusCode.OK.ToString())
     {
         returnValue = this.AddEntity(userEntity);
         this.AfterAdd(userEntity, out statusCode);
     }
     return returnValue;
 }
        /// <summary>
        /// 用户添加之前执行的方法
        /// </summary>
        /// <param name="userEntity">用户实体</param>
        /// <param name="statusCode">状态码</param>
        public void BeforeAdd(BaseUserEntity userEntity, out string statusCode)
        {
            // 检测成功,可以添加用户
            statusCode = StatusCode.OK.ToString();
            if (this.Exists(new KeyValuePair<string, object>(BaseUserEntity.FieldUserName, userEntity.UserName)
                , new KeyValuePair<string, object>(BaseUserEntity.FieldDeletionStateCode, 0)))
            {
                // 用户名已重复
                statusCode = StatusCode.ErrorUserExist.ToString();
            }
            else
            {
                // 检查编号是否重复
                if (!string.IsNullOrEmpty(userEntity.Code)
                    && this.Exists(new KeyValuePair<string, object>(BaseUserEntity.FieldCode, userEntity.Code)
                    , new KeyValuePair<string, object>(BaseUserEntity.FieldDeletionStateCode, 0)))
                {
                    // 编号已重复
                    statusCode = StatusCode.ErrorNameExist.ToString();
                }

                if (userEntity.IsStaff == 1)
                {
                    List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
                    parameters.Add(new KeyValuePair<string, object>(BaseStaffEntity.FieldUserName, userEntity.UserName));
                    parameters.Add(new KeyValuePair<string, object>(BaseStaffEntity.FieldDeletionStateCode, 0));
                    if (DbLogic.Exists(DbHelper, BaseStaffEntity.TableName, parameters))
                    {
                        // 编号已重复
                        statusCode = StatusCode.ErrorNameExist.ToString();
                    }
                    if (!string.IsNullOrEmpty(userEntity.Code))
                    {
                        parameters = new List<KeyValuePair<string, object>>();
                        parameters.Add(new KeyValuePair<string, object>(BaseStaffEntity.FieldCode, userEntity.Code));
                        parameters.Add(new KeyValuePair<string, object>(BaseStaffEntity.FieldDeletionStateCode, 0));
                        if (DbLogic.Exists(DbHelper, BaseStaffEntity.TableName, parameters))
                        {
                            // 编号已重复
                            statusCode = StatusCode.ErrorCodeExist.ToString();
                        }
                    }
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="dbHelper">数据库连接</param>
        /// <param name="userInfo">用户信息</param>
        /// <param name="userEntity">用户实体</param>
        /// <param name="statusCode">状态码</param>
        /// <param name="statusMessage">状态信息</param>
        /// <returns>主键</returns>
        public string AddUser(IDbHelper dbHelper, BaseUserInfo userInfo, BaseUserEntity userEntity, out string statusCode, out string statusMessage)
        {
            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
                BaseSystemInfo.IsAuthorized(userInfo);
            #endif

            string returnValue = string.Empty;
            BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo);
            // 若是系统需要用加密的密码,这里需要加密密码。
            if (BaseSystemInfo.ServerEncryptPassword)
            {
                userEntity.UserPassword = userManager.EncryptUserPassword(userEntity.UserPassword);
                // 安全通讯密码、交易密码也生成好
                userEntity.CommunicationPassword = userManager.EncryptUserPassword(userEntity.CommunicationPassword);
            }
            returnValue = userManager.Add(userEntity, out statusCode);
            statusMessage = userManager.GetStateMessage(statusCode);
            // 自己不用给自己发提示信息,这个提示信息是为了提高工作效率的,还是需要审核通过的,否则垃圾信息太多了
            if (userEntity.Enabled == 0 && statusCode.Equals(StatusCode.OKAdd.ToString()))
            {
                // 不是系统管理员添加
                if (!userInfo.IsAdministrator)
                {
                    // 给超级管理员群组发信息
                    BaseRoleManager roleManager = new BaseRoleManager(dbHelper, userInfo);
                    string[] roleIds = roleManager.GetIds(new KeyValuePair<string, object>(BaseRoleEntity.FieldCode, "Administrators"));
                    string[] userIds = userManager.GetIds(new KeyValuePair<string, object>(BaseUserEntity.FieldCode, "Administrator"));
                    // 发送请求审核的信息
                    BaseMessageEntity messageEntity = new BaseMessageEntity();
                    messageEntity.FunctionCode = MessageFunction.WaitForAudit.ToString();

                    // Pcsky 2012.05.04 显示申请的用户名
                    messageEntity.Contents = userInfo.RealName + "(" + userInfo.IPAddress + ")" + AppMessage.UserService_Application + userEntity.UserName + AppMessage.UserService_Check;
                    //messageEntity.Contents = userInfo.RealName + "(" + userInfo.IPAddress + ")" + AppMessage.UserService_Application + userEntity.RealName + AppMessage.UserService_Check;

                    BaseMessageManager messageManager = new BaseMessageManager(dbHelper, userInfo);
                    messageManager.BatchSend(userIds, null, roleIds, messageEntity, false);
                }
            }
            return returnValue;
        }
Beispiel #6
0
 /// <summary>
 /// 激活帐户
 /// </summary>
 /// <param name="openId">唯一识别码</param>
 /// <param name="statusCode">返回状态码</param>
 /// <returns>用户实体</returns>
 public BaseUserInfo AccountActivation(string openId, out string statusCode)
 {
     // 1.用户是否存在?
     BaseUserInfo userInfo = null;
     // 用户没有找到状态
     statusCode = StatusCode.UserNotFound.ToString();
     // 检查是否有效的合法的参数
     if (!String.IsNullOrEmpty(openId))
     {
         BaseUserManager userManager = new BaseUserManager(DbHelper);
         List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
         parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldOpenId, openId));
         parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldDeletionStateCode, 0));
         DataTable dataTable = userManager.GetDataTable(parameters);
         if (dataTable.Rows.Count == 1)
         {
             BaseUserEntity userEntity = new BaseUserEntity(dataTable);
             // 3.用户是否被锁定?
             if (userEntity.Enabled == 0)
             {
                 statusCode = StatusCode.UserLocked.ToString();
                 return userInfo;
             }
             if (userEntity.Enabled == 1)
             {
                 // 2.用户是否已经被激活?
                 statusCode = StatusCode.UserIsActivate.ToString();
                 return userInfo;
             }
             if (userEntity.Enabled == -1)
             {
                 // 4.成功激活用户
                 statusCode = StatusCode.OK.ToString();
                 userManager.SetProperty(new KeyValuePair<string, object>(BaseUserEntity.FieldId, userEntity.Id), new KeyValuePair<string, object>(BaseUserEntity.FieldEnabled, 1));
                 return userInfo;
             }
         }
     }
     return userInfo;
 }
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="userEntity">用户实体</param>
        /// <param name="statusCode">状态码</param>
        /// <returns>影响行数</returns>
        public int Update(BaseUserEntity userEntity, out string statusCode)
        {
            int returnValue = 0;
            // 检查用户名是否重复
            if (this.Exists(new KeyValuePair<string, object>(BaseUserEntity.FieldUserName, userEntity.UserName), new KeyValuePair<string, object>(BaseUserEntity.FieldDeletionStateCode, "0"), userEntity.Id))
            {
                // 用户名已重复
                statusCode = StatusCode.ErrorUserExist.ToString();
            }
            else
            {
                if (!string.IsNullOrEmpty(userEntity.Code) && userEntity.Code.Length > 0 && this.Exists(new KeyValuePair<string, object>(BaseUserEntity.FieldCode, userEntity.Code), new KeyValuePair<string, object>(BaseUserEntity.FieldDeletionStateCode, "0"), userEntity.Id))
                {
                    // 编号已重复
                    statusCode = StatusCode.ErrorCodeExist.ToString();
                }
                else
                {
                    // 01:先更新自己的数据
                    returnValue = this.UpdateEntity(userEntity);
                    // 02:用户修改时,文件夹同步更新
                    BaseFolderManager folderManager = new BaseFolderManager(this.DbHelper, this.UserInfo);
                    folderManager.SetProperty(new KeyValuePair<string, object>(BaseFolderEntity.FieldFolderName, userEntity.RealName), new KeyValuePair<string, object>(BaseFolderEntity.FieldId, userEntity.Id));

                    if (returnValue == 0)
                    {
                        statusCode = StatusCode.ErrorDeleted.ToString();
                    }
                    else
                    {
                        statusCode = StatusCode.OKUpdate.ToString();
                    }
                }
            }
            return returnValue;
        }
Beispiel #8
0
        /// <summary>
        /// 锁定用户
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userName">用户名</param>
        /// <returns>是否成功锁定</returns>
        public bool LockUser(BaseUserInfo userInfo, string userName)
        {
            // 写入调试信息
            #if (DEBUG)
                int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
                LogOnService.UserIsLogOn(userInfo);
            #endif

            bool returnValue = false;

            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.LogOnService_LockUser, MethodBase.GetCurrentMethod());
                    BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo);
                    List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
                    parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldUserName, userName));
                    parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldEnabled, 1));
                    parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldDeletionStateCode, 0));
                    BaseUserEntity userEntity = new BaseUserEntity(userManager.GetDataTable(parameters));
                    // 判断是否为空的
                    if (userEntity != null && !string.IsNullOrEmpty(userEntity.Id))
                    {
                        // 被锁定15分钟,不允许15分钟内登录,这时间是按服务器的时间来的。
                        userEntity.LockStartDate = DateTime.Now;
                        userEntity.LockEndDate = DateTime.Now.AddMinutes(BaseSystemInfo.LockUserPasswordError);
                        returnValue = userManager.UpdateEntity(userEntity) > 0;
                    }
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
                BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart, ConsoleColor.Yellow);
            #endif

            return returnValue;
        }
        private void btnCopy_Click(object sender, EventArgs e)
        {
            RolePermission rolePermission = new RolePermission();
            // 读取角色数据
            List<BaseUserEntity> userEntites = new List<BaseUserEntity>();
            for (int i = 0; i < this.cklstUser.CheckedItems.Count; i++)
            {
                BaseUserEntity userEntity = new BaseUserEntity(((System.Data.DataRowView)this.cklstUser.CheckedItems[i]).Row);
                userEntites.Add(userEntity);
            }
            // 角色复制到剪切板
            rolePermission.UserEntites = userEntites;
            // 模块访问权限复制到剪切板
            string[] grantModuleIds = this.GetGrantModuleIds();
            rolePermission.GrantModuleIds = grantModuleIds;
            // 操作权限复制到剪切板
            string[] grantPermissionIds = this.GetGrantPermissionIds();
            rolePermission.GrantPermissionIds = grantPermissionIds;

            Clipboard.SetData("rolePermission", rolePermission);
            this.btnPaste.Enabled = true;
        }
Beispiel #10
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="userInfo">用户信息</param>
        /// <param name="userEntity">用户实体</param>
        /// <param name="statusCode">状态码</param>
        /// <param name="statusMessage">状态信息</param>
        /// <returns>主键</returns>
        public string AddUser(BaseUserInfo userInfo, BaseUserEntity userEntity, out string statusCode, out string statusMessage)
        {
            // 写入调试信息
            #if (DEBUG)
                int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
                BaseSystemInfo.IsAuthorized(userInfo);
            #endif

            string returnValue = string.Empty;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    returnValue = AddUser(dbHelper, userInfo, userEntity, out statusCode, out statusMessage);
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.UserService_AddUser, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
                BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return returnValue;
        }
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (this.CheckInput())
            {
                BaseUserManager userManager = new BaseUserManager(this.UserInfo);
                DataTable dtUser = userManager.GetDataTable(DbTypes.Access,this.SelectedIds);

                BaseUserEntity userEntity = null;
                foreach (DataRow dataRow in dtUser.Rows)
                {
                    userEntity = new BaseUserEntity(dataRow);
                    userEntity.CompanyId = this.ucCompany.SelectedId;
                    userEntity.CompanyName = this.ucCompany.SelectedFullName;
                    userEntity.SubCompanyId = this.ucSubCompany.SelectedId;
                    userEntity.SubCompanyName = this.ucSubCompany.SelectedFullName;
                    userEntity.DepartmentId = this.ucDepartment.SelectedId;
                    userEntity.DepartmentName = this.ucDepartment.SelectedFullName;
                    userEntity.WorkgroupId = this.ucWorkgroup.SelectedId;
                    userEntity.WorkgroupName = this.ucWorkgroup.SelectedFullName;
                    userManager.Update(userEntity);
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
        private void btnCopy_Click(object sender, EventArgs e)
        {
            PermissionScopes permissionScopes = new PermissionScopes();
            // 模块访问权限复制到剪切板
            for (int i = 0; i < this.cklstUser.CheckedItems.Count; i++)
            {
                BaseUserEntity userEntity = new BaseUserEntity(((System.Data.DataRowView)this.cklstUser.CheckedItems[i]).Row);
                this.GrantUsers += userEntity.Id.ToString() + ";";
            }
            string[] grantUserIds = this.GrantUsers.Split(';');
            permissionScopes.GrantUserIds = grantUserIds;

            for (int i = 0; i < this.cklstRole.CheckedItems.Count; i++)
            {
                BaseRoleEntity roleEntity = new BaseRoleEntity(((System.Data.DataRowView)this.cklstRole.CheckedItems[i]).Row);
                this.GrantRoles += roleEntity.Id.ToString() + ";";
            }
            string[] grantRoleIds = this.GrantRoles.Split(';');
            permissionScopes.GrantRoleIds = grantRoleIds;

            string[] grantOrganizeIds = this.GetGrantOrganizeIds();
            permissionScopes.GrantOrganizeIds = grantOrganizeIds;
            string[] grantModuleIds = this.GetGrantModuleIds();
            permissionScopes.GrantModuleIds = grantModuleIds;
            string[] grantPermissionIds = this.GetGrantPermissionIds();
            permissionScopes.GrantPermissionIds = grantPermissionIds;
            Clipboard.SetData("permissionScopes", permissionScopes);
            this.btnPaste.Enabled = true;
        }
 private void btnCopy_Click(object sender, EventArgs e)
 {
     // 读取数据
     List<BaseUserEntity> userEntites = new List<BaseUserEntity>();
     for (int i = 0; i < this.cklstUser.CheckedItems.Count; i++)
     {
         BaseUserEntity userEntity = new BaseUserEntity(((System.Data.DataRowView)this.cklstUser.CheckedItems[i]).Row);
         userEntites.Add(userEntity);
     }
     // 复制到剪切板
     Clipboard.SetData("userEntites", userEntites);
     this.btnPaste.Enabled = true;
 }
 /// <summary>
 /// 用户添加之后执行的方法
 /// </summary>
 /// <param name="userEntity">用户实体</param>
 /// <param name="statusCode">状态码</param>
 public void AfterAdd(BaseUserEntity userEntity, out string statusCode)
 {
     // 运行成功
     statusCode = StatusCode.OKAdd.ToString();
 }
Beispiel #15
0
 public FrmUserAdd(BaseUserEntity entity)
     : this()
 {
     this.userEntity = entity;
 }
Beispiel #16
0
        public BaseUserEntity GetUserEntity()
        {
            BaseUserEntity userEntity = new BaseUserEntity();
            userEntity.UserName = this.txtUserName.Text;
            userEntity.RealName = this.txtRealName.Text;
            userEntity.Code = this.txtCode.Text;
            userEntity.QuickQuery = StringUtil.GetPinyin(userEntity.RealName);
            if (this.cmbDefaultRole.SelectedValue != null && this.cmbDefaultRole.SelectedValue.ToString().Length > 0)
            {
                userEntity.RoleId = this.cmbDefaultRole.SelectedValue.ToString();
            }
            else
            {
                userEntity.RoleId = null;
            }
            int securityLevel = 0;
            if (this.cmbSecurityLevel.SelectedValue != null && this.cmbSecurityLevel.SelectedValue.ToString().Length > 0)
            {
                int.TryParse(this.cmbSecurityLevel.SelectedValue.ToString(), out securityLevel);
            }
            userEntity.SecurityLevel = securityLevel;
            userEntity.UserPassword = this.txtPassword.Text;
            // 安全交易密码、安全通讯密码
            userEntity.CommunicationPassword = this.txtPassword.Text;
            // 是否进行分级管理
            if (BaseSystemInfo.UsePermissionScope)
            {
                userEntity.CompanyName = UserInfo.CompanyName;
                userEntity.DepartmentName = UserInfo.DepartmentName;
                userEntity.WorkgroupName = UserInfo.WorkgroupName;
            }

            // 2012.05.21 Pcsky 新增公司和部门的保存功能
            if (!string.IsNullOrEmpty(CompanyId))
            {
                userEntity.CompanyId = CompanyId;
            }
            if (!string.IsNullOrEmpty(CompanyName))
            {
                userEntity.CompanyName = CompanyName;
            }
            if (!string.IsNullOrEmpty(DepartmentId))
            {
                userEntity.DepartmentId = DepartmentId;
            }
            if (!string.IsNullOrEmpty(DepartmentName))
            {
                userEntity.DepartmentName = DepartmentName;
            }

            userEntity.Enabled = this.chkEnabled.Checked ? 1 : 0;
            userEntity.DeletionStateCode = 0;
            userEntity.IsVisible = 1;
            return userEntity;
        }
Beispiel #17
0
 /// <summary>
 /// 加载窗体
 /// </summary>
 public override void FormOnLoad()
 {
     // 表格显示序号的处理部分
     this.DataGridViewOnLoad(grdUserOrganize);
     this.userEntity = DotNetService.Instance.UserService.GetEntity(this.UserInfo, this.EntityId);
     // 绑定下拉筐数据
     this.BindItemDetails();
     // 显示用户信息
     this.ShowUser();
     // 用户的兼职情况
     this.GetUserOrganizeList();
     this.btnSetPassword.Enabled = true;
     //定位焦点
     this.ActiveControl = this.txtUserName;
     this.txtUserName.Focus();
 }
Beispiel #18
0
 /// <summary>
 /// 获取用户信息
 /// </summary>
 /// <returns>实体</returns>
 private BaseUserEntity GetUserEntity()
 {
     BaseUserEntity userEntity = new BaseUserEntity();
     userEntity.RealName = this.txtRealName.Text;
     if (this.cmbGender.SelectedValue != null)
     {
         userEntity.Gender = this.cmbGender.Text;
     }
     if (!string.IsNullOrEmpty(this.ucCompany.SelectedId))
     {
         userEntity.CompanyId = this.ucCompany.SelectedId;
         userEntity.CompanyName = this.ucCompany.SelectedFullName;
     }
     if (!string.IsNullOrEmpty(this.ucDepartment.SelectedId))
     {
         userEntity.DepartmentId = this.ucDepartment.SelectedId;
         userEntity.DepartmentName = this.ucDepartment.SelectedFullName;
     }
     if (!string.IsNullOrEmpty(this.ucWorkgroup.SelectedId))
     {
         userEntity.WorkgroupId = this.ucWorkgroup.SelectedId;
         userEntity.WorkgroupName = this.ucWorkgroup.SelectedFullName;
     }
     userEntity.Code = this.txtCode.Text;
     userEntity.Email = this.txtEmail.Text;
     userEntity.Mobile = this.txtMobile.Text;
     userEntity.OICQ = this.txtOICQ.Text;
     userEntity.UserName = this.txtUserName.Text;
     userEntity.Telephone = this.txtOfficePhone.Text;
     if (this.dtpBirthday.Checked)
     {
         userEntity.Birthday = this.dtpBirthday.Value.ToString(BaseSystemInfo.DateFormat);
     }
     else
     {
         userEntity.Birthday = null;
     }
     // 是否系统管理员有关系,是系统管理员才能用户生效
     if (this.cmbRole.SelectedValue != null && this.cmbRole.SelectedValue.ToString() != "")
     {
         userEntity.RoleId = this.cmbRole.SelectedValue.ToString();
     }
     userEntity.UserPassword = this.txtPassword.Text;
     userEntity.Enabled = this.chbEnabled.Checked ? 1 : 0;
     userEntity.Description = this.txtDescription.Text;
     userEntity.IsStaff = 1;
     userEntity.DeletionStateCode = 0;
     return userEntity;
 }
Beispiel #19
0
 private void btnCopy_Click(object sender, EventArgs e)
 {
     // 读取数据
     List<BaseUserEntity> userEntites = new List<BaseUserEntity>();
     for (int i = 0; i < this.DTUser.Rows.Count; i++)
     {
         BaseUserEntity userEntity = new BaseUserEntity(this.DTUser.Rows[i]);
         userEntites.Add(userEntity);
     }
     // 复制到剪切板
     Clipboard.SetData("userEntites", userEntites);
     this.btnPaste.Enabled = true;
 }
Beispiel #20
0
 public List<BaseUserEntity> Convert2UserEntitys(DataTable dt)
 {
     foreach (DataRow dr in dt.Rows)
     {
         BaseUserEntity user = new BaseUserEntity();
         user.Code = dr["编号"].ToString().Trim();
         user.RealName = dr["姓名"].ToString().Trim();
         user.UserName = dr["登录名"].ToString().Trim();
         user.QuickQuery = dr["快速查询"].ToString().Trim();
         user.RoleId = DotNetService.Instance.RoleService.GetDataTableByRoleName(UserInfo, dr["默认角色"].ToString()).Rows[0][BaseRoleEntity.FieldId].ToString().Trim();
         user.WorkCategory = dr["工作行业"].ToString().Trim();
         user.CompanyId = DotNetService.Instance.OrganizeService.GetCompanyDTByName(UserInfo, dr["公司名称"].ToString()).Rows[0][BaseOrganizeEntity.FieldId].ToString().Trim();
         user.CompanyName = dr["公司名称"].ToString().Trim();
         user.DepartmentId = DotNetService.Instance.OrganizeService.GetDepartmentDTByName(UserInfo, dr["部门名称"].ToString()).Rows[0][BaseOrganizeEntity.FieldId].ToString().Trim();
         user.DepartmentName = dr["部门名称"].ToString().Trim();
         user.Gender = dr["性别"].ToString().Trim();
         user.Mobile = dr["手机"].ToString().Trim();
         user.Telephone = dr["电话号码"].ToString().Trim();
         user.Birthday = dr["出生日期"].ToString().Trim();
         user.Duty = dr["岗位"].ToString().Trim();
         user.Title = dr["职称"].ToString().Trim();
         user.UserPassword = dr["用户密码"].ToString().Trim();
         user.OICQ = dr["QQ号码"].ToString().Trim();
         user.Email = dr["电子邮件"].ToString().Trim();
         user.Description = dr["描述"].ToString().Trim();
         users.Add(user);
     }
     return users;
 }
 /// <summary>
 /// 保存数据
 /// </summary>
 private void Save()
 {
     // 设置鼠标繁忙状态,并保留原先的状态
     Cursor holdCursor = this.Cursor;
     this.Cursor = Cursors.WaitCursor;
     try
     {
         this.btnOK.Enabled = false;
         // 将原来的角色移出,获取当前角色中的用户
         string[] userIds = DotNetService.Instance.RoleService.GetRoleUserIds(this.UserInfo, this.TargetRoleId);
         DotNetService.Instance.RoleService.RemoveUserFromRole(this.UserInfo, this.TargetRoleId, userIds);
         // 将新的角色添加到用户
         List<BaseUserEntity> userEntites = new List<BaseUserEntity>();
         for (int i = 0; i < this.cklstUser.CheckedItems.Count; i++)
         {
             BaseUserEntity userEntity = new BaseUserEntity(((System.Data.DataRowView)this.cklstUser.CheckedItems[i]).Row);
             userEntites.Add(userEntity);
         }
         string[] addUserIds = new string[userEntites.Count];
         for (int i = 0; i < userEntites.Count; i++)
         {
             addUserIds[i] = userEntites[i].Id.ToString();
         }
         // 添加用户到角色
         DotNetService.Instance.RoleService.AddUserToRole(this.UserInfo, this.TargetRoleId, addUserIds);
         this.btnOK.Enabled = true;
     }
     catch (Exception ex)
     {
         this.ProcessException(ex);
     }
     finally
     {
         // 设置鼠标默认状态,原来的光标状态
         this.Cursor = holdCursor;
     }
 }
        /// <summary>
        /// 更新密码
        /// </summary>
        /// <param name="oldPassword">原密码</param>
        /// <param name="newPassword">新密码</param>
        /// <param name="statusCode">返回状态码</param>
        /// <returns>影响行数</returns>
        public virtual int ChangePassword(string oldPassword, string newPassword, out string statusCode)
        {
            #if (DEBUG)
                int milliStart = Environment.TickCount;
            #endif

            int returnValue = 0;
            // 密码强度检查
            if (BaseSystemInfo.CheckPasswordStrength)
            {
                if (String.IsNullOrEmpty(newPassword))
                {
                    statusCode = StatusCode.PasswordCanNotBeNull.ToString();
                    return returnValue;
                }
            }
            // 加密密码
            if (BaseSystemInfo.ServerEncryptPassword)
            {
                oldPassword = this.EncryptUserPassword(oldPassword);
                newPassword = this.EncryptUserPassword(newPassword);
            }
            // 判断输入原始密码是否正确
            BaseUserEntity userEntity = new BaseUserEntity();
            userEntity.GetSingle(this.GetDataTableById(UserInfo.Id));
            if (userEntity.UserPassword == null)
            {
                userEntity.UserPassword = string.Empty;
            }
            // 密码错误
            if (!userEntity.UserPassword.Equals(oldPassword))
            {
                statusCode = StatusCode.OldPasswordError.ToString();
                return returnValue;
            }
            // 对比是否最近2次用过这个密码
            if (BaseSystemInfo.CheckPasswordStrength)
            {
                int i = 0;
                BaseParameterManager parameterManager = new BaseParameterManager(this.DbHelper, this.UserInfo);
                DataTable dataTable = parameterManager.GetDataTableParameterCode("User", this.UserInfo.Id, "Password");
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    string parameter = dataRow[BaseParameterEntity.FieldParameterContent].ToString();
                    if (parameter.Equals(newPassword))
                    {
                        statusCode = StatusCode.PasswordCanNotBeRepeat.ToString();
                        return returnValue;
                    }
                    i++;
                    {
                        // 判断连续2个密码就是可以了
                        if (i > 2)
                        {
                            break;
                        }
                    }
                }
            }
            // 更改密码,同时修改密码的修改日期
            List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
            parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldUserPassword, newPassword));
            // 注意日期格式,ACCESS中要用字符
            parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldChangePasswordDate, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
            returnValue = this.SetProperty(new KeyValuePair<string, object>(BaseUserEntity.FieldId, UserInfo.Id), parameters);
            if (returnValue == 1)
            {
                statusCode = StatusCode.ChangePasswordOK.ToString();
                // 若是强类型密码检查,那就保存密码修改历史,防止最近2-3次的密码相同的功能实现。
                if (BaseSystemInfo.CheckPasswordStrength)
                {
                    BaseParameterManager parameterManager = new BaseParameterManager(this.DbHelper, this.UserInfo);
                    BaseParameterEntity parameterEntity = new BaseParameterEntity();
                    parameterEntity.CategoryId = "User";
                    parameterEntity.ParameterId = this.UserInfo.Id;
                    parameterEntity.ParameterCode = "Password";
                    parameterEntity.ParameterContent = newPassword;
                    parameterEntity.DeletionStateCode = 0;
                    parameterEntity.Enabled = true;
                    parameterEntity.Worked = true;
                    parameterManager.AddEntity(parameterEntity);
                }
            }
            else
            {
                // 数据可能被删除
                statusCode = StatusCode.ErrorDeleted.ToString();
            }

            // 写入调试信息
            #if (DEBUG)
                int milliEnd = Environment.TickCount;
                Trace.WriteLine(DateTime.Now.ToString(BaseSystemInfo.TimeFormat) + " Ticks: " + TimeSpan.FromMilliseconds(milliEnd - milliStart).ToString() + " " + " BaseUserManager.ChangePassword(" + userEntity.Id + ")");
            #endif

            return returnValue;
        }
 /// <summary>
 /// 获取用户数据
 /// </summary>
 /// <returns>用户实体</returns>
 private BaseUserEntity GetUserEntity()
 {
     BaseUserEntity userEntity = new BaseUserEntity();
     if (this.cmbRole.SelectedValue == null || this.cmbRole.SelectedValue.ToString().Length == 0)
     {
         userEntity.RoleId = null;
     }
     else
     {
         userEntity.RoleId = this.cmbRole.SelectedValue.ToString();
     }
     // 获取用户数据
     userEntity.UserName = this.txtUserName.Text;
     userEntity.RealName = this.txtRealName.Text;
     userEntity.QuickQuery = StringUtil.GetPinyin(userEntity.RealName);
     if (this.cmbGender.SelectedValue != null)
     {
         userEntity.Gender = this.cmbGender.Text;
     }
     userEntity.Code = this.txtCode.Text;
     userEntity.Email = this.txtEmail.Text;
     userEntity.Mobile = this.txtMobile.Text;
     userEntity.Telephone = this.txtTelephone.Text;
     userEntity.UserPassword = this.txtPassword.Text;
     // 安全交易密码、安全通讯密码
     userEntity.CommunicationPassword = this.txtPassword.Text;
     if (string.IsNullOrEmpty(this.ucCompany.SelectedId))
     {
         userEntity.CompanyId = null;
         userEntity.CompanyName = null;
     }
     else
     {
         userEntity.CompanyId = this.ucCompany.SelectedId;
         userEntity.CompanyName = this.ucCompany.SelectedFullName;
     }
     if (string.IsNullOrEmpty(this.ucSubCompany.SelectedId))
     {
         userEntity.SubCompanyId = null;
         userEntity.SubCompanyName = null;
     }
     else
     {
         userEntity.SubCompanyId = this.ucSubCompany.SelectedId;
         userEntity.SubCompanyName = this.ucSubCompany.SelectedFullName;
     }
     if (string.IsNullOrEmpty(this.ucDepartment.SelectedId))
     {
         userEntity.DepartmentId = null;
         userEntity.DepartmentName = null;
     }
     else
     {
         userEntity.DepartmentId = this.ucDepartment.SelectedId;
         userEntity.DepartmentName = this.ucDepartment.SelectedFullName;
     }
     if (string.IsNullOrEmpty(this.ucWorkgroup.SelectedId))
     {
         userEntity.WorkgroupId = null;
         userEntity.WorkgroupName = null;
     }
     else
     {
         userEntity.WorkgroupId = this.ucWorkgroup.SelectedId;
         userEntity.WorkgroupName = this.ucWorkgroup.SelectedFullName;
     }
     userEntity.Enabled = this.chkEnabled.Checked ? 1 : 0;
     userEntity.IsStaff = this.chkIsStaff.Checked ? 1 : 0;
     // 应该是在待审核状态
     if (userEntity.Enabled == 0)
     {
         userEntity.AuditStatus = AuditStatus.WaitForAudit.ToString();
     }
     userEntity.Description = this.txtDescription.Text;
     return userEntity;
 }
 public virtual bool SignedPassword(string signedPassword)
 {
     bool returnValue = false;
     // 密码强度检查
     if (BaseSystemInfo.CheckPasswordStrength)
     {
         if (String.IsNullOrEmpty(signedPassword))
         {
             return returnValue;
         }
     }
     // 加密密码
     if (BaseSystemInfo.ServerEncryptPassword)
     {
         signedPassword = this.EncryptUserPassword(signedPassword);
     }
     // 判断输入原始密码是否正确
     BaseUserEntity userEntity = new BaseUserEntity();
     userEntity.GetSingle(this.GetDataTableById(UserInfo.Id));
     if (!(userEntity.CommunicationPassword == null && signedPassword.Length == 0))
     {
         if (userEntity.SignedPassword.Equals(signedPassword))
         {
             returnValue = true;
         }
     }
     return returnValue;
 }
        /// <summary>
        /// 显示内容
        /// </summary>
        public override void ShowEntity()
        {
            if (string.IsNullOrEmpty(this.EntityId))
            {
                return;
            }
            staffEntity = DotNetService.Instance.StaffService.GetEntity(UserInfo, this.EntityId);
            userEntity = DotNetService.Instance.UserService.GetEntity(UserInfo, staffEntity.UserId.ToString());
            // 将类转显示到页面
            this.txtRealName.Tag = staffEntity.Id;
            this.txtRealName.Text = staffEntity.RealName;
            this.txtCompany.Tag = staffEntity.CompanyId;
            if (staffEntity.CompanyId != null)
            {
                BaseOrganizeEntity organizeEntity = DotNetService.Instance.OrganizeService.GetEntity(this.UserInfo, staffEntity.CompanyId);
                this.txtCompany.Text = organizeEntity.FullName;
            }
            this.txtDepartment.Tag = staffEntity.DepartmentId;
            if (staffEntity.DepartmentId != null)
            {
                BaseOrganizeEntity organizeEntity = DotNetService.Instance.OrganizeService.GetEntity(this.UserInfo, staffEntity.DepartmentId);
                this.txtDepartment.Text = organizeEntity.FullName;
            }

            this.txtDuty.Tag = staffEntity.DutyId;
            if (staffEntity.DutyId != null)
            {
                BaseItemDetailsEntity itemDetailsEntity = DotNetService.Instance.ItemDetailsService.GetEntity(this.UserInfo, "ItemsDuty", staffEntity.DutyId.ToString());
                this.txtDuty.Text = itemDetailsEntity.ItemName;
            }

            this.txtOfficeTel.Text = staffEntity.OfficePhone;
            this.txtMobile.Text = staffEntity.Mobile;
            this.txtShortNumber.Text = staffEntity.ShortNumber;
            this.txtOICQ.Text = staffEntity.OICQ;
            this.txtEmail.Text = staffEntity.Email;
            this.txtDescription.Text = staffEntity.Description;
            this.txtSignature.Text = userEntity.Signature;
            // 获取图片部分,显示图片部分
            string fileId = DotNetService.Instance.ParameterService.GetParameter(UserInfo, "Staff", staffEntity.Id.ToString(), "StaffPictureId");
            if (!String.IsNullOrEmpty(fileId))
            {
                this.ucPicture.PictureId = fileId;
            }
            this.btnSave.Enabled = false;
            this.txtOfficeTel.Focus();
        }
Beispiel #26
0
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="userCode">用户编号</param>
        public BaseUserEntity GetEntityByCode(string userCode)
        {
            BaseUserEntity userEntity = null;

            List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
            parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldCode, userCode));
            parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldEnabled, 1));
            parameters.Add(new KeyValuePair<string, object>(BaseUserEntity.FieldDeletionStateCode, 0));
            DataTable dt = this.GetDataTable(parameters);
            if (dt.Rows.Count > 0)
            {
                userEntity = new BaseUserEntity(dt);
            }
            return userEntity;
        }
Beispiel #27
0
        /// <summary>
        /// 更新用户
        /// </summary>
        /// <param name="userInfo">用户信息</param>
        /// <param name="userEntity">用户实体</param>
        /// <param name="statusCode">状态码</param>
        /// <param name="statusMessage">状态信息</param>
        /// <returns>影响行数</returns>
        public int UpdateUser(BaseUserInfo userInfo, BaseUserEntity userEntity, out string statusCode, out string statusMessage)
        {
            // 写入调试信息
            #if (DEBUG)
                int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
                LogOnService.UserIsLogOn(userInfo);
            #endif

            int returnValue = 0;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    BaseUserManager userManager = new BaseUserManager(dbHelper, userInfo);
                    // 调用方法,并且返回运行结果
                    returnValue = userManager.Update(userEntity, out statusCode);
                    statusMessage = userManager.GetStateMessage(statusCode);
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, AppMessage.UserService_UpdateUser, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
                BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif

            return returnValue;
        }
Beispiel #28
0
 /// <summary>
 /// 扮演用户
 /// </summary>
 /// <param name="id">用户主键</param>
 /// <returns>用户类</returns>
 public BaseUserInfo Impersonation(string id, out string statusCode)
 {
     BaseUserInfo userInfo = null;
     // 获得登录信息
     DataTable dataTableLogOn = this.GetDataTableById(id);
     BaseUserEntity userEntity = new BaseUserEntity();
     userEntity.GetSingle(dataTableLogOn);
     // 只允许登录一次,需要检查是否自己重新登录了,或者自己扮演自己了
     if (!UserInfo.Id.Equals(id))
     {
         if (BaseSystemInfo.CheckOnLine)
         {
             if (userEntity.UserOnLine > 0)
             {
                 statusCode = StatusCode.ErrorOnLine.ToString();
                 return userInfo;
             }
         }
     }
     userInfo = this.ConvertToUserInfo(userEntity);
     if (userEntity.IsStaff.Equals("1"))
     {
         // 获得员工的信息
         BaseStaffEntity staffEntity = new BaseStaffEntity();
         BaseStaffManager staffManager = new BaseStaffManager(DbHelper, UserInfo);
         DataTable dataTableStaff = staffManager.GetDataTableById(id);
         staffEntity.GetSingle(dataTableStaff);
         userInfo = staffManager.ConvertToUserInfo(staffEntity, userInfo);
     }
     statusCode = StatusCode.OK.ToString();
     // 登录、重新登录、扮演时的在线状态进行更新
     this.ChangeOnLine(id);
     return userInfo;
 }
Beispiel #29
0
 /// <summary>
 /// 加载窗体
 /// </summary>
 public override void FormOnLoad()
 {
     // 让时间显示得更友善,默认是上班下班时间
     this.dtpAllowStartTime.Checked = true;
     this.dtpAllowStartTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0);
     this.dtpAllowStartTime.Checked = false;
     this.dtpAllowEndTime.Checked = true;
     this.dtpAllowEndTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 0, 0);
     this.dtpAllowEndTime.Checked = false;
     // 默认是锁定一周比较好
     this.dtpLockStartDate.Checked = true;
     this.dtpLockStartDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0);
     this.dtpLockStartDate.Checked = false;
     this.dtpLockEndDate.Checked = true;
     this.dtpLockEndDate.Value = this.dtpLockStartDate.Value.AddDays(7);
     this.dtpLockEndDate.Checked = false;
     // 加载用户
     this.userEntity = DotNetService.Instance.UserService.GetEntity(UserInfo, this.EntityId);
     // 绑定下拉框
     this.GetRoles();
     // 获取分类列表
     this.BindItemDetails();
     // 显示内容
     this.ShowEntity();
     // 焦点
     this.txtUserName.Focus();
 }
Beispiel #30
0
 /// <summary>
 /// 显示员工内容
 /// </summary>
 private void ShowStaffEntity()
 {
     if (this.staffEntity.Id == null)
     {
         return;
     }
     // 将类转显示到页面
     this.txtRealName.Text = this.staffEntity.RealName;
     // 性别
     if (!string.IsNullOrEmpty(this.staffEntity.Gender))
     {
         this.cmbGender.SelectedValue = this.staffEntity.Gender;
     }
     this.txtCode.Text = this.staffEntity.Code;
     if (!string.IsNullOrEmpty(this.staffEntity.Birthday))
     {
         this.dtpBirthday.Value = DateTime.Parse(this.staffEntity.Birthday);
         this.dtpBirthday.Checked = true;
     }
     if (!string.IsNullOrEmpty(this.staffEntity.GraduationDate))
     {
         this.dtpGraduationDate.Value = DateTime.Parse(this.staffEntity.GraduationDate);
         this.dtpGraduationDate.Checked = true;
     }
     if (!string.IsNullOrEmpty(this.staffEntity.Party))
     {
         this.cmbParty.SelectedValue = this.staffEntity.Party;
     }
     if (!string.IsNullOrEmpty(this.staffEntity.Nationality))
     {
         this.cmbNationality.SelectedValue = this.staffEntity.Nationality;
     }
     if (this.staffEntity.CompanyId != null)
     {
         this.ucCompany.SelectedId = this.staffEntity.CompanyId;
     }
     if (this.staffEntity.SubCompanyId != null)
     {
         this.ucSubCompany.SelectedId = this.staffEntity.SubCompanyId;
     }
     if (this.staffEntity.DepartmentId != null)
     {
         this.ucDepartment.SelectedId = this.staffEntity.DepartmentId;
     }
     if (this.staffEntity.WorkgroupId != null)
     {
         this.ucWorkgroup.SelectedId = this.staffEntity.WorkgroupId;
     }
     if (!string.IsNullOrEmpty(this.staffEntity.DutyId))
     {
         this.cmbDuty.SelectedValue = this.staffEntity.DutyId;
     }
     if (!string.IsNullOrEmpty(this.staffEntity.TitleId))
     {
         this.cmbTitle.SelectedValue = this.staffEntity.TitleId;
     }
     if (!string.IsNullOrEmpty(this.staffEntity.WorkingDate))
     {
         this.dtpWorkingDate.Value = DateTime.Parse(this.staffEntity.WorkingDate);
         this.dtpWorkingDate.Checked = true;
     }
     if (!string.IsNullOrEmpty(this.staffEntity.JoinInDate))
     {
         this.dtpJoinInDate.Value = DateTime.Parse(this.staffEntity.JoinInDate);
         this.dtpJoinInDate.Checked = true;
     }
     if (!string.IsNullOrEmpty(this.staffEntity.WorkingProperty))
     {
         this.cmbWorkingProperty.SelectedValue = this.staffEntity.WorkingProperty;
     }
     this.txtIdCard.Text = this.staffEntity.IDCard;
     this.txtOICQ.Text = this.staffEntity.OICQ;
     this.txtOfficePhone.Text = this.staffEntity.OfficePhone;
     this.txtShortNumber.Text = this.staffEntity.ShortNumber;
     this.txtEmail.Text = this.staffEntity.Email;
     this.txtMobile.Text = this.staffEntity.Mobile;
     this.txtBankCode.Text = this.staffEntity.BankCode;
     this.txtIdentificationCode.Text = this.staffEntity.IdentificationCode;
     this.txtSchool.Text = this.staffEntity.School;
     this.txtMajor.Text = this.staffEntity.Major;
     if (!string.IsNullOrEmpty(this.staffEntity.Education))
     {
         this.cmbEducation.SelectedValue = this.staffEntity.Education;
     }
     if (!string.IsNullOrEmpty(this.staffEntity.Degree))
     {
         this.cmbDegree.SelectedValue = this.staffEntity.Degree;
     }
     this.txtHomeAddress.Text = this.staffEntity.HomeAddress;
     this.txtHomePhone.Text = this.staffEntity.HomePhone;
     this.txtCarCode.Text = this.staffEntity.CarCode;
     this.txtEmergencyContact.Text = this.staffEntity.EmergencyContact;
     this.chbEnabled.Checked = this.staffEntity.Enabled == 1;
     this.txtDescription.Text = this.staffEntity.Description;
     if (!string.IsNullOrEmpty(staffEntity.Province))
         this.cmbProvince.SelectedIndex=this.cmbProvince.FindString(staffEntity.Province);
     if (!string.IsNullOrEmpty(staffEntity.City))
         this.cmbCity.SelectedIndex=this.cmbCity.FindString(staffEntity.City);
     if (!string.IsNullOrEmpty(staffEntity.Area))
         this.cmbArea.SelectedIndex=this.cmbArea.FindString(staffEntity.Area);
     this.chbCreateUser.Checked = false;
     // 显示用户信息部分
     if (this.staffEntity.UserId != null)
     {
         // 加载用户
         this.userEntity = DotNetService.Instance.UserService.GetEntity(UserInfo, this.staffEntity.UserId.ToString());
         // 判断是否被删除的用户
         if (this.userEntity.Id == null || this.userEntity.DeletionStateCode == 1)
         {
             // 若用户是被物理删除了,找不到相应的用户信息了
             this.staffEntity.UserId = null;
         }
         else
         {
             // 显示用户内容
             this.ShowUserEntity();
         }
     }
     // 获取图片部分,显示图片部分
     string fileId = DotNetService.Instance.ParameterService.GetParameter(UserInfo, "Staff", this.staffEntity.Id.ToString(), "StaffPictureId");
     if (!String.IsNullOrEmpty(fileId))
     {
         this.ucPicture.PictureId = fileId;
     }
     this.txtUserName.Text = this.staffEntity.UserName;
     if (staffEntity.UserId != null && staffEntity.UserId > 0)
     {
         this.UserId = staffEntity.UserId.ToString();
         this.userEntity = DotNetService.Instance.UserService.GetEntity(UserInfo, this.UserId);
         this.ShowUserEntity();
     }
 }