示例#1
0
 /// <summary>
 /// 异常日志信息
 /// </summary>
 /// <param name="pUserInfo">当前用户信息</param>
 /// <param name="pException">异常信息</param>
 public ExceptionLogInfo(BaseUserInfo pUserInfo, Exception pException)
 {
     if (pUserInfo != null)
     {
         //this.ClientID = pUserInfo.ClientID;
         this.UserID = pUserInfo.UserID;
     }
     this.Init(pException);
 }
示例#2
0
        /// <summary>
        /// 忘记密码按手机号码获取
        /// </summary>
        /// <param name="applicationCode">应用编号</param>
        /// <param name="accountCode">账户</param>
        /// <param name="password">密码</param>
        /// <param name="userName">用户名</param>
        /// <param name="mobile">手机号码</param>
        /// <returns>成功</returns>
        public bool GetPasswordByMobile(BaseUserInfo userInfo, string userName, string mobile)
        {
            bool result = false;

            if (!string.IsNullOrEmpty(mobile))
            {
                BaseUserContactManager manager = new BaseUserContactManager();
                List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                if (!string.IsNullOrEmpty(mobile))
                {
                    parameters.Add(new KeyValuePair <string, object>(BaseUserContactEntity.FieldMobile, mobile));
                }
                // 手机号码重复不发验证码,防止把别人的密码给修改了
                DataTable dt = manager.GetDataTable(parameters);
                string    id = string.Empty;
                if (dt != null && dt.Rows.Count == 1)
                {
                    id = dt.Rows[0][BaseUserContactEntity.FieldId].ToString();
                }
                BaseUserManager userManager = null;
                if (!string.IsNullOrEmpty(id))
                {
                    userManager = new BaseUserManager();
                    bool           userNameOK = true;
                    BaseUserEntity userEntity = userManager.GetObject(id);
                    if (!string.IsNullOrEmpty(userName))
                    {
                        if (!string.IsNullOrEmpty(userEntity.UserName) && !userEntity.UserName.Equals(userName))
                        {
                            userNameOK = false;
                            userInfo   = null;
                        }
                    }
                    // 只有有效的用户,才能获取密码,被删除的,无效的,不可以获取密码
                    if (userEntity.Enabled == 0 || userEntity.DeletionStateCode == 1)
                    {
                        userNameOK = false;
                        userInfo   = null;
                    }
                    if (userNameOK)
                    {
                        userInfo = userManager.ConvertToUserInfo(userEntity);
                    }
                    else
                    {
                        userInfo = null;
                    }
                }
                if (!string.IsNullOrEmpty(id) && userInfo != null)
                {
                    string userPassword = string.Empty;
                    if (BaseSystemInfo.CheckPasswordStrength)
                    {
                        userPassword = BaseRandom.GetRandomString(8).ToLower();
                    }
                    else
                    {
                        userPassword = BaseRandom.GetRandomString(8).ToLower();
                        // Random random = new System.Random();
                        // userPassword = random.Next(100000, 999999).ToString();
                    }
                    // 看是否有合理的请求参数
                    if (!string.IsNullOrEmpty(userPassword))
                    {
                        // 看是否一天超过了3次了
                        int sendUserPasswordCount = this.GetSendUserPasswordCount(mobile);
                        if (sendUserPasswordCount < 4)
                        {
                            // 应用编号
                            if (this.SendUserPassword(userInfo, mobile, userPassword))
                            {
                                userManager = new BaseUserManager(userInfo);
                                // 按手机号码获取的,可以自动解锁,防止密码连续输入错误,然后手机号码获取密码后,是被锁定状态,提高工作效率
                                userManager.SetPassword(userInfo.Id, userPassword, true);
                                userManager.GetStateMessage();
                                if (userManager.StatusCode == Status.SetPasswordOK.ToString())
                                {
                                    result = true;
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
示例#3
0
        public int SendMobile(BaseUserInfo userInfo, string systemCode, string userId, string cellPhone, string message, string messageCode, bool hotline, bool confidentialInformation, string channel, out string returnMsg)
        {
            returnMsg = string.Empty;

            if (string.IsNullOrEmpty(systemCode))
            {
                systemCode = "Base";
            }
            if (userInfo != null && userId != "VerificationCode" && userId != "UserPassword")
            {
                if (string.IsNullOrEmpty(userId))
                {
                    userId = userInfo.Id;
                }
                if (userInfo != null && !string.IsNullOrEmpty(userId) && !(userId.Equals("VerificationCode") || userId.Equals("UserPassword")))
                {
                    if (string.IsNullOrEmpty(ApplicationCode))
                    {
                        ApplicationCode = userInfo.CompanyCode;
                    }
                    if (string.IsNullOrEmpty(AccountCode))
                    {
                        AccountCode = userInfo.Code;
                    }
                    if (string.IsNullOrEmpty(Password))
                    {
                        Password = userInfo.Password;
                    }
                }
            }

            /*
             * string url = @"http://192.168.0.130:8800/Send.ashx";
             * WebClient webClient = new WebClient();
             * // webClient.UseDefaultCredentials = true;
             * NameValueCollection postValues = new NameValueCollection();
             * postValues.Add("V", "02");
             * postValues.Add("E", "8");
             * postValues.Add("C", this.AccountCode);
             * postValues.Add("P", this.Password);
             * postValues.Add("A", this.ApplicationCode);
             * postValues.Add("U", userId);
             * postValues.Add("H", hotline.ToString());
             * postValues.Add("T", cellPhone);
             * postValues.Add("Channel", channel);
             * postValues.Add("MC", messageCode);
             * postValues.Add("CI", confidentialInformation.ToString());
             * postValues.Add("M", message);
             * // 向服务器发送POST数据
             * byte[] responseArray = webClient.UploadValues(url, postValues);
             * string response = Encoding.UTF8.GetString(responseArray);
             * int result = 0;
             * if (!string.IsNullOrEmpty(response))
             * {
             *  if (ValidateUtil.IsInt(response))
             *  {
             *      result = int.Parse(response);
             *  }
             * }
             * return result;
             */

            StringBuilder request = new StringBuilder();

            request.Append("http://192.168.0.130:8800/Send.ashx?");
            // request.Append("http://122.225.117.230:8800/Send.ashx?");
            request.Append("V=").Append("02");
            request.Append("&E=").Append("8");
            request.Append("&C=").Append(this.AccountCode);
            request.Append("&P=").Append(this.Password);
            request.Append("&A=").Append(this.ApplicationCode);
            request.Append("&U=").Append(userId);
            request.Append("&H=").Append(hotline.ToString());
            request.Append("&T=").Append(cellPhone);
            request.Append("&Channel=").Append(channel);
            request.Append("&systemCode=").Append(systemCode);
            request.Append("&MC=").Append(messageCode);
            request.Append("&CI=").Append(confidentialInformation.ToString());
            request.Append("&M=");
            request.Append(System.Web.HttpUtility.UrlEncode(message, Encoding.UTF8));
            string url = request.ToString();

            return(SendMobile(url, out returnMsg));

            /*
             * StringBuilder request = new StringBuilder();
             * request.Append("Function=Send");
             * request.Append("&V=").Append("02");
             * request.Append("&E=").Append("8");
             * request.Append("&C=").Append(AccountCode);
             * request.Append("&P=").Append(Password);
             * request.Append("&A=").Append(ApplicationCode);
             * request.Append("&U=").Append(userId);
             * request.Append("&H=").Append(hotline.ToString());
             * request.Append("&T=").Append(cellPhone);
             * request.Append("&MC=").Append(messageCode);
             * request.Append("&CI=").Append(confidentialInformation.ToString());
             * request.Append("&M=");
             * request.Append(System.Web.HttpUtility.UrlEncode(message, Encoding.UTF8));
             * string key = DotNet.Utilities.SecretUtil.BuildSecurityRequest(request.ToString());
             * string url = "http://192.168.0.130:8800/Mobile.ashx?Key=" + key;
             * return SendMobile(url, out returnMsg);
             */
        }
示例#4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 public BaseWorkFlowHistoryManager(IDbHelper dbHelper, BaseUserInfo userInfo) : this(dbHelper)
 {
     UserInfo = userInfo;
 }
示例#5
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <returns>是否成功</returns>
        private bool LogOn()
        {
            // 设置鼠标繁忙状态,并保留原先的状态
            Cursor holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            string statusCode    = string.Empty;
            string statusMessage = string.Empty;

            try
            {
                string userName = this.txtUser.Text;

                DotNetService dotNetService = new DotNetService();
                BaseUserInfo  userInfo      = dotNetService.LogOnService.UserLogOn(UserInfo, userName, this.txtPassword.Text, true, out statusCode, out statusMessage);
                if (dotNetService.LogOnService is ICommunicationObject)
                {
                    ((ICommunicationObject)dotNetService.LogOnService).Close();
                }
                if (statusCode == StatusCode.OK.ToString())
                {
                    // 检查身份
                    if ((userInfo != null) && (userInfo.Id.Length > 0))
                    {
                        // 用户登录,保存登录信息
                        BaseSystemInfo.UserInfo = userInfo;
                        // 保存登录信息
                        this.SaveLogOnInfo(userInfo);
                        // 这里表示已经登录系统了
                        BaseSystemInfo.UserIsLogOn = true;
                        // 这里是登录功能部分
                        if (this.Parent == null)
                        {
                            this.Hide();
                            Form mainForm = this.Owner;
                            if (mainForm is IBaseMainForm)
                            {
                                // 这里不允许重复初始化服务
                                // ((IBaseMainForm)mainForm).InitService();
                                ((IBaseMainForm)mainForm).InitForm();
                                ((IBaseMainForm)mainForm).CheckMenu();
                                mainForm.Show();
                            }
                        }
                        // 登录次数归零,允许重新登录
                        this.LogOnCount = 0;
                        // 密码强度检查
                        // 周期性更换密码要求,一个月更换一次密码,30天
                        if (BaseSystemInfo.CheckPasswordStrength)
                        {
                            bool           chanagePassword = false;
                            string         message         = string.Empty;
                            BaseUserEntity userEntity      = dotNetService.UserService.GetEntity(userInfo, userInfo.Id);
                            if (dotNetService.UserService is ICommunicationObject)
                            {
                                ((ICommunicationObject)dotNetService.UserService).Close();
                            }
                            if (userEntity.ChangePasswordDate == null)
                            {
                                message         = AppMessage.MSG0062;
                                chanagePassword = true;
                            }
                            else
                            {
                                TimeSpan ts = ((DateTime)userEntity.ChangePasswordDate).Subtract(DateTime.Now);
                                if (ts.TotalDays > 30)
                                {
                                    message         = AppMessage.MSG0063;
                                    chanagePassword = true;
                                }
                            }
                            if (chanagePassword)
                            {
                                string assemblyName          = "DotNet.WinForm";
                                string formName              = "FrmUserChangePassword";
                                Type   assemblyType          = CacheManager.Instance.GetType(assemblyName, formName);
                                Form   frmUserChangePassword = (Form)Activator.CreateInstance(assemblyType, message);
                                frmUserChangePassword.ShowDialog(this);
                            }
                        }
                    }
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    // 已经登录次数 ++
                    this.LogOnCount++;

                    // 消息提醒
                    MessageBox.Show(statusMessage, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.txtPassword.Focus();
                    this.txtPassword.SelectAll();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                this.ProcessException(ex);
            }
            finally
            {
                // 已经忙完了
                this.Cursor = holdCursor;
            }
            return(true);
        }
示例#6
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 public BaseOrganizeLogOnManager(BaseUserInfo userInfo)
     : this()
 {
     UserInfo = userInfo;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 /// <param name="tableName">指定表名</param>
 public UserByIdentityManager(BaseUserInfo userInfo, string tableName) : this(userInfo)
 {
     base.CurrentTableName = tableName;
 }
示例#8
0
 /// <summary>
 /// Frame的自定义异常的基类
 /// </summary>
 /// <param name="pUserInfo">用户信息</param>
 /// <param name="pErrorInfo">错误信息</param>
 public FrameException(BaseUserInfo pUserInfo, string pMessage)
 {
     this.UserInfo = pUserInfo;
     this.Message = pMessage;
 }
示例#9
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 /// <param name="tableName">指定表名</param>
 public BaseTemplateManager(BaseUserInfo userInfo, string tableName) : this(userInfo)
 {
     base.CurrentTableName = tableName;
 }
示例#10
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 public BaseTemplateManager(BaseUserInfo userInfo) : this()
 {
     UserInfo = userInfo;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 /// <param name="tableName">指定表名</param>
 public BaseRolePermissionManager(IDbHelper dbHelper, BaseUserInfo userInfo, string tableName)
     : this(dbHelper, userInfo)
 {
     base.CurrentTableName = tableName;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 public BaseRolePermissionManager(IDbHelper dbHelper, BaseUserInfo userInfo)
     : this(dbHelper)
 {
     UserInfo = userInfo;
 }
示例#13
0
 /// <summary>
 /// ����¼��Ϣ���浽ע�����
 /// </summary>
 /// <param name="userInfo">�ǵ�¼�û�</param>
 private void SaveLoginInfo(BaseUserInfo userInfo)
 {
     // ������귱æ״̬
     this.Cursor = Cursors.WaitCursor;
     if (BaseSystemInfo.SavePassword)
     {
         try
         {
             // Ĭ�ϵ���Ϣд��ע���,�Ǻ���Ҫ�Ľ�һ��
             RegistryKey registryKey = Registry.LocalMachine.CreateSubKey(@"Software\" + BaseConfiguration.COMPANY_NAME + "\\" + BaseConfiguration.Instance.SoftName);
             registryKey.SetValue(BaseConfiguration.CURRENT_USERNAME, userInfo.Username);
             // RegistryKey.SetValue(BaseConfiguration.CURRENT_USERNAME, this.cmbUsername.SelectedValue);
             // RegistryKey.SetValue(BaseConfiguration.CURRENT_USERNAME, this.cmbUsername.SelectedText);
             registryKey.SetValue(BaseConfiguration.CURRENT_PASSWORD, userInfo.Password);
         }
         catch (Exception exception)
         {
             this.ProcessException(exception);
         }
         finally
         {
             // �������Ĭ��״̬
             this.Cursor = Cursors.Default;
         }
     }
 }
示例#14
0
 /// <summary>
 /// ְԱ��¼�������¼��Ϣ
 /// </summary>
 /// <param name="userInfo">ְԱʵ��</param>
 private void Login(BaseUserInfo userInfo)
 {
     BaseSystemInfo.Login(userInfo);
 }
示例#15
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 public BaseUserOrganizeManager(BaseUserInfo userInfo)
     : this()
 {
     UserInfo = userInfo;
 }
示例#16
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 /// <param name="tableName">指定表名</param>
 public BaseUserOrganizeManager(IDbHelper dbHelper, BaseUserInfo userInfo, string tableName)
     : this(dbHelper, userInfo)
 {
     base.CurrentTableName = tableName;
 }
示例#17
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 public BaseTemplateManager(IDbHelper dbHelper, BaseUserInfo userInfo) : this(dbHelper)
 {
     UserInfo = userInfo;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 public BaseRoleOrganizationManager(BaseUserInfo userInfo) : this()
 {
     UserInfo = userInfo;
     //按用户公司分表
     //CurrentTableName = BaseRoleOrganizationEntity.CurrentTableName + GetTableSuffix();
 }
示例#19
0
 /// <summary>
 /// 从缓存获取获取实体
 /// </summary>
 /// <param name="userInfo">UserInfo</param>
 /// <param name="id">主键</param>
 public static BaseRoleEntity GetEntityByCache(BaseUserInfo userInfo, string id)
 {
     return(GetEntityByCache(userInfo.SystemCode, id));
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 public UserByIdentityManager(IDbHelper dbHelper, BaseUserInfo userInfo) : this(dbHelper)
 {
     UserInfo = userInfo;
 }
示例#21
0
        /// <summary>
        /// 更新密码
        /// </summary>
        /// <param name="userId">用户主键、方便外部系统调用,若能传递参数过来</param>
        /// <param name="oldPassword">原密码</param>
        /// <param name="newPassword">新密码</param>
        /// <returns>影响行数</returns>
        public virtual BaseUserInfo ChangePassword(string userId, string oldPassword, string newPassword)
        {
            #if (DEBUG)
            int milliStart = Environment.TickCount;
            #endif

            string encryptOldPassword = oldPassword;
            string encryptNewPassword = newPassword;

            BaseUserInfo userInfo = null;
            // 密码强度检查
            if (BaseSystemInfo.CheckPasswordStrength)
            {
                if (String.IsNullOrEmpty(newPassword))
                {
                    this.StatusCode = Status.PasswordCanNotBeNull.ToString();
                    return(userInfo);
                }
            }
            // 判断输入原始密码是否正确
            BaseUserLogOnEntity entity = new BaseUserLogOnManager(this.DbHelper, this.UserInfo).GetObject(UserInfo.Id);
            if (entity.UserPassword == null)
            {
                entity.UserPassword = string.Empty;
            }

            // 加密密码
            if (BaseSystemInfo.ServerEncryptPassword)
            {
                encryptOldPassword = this.EncryptUserPassword(oldPassword, entity.Salt);
            }

            // 密码错误
            if (!entity.UserPassword.Equals(encryptOldPassword, StringComparison.CurrentCultureIgnoreCase))
            {
                this.StatusCode = Status.OldPasswordError.ToString();
                return(userInfo);
            }
            // 对比是否最近2次用过这个密码
            if (BaseSystemInfo.CheckPasswordStrength)
            {
                /*
                 * int i = 0;
                 * BaseParameterManager manager = new BaseParameterManager(this.DbHelper, this.UserInfo);
                 * var dt = manager.GetDataTableParameterCode("User", this.UserInfo.Id, "Password");
                 * foreach (DataRow dr in dt.Rows)
                 * {
                 *  string parameter = dr[BaseParameterEntity.FieldParameterContent].ToString();
                 *  if (parameter.Equals(newPassword))
                 *  {
                 *      this.StatusCode = Status.PasswordCanNotBeRepeat.ToString();
                 *      return userInfo;
                 *  }
                 *  i++;
                 *  {
                 *      // 判断连续2个密码就是可以了
                 *      if (i > 2)
                 *      {
                 *          break;
                 *      }
                 *  }
                 * }
                 */
            }

            // 更改密码,同时修改密码的修改日期,这里需要兼容多数据库
            string salt = string.Empty;
            if (BaseSystemInfo.ServerEncryptPassword)
            {
                salt = BaseRandom.GetRandomString(20);
                encryptNewPassword = this.EncryptUserPassword(newPassword, salt);
            }
            SQLBuilder sqlBuilder = new SQLBuilder(this.DbHelper);
            sqlBuilder.BeginUpdate(BaseUserLogOnEntity.TableName);
            if (BaseSystemInfo.ServerEncryptPassword)
            {
                sqlBuilder.SetValue(BaseUserLogOnEntity.FieldSalt, salt);
            }
            // 宋彪:此处增加更新密码强度级别
            sqlBuilder.SetValue(BaseUserLogOnEntity.FieldPasswordStrength, SecretUtil.GetUserPassWordRate(newPassword));
            sqlBuilder.SetValue(BaseUserLogOnEntity.FieldUserPassword, encryptNewPassword);
            // 2015-08-04 吉日嘎拉 修改了密码后,把需要修改密码字段设置为 0
            sqlBuilder.SetValue(BaseUserLogOnEntity.FieldNeedModifyPassword, 0);
            sqlBuilder.SetDBNow(BaseUserLogOnEntity.FieldChangePasswordDate);
            sqlBuilder.SetWhere(BaseUserLogOnEntity.FieldId, userId);
            int result = sqlBuilder.EndUpdate();

            if (result == 1)
            {
                // 2015-12-09 吉日嘎拉 确认已经记录了修改密码日志
                // BaseLoginLogManager.AddLog(this.UserInfo, Status.ChangePassword.ToDescription());

                // 2015-12-09 吉日嘎拉 增加日志功能、谁什么时候设置了谁的密码?
                var record = new BaseModifyRecordEntity();
                record.TableCode         = BaseUserLogOnEntity.TableName.ToUpper();
                record.TableDescription  = "用户登录信息表";
                record.ColumnCode        = BaseUserLogOnEntity.FieldUserPassword;
                record.ColumnDescription = "用户密码";
                record.RecordKey         = userId;
                record.NewValue          = "修改密码";
                // record.OldValue = "";
                if (this.UserInfo != null)
                {
                    record.IPAddress    = this.UserInfo.IPAddress;
                    record.CreateUserId = this.UserInfo.Id;
                    record.CreateOn     = DateTime.Now;
                }
                BaseModifyRecordManager modifyRecordManager = new Business.BaseModifyRecordManager(this.UserInfo, BaseUserEntity.TableName + "_Log");
                modifyRecordManager.Add(record, true, false);

                /*
                 * // 若是强类型密码检查,那就保存密码修改历史,防止最近2-3次的密码相同的功能实现。
                 * if (BaseSystemInfo.CheckPasswordStrength)
                 * {
                 *  BaseParameterManager parameterManager = new BaseParameterManager(this.DbHelper, this.UserInfo);
                 *  BaseParameterEntity parameterEntity = new BaseParameterEntity();
                 *  parameterEntity.CategoryCode = "User";
                 *  parameterEntity.ParameterId = this.UserInfo.Id;
                 *  parameterEntity.ParameterCode = "Password";
                 *  parameterEntity.ParameterContent = newPassword;
                 *  parameterEntity.DeletionStateCode = 0;
                 *  parameterEntity.Enabled = true;
                 *  parameterEntity.Worked = true;
                 *  parameterManager.AddObject(parameterEntity);
                 * }
                 */

                userInfo = this.LogOnByOpenId(this.UserInfo.OpenId, this.UserInfo.SystemCode).UserInfo;
                // 同步处理其他系统的密码修改动作
                if (BaseSystemInfo.ServerEncryptPassword)
                {
                    // AfterChangePassword(this.UserInfo.Id, salt, oldPassword, newPassword);
                }
                // 修改密码成功,写入状态
                this.StatusCode = Status.ChangePasswordOK.ToString();
            }
            else
            {
                // 数据可能被删除
                this.StatusCode = Status.ErrorDeleted.ToString();
            }

            return(userInfo);
        }
示例#22
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 /// <param name="tableName">指定表名</param>
 public BaseOrganizeLogOnManager(BaseUserInfo userInfo, string tableName)
     : this(userInfo)
 {
     base.CurrentTableName = tableName;
 }
示例#23
0
 /// <summary>
 /// 服务信息
 /// </summary>
 /// <param name="userInfo"></param>
 /// <param name="currentMethod"></param>
 private ServiceInfo(BaseUserInfo userInfo, MethodBase currentMethod)
 {
     UserInfo      = userInfo;
     CurrentMethod = currentMethod;
 }
示例#24
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 public BaseWorkFlowHistoryManager(BaseUserInfo userInfo) : this()
 {
     UserInfo = userInfo;
 }
示例#25
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 /// <param name="tableName">指定表名</param>
 public BaseOrganizationScopeManager(IDbHelper dbHelper, BaseUserInfo userInfo, string tableName) : this(dbHelper, userInfo)
 {
     CurrentTableName = tableName;
 }
示例#26
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 /// <param name="tableName">指定表名</param>
 public BaseWorkFlowHistoryManager(IDbHelper dbHelper, BaseUserInfo userInfo, string tableName) : this(dbHelper, userInfo)
 {
     base.CurrentTableName = tableName;
 }
示例#27
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 /// <param name="tableName">指定表名</param>
 public BaseOrganizationScopeManager(BaseUserInfo userInfo, string tableName) : this(userInfo)
 {
     CurrentTableName = tableName;
 }
示例#28
0
        public DataTable GetSentLog(BaseUserInfo userInfo, string beginDate, string endDate)
        {
            string    connectionString = string.Empty;
            DataTable result           = null;

            connectionString = ConfigurationHelper.AppSettings("OpenMasDbConnection", BaseSystemInfo.EncryptDbConnection);
            if (!string.IsNullOrEmpty(connectionString))
            {
                using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SqlServer, connectionString))
                {
                    string commandText = "SELECT * FROM SmsSentLog WHERE (UserId = " + dbHelper.GetParameter("UserId");
                    if (!string.IsNullOrEmpty(userInfo.Code))
                    {
                        commandText += " OR UserId = " + dbHelper.GetParameter("UserCode") + ")";
                    }
                    else
                    {
                        commandText += ") ";
                    }
                    List <IDbDataParameter> dbParameters = new List <IDbDataParameter>();
                    dbParameters.Add(dbHelper.MakeParameter("UserId", userInfo.Id));
                    if (!string.IsNullOrEmpty(userInfo.Code))
                    {
                        dbParameters.Add(dbHelper.MakeParameter("UserCode", userInfo.Code));
                    }
                    if (beginDate.Trim().Length > 0)
                    {
                        commandText += " AND CreateTime >= " + dbHelper.GetParameter("BeginDate");

                        DateTime dtBeginDate = DateTime.Parse(beginDate);
                        dtBeginDate = new DateTime(dtBeginDate.Year, dtBeginDate.Month, dtBeginDate.Day);
                        dbParameters.Add(dbHelper.MakeParameter("BeginDate", dtBeginDate));
                    }
                    if (endDate.Trim().Length > 0)
                    {
                        commandText += " AND CreateTime <= " + dbHelper.GetParameter("EndDate");

                        DateTime dtEndDate = DateTime.Parse(endDate);
                        dtEndDate = new DateTime(dtEndDate.Year, dtEndDate.Month, dtEndDate.Day);
                        // 这里可以考虑加一天
                        dtEndDate = dtEndDate.AddDays(1);
                        dbParameters.Add(dbHelper.MakeParameter("EndDate", dtEndDate));
                    }
                    commandText += " ORDER BY CreateTime";
                    result       = dbHelper.Fill(commandText, dbParameters.ToArray());

                    for (int i = 0; i < result.Rows.Count; i++)
                    {
                        if (result.Rows[i]["GatawayStatus"] != DBNull.Value)
                        {
                            if (result.Rows[i]["GatawayStatus"].ToString().Equals("DELIVRD"))
                            {
                                result.Rows[i]["GatawayStatus"] = "成功";
                                if (!userInfo.IsAdministrator)
                                {
                                    // 若不是超级管理员,都屏蔽信息
                                    if (result.Rows[i]["DestinationAddress"] != DBNull.Value)
                                    {
                                        string destinationAddress = result.Rows[i]["DestinationAddress"].ToString();
                                        if (destinationAddress.Length > 10)
                                        {
                                            destinationAddress = destinationAddress.Replace(destinationAddress.Substring(3, 4), "****");
                                            result.Rows[i]["DestinationAddress"] = destinationAddress;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
示例#29
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 public BaseOrganizationScopeManager(IDbHelper dbHelper, BaseUserInfo userInfo) : this(dbHelper)
 {
     UserInfo = userInfo;
     //按用户公司分表
     //CurrentTableName = BaseOrganizationScopeEntity.CurrentTableName + GetTableSuffix();
 }
 /// <summary>
 /// 刷新列表
 /// 2015-12-11 吉日嘎拉 刷新缓存功能优化
 /// </summary>
 /// <param name="userInfo">用户</param>
 /// <returns>数据表</returns>
 public void CachePreheating(BaseUserInfo userInfo)
 {
     BaseOrganizationManager.CachePreheating();
 }
        /// <summary>
        /// LogonWindowsAuthentication
        /// </summary>
        /// <param name="systemCode">子系统</param>
        /// <param name="oAuthName">OAuth 类型</param>
        /// <param name="oAuthOpenId">OAuth OpenId</param>
        /// <param name="oAuthUnionId">OAuth UnionId</param>
        /// <param name="permissionCode">权限编号</param>
        /// <param name="persistCookie">是否保存密码</param>
        /// <param name="formsAuthentication">表单验证,是否需要重定位</param>
        /// <param name="status">状态</param>
        /// <param name="statusMessage"></param>
        /// <returns></returns>
        public static BaseUserInfo OAuthLogin(string systemCode, string oAuthName, string oAuthOpenId, string oAuthUnionId, string permissionCode, bool persistCookie, bool formsAuthentication, out Status status, out string statusMessage)
        {
            BaseUserInfo result = null;

            status        = Status.Error;
            statusMessage = "登录失败";
            var entity = new BaseUserOAuthManager(UserInfo).GetEntity(oAuthName, oAuthOpenId, oAuthUnionId);

            if (entity != null)
            {
                var entityUser = new BaseUserManager(UserInfo).GetEntity(entity.UserId);
                if (entityUser != null)
                {
                    // 统一的登录服务
                    var taskId   = Guid.NewGuid().ToString("N");
                    var userInfo = GetUserInfo();
                    if (string.IsNullOrEmpty(systemCode))
                    {
                        systemCode = BaseSystemInfo.SystemCode;
                        if (string.IsNullOrEmpty(systemCode))
                        {
                            systemCode = userInfo.SystemCode;
                        }
                    }
                    if (string.IsNullOrEmpty(userInfo.IpAddress))
                    {
                        userInfo.IpAddress = Utils.GetIp();
                    }

                    // 统一的登录服务
                    var dotNetService   = new DotNetService();
                    var userLogonResult = dotNetService.LogonService.LogonByUserName(taskId, systemCode, GetUserInfo(), entityUser.UserName);
                    // 检查身份
                    if (userLogonResult.Status == Status.Ok)
                    {
                        var isAuthorized = true;
                        // 用户是否有哪个相应的权限
                        if (!string.IsNullOrEmpty(permissionCode))
                        {
                            isAuthorized = dotNetService.PermissionService.IsAuthorized(userInfo, permissionCode, null);
                        }
                        // 有相应的权限才可以登录
                        if (isAuthorized)
                        {
                            if (persistCookie)
                            {
                                // 相对安全的方式保存登录状态
                                //SaveCookie(userName, password);
                                // 内部单点登录方式 Troy.Cui 2016.12.26
                                SaveCookie(userInfo);
                            }
                            else
                            {
                                RemoveUserCookie();
                            }
                            Logon(userLogonResult.UserInfo, formsAuthentication);

                            userLogonResult.Status        = Status.Ok;
                            userLogonResult.StatusCode    = Status.Ok.ToString();
                            userLogonResult.StatusMessage = "登录成功";
                            status        = Status.Ok;
                            statusMessage = "登录成功";
                            result        = userLogonResult.UserInfo;
                        }
                        else
                        {
                            userLogonResult.Status        = Status.LogonDeny;
                            userLogonResult.StatusCode    = Status.LogonDeny.ToString();
                            userLogonResult.StatusMessage = "访问被拒绝、您的账户没有访问权限。";
                            status        = Status.LogonDeny;
                            statusMessage = "访问被拒绝、您的账户没有访问权限。";
                            result        = userLogonResult.UserInfo;
                        }
                    }
                    else
                    {
                        userLogonResult.Status        = Status.LogonDeny;
                        userLogonResult.StatusCode    = Status.LogonDeny.ToString();
                        userLogonResult.StatusMessage = "访问被拒绝、您的账户没有访问权限。";
                        status        = Status.LogonDeny;
                        statusMessage = "访问被拒绝、您的账户没有访问权限。";
                        result        = userLogonResult.UserInfo;
                    }
                }
            }

            return(result);
        }
示例#32
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 public BaseUserOrganizeManager(IDbHelper dbHelper, BaseUserInfo userInfo)
     : this(dbHelper)
 {
     UserInfo = userInfo;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbHelper">数据库连接</param>
 /// <param name="userInfo">用户信息</param>
 /// <param name="tableName">指定表名</param>
 public UserByIdentityManager(IDbHelper dbHelper, BaseUserInfo userInfo, string tableName) : this(dbHelper, userInfo)
 {
     base.CurrentTableName = tableName;
 }
示例#34
0
 /// <summary>
 /// Frame的自定义异常的基类
 /// </summary>
 /// <param name="pUserInfo">用户信息</param>
 /// <param name="pErrorInfo">错误信息</param>
 /// <param name="pInnerException">内部异常</param>
 public FrameException(BaseUserInfo pUserInfo, Exception pInnerException)
     : base(null, pInnerException)
 {
     this.UserInfo = pUserInfo;
     this.Message = pInnerException.Message;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="userInfo">用户信息</param>
 public UserByIdentityManager(BaseUserInfo userInfo) : this()
 {
     UserInfo = userInfo;
 }
示例#36
0
 public BaseAdviceDao(IDbHelper dbHelper, BaseUserInfo userInfo)
     : this(dbHelper)
 {
     this.UserInfo = userInfo;
 }
示例#37
0
 public BaseAttchmentDao(IDbHelper dbHelper, BaseUserInfo userInfo)
 {
     this.DbHelper = dbHelper;
     this.UserInfo = userInfo;
 }