示例#1
0
        public BaseUserEntity GetObjectByOpenId(string openId)
        {
            BaseUserEntity userEntity = null;

            // 用户没有找到状态
            this.StatusCode    = Status.UserNotFound.ToString();
            this.StatusMessage = this.GetStateMessage(this.StatusCode);
            // 检查是否有效的合法的参数
            if (!String.IsNullOrEmpty(openId))
            {
                BaseUserLogOnManager userLogOnManager            = new BaseUserLogOnManager();
                List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                parameters.Add(new KeyValuePair <string, object>(BaseUserLogOnEntity.FieldOpenId, openId));
                string id = userLogOnManager.GetId(parameters);
                if (!string.IsNullOrEmpty(id))
                {
                    parameters = new List <KeyValuePair <string, object> >();
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldId, id));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldDeletionStateCode, 0));
                    parameters.Add(new KeyValuePair <string, object>(BaseUserEntity.FieldEnabled, 1));
                    var dt = this.GetDataTable(parameters);
                    if (dt.Rows.Count == 1)
                    {
                        userEntity = BaseEntity.Create <BaseUserEntity>(dt);
                    }
                }
            }

            return(userEntity);
        }