Exemplo n.º 1
0
        /// <summary>
        /// 创建连接
        /// </summary>
        public void CreateConnecting()
        {
            sqlHelper = new SQLHelper();
            try
            {
                sqlHelper.CreateConnection(ConfigHelper.ConnStr_AutoRent);
            }
            catch (Exception ex)
            {
                CloseConnecting();
            }
            finally
            {

            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 分页通用方法
        /// </summary>
        /// <param name="input"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        public PaginationResponse ProcessPagination(PaginationRequest input, SQLHelper sql)
        {
            const string CmdText = "Usp_PCustomer_V2_Pagination";
            PaginationResponse Response = null;
            SqlParameter[] Parameter = PrepareParameters(input);

            try
            {
                DataTable dt = sql.ExecuteDataTable(CommandType.StoredProcedure, CmdText, "", Parameter);
                Response = new PaginationResponse();
                Response.dt = dt;
                Response.TotalPage = ConvertHelper.ToInt32(Parameter[Parameter.Length - 1].Value.ToString());
                Response.TotalRecord = ConvertHelper.ToInt32(Parameter[Parameter.Length - 2].Value.ToString());
                return Response;
            }
            catch (Exception ex)
            {
                sql.CloseConnection();

            }

            return Response;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据AccessToken获取会员ID
        /// </summary>
        /// <param name="Access_token"></param>
        /// <param name="AccountTpye"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        //public int GetCustomerid(string Access_token, ref int AccountTpye, SQLHelper sql)
        //{
        //    int Result = 0;
        //    string Commondtext = "USP_PCustomer_V2_ValidateAccessToken";
        //    SqlParameter[] Par =
        //  {
        //      new SqlParameter("@Accesstoken",Access_token),
        //      new SqlParameter("@CustomerID",SqlDbType.Int),
        //      new SqlParameter("@Accounttype",SqlDbType.VarChar,200),
        //      new SqlParameter("@ReturnMsg",SqlDbType.VarChar,200),
        //      new SqlParameter("@AccountName",SqlDbType.VarChar,200)
        //  };
        //    for (int i = 1; i < Par.Count(); i++)
        //    {
        //        Par[i].Direction = ParameterDirection.Output;
        //    }
        //    sql.ExecuteNonQuery(CommandType.StoredProcedure, Commondtext, Par);
        //    Result = ConvertHelper.ToInt32(Par[1].Value.ToString());
        //    AccountTpye = ConvertHelper.ToInt32(Par[2].Value.ToString());
        //    return Result;
        //}
        /// <summary>
        /// 获取AccessToken获取企业ID
        /// </summary>
        /// <param name="Access_token"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        public int GetPCustomerid(string Access_token, SQLHelper sql)
        {
            int Result = 0;

            const string Commondtext = "USP_PCustomer_V2_GetPCustomerID";
            SqlParameter[] Parameter =
              {
              new SqlParameter("@Accesstoken",Access_token),
              new SqlParameter("@PCustomerID",SqlDbType.Int),

              };
            for (int i = 1; i < Parameter.Count(); i++)
            {
                Parameter[i].Direction = ParameterDirection.Output;
            }
            sql.ExecuteNonQuery(CommandType.StoredProcedure, Commondtext, Parameter);

            Result = ConvertHelper.ToInt32(Parameter[Parameter.Length - 1].Value);
            return Result;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 根据账户名称获取账户信息
        /// </summary>
        /// <param name="appAccount"></param>
        /// <param name="sqlHelper"></param>
        /// <returns></returns>
        public UserAccountInfo GetCustomerInfoByAppAccount(string appAccount, SQLHelper sqlHelper)
        {
            UserAccountInfo uInfo = new UserAccountInfo();
            DataTable dt = null;

            if (appAccount == null || appAccount.Trim().Length == 0)
            {
                return uInfo;
            }

            const string procName = "dbo.Usp_PCustomer_V2_GetCustomerInfo";
            SqlParameter[] spars = new SqlParameter[] {
                new SqlParameter("@appaccount",appAccount)};

            try
            {
                dt = sqlHelper.ExecuteDataTable(CommandType.StoredProcedure, procName, "", spars);
                if (dt != null && dt.Rows.Count > 0)
                {
                    uInfo = BindUserAccountInfo(uInfo, dt);
                }
            }
            catch (Exception ex)
            {

            }
            return uInfo;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 根据accessToken获取账户信息
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sqlHelper"></param>
        /// <returns></returns>
        public UserAccountInfo GetCustomerInfoByAccessToken(string accessToken, SQLHelper sqlHelper)
        {
            UserAccountInfo uInfo = new UserAccountInfo();
            string appAcount = "";

            if (ValidateAccessToken(accessToken, sqlHelper, ref appAcount))
            {
                uInfo = GetCustomerInfoByAppAccount(appAcount, sqlHelper);
                uInfo = UserAccountchange(uInfo);
            }
            else
            {
                throw new Exception("验证失败-错误的令牌。");

            }

            return uInfo;
        }
Exemplo n.º 6
0
        public void Dispose()
        {
            if (sqlHelper != null)
            {
                if (sqlHelper != null)
                    sqlHelper.Dispose();
                sqlHelper = null;

            }
        }
Exemplo n.º 7
-1
        /// <summary>
        /// 验证accessToken是否合法,返回账户信息
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sqlHelper"></param>
        /// <returns></returns>
        public bool ValidateAccessToken(string accessToken, SQLHelper sqlHelper, ref string appAcount)
        {
            bool result = false;
            string accessTokenCode = ConvertAccessTokenCode(accessToken);

            const string procName = "dbo.Usp_PCustomer_V2_GetUserInfoByAccesstoken";
            SqlParameter[] spars = new SqlParameter[] {
                new SqlParameter("@Accesstoken",accessToken)
                ,new SqlParameter("@AccesstokenCode",accessTokenCode)};

            try
            {
                DataTable dt = sqlHelper.ExecuteDataTable(CommandType.StoredProcedure, procName, "", spars);
                if (dt != null && dt.Rows.Count > 0)
                {
                    appAcount = dt.Rows[0]["app_account"].ToString();
                    if (appAcount.Trim().Length > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return result;
        }
Exemplo n.º 8
-6
        /// <summary>
        /// 查询订车人账号id
        /// </summary>
        /// <param name="Customerid"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        public int Getstaffid(int Customerid, SQLHelper sql)
        {
            DataTable dt = new DataTable();
            string comondtxt = string.Format(@"SELECT PID FROM TB_PCustomerAssigner WHERE CustomerID={0}", Customerid);
            dt = sql.ExecuteDataTable(CommandType.Text, comondtxt, "", null);
            if (dt.Rows.Count > 0)
            {

                return dt.Rows[0][0].ToInt32();
            }
            else
            {
                return 0;
            }
        }