Esempio n. 1
0
        /// <summary>
        /// 获得用户信息
        /// </summary>
        /// <param name="openid">用户标识</param>
        /// <param name="usertype">用户类型 1-支付宝用户 2-微信用户</param>
        /// <param name="info">用户信息</param>
        /// <param name="msg">成功、错误或异常信息</param>
        /// <returns>0-成功  大于0-失败   小于0-异常</returns>
        public int DB_UserInfo(string openid, string usertype, out UserInfo info, out string msg)
        {
            msg  = "";
            info = new UserInfo();
            OracleConnection connection = new OracleConnection(WebConfigParameter.ConnectionHisString);
            OracleDataReader dr         = null;

            int ret = -1;

            try
            {
                bool _flag = false;

                string findText = _builder.GetLandSql(openid, usertype, out _flag, out msg);
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, findText);

                if (!_flag)
                {
                    ret = 10;
                    return(ret);
                }

                dr = DbHelperOra.ExecuteReader(findText, connection);

                if (dr.HasRows)
                {
                    if (dr.Read())
                    {
                        info.openid    = !dr.IsDBNull(0) ? dr.GetString(0) : "";
                        info.name      = !dr.IsDBNull(1) ? dr.GetString(1) : "";
                        info.phone     = !dr.IsDBNull(2) ? dr.GetString(2) : "";
                        info.idcardno  = !dr.IsDBNull(3) ? dr.GetString(3) : "";
                        info.address   = !dr.IsDBNull(4) ? dr.GetString(4) : "";
                        info.headurl   = !dr.IsDBNull(5) ? dr.GetString(5) : "";
                        info.cardno    = !dr.IsDBNull(6) ? dr.GetString(6) : "";
                        info.patientid = !dr.IsDBNull(7) ? dr.GetString(7) : "";
                    }
                    //如果已绑卡判断绑卡是否失效
                    if (!string.IsNullOrEmpty(info.cardno) && info.cardno != " ")
                    {
                        if (!IsCardnoValid(info.patientid, info.cardno, out msg))
                        {
                            info.cardno    = "";
                            info.patientid = "";
                        }
                    }
                    if (IsZYBrxxValid(info.idcardno, info.name, out msg))
                    {
                        info.inpatentflag = "1";
                    }
                    else
                    {
                        info.inpatentflag = "0";
                    }
                    ret = 0;
                }
                else
                {
                    msg = "该登录信息未注册!";
                    ret = 1;
                }
                if (null != dr)
                {
                    dr.Close();
                }

                return(ret);
            }
            catch (Exception ex)
            {
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);

                msg = GetExceptionInfo(ex);
                ret = -1;
                return(ret);
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }
                connection.Close();
            }
        }