Esempio n. 1
0
        public async Task <SMSResponse> BindAccount(AccountRequestModel request, string OTPType = "Bind")
        {
            SMSResponse response = new SMSResponse();

            statement = new Statement();
            statement.AppendStatement("EXEC REST_CheckPhoneNumber @IDCard, @BirthDay, @OTPType");     // , @UserId
            statement.AppendParameter("@IDCard", request.IDCard);
            statement.AppendParameter("@BirthDay", request.BirthDay);
            statement.AppendParameter("@OTPType", OTPType);
            // statement.AppendParameter("@UserId", request.UserId);

            dt = resAccess.ExecuteDataTable(statement);
            if (dt.Rows.Count > 0)
            {
                string urlData = string.Format(state.SMSConfigs.UrlBase + "user={0}&pass={1}&type={2}&to={3}&from={4}&text={5}&servid={6}", state.SMSConfigs.User, state.SMSConfigs.Pass, state.SMSConfigs.Type, dt.Rows[0]["PhoneNumber"].ToString(), state.SMSConfigs.From, func.ToHexString(dt.Rows[0]["Message"].ToString()), state.SMSConfigs.ServID);
                CallAPI(urlData);
                response.phoneNumber = dt.Rows[0]["OriginalPhoneNumber"].ToString();
                response.result      = dt.Rows[0]["result"].ToString();
                response.refOTP      = dt.Rows[0]["OTP_Reference"].ToString();
            }
            else
            {
                response.phoneNumber = "";
                response.result      = "";
                response.refOTP      = "";
                return(response);
            }

            return(response);
        }
Esempio n. 2
0
        public async Task <string> Register(AccountRequestModel request)
        {
            dt = new DataTable();
            string result = "";

            statement = new Statement();
            statement.AppendStatement("EXEC REST_AccountRegister @UserId, @IDCard, @BirthDay, @OTP");
            statement.AppendParameter("@UserId", request.UserId);
            statement.AppendParameter("@IDCard", request.IDCard);
            statement.AppendParameter("@BirthDay", request.BirthDay);
            statement.AppendParameter("@OTP", request.OTP);

            dt = resAccess.ExecuteDataTable(statement);
            if (dt.Rows.Count > 0)
            {
                result = dt.Rows[0]["Result"].ToString();
            }
            return(result);
        }