public void Start() { _highestFollowingAccount = new AccountDTO(); _detectedAccount = false; this.GetSubInfo(); this._updateDataTimer.Start(); }
public void Stop() { this._updateDataTimer.Interval = this._updateDataInterval; this._updateDataTimer.Stop(); _highestFollowingAccount = new AccountDTO(); }
static System.Collections.Generic.List<AccountDTO> ConvertAcountsOutStanding(string data) { System.Collections.Generic.List<AccountDTO> list = null; if (data != string.Empty) { if (!data.Contains("No information is available")) { string type = string.Empty; if (data.Contains("Master Outstanding")) { type = "Master"; } else if (data.Contains("Agent Outstanding")) { type = "Agent"; } else if (data.Contains("Member Outstanding")) { type = "Member"; } list = new List<AccountDTO>(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(data); foreach (HtmlNode table in doc.DocumentNode.SelectNodes("//table")) { foreach (HtmlNode row in table.SelectNodes("tr")) { AccountDTO account = new AccountDTO(); account.AccountType = type; HtmlNodeCollection cells = row.SelectNodes("td"); string stringEntry = cells[0].InnerText; if (!stringEntry.Contains("User") && !stringEntry.Contains("standing") && !stringEntry.Contains("Total")) { account.Name = stringEntry; if (account.AccountType == "Member") { string[] array = cells[1].InnerHtml.Split(new string[] { "'" }, System.StringSplitOptions.None); account.ID = array[1]; } else if (account.AccountType == "Agent") { string[] array = cells[0].InnerHtml.Split(new string[] { "'" }, System.StringSplitOptions.None); account.ID = array[1]; } else if (account.AccountType == "Master") { string[] array = cells[0].InnerHtml.Split(new string[] { "'" }, System.StringSplitOptions.None); account.ID = array[1]; } account.OutStanding = cells[1].InnerText.Trim(); list.Add(account); } } } } } return list; }
public List<AccountDTO> GetAccountDataFirstTime(AccountDTO account) { List<AccountDTO> list = new List<AccountDTO>(); this.LastUpdateCompleted = false; try { string requestUriString = string.Empty; if (account.AccountType == "Member") { requestUriString = string.Concat(new string[] { "https://", this._host, "/", this._dynamicURL, "/_Reports/BetList/OutstandingDetail.aspx?custid=", account.ID, "&username="******"&type=RunByDate_Mem&chkgetall=on&chk_showsb=on&chk_showcasino=off&chk_showrb=on&chk_showng=on&chk_showbi=off" }); //this._getDataRequest.CookieContainer.Add(new System.Uri("http://" + this._host), new System.Net.Cookie(this._setCookie, requestUriString)); } else if (account.AccountType == "Agent") { requestUriString = string.Concat(new string[] { "https://", this._host, "/", this._dynamicURL, "/_Reports/Common/Outstanding.aspx?custid=", account.ID, "&roleid=2&sortingcolumn=username&sortingup=true" }); } else if (account.AccountType == "Master") { requestUriString = string.Concat(new string[] { "https://", this._host, "/", this._dynamicURL, "/_Reports/Common/Outstanding.aspx?custid=", account.ID, "&roleid=3&sortingcolumn=username&sortingup=true" }); } string text = CreateWebRequest("GET", requestUriString, "http://" + this._host + "/" + this._dynamicURL + "/_Reports/Common/Outstanding.aspx", this._cookies, this._host, useProxy, ""); if (text == null || text == string.Empty) { } else { try { if (account.AccountType == "Member") { return ConvertAcountsOutStanding(text); } else if (account.AccountType == "Master") { return ConvertAcountsOutStanding(text); } else if (account.AccountType == "Agent") { return ConvertAcountsOutStanding(text); } } catch (System.Exception data) { } } } catch (System.Exception data) { this.GetAccountDataFirstTime(account); throw data; } finally { this.LastUpdateCompleted = true; } return list; }
public void GetAccountData(AccountDTO account) { this.LastUpdateCompleted = false; try { string requestUriString = string.Empty; if (account.AccountType == "Member") { requestUriString = string.Concat(new string[] { "https://", this._host, "/", this._dynamicURL, "/_Reports/BetList/OutstandingDetail.aspx?custid=", account.ID, "&username="******"&type=RunByDate_Mem&chkgetall=on&chk_showsb=on&chk_showcasino=off&chk_showrb=on&chk_showng=on&chk_showbi=off" }); //this._getDataRequest.CookieContainer.Add(new System.Uri("http://" + this._host), new System.Net.Cookie(this._setCookie, requestUriString)); } else if (account.AccountType == "Agent") { requestUriString = string.Concat(new string[] { "https://", this._host, "/", this._dynamicURL, "/_Reports/Common/Outstanding.aspx?custid=", account.ID, "&roleid=2&sortingcolumn=username&sortingup=true" }); } else if (account.AccountType == "Master") { requestUriString = string.Concat(new string[] { "https://", this._host, "/", this._dynamicURL, "/_Reports/Common/Outstanding.aspx?custid=", account.ID, "&roleid=3&sortingcolumn=username&sortingup=true" }); } else if (account.AccountType == "SuperMaster") { requestUriString = string.Concat(new string[] { "https://", this._host, "/", this._dynamicURL, "/_Reports/Common/Outstanding.aspx" }); } string text = CreateWebRequest("GET", requestUriString, "https://" + this._host + "/" + this._dynamicURL + "/_Reports/Common/Outstanding.aspx", this._cookies, this._host, useProxy, ""); //string text = ParseRequest(this._getDataRequest, ""); if (text == null || text == string.Empty) { this.On_FullDataCompleted(new EngineEventArgs { Type = eEngineEventType.SessionExpired, Data = null }); } else { try { if (account.AccountType == "Member") { this._lastListBetList = ConvertData(text, _OldBetListHistory, account.Name); this.On_FullDataCompleted(new EngineEventArgs { Type = eEngineEventType.Success, Data = this._lastListBetList }); } else { this._lastAccountOutStandingList = ConvertAcountsOutStanding(text); this.On_GetOutStandingDataCompleted(new EngineEventArgs { Type = eEngineEventType.Success, Data = this._lastAccountOutStandingList }); } } catch (System.Exception data) { this.On_FullDataCompleted(new EngineEventArgs { Type = eEngineEventType.Error, Data = data }); } } } catch (System.Exception data) { this.GetAccountData(account); throw data; } finally { this.LastUpdateCompleted = true; } }
public System.Collections.Generic.List<BetDTO> GetBetsDataFirstTime(AccountDTO account) { this.LastUpdateCompleted = false; System.Collections.Generic.List<BetDTO> list = null; try { string requestUriString = string.Concat(new string[] { "https://", this._host, "/", this._dynamicURL, "/_Reports/BetList/OutstandingDetail.aspx?custid=", account.ID, "&username="******"&type=RunByDate_Mem&chkgetall=on&chk_showsb=on&chk_showcasino=off&chk_showrb=on&chk_showng=on&chk_showbi=off" }); string text = CreateWebRequest("GET", requestUriString, "https://" + this._host + "/" + this._dynamicURL + "/_Reports/Common/Outstanding.aspx", this._cookies, this._host, useProxy, ""); //this._getDataRequest.CookieContainer.Add(new System.Uri("http://" + this._host), new System.Net.Cookie(this._setCookie, requestUriString)); //string text = ParseRequest(this._getDataRequest, ""); if (text == null || text == string.Empty) { return list; } else { try { return ConvertData(text, _OldBetListHistory, account.Name); } catch (System.Exception data) { //this.On_FullDataCompleted(new EngineEventArgs //{ // Type = eEngineEventType.Error, // Data = data //}); return list; } } } catch (System.Exception data) { //iBet.Utilities.WriteLog.Write(data.Message); //iBet.Utilities.WriteLog.Write(text); return list; //GetBetsDataFirstTime(account); } finally { this.LastUpdateCompleted = true; } }
private bool CheckCorrectAccount(AccountDTO account) { if (account.Name.ToLower().Contains(this._followingAccount.ToLower()) || this._followingAccount.ToLower().Contains(account.Name.ToLower())) return true; return false; }
private bool CompareAccountWithFollowingField(AccountDTO account) { //int i = txtListFollowAccounts.Lines.Length; for (int i = 0; i < txtListFollowAccounts.Lines.Length; i++) { if (account.Name.Contains(txtListFollowAccounts.Lines[i])) return true; } return false; }
private bool CheckCurrentAccountsForChange(List<AccountDTO> oldacc, AccountDTO acctoCompare) { if (oldacc == null || oldacc.Count == 0) return true; AccountDTO account = AccountDTO.SearchAccountByName(acctoCompare.Name, _lastAccountInSubOutStanding); if (account != null) { if (account.OutStanding == acctoCompare.OutStanding) { return false;//khong thay doi } else { float floatOld; float floatNew; if (float.TryParse(account.OutStanding.Replace(",", ""), out floatOld) && float.TryParse(acctoCompare.OutStanding.Replace(",", ""), out floatNew)) { if (floatOld < floatNew) { //iBet.Utilities.WriteLog.Write(acctoCompare.AccountType + ":" + acctoCompare.Name + " got new outstanding: " + acctoCompare.OutStanding + ". Old value: " + account.OutStanding); account.OutStanding = acctoCompare.OutStanding; return true;// co thay doi } else { //iBet.Utilities.WriteLog.Write(acctoCompare.Name + ": from " + account.OutStanding + " down to " + acctoCompare.OutStanding); account.OutStanding = acctoCompare.OutStanding; return false; } } } } else { oldacc.Add((AccountDTO)acctoCompare.Clone()); return true; } return false; }
private void AddAlreadyBetRunningToOldBetList(List<BetDTO> listBeted, AccountDTO account) { if (listBeted != null) { if (_listDoneBetInSub == null) _listDoneBetInSub = new List<BetDTO>(); foreach (BetDTO bet in listBeted) { if (!this._OldBetListHistory.ContainsKey(bet.RefID)) { bet.ID = (this._listDoneBetInSub.Count + 1).ToString(); this._OldBetListHistory.Add(bet.RefID, DateTime.Now);//add vao list da bet this._listDoneBetInSub.Add(bet); } //this._ibetSubEngine._OldBetListHistory.Add(bet.RefID, DateTime.Now);//add vao engine } } else { ShowErrorDialog("Cannot parse bet list of " + account.Name); } }