/// <summary> /// 离职处理 /// </summary> /// <param name="id">主键</param> /// <returns>影响行数</returns> public int Leave(BaseUserEntity userEntity, BaseUserLogOnEntity userLogOnEntity, string comment) { int result = 0; if (userEntity != null) { // 更新用户实体 this.UpdateObject(userEntity); } // 更新登录信息 if (userLogOnEntity != null) { BaseUserLogOnManager userLogOnManager = new BaseUserLogOnManager(this.UserInfo); userLogOnManager.UpdateObject(userLogOnEntity); } // 填写评论 if (!string.IsNullOrWhiteSpace(comment)) { SQLBuilder sqlBuilder = new SQLBuilder(BaseSystemInfo.ServerDbType); sqlBuilder.BeginInsert(BaseCommentEntity.TableName); sqlBuilder.SetValue(BaseCommentEntity.FieldId, System.Guid.NewGuid().ToString("N")); sqlBuilder.SetValue(BaseCommentEntity.FieldCategoryCode, BaseUserEntity.TableName); sqlBuilder.SetValue(BaseCommentEntity.FieldObjectId, userEntity.Id); sqlBuilder.SetValue(BaseCommentEntity.FieldContents, comment); sqlBuilder.SetValue(BaseCommentEntity.FieldWorked, 1); sqlBuilder.SetValue(BaseCommentEntity.FieldDepartmentId, userEntity.DepartmentId); sqlBuilder.SetValue(BaseCommentEntity.FieldDepartmentName, userEntity.DepartmentName); sqlBuilder.SetValue(BaseCommentEntity.FieldCreateUserId, this.UserInfo.Id); sqlBuilder.SetValue(BaseCommentEntity.FieldCreateBy, this.UserInfo.RealName); sqlBuilder.SetDBNow(BaseCommentEntity.FieldCreateOn); sqlBuilder.SetValue(BaseCommentEntity.FieldIPAddress, this.UserInfo.IPAddress); sqlBuilder.SetValue(BaseCommentEntity.FieldEnabled, 1); sqlBuilder.SetValue(BaseCommentEntity.FieldDeletionStateCode, 0); sqlBuilder.EndInsert(); } // 2016-03-17 吉日嘎拉 停止吉信的号码 if (userEntity != null && !string.IsNullOrEmpty(userEntity.NickName)) { AfterLeaveStopIM(userEntity); } // 2016-03-17 吉日嘎拉 停止吉信的号码 if (userEntity != null && !string.IsNullOrEmpty(userEntity.Id)) { BaseUserContactEntity userContactEntity = BaseUserContactManager.GetObjectByCache(userEntity.Id); { if (userContactEntity != null && !string.IsNullOrEmpty(userContactEntity.CompanyMail)) { ChangeUserMailStatus(userContactEntity.CompanyMail, true); } } } return(result); }
/// <summary> /// 获取实体 /// </summary> /// <param name="userInfo">用户</param> /// <param name="id">主键</param> /// <returns>实体</returns> public BaseUserContactEntity GetUserContactObjectByCache(BaseUserInfo userInfo, string id) { BaseUserContactEntity entity = null; var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod()); ServiceUtil.ProcessUserCenterReadDb(userInfo, parameter, (dbHelper) => { entity = BaseUserContactManager.GetObjectByCache(id); }); return(entity); }
/// <summary> /// 验证手机验证码 /// 2015-11-10 吉日嘎拉 手机验证码确认的代码进行优化 /// </summary> /// <param name="userInfo">用户</param> /// <param name="mobile">手机号码</param> /// <param name="code">验证码</param> /// <returns>成功验证</returns> public bool ValidateVerificationCode(BaseUserInfo userInfo, string mobile, string code) { bool result = false; if (string.IsNullOrEmpty(mobile)) { return(false); } if (string.IsNullOrEmpty(code)) { return(false); } string connectionString = string.Empty; connectionString = ConfigurationHelper.AppSettings("OpenMasDbConnection", BaseSystemInfo.EncryptDbConnection); if (!string.IsNullOrEmpty(connectionString)) { using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SqlServer, connectionString)) { string commandText = @"SELECT COUNT(1) FROM SMSSentLog WHERE DATEDIFF(Hour, CreateTime, GETDATE()) < 8 AND MessageCode = " + dbHelper.GetParameter("MessageCode") + " AND DestinationAddress = " + dbHelper.GetParameter("DestinationAddress"); object remainingNumber = dbHelper.ExecuteScalar(commandText , new IDbDataParameter[] { dbHelper.MakeParameter("MessageCode", code) , dbHelper.MakeParameter("DestinationAddress", mobile) }); if (remainingNumber != null) { result = int.Parse(remainingNumber.ToString()) > 0; } } // 手机验证码通过审核了 if (result && userInfo != null) { BaseUserContactEntity userContactEntity = BaseUserContactManager.GetObjectByCache(userInfo.Id); if (userContactEntity != null) { // 2016-02-13 吉日嘎拉 这里还需要进行缓存更新操作 userContactEntity.MobileValiated = 1; userContactEntity.MobileVerificationDate = DateTime.Now; new BaseUserContactManager().Update(userContactEntity); } } } return(result); }