Dre4m Shell
Server IP : 103.6.199.200  /  Your IP : 3.135.184.136
Web Server : Microsoft-IIS/10.0
System : Windows NT EMPUSA 10.0 build 20348 (Windows Server 2016) i586
User : EMPUSA$ ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Domains/tradepan/cyreward.biz/wwwroot/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/Domains/tradepan/cyreward.biz/wwwroot/Thron.ashx
<%@ WebHandler Language="C#" Class="Thron" %>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Collections;
//using System.Data.Objects;
//using System.Data.Entity.Core.Objects;
using System.Data.Entity;
using System.Xml;
using System.Xml.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Text;
using System.IO;
using System.Net;
//using HtmlTextFormat;
using System.Diagnostics;
using System.Threading;


public class Thron : IHttpHandler {


    //#region Basic Measurement
    //private OleDbConnection Connection;
    //private OleDbDataAdapter Da;
    //private OleDbCommand Command;
    //private OleDbDataReader DataReader;
    //public string RedirectPage;
    //#endregion
    

    public string[] l_temp = new string[20];
    ICEClass icObj = new ICEClass();

    
        public void ProcessRequest(HttpContext context)
        {
            bool l_processed = false ;
            string l_ll = "";
            
         context.Response.AppendHeader("Cache-Control", "no-cache, must-revalidate, max-age=0");
           context.Response.AppendHeader("Expires", "Thu, 01 Jan 1970 00:00:01 GMT");
          context.Response.AppendHeader("Pragma", "no-cache");

            //context.Response.ContentType = "text/xml";

            //// IP白名单检测
            //var client_ip = context.Request.UserHostAddress;
            //if (!iplists.ContainsKey(client_ip) || iplists[client_ip] != true)
            //{
            //    context.Response.Write("forbidden");
            //    context.Response.End();
            //}


            string xml_text;
            StreamReader reader;
            using (reader = new StreamReader(context.Request.InputStream))
            {
                xml_text = reader.ReadToEnd();
            }

//string l_PaymentID = "1122";
//string l_CCS = "01";
//string l_Return = "";
//string l_FromServer = "";
//string l_status = "";          
//string json = xml_text;
//string path = "C:/Webhtml/EUP/Member/GHL/";
                        
//            string l_ret = icObj.API_MMLogin("", "", json, l_Return, ref l_FromServer, ref l_status,  path , l_PaymentID + l_CCS);

            //Response.Redirect("Member/GHL/" + l_PaymentID + l_CCS + ".html");

 //           return;
            
            
            int l_SS = 0;
            string l_IP = "";
            int l_wbw_i = 0;
            string l_wbw = "";


            try
            {

                l_IP = context.Request.UserHostAddress;
                //this.Request.ServerVariables["REMOTE_ADDR"];
                
            //    xml_text = @"{""amount"":""1.0000"",""transaction_id"":""0"",""price"":""2"",""pack"":""50"",""username"":""Testing1332"",""bankcard"":""GTC"",""voucher"":4.1600000000000001,""command"":""CCF"",""baseamt"":""0.2003"",""sign"":""124a21a7c1ee6e4db497368c665ef45182f9""}";
                
                
             //   xml_text = @"{""command"":""STrans"",""member_id"":""958428142042-59506720165"",""token"":""776426142042-47706420163605"",""out_trade_no"":""TestGP1-1742005644"",""subject"":""Test"",""amount"":2,""currency_id"":6,""version"":""2.2""}";
             //    xml_text = @"{""command"":""MTrans"", ""token"":""888658410022-388077K012110"", ""subject"":""WLX商品"",""bill"":""INV34342"", ""amount"":176.00, ""currency_id"":6, ""return_url"":""http://www.wlx88.com/center/order/list/1"", ""currency_id"":6, ""fail_url"":""http://www.wlx88.com/center/order/list/0"", ""notify_url"":""http://www.wlx88.com/center/grabpay/result"", ""out_trade_no"":""WLX201705171019050""}";
                
              //  xml_text = @"{""command"":""UpdateBalance"", ""username"":""name"", ""sign"":""9eace2e77e0c1f5be7bbd3e9b54b9af2"", ""bankcard"":-1, ""amount"":3400 } ";
             //   xml_text = @"{""command"":""CLV"", ""username"":""CY2000"", ""sign"":""cXw3MtM1U2c2fT7wT9hq7ZRa0xXqAZPYLbVGxKoieEDDLYsc3d"", ""lang"":""EN"", ""country"":""KR"", ""sponsor_id"":""ADMIN5"", ""voucher"":1, ""amount"":3400, ""rva"":34, ""cash"":100, ""qtr"":""0;0;0;0;0;0;0;2;0;0;0;0;1;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;"" } ";

             //   xml_text = @"{""command"":""GHL"", ""username"":""CY2000"", ""sign"":""cXw3MtM1U2c2fT7wT9hq7ZRa0xXqAZPYLbVGxKoieEDDLYsc3d"", ""transaction_id"":1029,  ""amount"":3400} ";
                
             //   xml_text = @"{""command"":""TRF"",""username"":""SLGGROUP"",""bankcard"":""SBU"",""transaction_id"":""0"",""voucher"":"0","amount":13,"sign":"45a565vdfdf34534xxr3633"}

             //   xml_text = @"{""command"":""BAL"",""sign"":""125acaea84b5370d15e95e672f331bfd49dd""}";

            //    xml_text = @"{""command"":""TRF"",""username"":""lennypong"",""bankcard"":""BLC"",""transaction_id"":""0"",""voucher"":""4.28"",""amount"":""10"",""sign"":""789acaea84b5370d15e95e672f331bfd49dd""}";

           //    xml_text = @"{""command"":""QRC"",""username"":""Testing1331"",""sign"":""00010001""}";

            //    xml_text = @"{""command"":""HIS"",""username"":""Testing1331"",""bankcard"":""SBU"",""transaction_id"":""0"",""voucher"":""0"",""date_from"":""01-Jan-1900"",""date_to"":""01-Jan-2020"",""sign"":""789acaea84b5370d15e95e672f331bfd49dd""}";
           //     xml_text = @"{""command"":""CCF"",""username"":""testing1332"",""bankcard"":""GTC"",""transaction_id"":""0"",""voucher"":4.16,""amount"":""10"",""sign"":""124acaea84b5370d15e95e672f331bfd49dd""}";

           //   xml_text = @"{""command"":""THF"",""username"":""testing1336"",""bankcard"":""AT"",""transaction_id"":""0"",""voucher"":4.16,""amount"":""1000"",""sign"":""129acaea84b5370d15e95e672f331bfd49dd""}";

            //    xml_text = @"{""command"":""DEAL"",""sign"":""124acaea84b5370d15e95e672f331bfd49dd"",""ac1"":""testing1332"",""amount"":34}";

           //     xml_text = @"{""command"":""THF"",""username"":""ADMIN5"",""bankcard"":""AT"",""transaction_id"":""0"",""voucher"":4.16,""amount"":""832.00"",""sign"":""124a21a7c1ee6e4db497368c665ef45182f9""}";
                
            //    xml_text = @"{""command"":""QRC"",""username"":""testing1331"",""sign"":""00010001""}";
           // xml_text = @"{""command"":""QRC"",""username"":""XUAN001"",""sign"":""695137""}";    
                //if (false)
               // {
                    l_wbw_i = xml_text.IndexOf('{');
                    if (l_wbw_i < 0)
                    {
                        string ret3 = @"[{""id"":""71"",""title"":""Cleveland Classic: Joshna Chinappa, Dipika Pallikal progress"",""category"":""poke"",""date"":""2017-09-28"",""image"":""http:\/\/mobileappdatabase.in\/smartnews\/app_dashboard\/uploads\/181300327_Dipika-Pallikal.jpg"",""description"":""p>\r\n""}]";
                        context.Response.Write(ret3);


                       // string FilePath1 = "~/APA/";

                       // icObj.WriteMyFile("cvv", FilePath1, icObj.ICDateTime(0).Substring(0, 11), "DD");
            
                        
                        return;
                    }
                    l_wbw = xml_text.Substring(l_wbw_i);

               // }
                     
            // 请求日志
                //using (var db = new bet2Entities())
                //{
                //    var log = new bet_openapi_log();
                //    log.req_urlreferrer = context.Request.UrlReferrer.ToString();
                //    log.req_useragent = context.Request.UserAgent;
                //    log.req_hostaddress = context.Request.UserHostAddress;
                //    log.req_hostname = context.Request.UserHostName;
                //    log.req_date = DateTime.UtcNow;
                //    log.req_content = xml_text;

                //    db.AddTobet_openapi_log(log);
                //    db.SaveChanges();
                //}

            }
            catch (Exception ex)
            {
                return;
            }

            //string FolderPath = ConfigurationManager.AppSettings["FolderPath"];
            //string FilePath = Server.MapPath("APA/");

            string FilePath = "C:/Domains/tradepan/eup4u.com/wwwroot/APA/";// "~APA/";
            
            try
            {
               

                icObj.WriteMyFile("cvv", FilePath, icObj.ICDateTime(0).Substring(0, 11), xml_text);
            }
            catch
            {
            }
            
            
            string a_Trdid = "";
            string a_Trhid = "";
            string a_Trsid = "";
            l_ll = icObj.fs_Last("wbw_eLog", "TransID", ref a_Trdid, ref a_Trhid, ref a_Trsid);

            if (xml_text.Length > 250)
            {
                if (xml_text.Length < 500)
                    icObj.ExecSQL(0, "insert into wbw_eLog(transid, trdid, trhid, trsid, trdate, Amount, RefNo, Subject1, Subject2 ) values (" + l_ll + " + 1, " + a_Trdid + ", " + a_Trhid + ", " + a_Trdid + ", #" + icObj.ICDateTime(0) + "# , 0,  'SET' , '" + xml_text.Substring(0, 250) + "', '" + xml_text.Substring(250) + "' ) ");
                else
                    icObj.ExecSQL(0, "insert into wbw_eLog(transid, trdid, trhid, trsid, trdate, Amount, RefNo, Subject1, Subject2 ) values (" + l_ll + " + 1, " + a_Trdid + ", " + a_Trhid + ", " + a_Trdid + ", #" + icObj.ICDateTime(0) + "# , 0,  'SET' , '" + xml_text.Substring(0, 250) + "', '" + xml_text.Substring(250, 250) + "' ) ");
            }
            else
                icObj.ExecSQL(0, "insert into wbw_eLog(transid, trdid, trhid, trsid, trdate, Amount, RefNo, Subject1 ) values (" + l_ll + " + 1, " + a_Trdid + ", " + a_Trhid + ", " + a_Trdid + ", #" + icObj.ICDateTime(0) + "# , 0,  'SET' , '" + xml_text + "' ) ");
            
            string[] l_json = l_wbw.Split(',');
            int ll_i = 0;
            string l_Field = "";
            string l_Data = "";
            string l_Source = "";
            
            
            string l_Token = "";
            string l_Tr = "";
            string l_User = "";
            string l_Pass = "";
            string l_Amt = "";
            string l_Command = "";
            string l_OutTrade = "";
            string l_version = "1.1";


            string l_mt4 = "";
            string l_currencyid = "";
            string l_trcode = "";
            string l_remark = "";
            string l_bal = "";

            string l_member_name = "";
                    
            string l_sponsor_id = "";
            string l_ic_number = "";
            string l_gender = "";
            
            string l_email = "";
            string l_phone = "";
            string l_country = "";
            string l_address = "";
            
            string l_ac1 = "";
            string l_ab1 = "";
            string l_ac2 = "";
            string l_ab2 = "";
            string l_date_from = "";
            string l_date_to = "";

            string l_username = "";
            string l_sign = "";
            string l_bankcard ="";
            string amount = "";
            string l_Sign = "";

            string l_lang = "";
            string l_voucher = "";
            string l_rva = "";
            string l_cash = "";
            string l_qtr = "";
            string l_shipping = "";

            string l_localcc = "";
            
            string l_price = "";
            string l_pack = "";
            
                                                
            for (ll_i=0;ll_i< l_json.GetUpperBound(0) +1;ll_i++)
            {
                l_Source = l_json[ll_i ] + "::" ;
                l_Field = l_Source.Split(':')[0];
                l_Data = l_Source.Split(':')[1];
                l_Field = l_Field.Replace("\"", " ").Replace("{", " ").Trim();
                l_Data = l_Data.Replace("\"", " ").Replace("}", " ").Trim();

                if (l_Field == "command")
                    l_Command = l_Data;
                if (l_Field == "sign")
                    l_Sign = l_Data;                
                if (l_Field == "transaction_id")
                    l_Tr = l_Data;                                
                if (l_Field == "username")
                    l_User = l_Data;
                if (l_Field == "password")
                    l_Pass = l_Data;
                if (l_Field == "token")
                    l_Token = l_Data;
                if (l_Field == "amount")
                    l_Amt = l_Data;                     
                if (l_Field == "out_trade_no")
                    l_OutTrade = l_Data;
                if (l_Field == "version")
                    l_version = l_Data;

                if (l_Field == "mt4")
                    l_mt4 = l_Data;
                if (l_Field == "currency_id")
                    l_currencyid = l_Data;
                if (l_Field == "tr_code")
                    l_trcode = l_Data;
                if (l_Field == "remark")
                    l_remark = l_Data;
                if (l_Field == "balance")
                    l_bal = l_Data;
                                               
                if (l_Field == "member_name")
                    l_member_name = l_Data; 
                if (l_Field == "sponsor_id")
                    l_sponsor_id = l_Data;
                if (l_Field == "ic_number")
                    l_ic_number = l_Data;
                if (l_Field == "gender")
                    l_gender = l_Data;
                if (l_Field == "email")
                    l_email = l_Data;
                if (l_Field == "phone")
                    l_phone = l_Data;
                if (l_Field == "country")
                    l_country = l_Data;
                if (l_Field == "address")
                    l_address = l_Data;

                if (l_Field == "ac1")
                    l_ac1 = l_Data;
                if (l_Field == "ab1")
                    l_ab1 = l_Data;
                if (l_Field == "ac2")
                    l_ac2 = l_Data;
                if (l_Field == "ab2")
                    l_ab2 = l_Data;

                if (l_Field == "date_from")
                    l_date_from = l_Data;
                if (l_Field == "date_to")
                    l_date_to = l_Data;


                if (l_Field == "username")
                    l_username = l_Data;

                if (l_Field == "sign")
                    l_sign = l_Data;

                if (l_Field == "bankcard")
                    l_bankcard = l_Data;

                if (l_Field == "amount")
                    amount = l_Data;

                if (l_Field == "lang")
                    l_lang = l_Data;
                if (l_Field == "voucher")
                    l_voucher = l_Data;
                if (l_Field == "rva")
                    l_rva = l_Data;
                if (l_Field == "cash")
                    l_cash = l_Data;
                if (l_Field == "qtr")
                    l_qtr = l_Data;
                if (l_Field == "shipping")
                    l_shipping = l_Data;

                if (l_Field == "price")
                    l_price = l_Data;
                if (l_Field == "pack")
                    l_pack = l_Data;

                if (l_Field == "localcc")
                    l_localcc = l_Data;
                   
              //  Lang;Voucher;UserName;Country;sponsor_id;amount;Cash;RVA;StrQtr
                                                                                                                                                                             
            }     
            // string ret = ResponseFund2(l_Token, l_User, l_Pass, l_Amt);
            //response_sb.AppendLine(ret);
            //context.Response.Write(response_sb.ToString());

            //if (l_version == "1.1" || true)
            //{
            //    string ret = API_fc_Fast(l_Command, l_User, l_Pass, l_Token, l_Amt, l_Tr, l_OutTrade, l_mt4, l_currencyid, l_trcode, l_remark, l_bal, l_ac1, l_ab1, l_ac2, l_ab2,  l_member_name, l_sponsor_id, l_ic_number, l_gender, l_email, l_phone, l_country, l_address, l_date_from, l_date_to    );
            //    context.Response.Write(ret);
            //}
            //else
            //{
            //    string ret2 = "{" + icObj.API_fc_Error(901) + "}";
            //    context.Response.Write(ret2);
            //}
          
            string ret2 = "";

            if (l_Tr == "" || l_Command == "CCF" || l_Command == "TRF" || l_Command == "THF" || l_Command == "TSF" || l_Command == "HIS" || l_Command == "MLV"  || l_Command == "DEAL")
            {
                if (l_qtr == "" || l_Command == "CCF" || l_Command == "TRF" || l_Command == "THF" || l_Command == "TSF" || l_Command == "HIS" || l_Command == "MLV" || l_Command == "DEAL")
                {
                    if (l_Command == "QREG")
                        ret2 = API_QR_QREG(l_Command, l_member_name, l_ac1, l_email, l_phone, l_sponsor_id );
                    else
                        if (l_Command == "QRC")
                            ret2 = API_FXX_Fast(l_Command, l_username, l_sign, l_bankcard, l_remark, amount);
                        else
                        {
                            if (l_Command == "TRF" || l_Command == "CCF" || l_Command == "TSF" || l_Command == "THF")
                            {
                                if (l_Command == "TRF" || l_Command == "CCF")
                                {
                                    if (l_Command == "TRF" )
                                        ret2 = API_FXX_Trf(l_Command, l_username, l_sign, l_bankcard, l_remark, amount, l_voucher, l_price, l_pack, l_localcc );
                                    else
                                        ret2 = API_FXX_Trf("CCF", l_username, l_sign, l_bankcard, l_remark, amount, l_voucher, l_price, l_pack, l_localcc);
                                }
                                else
                                {
                                    if (l_Command == "THF")
                                        ret2 = API_FXX_Thf(l_Command, l_username, l_sign, l_bankcard, l_remark, amount, l_voucher);
                                    else
                                        ret2 = API_FXX_Tsf(l_Command, l_username, l_sign, l_bankcard, l_remark, amount, l_voucher);
                                }
                            }
                            else
                                if (l_Command == "HIS" || l_Command == "MLV")
                                {
                                    if (l_Command == "HIS" )
                                    ret2 = API_FXX_HIS(l_Command, l_username, l_sign, l_bankcard, l_date_from, l_date_to);
                                    else
                                    ret2 = API_FXX_MLV(l_Command, l_username, l_sign, l_bankcard, l_date_from, l_date_to);
                                }
                                else
                                    if (l_Command == "BAL")
                                        ret2 = API_FXX_BAL(l_Command, l_sign);
                                    else
                                        if (l_Command == "DEAL")
                                            ret2 = API_FXX_DEAL(l_Command, l_sign, l_ac1, amount);
                                        else
                                            ret2 = API_QR_Fast(l_Command, l_username, l_sign, l_bankcard, l_remark, amount);
                        }
                    
                }
                else
                    ret2 = API_QR_Payment(l_Command, l_username, l_sign, l_lang, l_voucher, amount, l_rva, l_cash, l_country, l_sponsor_id, l_shipping, l_qtr);
            }
            else
            {
                ret2 = API_QR_GHL(l_Command, l_username, l_sign, l_Tr, l_voucher, amount);
            }

            try
            {


                icObj.WriteMyFile("cvv", FilePath, icObj.ICDateTime(0).Substring(0, 11), ret2);
            }
            catch
            {
            }
            
            //string ret2 = @"[{""id"":""71"",""title"":""Cleveland Classic: Joshna Chinappa, Dipika Pallikal progress"",""category"":""poke"",""date"":""2017-09-28"",""image"":""http:\/\/mobileappdatabase.in\/smartnews\/app_dashboard\/uploads\/181300327_Dipika-Pallikal.jpg"",""description"":""p>\r\n""}]";
               context.Response.Write(ret2);            
            
        }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }


    string API_QR_GHL(string a_Inst, string l_UserId, string l_sign, string l_TxtID, string l_Voucher,  string l_Amt)
    {
        string[] l_Para2 = new string[20];
        string[] l_Para = new string[56];
        string l_Str = "";


        if (a_Inst == "GHL")
        {
            string l_Data2 = "";
            string l_Data = "";
            string l_Data3 = icObj.xxa_DecryptURL2(l_sign, "") + ";;;;;;;";

            string l_Enc = "";
            if (l_Data3 != "")
            {

                l_Amt = icObj.SQL_GetData(0, "Select totalPrice, CVIP, total_RP from wbw_OrderInfo where OrderID = " + l_TxtID, 3, l_Para2);
                if (l_Amt == null || l_Amt == "")
                    l_Amt = "0";
                double ld_Amt = double.Parse(l_Amt);// / 2;
                if (ld_Amt > 0)
                {
                    ld_Amt = icObj.fcc_MYLocal(ld_Amt, l_Para2[1]);
                    l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_sign + @""",""data"":{""amount"":" + ld_Amt.ToString()  + @"}}";
                }
                else
                    l_Str = @"{""res_code"":604,""status_message"":""Fail"",""sign"":""" + l_sign + @""",""data"":{""amount"":" + ld_Amt.ToString() + @"}}";
                
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }

    string API_QR_QREG(string a_Inst, string l_member_name, string l_ac1, string l_email, string l_phone, string l_sponsor)
    {
        string[] l_Para = new string[56];
        string l_Str = "";

        //if (a_Inst == "UpdateBalance" || a_Inst == "GetBalance" || a_Inst == "UseBalance" || a_Inst == "Transaction" || a_Inst == "Login")
        //{
        //    l_Str = icObj.QR_command(a_Inst, l_UserId, l_sign, l_BankCard, l_Subject, l_Amt);
        //}

        if (a_Inst == "QREG")
        {
            string l_Data2 = "";
            string l_Data = "";
            string l_Enc = "";

            l_Data = icObj.SQL_GetData(0, "Select A1.Name  from wbw_Member A1  where  A1.emails = '" + l_email  + "' ", 1, l_Para);
            if (l_Data == null || l_Data == "")
            {
                //l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                //l_Data2 = @"""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.') + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @"""";
                //l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""data"":{" + l_Data2 + @"}}"; 

                l_Data = icObj.f_SLG_Member("EN", l_member_name, l_phone, l_email, l_sponsor );  
                l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""username"":""" + l_Data + @"""}";
            }
            else
            {
                l_Str = @"{""res_code"":602,""status_message"":""Fail"",""username"":""" + l_Data  + @"""}";
            }

        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }


    string API_FXX_Trf(string a_Inst, string l_UserId, string l_sign, string l_BankCard, string l_Subject, string l_Amt, string l_Voucher, string l_Price, string l_Settlement, string l_LocalCurrency)
    {
        string[] l_Para = new string[56];
        string l_Str = "";
        string l_Secu = "";
        string l_QR = "";

        string[] l_Curr = new string[56];
        string[] l_Rate = new string[56];

        double ls_Amt = double.Parse(l_Amt);

        double l_Cash = 0;

        try
        {
            l_Cash = double.Parse(l_Price) * double.Parse(l_Settlement) / 100;
        }
        catch
        {
            l_Cash = double.Parse(l_Price) - ls_Amt;
        }
        
        string l_Str1 = icObj.SQL_GetData(0, "Select  '1;' & Plan_Setting from wbw_plan where plan_code = 'EXRATE' ", 1, icObj.l_temp);
        l_Str1 = l_Str1 + ";;;;;;;;;;;;;";
        l_Rate = l_Str1.Split(';');
        l_Curr[0] = "1";
        l_Curr[1] = l_Rate[6];
        l_Curr[2] = l_Rate[7];
        l_Curr[3] = l_Rate[8];
        l_Curr[4] = l_Rate[9];
        l_Curr[5] = l_Rate[10]; 
                
        //l_Rate[0] = "1";
        //l_Rate[1] = "1.2";
        //l_Rate[2] = "10000";
        //l_Rate[3] = "4.2";
        //l_Curr[0] = "1";
        //l_Curr[1] = "4.27";
        //l_Curr[2] = "7";
        //l_Curr[3] = "1000";
        //l_Curr[4] = "100";

        if (l_BankCard == "SBU")
            l_BankCard = "GTC";

        if (l_Voucher == null || l_Voucher == "" || l_Voucher == "0")
            l_Voucher = l_Curr[1];
        
        if (l_LocalCurrency == "USD")
            l_Voucher = l_Curr[0];
        
            //if (l_BankCard == "BLC")
            //{
            //    ls_Amt = (double.Parse(l_Amt) * double.Parse(l_Rate[3])) / double.Parse(l_Rate[1]);
            //}
            //else
            //{
            //    if (l_BankCard == "BTC")
            //    {
            //        ls_Amt = (double.Parse(l_Amt) * double.Parse(l_Rate[2])) / double.Parse(l_Rate[1]);
            //    }
            //}


        if (l_BankCard == "GTC")
        {
            ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[1]));
        }

        if (l_BankCard == "AT")
        {
            ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[4]));
        }

        if (l_BankCard == "RT")
        {
            ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[5]));
        }
                        
        if (l_BankCard == "USDT")
        {
            ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[3]));
        }

        if (l_BankCard == "BTC")
        {
            ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[2]));
        }


        
         
        //if (a_Inst == "UpdateBalance" || a_Inst == "GetBalance" || a_Inst == "UseBalance" || a_Inst == "Transaction" || a_Inst == "Login")
        //{
        //    l_Str = icObj.QR_command(a_Inst, l_UserId, l_sign, l_BankCard, l_Subject, l_Amt);
        //}

        if (a_Inst == "TRF" || a_Inst == "CCF")
        {
            string l_Data2 = "";
            string l_Data = "";
            string l_Data3 = l_sign;

            string l_Enc = "";

            try
            {
                l_Data2 = l_sign.Split('a')[0];
            }
            catch
            {
            }  
            
            
            if (l_Data3 != "" && l_Data2 != "")
            {



               // l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.[Pass_2] from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + "  ", 14, l_Para);
                l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.eCoinE, A1.eCoinM , A1.eCoinZ, A1.eCoinP, A1.eCoinR, A1.[Pass_2], A1.ebv3, A1.[Name]  , A1.eCoinA, A1.eCoinI from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + " ", 23, l_Para);
                if (l_Data == null || l_Data == "")
                    l_Str = @"{""res_code"":602,""status_message"":""Fail""}";
                else
                {

                    l_Secu = icObj.cf_MemberInfo(l_Para[12], l_Para[18], "", "");
                    if (l_Secu.Substring(0, 1) == "0")
                    {
                        l_Str = @"{""res_code"":633,""status_message"":""Close Reopen""}";
                    }
                    else
                    {
                        string l_Msg4 = icObj.f_Transac(l_sign, l_UserId, ls_Amt, l_Secu, l_BankCard, double.Parse(l_Amt), double.Parse(l_Voucher), l_LocalCurrency + l_Price );


                        if (l_Msg4.Substring(0, 2) == "**")
                        {
                            //l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");

                            l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.eCoinE, A1.eCoinM , A1.eCoinZ, A1.eCoinP, A1.eCoinR, A1.[Pass_2], A1.ebv3, A1.[Name] , A1.eCoinA, A1.eCoinI  from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + " ", 23, l_Para);
                            if (l_Data == null || l_Data == "")
                                l_Str = @"{""res_code"":612,""status_message"":""Fail""}";
                            else
                            {
                                l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                                l_QR = icObj.f_SSCTrans(l_Para[12], l_Para[18], ref  l_Secu);

                                l_Data2 = @"""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.') + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @""",""QR"":""" + l_QR + @""",""CLV"":" + icObj.VarStr(l_Para[21], 2) + @",""MLV"":" + icObj.VarStr( l_Para[22], 2) + @",""GTB"":" + l_Para[15] + @",""GTC"":" + l_Para[13] + @",""BTC"":" + l_Para[14] + @",""USDT"":" + l_Para[15] + @",""AT"":" + l_Para[16] + @",""RT"":" + l_Para[17] + @",""GTC_RATE"":" + l_Rate[1] + @",""BTC_RATE"":" + l_Rate[2] + @",""USDT_RATE"":" + l_Rate[3] + @",""AT_RATE"":" + l_Rate[4] + @",""RT_RATE"":" + l_Rate[5] + @",""MYR"":" + l_Curr[1] + @",""RMB"":" + l_Curr[2] + @",""THB"":" + l_Curr[3] + @",""NTD"":" + l_Curr[4] + @",""USD"":" + l_Curr[0] + @",""ebv3"":" + l_Para[19] + @",""invoice"":""" + l_Para[20] + @""",""Cash"":""0"",""CPU"":""" + icObj.GetSha256String(l_Para[20] + ":A" + l_Para[19]) + @"""";
                                l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""return_message"":""" + l_Msg4 + @""",""data"":{" + l_Data2 + @"}}";


                                if (a_Inst == "CCF")
                                {
                                    icObj.f_StockIn(icObj.GetSha256String(l_Para[20] + ":A" + l_Para[19]), int.Parse(l_Para[0]), "",  "M00003", "apple", "Photo Print" ,  icObj.VarStr(   l_Cash.ToString()   , 2)   , "MYR");
                                    
                                }
                            }
                        }
                        else
                        {
                            l_Str = @"{""res_code"":603,""status_message"":""Fail""}";
                        }
                    }
                }
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }


    string API_FXX_Tsf(string a_Inst, string l_UserId, string l_sign, string l_BankCard, string l_Subject, string l_Amt, string l_Voucher)
    {
        string[] l_Para = new string[56];
        string l_Str = "";
        string l_Secu = "";
        string l_QR = "";

        string[] l_Curr = new string[56];
        string[] l_Rate = new string[56];

        double ls_Amt = double.Parse(l_Amt);

        string l_Str1 = icObj.SQL_GetData(0, "Select  '1;' & Plan_Setting from wbw_plan where plan_code = 'EXRATE' ", 1, icObj.l_temp);
        l_Str1 = l_Str1 + ";;;;;;;;;;;;;";
        l_Rate = l_Str1.Split(';');
        l_Curr[0] = "1";
        l_Curr[1] = l_Rate[6];
        l_Curr[2] = l_Rate[7];
        l_Curr[3] = l_Rate[8];
        l_Curr[4] = l_Rate[9];
        l_Curr[5] = l_Rate[10];

        //l_Rate[0] = "1";
        //l_Rate[1] = "1.2";
        //l_Rate[2] = "10000";
        //l_Rate[3] = "4.2";
        //l_Curr[0] = "1";
        //l_Curr[1] = "4.27";
        //l_Curr[2] = "7";
        //l_Curr[3] = "1000";
        //l_Curr[4] = "100";

        if (l_BankCard == "SBU")
            l_BankCard = "GTC";

        if (l_Voucher == null || l_Voucher == "" || l_Voucher == "0")
            l_Voucher = l_Curr[1];


        //if (l_BankCard == "BLC")
        //{
        //    ls_Amt = (double.Parse(l_Amt) * double.Parse(l_Rate[3])) / double.Parse(l_Rate[1]);
        //}
        //else
        //{
        //    if (l_BankCard == "BTC")
        //    {
        //        ls_Amt = (double.Parse(l_Amt) * double.Parse(l_Rate[2])) / double.Parse(l_Rate[1]);
        //    }
        //}


        //if (l_BankCard == "GTC")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[1]));
        //}

        //if (l_BankCard == "AT")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[4]));
        //}

        //if (l_BankCard == "RT")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[5]));
        //}

        //if (l_BankCard == "USDT")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[3]));
        //}

        //if (l_BankCard == "BTC")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[2]));
        //}

        ls_Amt = double.Parse(l_Amt);


        //if (a_Inst == "UpdateBalance" || a_Inst == "GetBalance" || a_Inst == "UseBalance" || a_Inst == "Transaction" || a_Inst == "Login")
        //{
        //    l_Str = icObj.QR_command(a_Inst, l_UserId, l_sign, l_BankCard, l_Subject, l_Amt);
        //}

        if (a_Inst == "TSF")
        {
            string l_Data2 = "";
            string l_Data = "";
            string l_Data3 = l_sign;

            string l_Enc = "";

            try
            {
                l_Data2 = l_sign.Split('a')[0];
            }
            catch
            {
            }


            if (l_Data3 != "" && l_Data2 != "")
            {



                // l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.[Pass_2], A1.ebv3 from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + "  ", 14, l_Para);
                l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.eCoinE, A1.eCoinM , A1.eCoinZ, A1.eCoinP, A1.eCoinR, A1.[Pass_2], A1.ebv3, A1.[Name]  , A1.eCoinA, A1.eCoinI  from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + " ", 23, l_Para);
                if (l_Data == null || l_Data == "")
                    l_Str = @"{""res_code"":602,""status_message"":""Fail""}";
                else
                {

                    l_Secu = icObj.cf_MemberInfo(l_Para[12], l_Para[18], "", "");
                    if (l_Secu.Substring(0, 1) == "0")
                    {
                        l_Str = @"{""res_code"":633,""status_message"":""Close Reopen""}";
                    }
                    else
                    {
                        l_Voucher = "0";
                        string l_Msg4 = "";
                        if (double.Parse(l_Para[16]) + double.Parse(l_Voucher) >= double.Parse(l_Amt))
                            l_Msg4 = icObj.f_Packac(l_sign, l_UserId, ls_Amt, l_Secu, l_BankCard, double.Parse(l_Amt), double.Parse(l_Voucher));
                        else
                            l_Msg4 = icObj.fs_Lang("EN",    "Not Enough") + " AT+RT";


                        if (l_Msg4.Substring(0, 2) == "**" || l_Msg4.Substring(0, 2) == "Ch")
                        {
                            //l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");

                            l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.eCoinE, A1.eCoinM , A1.eCoinZ, A1.eCoinP, A1.eCoinR, A1.[Pass_2], A1.ebv3, A1.[Name]  , A1.eCoinA, A1.eCoinI  from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + " ", 23, l_Para);
                            if (l_Data == null || l_Data == "")
                                l_Str = @"{""res_code"":612,""status_message"":""Fail""}";
                            else
                            {
                                l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                                l_QR = icObj.f_SSCTrans(l_Para[12], l_Para[18], ref  l_Secu);

                                l_Data2 = @"""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.') + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @""",""QR"":""" + l_QR + @""",""CLV"":" + icObj.VarStr(l_Para[21], 2) + @",""MLV"":" + icObj.VarStr(l_Para[22], 2) + @",""GTB"":" + l_Para[15] + @",""GTC"":" + l_Para[13] + @",""BTC"":" + l_Para[14] + @",""USDT"":" + l_Para[15] + @",""AT"":" + l_Para[16] + @",""RT"":" + l_Para[17] + @",""GTC_RATE"":" + l_Rate[1] + @",""BTC_RATE"":" + l_Rate[2] + @",""USDT_RATE"":" + l_Rate[3] + @",""AT_RATE"":" + l_Rate[4] + @",""RT_RATE"":" + l_Rate[5] + @",""MYR"":" + l_Curr[1] + @",""RMB"":" + l_Curr[2] + @",""THB"":" + l_Curr[3] + @",""NTD"":" + l_Curr[4] + @",""USD"":" + l_Curr[0] + @",""ebv3"":" + l_Para[19] + @",""invoice"":""" + l_Para[20] + @""",""Cash"":""0"",""CPU"":""" + icObj.GetSha256String(l_Para[20] + ":A" + l_Para[19]) + @"""";
                                l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""return_message"":""" + l_Msg4 + @""",""data"":{" + l_Data2 + @"}}";
                            }
                        }
                        else
                        {
                            l_Str = @"{""res_code"":603,""status_message"":""Fail""}";
                        }
                    }
                }
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }



    string API_FXX_Thf(string a_Inst, string l_UserId, string l_sign, string l_BankCard, string l_Subject, string l_Amt, string l_Voucher)
    {
        string[] l_Para = new string[56];
        string l_Str = "";
        string l_Secu = "";
        string l_QR = "";

        string[] l_Curr = new string[56];
        string[] l_Rate = new string[56];

        double ls_Amt = double.Parse(l_Amt);

        string l_Str1 = icObj.SQL_GetData(0, "Select  '1;' & Plan_Setting from wbw_plan where plan_code = 'EXRATE' ", 1, icObj.l_temp);
        l_Str1 = l_Str1 + ";;;;;;;;;;;;;";
        l_Rate = l_Str1.Split(';');
        l_Curr[0] = "1";
        l_Curr[1] = l_Rate[6];
        l_Curr[2] = l_Rate[7];
        l_Curr[3] = l_Rate[8];
        l_Curr[4] = l_Rate[9];
        l_Curr[5] = l_Rate[10];

        //l_Rate[0] = "1";
        //l_Rate[1] = "1.2";
        //l_Rate[2] = "10000";
        //l_Rate[3] = "4.2";
        //l_Curr[0] = "1";
        //l_Curr[1] = "4.27";
        //l_Curr[2] = "7";
        //l_Curr[3] = "1000";
        //l_Curr[4] = "100";

        if (l_BankCard == "SBU")
            l_BankCard = "GTC";

        if (l_Voucher == null || l_Voucher == "" || l_Voucher == "0")
            l_Voucher = l_Curr[1];


        //if (l_BankCard == "BLC")
        //{
        //    ls_Amt = (double.Parse(l_Amt) * double.Parse(l_Rate[3])) / double.Parse(l_Rate[1]);
        //}
        //else
        //{
        //    if (l_BankCard == "BTC")
        //    {
        //        ls_Amt = (double.Parse(l_Amt) * double.Parse(l_Rate[2])) / double.Parse(l_Rate[1]);
        //    }
        //}


        //if (l_BankCard == "GTC")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[1]));
        //}

        //if (l_BankCard == "AT")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[4]));
        //}

        //if (l_BankCard == "RT")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[5]));
        //}

        //if (l_BankCard == "USDT")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[3]));
        //}

        //if (l_BankCard == "BTC")
        //{
        //    ls_Amt = (double.Parse(l_Amt) / double.Parse(l_Voucher) / double.Parse(l_Rate[2]));
        //}

        ls_Amt = double.Parse(l_Amt);


        //if (a_Inst == "UpdateBalance" || a_Inst == "GetBalance" || a_Inst == "UseBalance" || a_Inst == "Transaction" || a_Inst == "Login")
        //{
        //    l_Str = icObj.QR_command(a_Inst, l_UserId, l_sign, l_BankCard, l_Subject, l_Amt);
        //}

        if (a_Inst == "THF")
        {
            string l_Data2 = "";
            string l_Data = "";
            string l_Data3 = l_sign;

            string l_Enc = "";

            try
            {
                l_Data2 = l_sign.Split('a')[0];
            }
            catch
            {
            }


            if (l_Data3 != "" && l_Data2 != "")
            {



                // l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.[Pass_2] from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + "  ", 14, l_Para);
                l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.eCoinE, A1.eCoinM , A1.eCoinZ, A1.eCoinP, A1.eCoinR, A1.[Pass_2], A1.ebv3, A1.[Name]  , A1.eCoinA, A1.eCoinI  from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + " ", 23, l_Para);
                if (l_Data == null || l_Data == "")
                    l_Str = @"{""res_code"":602,""status_message"":""Fail""}";
                else
                {

                    l_Secu = icObj.cf_MemberInfo(l_Para[12], l_Para[18], "", "");
                    if (l_Secu.Substring(0, 1) == "0")
                    {
                        l_Str = @"{""res_code"":633,""status_message"":""Close Reopen""}";
                    }
                    else
                    {
                        if (double.Parse(l_Amt) * 0.3 < double.Parse(l_Para[17]))
                        {
                            double l_Amt2 = double.Parse(l_Amt) * 0.3;
                            l_Voucher = l_Amt2.ToString(); 
                        }
                        else
                        {
                            l_Voucher = l_Para[17]; 
                        } 
                        
                        string l_Msg4 = "";
                        if (double.Parse(l_Para[16]) + double.Parse(l_Voucher) >= double.Parse(l_Amt))
                            l_Msg4 = icObj.f_Packac(l_sign, l_UserId, ls_Amt, l_Secu, "RT", double.Parse(l_Amt), double.Parse(l_Voucher));
                        else
                            l_Msg4 = icObj.fs_Lang("EN",    "Not Enough") + " AT";

                        if (l_Msg4.Substring(0, 2) == "**" || l_Msg4.Substring(0, 2) == "Ch")
                        {
                            //l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");

                            l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.eCoinE, A1.eCoinM , A1.eCoinZ, A1.eCoinP, A1.eCoinR, A1.[Pass_2], A1.ebv3, A1.[Name]  , A1.eCoinA, A1.eCoinI  from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + " ", 23, l_Para);
                            if (l_Data == null || l_Data == "")
                                l_Str = @"{""res_code"":612,""status_message"":""Fail""}";
                            else
                            {
                                l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                                l_QR = icObj.f_SSCTrans(l_Para[12], l_Para[18], ref  l_Secu);

                                l_Data2 = @"""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.') + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @""",""QR"":""" + l_QR + @""",""CLV"":" + icObj.VarStr(l_Para[21], 2) + @",""MLV"":" + icObj.VarStr(l_Para[22], 2) + @",""GTB"":" + l_Para[15] + @",""GTC"":" + l_Para[13] + @",""BTC"":" + l_Para[14] + @",""USDT"":" + l_Para[15] + @",""AT"":" + l_Para[16] + @",""RT"":" + l_Para[17] + @",""GTC_RATE"":" + l_Rate[1] + @",""BTC_RATE"":" + l_Rate[2] + @",""USDT_RATE"":" + l_Rate[3] + @",""AT_RATE"":" + l_Rate[4] + @",""RT_RATE"":" + l_Rate[5] + @",""MYR"":" + l_Curr[1] + @",""RMB"":" + l_Curr[2] + @",""THB"":" + l_Curr[3] + @",""NTD"":" + l_Curr[4] + @",""USD"":" + l_Curr[0] + @",""ebv3"":" + l_Para[19] + @",""invoice"":""" + l_Para[20] + @""",""Cash"":""0"",""CPU"":""" + icObj.GetSha256String(l_Para[20] + ":A" + l_Para[19]) + @"""";
                                l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""return_message"":""" + l_Msg4 + @""",""data"":{" + l_Data2 + @"}}";
                            }
                        }
                        else
                        {
                            l_Str = @"{""res_code"":603,""status_message"":""Fail""}";
                        }
                    }
                }
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }
    
    string API_FXX_HIS(string a_Inst, string l_UserId, string l_sign, string l_BankCard, string l_From, string l_To)
    {
        string[] l_Para = new string[56];
        string l_Str = "";
        string l_Secu = "";


        if (a_Inst == "HIS")
        {
            string l_Data2 = "";
            string l_Data = "";
            string l_Data3 = l_sign;

            string l_Enc = "";

            try
            {
                l_Data2 = l_sign.Split('a')[0];
            }
            catch
            {
            }


            if (l_Data3 != "" && l_Data2 != "")
            {
                if (l_From == "")
                    l_From = "1-Jan-2000";

                if (l_To == "")
                    l_To = "1-Jan-2100";

                l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.[Pass_2], A1.ebv3, A1.[Name] from wbw_Member A1, tb_Member A2 where  A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + "  ", 14, l_Para);
                if (l_Data == null || l_Data == "")
                    l_Str = @"{""res_code"":602,""status_message"":""Fail""}";
                else
                {
                    l_Secu = icObj.cf_MemberInfo(l_Para[12], l_Para[13], "", "");
                    //string l_Msg4 = icObj.f_Transac(l_sign, l_UserId, double.Parse(l_Amt), l_Secu);

                    int ll = 0;
                    int ll2 = 0;
                    string tbName = "tb_Member";
                    double l_Amt = 0;
                    double l_Amt2 = 0;
                    double l_QTY = 0;
                    string l_From_To = "";
                    
                    //string l_str = "select  ewalletid, trdate, takenote, moneyin , moneyout, memberin, memberout   from wbw_eCoinE where ( memberin = " + l_Para[0] + " or memberOut = " + l_Para[0] + " ) and TrDate >= #" + l_From  + "# and TrDate <= #" + l_To + "# Order by ewalletID desc ";
                    string l_str = "select  A1.ewalletid, A1.trdate, A1.takenote, A1.moneyin , A1.moneyout, A1.memberin, A1.memberout, B1.NickName, B2.NickName, A1.Bank, 0, 0, 0, 0, A1.trdid, A1.trhid, A1.trsid   from  wbw_eCoinA A1, wbw_Member B1, wbw_Member B2 where   B1.MemberID = A1.MemberIN AND B2.MemberID = A1.MemberOut AND ( A1.memberin = " + l_Para[0] + " or A1.memberOut = " + l_Para[0] + " ) and A1.TrDate >= #" + l_From + "# and A1.TrDate <= #" + l_To + "# Order by A1.ewalletID desc ";
                    
                    DataSet  ds = icObj.ReturnDs(l_str, tbName);
                    string l_ret = "";
                    double l_GTC = 0;
                    
                    for (ll = 0; ll < ds.Tables[tbName].Rows.Count && ll2 < 30; ll++)
                    {
                        ll2 = ll + 1;
                        //ds.Tables[tbName].Rows[ll][11].ToString()
                        if (ds.Tables[tbName].Rows[ll][5].ToString() == ds.Tables[tbName].Rows[ll][6].ToString())
                        {
                            l_Amt = double.Parse(icObj.VarStr(   ds.Tables[tbName].Rows[ll][4].ToString(), 2) ) * -1;
                            l_QTY = double.Parse( icObj.VarStr( ds.Tables[tbName].Rows[ll][12].ToString(), 2)) * -1;
                            l_Amt2 = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][10].ToString(), 2)) * -1;
                            if (l_Amt == 0)
                                l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][3].ToString()) * -1;

                            l_From_To = ds.Tables[tbName].Rows[ll][8].ToString();
                        }
                        else
                        {
                            if (ds.Tables[tbName].Rows[ll][5].ToString() == l_Para[0])
                            {
                                l_Amt = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][3].ToString(), 2));
                                l_QTY = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][12].ToString(), 2));
                                l_Amt2 = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][10].ToString(), 2));
                                if (l_Amt == 0)
                                    l_Amt = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][4].ToString(), 2));
                                l_From_To = ds.Tables[tbName].Rows[ll][7].ToString();
                            }

                            if (ds.Tables[tbName].Rows[ll][6].ToString() == l_Para[0])
                            {
                                l_Amt = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][4].ToString(), 2)) * -1;
                                l_QTY = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][12].ToString(), 2)) * -1;
                                l_Amt2 = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][10].ToString(), 2)) * -1;
                                if (l_Amt == 0)
                                    l_Amt = double.Parse(icObj.VarStr(ds.Tables[tbName].Rows[ll][3].ToString(), 2)) * -1;

                                l_From_To = ds.Tables[tbName].Rows[ll][8].ToString();
                            }
                        }

                        if (l_Amt2 == 0)
                        {
                            l_Amt2 = l_Amt;
                            l_QTY = l_Amt / 2.1;
                        }

                        l_GTC = l_Amt2 / l_QTY;
                        l_QTY = double.Parse(   icObj.VarStr(l_Amt.ToString() , 2) );
                        
                        if ( ds.Tables[tbName].Rows[ll][5].ToString() == l_Para[0])
                            l_From_To = ds.Tables[tbName].Rows[ll][8].ToString();
                        else
                            l_From_To = ds.Tables[tbName].Rows[ll][7].ToString();
                        
                        l_ret = l_ret + ", {\"num\":" + ll2 + ",\"id\":" + ds.Tables[tbName].Rows[ll][0].ToString() + ",  \"date\":\"" + ds.Tables[tbName].Rows[ll][1].ToString() + "\", \"description\":\"" + ds.Tables[tbName].Rows[ll][2].ToString() + "\", \"amount\":" + l_QTY + ", \"rate\":\"" + icObj.VarStr(   l_GTC.ToString()  , 4) + "\", \"qty\":\"" + l_Amt2 + " " + ds.Tables[tbName].Rows[ll][9].ToString() + "\", \"transaction\":" + ds.Tables[tbName].Rows[ll][14].ToString() + ds.Tables[tbName].Rows[ll][15].ToString() + ds.Tables[tbName].Rows[ll][16].ToString() + ds.Tables[tbName].Rows[ll][0].ToString() + ", \"settlement\":\"100%\", \"from_to\":\"" + l_From_To + "\"} ";

                        
                        //if (ds.Tables[tbName].Rows[ll][5].ToString() == ds.Tables[tbName].Rows[ll][6].ToString())
                        //{
                        //    l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][4].ToString()) * -1;
                        //    if (l_Amt == 0)
                        //        l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][3].ToString()) * -1;
                        //}
                        //else
                        //{
                        //    if (ds.Tables[tbName].Rows[ll][5].ToString() == l_Para[0])
                        //    {
                        //        l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][3].ToString());
                        //        if (l_Amt == 0)
                        //            l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][4].ToString());
                        //    }

                        //    if (ds.Tables[tbName].Rows[ll][6].ToString() == l_Para[0])
                        //    {
                        //        l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][4].ToString()) * -1;
                        //        if (l_Amt == 0)
                        //            l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][3].ToString()) * -1;
                        //    }
                        //}

                        //l_ret = l_ret + ", {\"num\":" + ll2 + ",\"id\":" + ds.Tables[tbName].Rows[ll][0].ToString() + ",  \"date\":\"" + ds.Tables[tbName].Rows[ll][1].ToString() + "\", \"description\":\"" + ds.Tables[tbName].Rows[ll][2].ToString() + "\", \"amount\":" + l_Amt + ", \"rate\":1" + l_Amt + ", \"qty\":\"2" + l_Amt + " GTC\", \"transaction\":3" + ds.Tables[tbName].Rows[ll][0].ToString() + ", \"settlement\":\"100%\", \"from_to\":\"Testing\"} ";

                    }
                    l_ret = l_ret + "  ";
                    
                        l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                      //  l_Data2 = @"""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.') + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @"""";
                        l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""return_message"":""" + ds.Tables[tbName].Rows.Count.ToString() + @""",""data"":[" + l_ret.Substring(1)  + @"]}";

                }
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }



    string API_FXX_MLV(string a_Inst, string l_UserId, string l_sign, string l_BankCard, string l_From, string l_To)
    {
        string[] l_Para = new string[56];
        string l_Str = "";
        string l_Secu = "";


        if (a_Inst == "MLV")
        {
            string l_Data2 = "";
            string l_Data = "";
            string l_Data3 = l_sign;

            string l_Enc = "";

            try
            {
                l_Data2 = l_sign.Split('a')[0];
            }
            catch
            {
            }


            if (l_Data3 != "" && l_Data2 != "")
            {
                if (l_From == "")
                    l_From = "1-Jan-2000";

                if (l_To == "")
                    l_To = "1-Jan-2100";

                l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.[Pass_2], A1.ebv3, A1.[Name] from wbw_Member A1, tb_Member A2 where  A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + "  ", 14, l_Para);
                if (l_Data == null || l_Data == "")
                    l_Str = @"{""res_code"":602,""status_message"":""Fail""}";
                else
                {
                    l_Secu = icObj.cf_MemberInfo(l_Para[12], l_Para[13], "", "");
                    //string l_Msg4 = icObj.f_Transac(l_sign, l_UserId, double.Parse(l_Amt), l_Secu);

                    int ll = 0;
                    int ll2 = 0;
                    string tbName = "tb_Member";
                    double l_Amt = 0;
                    double l_Amt2 = 0;
                    double l_QTY = 0;
                    string l_From_To = "";

                    //string l_str = "select  ewalletid, trdate, takenote, moneyin , moneyout, memberin, memberout   from wbw_eCoinE where ( memberin = " + l_Para[0] + " or memberOut = " + l_Para[0] + " ) and TrDate >= #" + l_From  + "# and TrDate <= #" + l_To + "# Order by ewalletID desc ";
                    string l_str = "select  A1.ewalletid, A1.trdate, A1.takenote, A1.moneyin , A1.moneyout, A1.memberin, A1.memberout, B1.NickName, B2.NickName, A1.Bank, 0, 0, 0, 0, A1.trdid, A1.trhid, A1.trsid   from  wbw_eCoinI A1, wbw_Member B1, wbw_Member B2 where    B1.MemberID = A1.MemberIN AND B2.MemberID = A1.MemberOut AND ( A1.memberin = " + l_Para[0] + " or A1.memberOut = " + l_Para[0] + " ) and A1.TrDate >= #" + l_From + "# and A1.TrDate <= #" + l_To + "# Order by A1.ewalletID desc ";

                    DataSet ds = icObj.ReturnDs(l_str, tbName);
                    string l_ret = "";
                    double l_GTC = 0;

                    for (ll = 0; ll < ds.Tables[tbName].Rows.Count && ll2 < 30; ll++)
                    {
                        ll2 = ll + 1;
                        //ds.Tables[tbName].Rows[ll][11].ToString()
                        if (ds.Tables[tbName].Rows[ll][5].ToString() == ds.Tables[tbName].Rows[ll][6].ToString())
                        {
                            l_Amt = double.Parse(icObj.VarStr(ds.Tables[tbName].Rows[ll][4].ToString(), 2)) * -1;
                            l_QTY = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][12].ToString(), 2)) * -1;
                            l_Amt2 = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][10].ToString(), 2)) * -1;
                            if (l_Amt == 0)
                                l_Amt = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][3].ToString(), 2)) * -1;

                            l_From_To = ds.Tables[tbName].Rows[ll][8].ToString();
                        }
                        else
                        {
                            if (ds.Tables[tbName].Rows[ll][5].ToString() == l_Para[0])
                            {
                                l_Amt = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][3].ToString(), 2));
                                l_QTY = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][12].ToString(), 2));
                                l_Amt2 = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][10].ToString(), 2));
                                if (l_Amt == 0)
                                    l_Amt = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][4].ToString(), 2));
                                l_From_To = ds.Tables[tbName].Rows[ll][7].ToString();
                            }

                            if (ds.Tables[tbName].Rows[ll][6].ToString() == l_Para[0])
                            {
                                l_Amt = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][4].ToString(), 2)) * -1;
                                l_QTY = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][12].ToString(), 2)) * -1;
                                l_Amt2 = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][10].ToString(), 2)) * -1;
                                if (l_Amt == 0)
                                    l_Amt = double.Parse(icObj.VarStr( ds.Tables[tbName].Rows[ll][3].ToString(), 2)) * -1;

                                l_From_To = ds.Tables[tbName].Rows[ll][8].ToString();
                            }
                        }

                        if (l_Amt2 == 0)
                        {
                            l_Amt2 = l_Amt;
                            l_QTY = l_Amt / 2.1;
                        }

                        l_GTC = l_Amt2 / l_QTY;

                        l_QTY = double.Parse ( icObj.VarStr(   l_Amt.ToString()  , 2) ) ;
                        
                        if (ds.Tables[tbName].Rows[ll][5].ToString() == l_Para[0])
                            l_From_To = ds.Tables[tbName].Rows[ll][8].ToString();
                        else
                            l_From_To = ds.Tables[tbName].Rows[ll][7].ToString();

                        l_ret = l_ret + ", {\"num\":" + ll2 + ",\"id\":" + ds.Tables[tbName].Rows[ll][0].ToString() + ",  \"date\":\"" + ds.Tables[tbName].Rows[ll][1].ToString() + "\", \"description\":\"" + ds.Tables[tbName].Rows[ll][2].ToString() + "\", \"amount\":" + l_QTY + ", \"rate\":\"" + icObj.VarStr(l_GTC.ToString(), 4) + "\", \"qty\":\"" + l_Amt2 + " " + ds.Tables[tbName].Rows[ll][9].ToString() + "\", \"transaction\":" + ds.Tables[tbName].Rows[ll][14].ToString() + ds.Tables[tbName].Rows[ll][15].ToString() + ds.Tables[tbName].Rows[ll][16].ToString() + ds.Tables[tbName].Rows[ll][0].ToString() + ", \"settlement\":\"100%\", \"from_to\":\"" + l_From_To + "\"} ";


                        //if (ds.Tables[tbName].Rows[ll][5].ToString() == ds.Tables[tbName].Rows[ll][6].ToString())
                        //{
                        //    l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][4].ToString()) * -1;
                        //    if (l_Amt == 0)
                        //        l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][3].ToString()) * -1;
                        //}
                        //else
                        //{
                        //    if (ds.Tables[tbName].Rows[ll][5].ToString() == l_Para[0])
                        //    {
                        //        l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][3].ToString());
                        //        if (l_Amt == 0)
                        //            l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][4].ToString());
                        //    }

                        //    if (ds.Tables[tbName].Rows[ll][6].ToString() == l_Para[0])
                        //    {
                        //        l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][4].ToString()) * -1;
                        //        if (l_Amt == 0)
                        //            l_Amt = double.Parse(ds.Tables[tbName].Rows[ll][3].ToString()) * -1;
                        //    }
                        //}

                        //l_ret = l_ret + ", {\"num\":" + ll2 + ",\"id\":" + ds.Tables[tbName].Rows[ll][0].ToString() + ",  \"date\":\"" + ds.Tables[tbName].Rows[ll][1].ToString() + "\", \"description\":\"" + ds.Tables[tbName].Rows[ll][2].ToString() + "\", \"amount\":" + l_Amt + ", \"rate\":1" + l_Amt + ", \"qty\":\"2" + l_Amt + " GTC\", \"transaction\":3" + ds.Tables[tbName].Rows[ll][0].ToString() + ", \"settlement\":\"100%\", \"from_to\":\"Testing\"} ";

                    }
                    l_ret = l_ret + "  ";

                    l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                    //  l_Data2 = @"""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.') + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @"""";
                    l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""return_message"":""" + ds.Tables[tbName].Rows.Count.ToString() + @""",""data"":[" + l_ret.Substring(1) + @"]}";

                }
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }

    

    string API_FXX_BAL(string a_Inst,   string l_sign )
    {
        string[] l_Para2 = new string[56];
        string l_Data1 = "";
        
        string[] l_Para = new string[56];
        string l_Str = "";

        string[] l_Curr = new string[56];
        string[] l_Rate = new string[56];

        string l_Str1 = icObj.SQL_GetData(0, "Select  '1;' & Plan_Setting from wbw_plan where plan_code = 'EXRATE' ", 1, icObj.l_temp);
        l_Str1 = l_Str1 + ";;;;;;;;;";
        l_Rate = l_Str1.Split(';');
        l_Curr[0] = "1";
        l_Curr[1] = l_Rate[6];
        l_Curr[2] = l_Rate[7];
        l_Curr[3] = l_Rate[8];
        l_Curr[4] = l_Rate[9];
        l_Curr[5] = l_Rate[10]; 
        
        //l_Rate[0] = "1";
        //l_Rate[1] = "1.2";
        //l_Rate[2] = "10000";
        //l_Rate[3] = "4.2";
        //l_Curr[0] = "1";
        //l_Curr[1] = "4.27";
        //l_Curr[2] = "7";
        //l_Curr[3] = "1000";
        //l_Curr[4] = "100";

        if (a_Inst == "BAL")
        {
            string l_Data2 = "";
            string l_Data = "";
            
            string l_QR = "";
            string l_Secu = "";


            string l_Data3 = l_sign;

            string l_Enc = "";

            try
            {
                l_Data2 = l_sign.Split('a')[0];
            }
            catch
            {
            }


            if (l_Data3 != "" && l_Data2 != "")
            {
                l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.eCoinE, A1.eCoinM , A1.eCoinZ, A1.eCoinP, A1.eCoinR, A1.[Pass_2], A1.ebv3, A1.[Name]  , A1.eCoinA, A1.eCoinI  from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + " ", 23, l_Para);
                if (l_Data == null || l_Data == "")
                    l_Str = @"{""res_code"":602,""status_message"":""Fail""}";
                else
                {
                    l_Data1 = icObj.SQL_GetData(0, "Select A2.Img1,  A2.Img2  from wbw_Member A1, wbw_ID A2 where A1.ICNum = A2.IcNumber and  A1.Memberid = " + l_Data + " and A2.[Status] in ('A', 'C') ", 2, l_Para2);

                    if (l_Para2[0] == "" || l_Para2[1] == "" || l_Para2[0] == null || l_Para2[1] == null)
                        l_Data1 = "";
                    else
                        l_Data1 = "Member";
                    
                    l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                    l_QR = l_sign; // icObj.f_SSCTrans(l_Para[0], l_sign, ref  l_Secu);
                    l_Data2 = @"""Goto"":""" + l_Data1 + @""",""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.') + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @""",""QR"":""" + l_QR + @""",""CLV"":" + icObj.VarStr(l_Para[21], 2) + @",""MLV"":" + icObj.VarStr(l_Para[22], 2) + @",""GTB"":" + l_Para[15] + @",""GTC"":" + l_Para[13] + @",""BTC"":" + l_Para[14] + @",""USDT"":" + l_Para[15] + @",""AT"":" + l_Para[16] + @",""RT"":" + l_Para[17] + @",""GTC_RATE"":" + l_Rate[1] + @",""BTC_RATE"":" + l_Rate[2] + @",""USDT_RATE"":" + l_Rate[3] + @",""AT_RATE"":" + l_Rate[4] + @",""RT_RATE"":" + l_Rate[4] + @",""MYR"":" + l_Curr[1] + @",""RMB"":" + l_Curr[2] + @",""THB"":" + l_Curr[3] + @",""NTD"":" + l_Curr[4] + @",""USD"":" + l_Curr[0] + @",""ebv3"":" + l_Para[19] + @",""invoice"":""" + l_Para[20] + @""",""Cash"":""0"",""CPU"":""" + icObj.GetSha256String(l_Para[20] + ":A" + l_Para[19]) + @"""";
                    l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""data"":{" + l_Data2 + @"}}";
                }
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }



    string API_FXX_DEAL(string a_Inst, string l_sign, string l_Supplier, string l_Amount )
    {
        string[] l_Para = new string[56];
        string[] l_Para2 = new string[56];
        string l_Str = "";

        string[] l_Curr = new string[56];
        string[] l_Rate = new string[56];
        int l_InvID = 1;

        
        string l_Str1 = icObj.SQL_GetData(0, "Select  '1;' & Plan_Setting from wbw_plan where plan_code = 'EXRATE' ", 1, icObj.l_temp);
        l_Str1 = l_Str1 + ";;;;;;;;;";
        l_Rate = l_Str1.Split(';');
        l_Curr[0] = "1";
        l_Curr[1] = l_Rate[6];
        l_Curr[2] = l_Rate[7];
        l_Curr[3] = l_Rate[8];
        l_Curr[4] = l_Rate[9];
        l_Curr[5] = l_Rate[10];

        //l_Rate[0] = "1";
        //l_Rate[1] = "1.2";
        //l_Rate[2] = "10000";
        //l_Rate[3] = "4.2";
        //l_Curr[0] = "1";
        //l_Curr[1] = "4.27";
        //l_Curr[2] = "7";
        //l_Curr[3] = "1000";
        //l_Curr[4] = "100";

        if (a_Inst == "DEAL")
        {
            string l_Data2 = "";
            string l_Data = "";

            string l_QR = "";
            string l_Secu = "";


            string l_Data3 = l_sign;

            string l_Enc = "";

            try
            {
                l_Data2 = l_sign.Split('a')[0];
            }
            catch
            {
            }


            if (l_Data3 != "" && l_Data2 != "")
            {
                l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.eCoinE, A1.eCoinM , A1.eCoinZ, A1.eCoinP, A1.eCoinR, A1.[Name], A1.ebv3, A1.[Name]  , A1.eCoinA, A1.eCoinI from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.MemberID = " + l_Data2 + " ", 23, l_Para);
                if (l_Data == null || l_Data == "")
                    l_Str = @"{""res_code"":602,""status_message"":""Fail""}";
                else
                {

                    if (l_Para[19] == null || l_Para[19] == "")
                        l_InvID = 1;
                    else
                        l_InvID = int.Parse(l_Para[19]) + 1;
                    
                    
                    l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                    l_QR = l_sign; // icObj.f_SSCTrans(l_Para[0], l_sign, ref  l_Secu);
                    l_Data2 = @"""MerchantKey"":""apple"",""MerchantCode"":""M00003"",""Cash"":""70"",""RefNo"":""" + l_Para[18] + @":A" + l_InvID.ToString() + @""",""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.') + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @""",""QR"":""" + l_QR + @""",""CLV"":" + icObj.VarStr(l_Para[21], 2) + @",""MLV"":" + icObj.VarStr(l_Para[22], 2) + @",""GTB"":" + l_Para[15] + @",""GTC"":" + l_Para[13] + @",""BTC"":" + l_Para[14] + @",""USDT"":" + l_Para[15] + @",""AT"":" + l_Para[16] + @",""RT"":" + l_Para[17] + @",""GTC_RATE"":" + l_Rate[1] + @",""BTC_RATE"":" + l_Rate[2] + @",""USDT_RATE"":" + l_Rate[3] + @",""AT_RATE"":" + l_Rate[4] + @",""RT_RATE"":" + l_Rate[4] + @",""MYR"":" + l_Curr[1] + @",""RMB"":" + l_Curr[2] + @",""THB"":" + l_Curr[3] + @",""NTD"":" + l_Curr[4] + @",""USD"":" + l_Curr[0] + @",""ebv3"":" + l_Para[19] + @",""invoice"":""" + l_Para[20] + @""",""CPU"":""" + icObj.GetSha256String(l_Para[20] + ":A" + l_Para[19]) + @"""";
                    l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""data"":{" + l_Data2 + @"}}";
                }
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }
        
    
    
    
    string API_FXX_Fast(string a_Inst, string l_UserId, string l_sign, string l_BankCard, string l_Subject, string l_Amt)
    {
        string[] l_Para = new string[56];

        string l_Data1 = "";
        string[] l_Para2 = new string[56];

        string[] l_Curr = new string[56];
        string[] l_Rate = new string[56];

        string l_Str1 = icObj.SQL_GetData(0, "Select  '1;' & Plan_Setting from wbw_plan where plan_code = 'EXRATE' ", 1, icObj.l_temp);
        l_Str1 = l_Str1 + ";;;;;;;;;";
        l_Rate = l_Str1.Split(';');
        l_Curr[0] =  "1";
        l_Curr[1] = l_Rate[6];
        l_Curr[2] = l_Rate[7];
        l_Curr[3] = l_Rate[8];
        l_Curr[4] = l_Rate[9];
        l_Curr[5] = l_Rate[10]; 
                
        //l_Rate[0] =  "1";
        //l_Rate[1] =  "1.2";
        //l_Rate[2] =  "10000";
        //l_Rate[3] =  "4.2";
        //l_Curr[0] =  "1";
        //l_Curr[1] =  "4.27";
        //l_Curr[2] =  "7";
        //l_Curr[3] =  "1000";
        //l_Curr[4] =  "100";
 
        string l_Str = "";

        //if (a_Inst == "UpdateBalance" || a_Inst == "GetBalance" || a_Inst == "UseBalance" || a_Inst == "Transaction" || a_Inst == "Login")
        //{
        //    l_Str = icObj.QR_command(a_Inst, l_UserId, l_sign, l_BankCard, l_Subject, l_Amt);
        //}

        if (a_Inst == "QRC")
        {
            if (l_sign.Length < 3)
                l_sign = "pass1234";
            string l_Data2 = "";
            string l_Data = "";
            string l_Data3 = icObj.xxa_DecryptURL2(l_sign, "") + ";;;;;;;";
            string l_QR = "";
            string l_Secu = "";
            
            string l_Enc = "";
            if (l_UserId != "")
            {
                l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName, A1.eCoinE, A1.eCoinM , A1.eCoinZ , A1.eCoinP, A1.eCoinR, A1.[Pass_2], A1.ebv3 + 1, A1.[name] , A1.eCoinA, A1.eCoinI from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.[nickname] = '" + l_UserId + "' and A1.pass_2 = '" + l_sign + "' ", 23, l_Para);
                if (l_Data == null || l_Data == "")
                    l_Str = @"{""res_code"":602,""status_message"":""Login Fail""}";
                else
                {
                    l_Data1 = icObj.SQL_GetData(0, "Select A2.Img1,  A2.Img2  from wbw_Member A1, wbw_ID A2 where A1.ICNum = A2.IcNumber and  A1.Memberid = " + l_Data + " and A2.[Status] in ('A', 'C') ", 2, l_Para2);

                    if (l_Para2[0] == "" || l_Para2[1] == "" || l_Para2[0] == null || l_Para2[1] == null)
                        l_Data1 = "";
                    else
                        l_Data1 = "Member";
                    
                    l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                    l_QR = icObj.f_SSCTrans(l_UserId, l_sign,ref  l_Secu);
                    l_Data2 = @"""Goto"":""" + l_Data1 + @""",""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.') + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @""",""dual"":""" + icObj.lG_USD + @""",""QR"":""" + l_QR + @""",""CLV"":" + icObj.VarStr(l_Para[21], 2) + @",""MLV"":" + icObj.VarStr(l_Para[22], 2) + @",""GTB"":" + l_Para[15] + @",""GTC"":" + l_Para[13] + @",""BTC"":" + l_Para[14] + @",""USDT"":" + l_Para[15] + @",""AT"":" + l_Para[16] + @",""RT"":" + l_Para[17] + @",""GTC_RATE"":" + l_Rate[1] + @",""BTC_RATE"":" + l_Rate[2] + @",""USDT_RATE"":" + l_Rate[3] + @",""AT_RATE"":" + l_Rate[4] + @",""RT_RATE"":" + l_Rate[5] + @",""MYR"":" + l_Curr[1] + @",""RMB"":" + l_Curr[2] + @",""THB"":" + l_Curr[3] + @",""NTD"":" + l_Curr[4] + @",""USD"":" + l_Curr[0] + @",""ebv3"":" + l_Para[19] + @",""invoice"":""" + l_Para[20] + @""",""Cash"":""0"",""CPU"":""" + icObj.GetSha256String(l_Para[20] + ":A" + l_Para[19]) + @"""";
                    l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""data"":{" + l_Data2 + @"}}";
                }
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Login Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }
        
    string API_QR_Fast(string a_Inst, string l_UserId, string l_sign, string l_BankCard, string l_Subject, string l_Amt)
    {
        string[] l_Para = new string[56]; 
        string l_Str = "";

        //if (a_Inst == "UpdateBalance" || a_Inst == "GetBalance" || a_Inst == "UseBalance" || a_Inst == "Transaction" || a_Inst == "Login")
        //{
        //    l_Str = icObj.QR_command(a_Inst, l_UserId, l_sign, l_BankCard, l_Subject, l_Amt);
        //}

        if (a_Inst == "GoIn")
        {
            string l_Data2 = "";
            string l_Data = "";
            string l_Data3 = icObj.xxa_DecryptURL2(l_sign, "") + ";;;;;;;";

            string l_Enc = "";
            if (l_Data3 != "")
            {
                l_Data = icObj.SQL_GetData(0, "Select A1.MemberID, A1.[password], A1.icnum,  A1.truename, A1.phonecode, A1.emails, A1.eCoinA, A1.eCoinI, A2.Address, A2.PostCode, A2.City, A1.Country, A1.NickName from wbw_Member A1, tb_Member A2 where A1.MemberID = A2.MemberID and  A1.[nickname] = '" + l_Data3.Split(';')[0] + "' and A1.pass_2 = '" + l_Data3.Split(';')[1] + "' ", 13, l_Para);
                if (l_Data == null || l_Data == "")
                    l_Str = @"{""res_code"":602,""status_message"":""Fail""}";
                else
                {
                    l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                    l_Data2 = @"""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @""",""myname"":""" + l_Para[3] + @""",""nickname"":""" + l_Para[12] + @""",""address"":""" + l_Para[8].Replace(',', '.')  + @". " + l_Para[9] + @" " + l_Para[10] + @""",""country"":""" + l_Para[11] + @"""";
                    l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""data"":{" + l_Data2 + @"}}";
                }
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }


    // API_QR_Payment(l_Command, l_username, l_sign, l_lang, l_country, amount, l_rva, l_cash, l_country, l_sponsor_id, l_voucher, l_qtr);
    string API_QR_Payment(string a_Inst, string l_UserId, string l_sign, string l_Lang, string l_Voucher, string l_Amt, string l_RVA, string l_Cash, string l_Country, string l_SponsorID, string l_Shipping, string l_Qtr)
    {
        string[] l_Para = new string[56];
        string l_Str = "";
        string FilePath = "";// Server.MapPath("APA/");
        
        if (a_Inst == "CLV")
        {
            string l_Data2 = "";
            string l_Data = "";
            string l_Data3 = icObj.xxa_DecryptURL2(l_sign, "") + ";;;;;;;";
            string ls_Invoice = "";
            string l_Enc = "";
            
            if ( l_Shipping  == "")
                l_Shipping  = "0";
            
            if (l_Data3 != "")
            {
                ls_Invoice = icObj.f_MakePayment(FilePath, l_Lang, "M", int.Parse (  l_Voucher) , l_UserId, l_Country, l_SponsorID, double.Parse(l_Amt), double.Parse(l_Cash), double.Parse(l_RVA), double.Parse(l_Shipping ),   l_Qtr, "WEB");
                if (ls_Invoice.Length < 8 )
                    l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_sign + @""",""data"":{""transaction_id"":" + ls_Invoice + @"}}";
                else
                    l_Str = @"{""res_code"":604,""status_message"":""Fail"",""sign"":""" + l_sign + @""",""data"":{""transaction_id"":" + ls_Invoice + @"}}";
                
                //l_Data = icObj.SQL_GetData(0, "Select MemberID, [password], icnum,  truename, phonecode, emails, eCoinA, eCoinI from wbw_Member where [nickname] = '" + l_Data3.Split(';')[0] + "' and pass_2 = '" + l_Data3.Split(';')[1] + "' ", 8, l_Para);
                //if (l_Data == null || l_Data == "")
                //    l_Str = @"{""res_code"":602,""status_message"":""Fail""}";
                //else
                //{
                //    l_Enc = icObj.xxa_EncryptURL2(l_Para[0] + ";" + l_Para[1] + ";" + icObj.ICDateTime(0) + ";", "");
                //    l_Data2 = @"""member_name"":""" + l_Para[3] + @""",""ic_number"":""" + l_Para[2] + @""",""phone"":""" + l_Para[4] + @""",""email"":""" + l_Para[5] + @"""";
                //    l_Str = @"{""res_code"":404,""status_message"":""SUCCESS"",""sign"":""" + l_Enc + @""",""data"":{" + l_Data2 + @"}}";
                //}
            }
            else
                l_Str = @"{""res_code"":601,""status_message"":""Fail""}";
        }
        else
        {
            l_Str = @"{""res_code"":609,""status_message"":""Invalid Command""}";
        }
        return l_Str;
    }
    
        
    string API_fx_Fast(string a_Inst, string l_UserId, string l_sign, string l_BankCard, string l_Amt)
    {
        string l_Str = "";
        string l_Info = @",""data"":{";
        string l_Info2 = @"{""status_code"":200,""status_message"":""SUCCESS"",";

        if (a_Inst == "UpdateBalance" || a_Inst == "GetBalance")
        {
            l_Str = fc_command(a_Inst, l_UserId, l_sign, l_BankCard, l_Amt);
        }
        return l_Str;
    }

    string fc_command(string l_Command, string l_UserId, string l_Sign, string l_BankCard, string l_Amt)
    {
        string l_Str = "";
        string l_Info = @",""data"":{";
        string l_Info2 = @"{""status_code"":200,""status_message"":""SUCCESS"",";
        string l_Bal = "56";
        string[] l_Para = new string[45];

        string New_sign = "";
        double ld_Bal = 0;
         string l_Token ="";
        double ld_Amt = 0;
        string l_Coin = "eCoinE";
        string l_Ret = "";
        string l_Subject = "From FX";
        string l_MemberID = "";
        
        try
        {
            if (l_UserId.Length > 0 && l_Sign.Length > 0 && l_BankCard == "-1"  && (l_Command == "UpdateBalance" || l_Command == "GetBalance" ))
            {

                l_Bal = icObj.SQL_GetData(0, "Select eCoinE, [password], MemberID from wbw_Member where trim(emails) = '" + l_UserId + "'", 3, l_Para);
                l_MemberID = l_Para[2];
                 
                
                if ( l_Bal == null || l_Bal == "" )
                {
                    l_Info2 = @"{""status_code"":404,""status_message"":""Username Not Found""}";   
                }
                else
                {
                    ld_Bal = double.Parse(l_Bal);  
                    New_sign = icObj.md5_sign(l_UserId, l_Para[1], "");
                    if (l_Sign == New_sign )
                    {
                        if (l_Command == "UpdateBalance")
                        {

                            if (l_Amt.Length > 0)
                            {
                                l_Token = "W" + icObj.GetLogID("W");
                                ld_Amt = double.Parse(l_Amt);
                                if (ld_Amt < 0)
                                    l_Ret = icObj.f_Remove2(l_Coin, -ld_Amt, int.Parse(l_MemberID), "***", "Withdraw", 0, -ld_Amt, l_Coin, "F", "");
                                else
                                    l_Ret = icObj.cf_Insert("EN", "REMIT+", l_Coin, l_Coin, icObj.ICDateTime(0), long.Parse(l_MemberID), "", 8, "***", "", 0, 1, ld_Amt, l_Subject, "", l_Token, ld_Amt, 1, 0);



                                ld_Bal = ld_Amt + ld_Bal;
                                l_Info2 = l_Info2 + @"""result"":{""NewBalance"":" + ld_Bal.ToString()  + @",""bankcard"":" + l_BankCard + @",""username"":""" + l_UserId + @"""}" + "}";
                            }
                            else
                            {
                                l_Info2 = @"{""status_code"":205,""status_message"":""Format Error JSON""}";
                            }
                            
                        }
                        else
                        {

                            l_Info2 = l_Info2 + @"""result"":{""Balance"":" + l_Bal + @",""bankcard"":" + l_BankCard + @",""username"":""" + l_UserId + @"""}" + "}";
                        }
                    }
                    else
                    {
                        l_Info2 = @"{""status_code"":404,""status_message"":""Username Not Found""}";  
                    }                   
                }

            }
            else
            {
                l_Info2 = @"{""status_code"":205,""status_message"":""Format Error JSON""}";
            }
        }
         catch
        {
            l_Info2 = @"{""status_code"":205,""status_message"":""Format Error JSON""}";
         }

         l_Str = l_Info2;
        return l_Str ;
    }
    
    string API_fc_Fast(string a_Inst, string l_UserId, string l_Password, string l_Token, string l_Amt, string l_Tr, string l_Out_Trade, string l_mt4, string l_currencyid, string l_trcode, string l_remark, string l_bal, string l_ac1, string l_ab1, string l_ac2, string l_ab2, string l_member_name, string l_sponsor_id, string l_ic_number, string l_gender, string l_email, string l_phone, string l_country, string l_address, string l_date_from , string l_date_to)
    {
        string l_Str = "";
        string l_Info = @",""data"":{";


        if (a_Inst == "MHistory")
            l_Str = fc_command_MH(a_Inst, l_Token, l_date_from , l_date_to );
        else
        {
            if (a_Inst == "SetLogin")
            {
                
                l_Str = API_W_fc_Member(a_Inst, l_UserId, l_Password, l_member_name, l_sponsor_id, l_ic_number, l_gender, l_email, l_phone, l_country, l_address, l_ac1 , l_ac2 );

            }
            else
            {
                if (a_Inst == "MCash" || a_Inst == "MLogin" || a_Inst == "SLogin" || a_Inst == "MT4")
                    l_Str = API_W_fc_command_L(a_Inst, l_UserId, l_Password);
                else
                {
                    if (a_Inst == "SetMT4")
                        l_Str = API_W_fc_command_MT4(a_Inst, l_UserId, l_Password, l_ac1, l_ab1, l_ac2, l_ab2);
                    else
                    {
                        if (a_Inst == "MTrans" || a_Inst == "BookA" || a_Inst == "BookB" || a_Inst == "RTrans")
                            l_Str = icObj.API_MT4(a_Inst, l_UserId, l_Password, l_Token, l_Amt, l_Tr, l_Out_Trade, l_mt4, l_currencyid, l_trcode, l_remark, l_bal);
                        else
                            l_Str = icObj.API_fc_Fast(a_Inst, l_UserId, l_Password, l_Token, l_Amt, l_Tr, l_Out_Trade);
                    }
                }
            }
        }
        return l_Str;
    }



    string API_W_fc_command_MT4(string a_Inst, string a_User, string a_Pass, string l_ac1 , string l_ab1 , string l_ac2, string l_ab2  )
    {
        string l_Str = "";
        string l_Info = @",""data"":{";
        int l_GoodM = 0;



        if (a_Inst == "SetMT4")
        {
            l_Info = l_Info + fn_SetMT4(a_User, a_Pass, l_ac1, l_ab1 , l_ac2, l_ab2   );
            if (l_Info.Length < 20)
            {
                l_Str = "{" + icObj.API_fc_Error(100) + "}";
            }
            else
                l_Str = "{" + icObj.API_fc_Error(203) + l_Info + "}";

        }
        
        return l_Str;
    }



    string f_assign_New( string l_Loginid, string l_Password, string l_Store, string l_AB, string a_SponsorID, string a_PlacementID, string a_FullName, string a_ICNum, string a_Gender, string a_EMail, string a_Phone, string a_Country, string a_City, string a_Address, string l_Position, string a_Code, string a_NickName, string a_Msn, string a_Fax, string a_Bank, string a_Swift, string a_Acc, string a_ac1, string a_ac2)
    {

        string l_Msg = "";

        string l_Return = "";
        string l_SQLw;
        long l_Token = 0;
        string l_SQL = "";
        string l_DirectStr = "";
        string[] l_para = new string[80];


        //New Member Password Setting
        string ls_Token = "M" + icObj.GetLogID("M"); 
        string l_IC = "885566677" + a_ICNum.Trim();
        l_IC = l_IC.Substring(l_IC.Length - 6, 6);


        string ls_Country = icObj.fs_Country(a_Country);

        l_para[0] = "";
        l_para[1] = a_Code.Trim();
        l_para[2] = a_Gender;
        l_para[3] = l_Password;
        l_para[4] = a_FullName;
        l_para[5] = l_Password;
        l_para[6] = "";  //Answer;
        l_para[7] = a_Phone;
        l_para[8] = a_EMail;
        l_para[9] = a_City;
        l_para[10] = a_Address;
        l_para[11] = ""; // txtPostCode.Text.Trim();
        l_para[12] = icObj.ICDateTime(0);
        l_para[32] = ls_Country;
        l_para[15] = l_AB;
        l_para[17] = a_NickName.Trim();
        l_para[18] = a_Msn.Trim();
        l_para[19] = a_Fax.Trim();
        l_para[20] = a_Bank.Trim();   //txtBank.Text.Trim();
        l_para[21] = a_Acc.Trim();
        l_para[22] = a_ICNum;
        l_para[25] = ls_Token.Trim().Substring(1);



        string[] l_para2 = new string[11];
        string l_Direct = "";
        int l_BV = 0;


        l_DirectStr = a_SponsorID.Trim();
        l_BV = icObj.fs_Pack_BV(l_Position);
        l_para[23] = l_BV.ToString();
        l_para[24] = l_Position;

        l_Token = icObj.CheckLogID(ls_Token.Substring(0, 1), long.Parse(ls_Token.Substring(1)));


        if (l_Token == 0)
        {


            string ls_MMID = icObj.SQL_GetData(0, "Select InPlanC from wbw_Member where [NickName] = '" + a_NickName.Trim() + "' ", 1, icObj.l_temp);
            if (ls_MMID == null || ls_MMID == "")
            {
            }
            else
            {
                l_Msg = "This User ID been used on " + ls_MMID;
                return l_Msg;
            };


            int G_Int_MemberID = 0;
            string l_PV = "";
            string l_Code = "";
            string l_DirectID = a_PlacementID;

            string l_Str = ""; // icObj.cf_Member("8", "***", a_SponsorID.Trim(), l_para, ref G_Int_MemberID, ref l_PV, ref l_Code, true, "", ref  l_DirectID, l_AB);


            if ((l_Code == null || l_Code == "") && l_Str == "")
            {
                l_Msg = "System Fail to register the New Member.";
                return l_Msg;
            }
            else
            {
                icObj.f_AddMT4(G_Int_MemberID, a_NickName, a_ac1, "");
               // icObj.f_AddMT4(G_Int_MemberID, a_NickName , a_ac1 , "A");
               // icObj.f_AddMT4(G_Int_MemberID, a_NickName, a_ac2, "B");
                
                l_Msg = l_Str;
                return l_Msg;
            }
        }
        return l_Msg;
    }
    
    string API_W_fc_Member(string a_Inst, string a_User, string a_Pass, string l_member_name, string l_sponsor_id, string l_ic_number, string l_gender, string l_email, string l_phone, string l_country, string l_address, string l_ac1, string l_ac2)
    {
        string l_Str = "";
        string l_Info = @",""data"":{";
        int l_GoodM = 0;


            //l_Info = l_Info + fn_SetMT4(a_User, a_Pass, l_ac1, l_ab1, l_ac2, l_ab2);
        l_Info = f_assign_New(a_User, a_Pass,  "EDI", "C", l_sponsor_id, l_sponsor_id, l_member_name, l_ic_number, l_gender, l_email, l_phone, l_country, "", l_address, "0", "ASSIGN", a_User, "", "", "", "", "", l_ac1, l_ac2 );
        
            if (l_Info.Length < 5)
            {
                l_Str = "{" + icObj.API_fc_Error(100) + "}";
            }
            else
                l_Str = "{" + icObj.API_fc_Error(203) + "{ \"fail\" : \"" + l_Info + "\"}}";

        return l_Str;
    }
    
    
    string API_W_fc_command_L(string a_Inst, string a_User, string a_Pass)
    {
        string l_Str = "";
        string l_Info = @",""data"":{";
        int l_GoodM = 0;

        if (a_Inst == "MCash")
        {
            l_Info = l_Info + fn_UserLogin(a_User, a_Pass, "M");
            if (l_Info.Length < 20)
                l_Str = "{" + icObj.API_fc_Error(200) + "}";
            else
                l_Str = "{" + icObj.API_fc_Error(100) + l_Info + "}";

        }

        if (a_Inst == "MLogin")
        {
            l_Info = l_Info + fn_UserLogin(a_User, a_Pass, "M");
            if (l_Info.Length < 20)
                l_Str = "{" + icObj.API_fc_Error(200) + "}";
            else
                l_Str = "{" + icObj.API_fc_Error(100) + l_Info + "}";

        }

        if (a_Inst == "SLogin")
        {
            l_Info = l_Info + fn_UserLogin(a_User, a_Pass, "S");
            if (l_Info.Length < 20)
                l_Str = "{" + icObj.API_fc_Error(200) + "}";
            else
                l_Str = "{" + icObj.API_fc_Error(100) + l_Info + "}";

        }

        if (a_Inst == "MT4")
        {
            l_Info = l_Info + fn_UserLogin(a_User, a_Pass, "4");
            if (l_Info.Length < 20)
                l_Str = "{" + icObj.API_fc_Error(200) + "}";
            else
                l_Str = "{" + icObj.API_fc_Error(100) + l_Info + "}";

        }
        
        return l_Str;
    }
    
    
    
    
    
    
    
    
    
    
    

    

    string XML_rLogin(string a_User, string a_Pass, ref string a_SecureTag, ref string a_Bal)
    {
        string l_SQL = "";
        string l_Bal = "0";
        string l_ACK = "";
        string l_LoginCode = "";
        string l_Last = "";
        string l_Lasti = "";
        string l_Error = "System Error";
        string l_YourRef = "";
        string l_Backup = "";
        
        string l_WBW = icObj.wbw_Code(a_User, a_Pass, "", ref l_Last, ref l_Lasti, ref l_LoginCode, 1, ref l_Backup);
        string url = icObj.URL_Login + "Tr=Return&User=" + a_User + "&Pass=" + a_Pass + "&Base=" + l_Last + "&Session=" + l_LoginCode + "&Balance=" + a_Bal;

        try
        {
            WebRequest request = WebRequest.Create(url);
            using (WebResponse response = (HttpWebResponse)request.GetResponse())
            {
                using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
                {
                    DataSet dsResult = new DataSet();
                    dsResult.ReadXml(reader);
                    DataTable dtCoordinates = new DataTable();
                    dtCoordinates.Columns.AddRange(new DataColumn[4] { new DataColumn("session", typeof(string)),
                     new DataColumn("bal", typeof(string)),
                    new DataColumn("ref", typeof(string)),
                        new DataColumn("status", typeof(string)) });
                    foreach (DataRow row in dsResult.Tables[0].Rows)
                    {
                        // string geometry_id = dsResult.Tables["geometry"].Select("result_id = 0" )[0]["geometry_id"].ToString();
                        // DataRow location = dsResult.Tables["location"].Select("geometry_id = " + geometry_id)[0];
                        // dtCoordinates.Rows.Add(location["lat"], location["lng"]);
                        dtCoordinates.Rows.Add(row[0], row[1], row[2], row[3]);
                        l_Bal = row[1].ToString();
                        l_YourRef = row[2].ToString();
                        l_ACK = row[3].ToString();
                    }
                }
            }

        }
        catch
        {
        }
        //a_SecureTag = l_YourRef;
        if (l_ACK == null || l_ACK == "")
            l_ACK = "-88";
        return l_YourRef;
    }
    





    string f_SendSOAP1(string a_Inst, string a_UserId, string a_Password, string a_Amt, string a_Cur)
    {

        string l_UserId = a_UserId;
        string l_Password = a_Password;
        string l_Amt = "";
        string l_Cur = "";

        string l_Token = "";
        string l_Member = "";
        string l_Pin = "";
        string l_Tr = "";

        if (a_Inst == "MPin" || a_Inst == "SPin" || a_Inst == "MInfo" || a_Inst == "SInfo")
            l_Token = a_Password;

        if (a_Inst == "STrans")
        {
            l_Token = a_UserId;
            l_Member = a_Password;

        }

        if (a_Inst == "SConfirm")
        {
            l_Token = a_UserId;
            l_Pin = a_Password;
            l_Tr = a_Cur;

        }

        return CreateSOAP(a_Inst, l_UserId, l_Password, l_Token, l_Member, l_Pin, l_Amt, l_Cur, l_Tr);

    }
    
    private static string CreateSOAP(string a_Inst, string a_UserId, string a_Password, string a_Token, string a_Member, string a_Pin, string a_Amt, string a_Cur, string a_Tr)
    {

        //        xmlDocument.LoadXml(@"<?xml version=""1.0"" encoding=""utf-8""?>
        //                        <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">
        //                          <soap:Body>
        //                            <Call xmlns=""http://intecon.co.za/webservices/allps/"">
        //                              <xmlrequest></xmlrequest>
        //                            </Call>
        //                          </soap:Body>
        //                        </soap:Envelope>");

        if (a_Inst == null)
            a_Inst = " ";

        if (a_UserId == null)
            a_UserId = "";

        if (a_Password == null)
            a_Password = "";

        if (a_Token == null)
            a_Token = "";

        if (a_Member == null)
            a_Member = "";

        if (a_Pin == null)
            a_Pin = "";

        if (a_Tr == null)
            a_Tr = "";

        if (a_Cur == null)
            a_Cur = "";

        if (a_Amt == null)
            a_Amt = "";



        return @"{""command"":""" + a_Inst + @""",""username"":""" + a_UserId + @""",""password"":""" + a_Password + @""",""token"":""" + a_Token + @""",""member_id"":""" + a_Member + @""",""amount"":" + a_Amt + @",""currency_id"":" + a_Cur + @",""transaction_id"":""" + a_Tr + @""",""pin"":""" + a_Pin + @"""} ";

    }



    string fn_SetMT4(string a_User, string a_Password, string a_ac1, string a_ab1, string a_ac2, string a_ab2)
    {
        string l_Backup = "";
        string l_LoginCode = "";
        string l_Last = "";
        string l_Lasti = "";
        string l_WBW = "";
        string l_Bal = "";
        string l_Error = "";
        string l_Secure = "0;0;XXX;0;NM;IMYM;;;;;";
        string l_YourRef = "";
        string l_Token = "";
        string l_CC = "";
        string l_Cty = "";
        long l_Lastid = 0;
        string[] l_Para = new string[40];

        string l_ret = "";
        string l_str = "";
        DataSet ds;
        string tbName = "GPay";
        int ll = 0;
        int ll2 = 0;
        
        try
        {
            if ( a_ac1  !=  "" )
                l_Error = icObj.SQL_GetData(0, "Select NickName from wbw_Member, wbw_MT4 where wbw_MT4.MemberID = wbw_Member.MemberID and wbw_MT4.MT4 = '" + a_ac1 + "'", 1, icObj.l_temp);

            if ( l_Error != null && l_Error != "" )
            {
                a_ab1 = "";
                l_ret = "\"a_ac_used\":\"" + l_Error  + "\"";
            }
            
            if (a_ac2 != "")
                l_Error = icObj.SQL_GetData(0, "Select NickName from wbw_Member, wbw_MT4 where wbw_MT4.MemberID = wbw_Member.MemberID and wbw_MT4.MT4 = '" + a_ac2 + "'", 1, icObj.l_temp);

            if (l_Error != null && l_Error != "")
            {
                a_ab2 = "";
                if (l_ret == "")
                    l_ret = "\"b_ac_used\":\"" + l_Error + "\"}";
                else
                    l_ret = l_ret + ", \"b_ac_used\":\"" + l_Error + "\"}";
            }
            else
            {
                if ( l_ret != "" )
                    l_ret = l_ret + "}";
            }
        }
        catch
        {
            l_ret = "\"a_ac_used\":\"ERROR\", \"b_ac_used\":\"ERROR\"}";
        };


        if (l_ret == "")
        {
            l_Last = icObj.SQL_GetData(0, "Select MT4_ID from wbw_MT4 Order by MT4_ID desc ", 1, icObj.l_temp );
            if (l_Last == null || l_Last == "" )
                l_Last = "100";
            
            l_LoginCode =  icObj.SQL_GetData(0, "Select AA.MemberID, AA.truename, AB.answers from wbw_Member AA, tb_Member AB where AA.MemberID = AB.MemberID and ( AA.[Name] = '" + a_User  + "' or AA.nickname = '" + a_User  + "')  ", 3, l_Para  );
            //l_ret = @"""token"":""" + l_Para[2] + @""",""full_name"":""" + l_Para[1] + l_ret + @""" }";            
            
            if ( a_ab1 != "")
            {   
                icObj.SQL_Exec(0, "Insert into wbw_MT4(MT4_ID, MemberID,  MT4, [Status] ) Values ( " + l_Last + " + 1, " + l_LoginCode  + ", '" + a_ac1  + "', '" + a_ab1  + "') ");
                if ( a_ab2 != "")
                    icObj.SQL_Exec(0, "Insert into wbw_MT4(MT4_ID, MemberID,  MT4, [Status] ) Values ( " + l_Last + " + 2, " + l_LoginCode  + ", '" + a_ac2  + "', '" + a_ab2  + "') ");
                l_Error = "100";
            }
            else
            {
                if (a_ab2 != "" )
                {
                    icObj.SQL_Exec(0, "Insert into wbw_MT4(MT4_ID, MemberID,  MT4, [Status] ) Values ( " + l_Last + " + 1, " + l_LoginCode  + ", '" + a_ac2  + "', '" + a_ab2  + "') ");
                    l_Error = "100";
                }
            }
        }
        else
        {
            l_Error = "200";
        }

        if (l_Error != "100")
            l_Error = l_ret;
        
        return l_Error;
    }


    


    string fn_UserLogin(string a_User, string a_Password, string a_Type)
    {
        string l_Backup = "";
        string l_LoginCode = "";
        string l_Last = "";
        string l_Lasti = "";
        string l_WBW = "";
        string l_Bal = "";
        string l_Error = "";
        string l_Secure = "0;0;XXX;0;NM;IMYM;;;;;";
        string l_YourRef = "";
        string l_Token = "";
        string l_CC = "";
        string l_Cty = "";
        long l_Lastid = 0;
        string[] l_Para = new string[40];

        string l_ret = "";
        string l_str = "";
        DataSet ds;
        string tbName = "GPay";
        int ll = 0;
        int ll2 = 0;

        string l_ac1 = "";
        string l_ac2 = "";
        
        try
        {
            l_Error = icObj.Login("EN", a_User.Trim(), a_Password.Trim(), "", "", ref l_Secure,"");
        }
        catch
        {
            l_Error = icObj.SysMsgDirect("M", "LoginFail", "AInfo");
        };

        
        if (l_Error == "Open")
        {
            //l_CC = icObj.ExecSQLData(0, "Select wbw_secu, GPID from tb_wbw, ELink where tb_wbw.wbw_id = ELink.GPID ", 2, icObj.l_temp);
            l_CC = icObj.GetSha256String(a_User.Trim() + a_Password.Trim()) + "987654321";
            l_CC = l_CC.Substring(0, 16);
            l_Token = l_CC;

            icObj.ExecSQLData(0, "SELECT AA.TrueName, AB.eCoinE, AA.Answers, AA.MemberID, AB.TrueName, AC.NickName, AB.ICNum, AB.Sex, AA.Emails, AA.PhoneCode, AA.country, AA.Address from tb_member AA , wbw_Member AB, wbw_Member AC where AA.MemberID = AB.MemberID and  AC.MemberID = AA.SponsorID  and ( AB.[name] = '" + a_User.Trim() + "' or AB.[nickname] = '" + a_User.Trim() + "' ) and AB.[pass_2] = '" + a_Password.Trim() + "' ", 12, l_Para);
            if (l_Para[2] != null)
            {
                if (a_Type == "4")
                {
                    l_str = "select tb_Member.Memberid ,  wbw_MT4.Mt4, wbw_MT4.Status from wbw_mt4, tb_Member where tb_Member.MemberID = wbw_mt4.MemberID and tb_Member.Answers = '" + l_CC + "' Order by MT4_ID desc ";
                    ds = icObj.ReturnDs(l_str, tbName);
                    l_ret = "";
                    for (ll = 0; ll < ds.Tables[tbName].Rows.Count; ll++)
                    {
                        ll2 = ll + 1;
                        l_ret = l_ret + ", \"ac" + ll2 + "\":\"" + ds.Tables[tbName].Rows[ll][1].ToString() + "\",  \"ab" + ll2 + "\":\"" + ds.Tables[tbName].Rows[ll][2].ToString() + "\" ";
                        
                    }
                               
                    l_Error = @"""token"":""" + l_Token + @""",""full_name"":""" + l_Para[0] + l_ret  + @" }";
                }
                else
                {
                    l_Para[11] = l_Para[11].Replace("\r", "");
                    l_Para[11] = l_Para[11].Replace("\n", "");

                    l_ac1 = icObj.SQL_GetData(0, "Select MT4 , MT4_ID from wbw_MT4 where MemberID = " + l_Para[3] + " and Status = 'A' Order By MT4_ID desc", 2, icObj.l_temp);
                    l_ac2 = icObj.SQL_GetData(0, "Select MT4 , MT4_ID from wbw_MT4 where MemberID = " + l_Para[3] + " and Status = 'B' Order By MT4_ID desc", 2, icObj.l_temp);
                    
                    //l_Error = @"""token"":""" + l_Token + @""",""full_name"":""" + l_Para[0] + @""",""balance"":" + l_Para[1] + @",""user_id"":""" + l_Para[3] + @""", ""member_name"":""" + l_Para[4] + @""", ""sponsor_id"":""" + l_Para[5] + @""", ""ic_number"":""" + l_Para[6] + @""", ""gender"":""" + l_Para[7] + @""", ""email"":""" + l_Para[8] + @""", ""phone"":""" + l_Para[9] + @""", ""country"":""" + l_Para[10] + @""", ""address"":""" + l_Para[11] + @""", ""ac1"":""" + l_ac1  + @""", ""ac2"":""" + l_ac2 + @"""}";
                    l_Error = @"""token"" ""full_name"":""" + l_Para[0] + @""", ""ic_number"":""" + l_Para[6] + @""", ""gender"":""" + l_Para[7] + @""", ""email"":""" + l_Para[8] + @""", ""phone"":""" + l_Para[9] + @""", ""country"":""" + l_Para[10] + @""", ""address"":""" + l_Para[11] + @""", ""ac1"":""" + l_ac1 + @""", ""ac2"":""" + l_ac2 + @"""}";
                    icObj.ExecSQL(0, "Update tb_member Set answers = '" + l_Token + "' Where ( [name] = '" + a_User.Trim() + "' or [nickname] = '" + a_User.Trim() + "' ) and [pass_2] = '" + a_Password.Trim() + "' ");
                }
                
            }
            else
                l_Error = "200";
        }
        else
        {
            l_Error = "200";
        }

            
            //    l_Token = icObj.f_NewToken(l_CC, l_Para[3]);
            //else
            //{
            //    if (l_Para[2].Length > 8)
            //        l_Token = l_Para[2];
            //    else
            //        l_Token = icObj.f_NewToken(l_CC, l_Para[3]);
            //}  
        
        
        
        return  l_Error;
    }




    string VB22GCall(string a_Tr, string a_User, string a_Pass, string a_Base, string a_Session, ref string l_Bal, ref string l_Ref, ref string l_Status, ref string l_Name, ref string l_Email, ref string l_Tel, ref string l_Cty, ref string l_Bal2, ref double a_Rate)
    {
        //if (a_User == "" || a_Pass == "" || a_Base == "")
        //    return "";
        //a_User = a_User.Replace("+", "%2B");
        //a_Pass = a_Pass.Replace("+", "%2B");

        ////string cmd = string.Format("\"D:\\WebHTML\\Grabpays\\Grab.vbs\" {0} {1} {2} {3} {4} {5} ", a_Tr, a_User, a_Pass, a_Base, a_Session, l_Bal);
        ////string l_Str = "";
        //string cmd = string.Format("\"C:\\Domains\\coperiac\\grabpays.com\\wwwroot\\Grab.vbs\" {0} {1} {2} {3} {4} {5} ", a_Tr, a_User, a_Pass, a_Base, a_Session, l_Bal);
        //string l_Str = "";
        //System.Console.WriteLine("{0} {1}", "cscript", cmd);

        //Process process = new Process();
        //process.StartInfo.UseShellExecute = false;
        //process.StartInfo.RedirectStandardOutput = true;
        //process.StartInfo.CreateNoWindow = true;
        //process.StartInfo.FileName = "cscript.exe";
        //process.StartInfo.Arguments = cmd;
        //try
        //{
        //    process.Start();
        //    l_Str = process.StandardOutput.ReadToEnd();
        //    //System.Console.WriteLine(process.ExitCode);  
        //    //lblMsg.Text = process.ExitCode.ToString()  ;
        //}
        //catch (Exception ex)
        //{
        //    System.Console.WriteLine(ex.ToString());
        //}

        //string l_session = "";
        //string l_Ret = icObj.WB_Info("APP", a_User  , a_Pass ,l_Str, ref l_session, ref l_Bal, ref l_Ref, ref l_Status, ref  l_Name, ref l_Email, ref l_Tel, ref l_Cty);

        //l_Bal2 = l_Bal;
        //if (l_Bal2 == null || l_Bal2 == "")
        //    l_Bal2 = "0";
        
        //// if (a_User == "prince178")
        //    l_Bal = icObj.f_toGPoint(a_User, "GRATE", l_Cty, l_Bal, ref a_Rate).ToString();

        //return l_Ret;
        return "";
    }



    string VBGCall(string a_Tr, string a_User, string a_Pass, string a_Base, string a_Session, ref string l_Bal, ref string l_Ref, ref string l_Status, ref string l_Name, ref string l_Email, ref string a_Tel, ref string a_Cty, ref string l_Bal2, ref double a_Rate)
    {
        string l_Ret = "";
        if (a_User == "" || a_Pass == "" || a_Base == "")
            return "";
        string l_Inst = a_Tr + ":" + a_User + ":" + a_Base + ":" + l_Bal;

        a_User = a_User.Replace("+", "%2B");
        a_Pass = a_Pass.Replace("+", "%2B");


        string l_session = "";
        string url = "http://42.1.62.42:28989/service/cas/emsreqx.asp?Tr=" + a_Tr + "&User=" + a_User + "&Pass=" + a_Pass + "&Base=" + a_Base + "&Session=" + a_Session + "&Balance=" + l_Bal;


        string l_Str = f_SendJSon(url, "");
        //return icObj.WB_Info(l_Str, ref l_session, ref l_Bal, ref l_Ref, ref l_Status, ref  l_Name,  ref a_Tel, ref a_Cty);
        l_Ret = icObj.WB_Info("APP", a_User, a_Pass, l_Str, ref l_session, ref l_Bal, ref l_Ref, ref l_Status, ref  l_Name, ref l_Email, ref a_Tel, ref a_Cty);



        
        l_Bal2 = l_Bal;
        if (l_Bal2 == null || l_Bal2 == "")
            l_Bal2 = "0";
        //if (a_User.Trim()  == "prince178")
        l_Bal = icObj.f_toGPoint(a_User.Trim(), "GRATE", a_Cty, l_Bal2, ref a_Rate).ToString();
        return l_Ret;
    }


    public string f_SendJSon(string a_url, string a_json)
    {
        // create a request
        try
        {
            HttpWebRequest request = (HttpWebRequest)
            WebRequest.Create(a_url); request.KeepAlive = false;
            request.ProtocolVersion = HttpVersion.Version10;
            request.Method = "POST";


            // turn our request string into a byte stream
            byte[] postBytes = Encoding.UTF8.GetBytes(a_json);

            // this is important - make sure you specify type this way
            request.ContentType = "application/json; charset=UTF-8";
            request.Accept = "application/json";
            request.ContentLength = postBytes.Length;
            //    request.CookieContainer = Cookies;
            //    request.UserAgent = currentUserAgent;
            request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"; //Request.ServerVariables["HTTP_USER_AGENT"];
            Stream requestStream = request.GetRequestStream();

            // now send it
            requestStream.Write(postBytes, 0, postBytes.Length);
            requestStream.Close();

            // grab te response and print it out to the console along with the status code
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            string result;
            using (StreamReader rdr = new StreamReader(response.GetResponseStream()))
            {
                result = rdr.ReadToEnd();
            }

            return result;
        }
        catch
        {
        }
        return "";
    }





    string fc_command_MH(string a_Inst, string a_Token, string a_Date_From , string a_Date_To)
    {
        string l_Str = "";
        string l_Pin = "";
        string l_Info = @",""data"":[";
        int l_GoodM = 0;
        string[] l_Para = new string[60];
        string l_TokenNew = "";
        string l_LoginID = "";

        string l_SQL;
        DataSet ds;
        int ll = 0;
        int ll_Max = 0;
        string l_CC = "";
        double l_Amt = 0;
        
        if (a_Inst == "MHistory")
        {
            l_SQL = "SELECT Answers , len(answers), Moneyin, moneyout , trdate, refno, takenote , ewalletid, bal from tb_member AA, wbw_eCoinP AB where ( AB.Memberin = AA.Memberid  or  AB.Memberout = AA.Memberid  ) and answers is not null and len(answers) > 8 and (answers = '" + a_Token + "' or ( '" + a_Token + "' = '0' and (EDI1 = 0  or EDI1 is null ) ) ) Order By eWalletid asc ";
            ds = icObj.ReturnDs(l_SQL, "Admin");
            
                if (ds.Tables["Admin"].Rows.Count > 0)
                {
                    ll_Max = ds.Tables["Admin"].Rows.Count;
                    if (ll_Max > 20)
                        ll_Max = 20;
                    
                    for (ll = 0; ll < ll_Max; ll++)
                    {

                        if (ll == 0)
                            l_Info = l_Info + @"{""token"":" + ds.Tables["Admin"].Rows[ll][0].ToString() + @",";
                        else
                            l_Info = l_Info + @",{""token"":" + ds.Tables["Admin"].Rows[ll][0].ToString() + @",";

                        if (double.Parse(ds.Tables["Admin"].Rows[ll][3].ToString()) > 0)
                            l_Amt = double.Parse(ds.Tables["Admin"].Rows[ll][3].ToString()) * -1;
                        else
                            l_Amt = double.Parse(ds.Tables["Admin"].Rows[ll][2].ToString());
                        
                        l_Info = l_Info + @"""mt4"":"""",";
                        l_Info = l_Info + @"""amount"":" + l_Amt + @",";
                        l_Info = l_Info + @"""currency_id"":6,";
                        l_Info = l_Info + @"""tr_date"":""" + ds.Tables["Admin"].Rows[ll][4].ToString() + @""",";
                        l_Info = l_Info + @"""tr_code"":""" + ds.Tables["Admin"].Rows[ll][5].ToString() + @""",";
                        l_Info = l_Info + @"""remark"":""" + ds.Tables["Admin"].Rows[ll][6].ToString() + @""",";
                        l_Info = l_Info + @"""out_trade_no"":""" + ds.Tables["Admin"].Rows[ll][7].ToString() + @""",";
                        l_Info = l_Info + @"""balance"":" + ds.Tables["Admin"].Rows[ll][8].ToString() + @"}";

                    }
                }

        }





        if (l_Info.Length < 10)
            l_Str = "{" + icObj.API_fc_Error(300) + "}";
        else
        {
            l_Info = l_Info + "]";
            l_Str = "{" + icObj.API_fc_Error(100) + l_Info + "}";
        }
        return l_Str;

    }
    
    

}

Anon7 - 2022
AnonSec Team