public List <accountList> GetIBCode(broker_productList broker_product, List <accountList> accountList) { List <accountList> ibList = new List <Program.accountList>(); MySqlConnection conn = connMySQL("ci_broker_" + broker_product.bId); MySqlCommand cmd; foreach (accountList accountValue in accountList) { string cmdText = "SELECT * FROM client_product WHERE apply_account = 1 AND introducer_IB_Code = " + accountValue.ib_mt4_login + " AND pId = " + broker_product.id; cmd = new MySqlCommand(cmdText, conn); using (MySqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { ibList.Add( new Program.accountList() { ib_mt4_login = Convert.ToInt32(reader["mt4_login"]), broker_productList = broker_product, } ); } } } conn.Close(); return(ibList); }
public List <accountList> GetAccountList(broker_productList broker_product) { List <accountList> accountList = new List <accountList>(); List <clientList> clientList = new List <clientList>(); accountList.Add( new Program.accountList() { ib_mt4_login = broker_product.mt4_commission_account, broker_productList = broker_product, } ); while (GetIBCode(broker_product, accountList).Count() > 0) { ; } /**** IB的客戶 ****/ MySqlConnection conn = connMySQL("ci_broker_" + broker_product.bId); string cmdText = "SELECT * FROM client_product WHERE apply_account = 1 AND pId=" + broker_product.id; MySqlCommand cmd = new MySqlCommand(cmdText, conn); using (MySqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { clientList = GetClientList(broker_product, Convert.ToInt32(reader["mt4_login"])); accountList.Add( new accountList() { ib_mt4_login = Convert.ToInt32(reader["mt4_login"]), broker_productList = broker_product, } ); } } conn.Close(); return(accountList); }
public List <clientList> GetClientList(broker_productList broker_product, int ib_mt4_login) { List <clientList> clientList = new List <clientList>(); MySqlConnection conn = connMySQL("ci_broker_" + broker_product.bId); string cmdText = "SELECT * FROM client_product WHERE apply_account = 0 AND introducer_IB_Code = " + ib_mt4_login + " AND pId = " + broker_product.id; MySqlCommand cmd = new MySqlCommand(cmdText, conn); using (MySqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { clientList.Add( new clientList() { client_mt4_login = Convert.ToInt32(reader["mt4_login"]) } ); } } conn.Close(); return(clientList); }