void Start() { connectAPI = GetComponent <ConnectAPI>(); postRegistFunction = delegate { data = JsonUtility.FromJson <Data>(result); }; postSessionFunction = delegate { data.session = JsonUtility.FromJson <Data>(result).session; data.success = JsonUtility.FromJson <Data>(result).success; }; postLoadInfomation = delegate { data.data = JsonUtility.FromJson <Data>(result).data; data.success = JsonUtility.FromJson <Data>(result).success; }; postCoinChange = delegate { }; postCoinGet = delegate { //data = JsonUtility.FromJson<Data>(result).data; }; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); StringBuilder nameBuilder = new StringBuilder(); ConnectAPI.BrokerOpen(nameBuilder, BrokerError, BrokerPercent); StringBuilder accounts = new StringBuilder(); ConnectAPI.BrokerLogin(null, null, null, accounts); double[] pdBalance = new double[1]; double[] pdTradeVal = new double[1]; double[] pdMarginVal = new double[1]; ConnectAPI.BrokerAccount(accounts.ToString().Split('\0')[0], pdBalance, pdTradeVal, pdMarginVal); double[] pPrice = new double[1]; double[] pSpread = new double[1]; double[] pVolume = new double[1]; double[] pPip = new double[1]; double[] pPipCost = new double[1]; double[] pMinAmount = new double[1]; double[] pMargin = new double[1]; double[] pRollLong = new double[1]; double[] pRollShort = new double[1]; ConnectAPI.BrokerAsset("EUR/USD", pPrice, pSpread, pVolume, pPip, pPipCost, pMinAmount, pMargin, pRollLong, pRollShort); }
public async Task <Organization> GetInforOrganizationFromAcc(int accountId) { if (Request.Headers.TryGetValue("Authorization", out _authorizationToken)) { this._accessToken = _authorizationToken.ToString().Substring("Bearer ".Length); } RequestInfor requestInfor = new RequestInfor() { UrlBase = StaticConfig.UrlCatalogGetInforOrganizationFromAcc + "/" + accountId.ToString(), HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = _accessToken } }; var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.GET); if (responseData.Code == 200) { return(Helpers.Deserialize <Organization>(responseData.Data)); } return(new Organization() { OrganizationId = -1 }); }
public ConnectKHOpenAPI() { InitializeComponent(); api = ConnectAPI.Get(); api.SetAPI(axAPI); api.StartProgress(new RealType(), new DataBaseConnect().GetConnectString()); }
public async Task <ActionResult> Add(Organization ogt) { RequestInfor requestInfor = new RequestInfor() { UrlBase = Configuarations.Url_AddOrganization, HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = AccessToken }, FormValue = Helpers.ConvertObToKeyPair(ogt) }; var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.POST); if (responseData.Code == 200) { SystemSession.CurrentAccount.OrganizationName = ogt.OrganizationId != 0 ? ogt.Name : OrganizationName; return(RedirectToAction("Index", "Organization")); } else { ModelState.AddModelError("", responseData.Message); } return(View("_Add", ogt)); }
private void CheckReconnectTimeout() { if (this.IsReconnecting()) { float realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup; float num2 = realtimeSinceStartup - this.m_reconnectStartTimestamp; float timeout = this.GetTimeout(); if (num2 >= timeout) { this.OnReconnectTimeout(); } else { ClientConnection <PegasusPacket> gameServerConnection = ConnectAPI.GetGameServerConnection(); if (!gameServerConnection.Active && !gameServerConnection.HasEvents()) { float num4 = realtimeSinceStartup - this.m_retryStartTimestamp; float retryTime = this.GetRetryTime(); if (num4 >= retryTime) { this.m_retryStartTimestamp = realtimeSinceStartup; this.StartGame(); } } } } }
/* --- Static Methods (Interface) --- */ public static void OnArcaneDustBalance() { long balance = ConnectAPI.GetArcaneDustBalance(); HSMPClient.Get().SendDebugMessage("OnArcangeDustBalance: " + balance); HSMPClient.Get().Send(new MsgCurrencyBalance(MsgCurrencyBalance.CurrencyType.DUST, balance)); }
public async Task <GridModel <ProductPrice> > GetListPricePG(RequestParams pr) { if (Request.Headers.TryGetValue("Authorization", out _authorizationToken)) { this._accessToken = _authorizationToken.ToString().Substring("Bearer ".Length); } RequestInfor requestInfor = new RequestInfor() { UrlBase = StaticConfig.UrlPriceGetListPricePg + "/" + pr.PageIndex.ToString() + "/" + pr.ProductId.ToString() + "/" + pr.ProductCategoryId.ToString(), HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = _accessToken } }; var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.GET); GridModel <ProductPrice> listPrice = new GridModel <ProductPrice>(); if (responseData.Code == 200) { listPrice = Helpers.Deserialize <GridModel <ProductPrice> >(responseData.Data); } return(listPrice); }
public async Task <List <Product> > GetListProduct(int productCategoryId, int organizationId) { if (Request.Headers.TryGetValue("Authorization", out _authorizationToken)) { this._accessToken = _authorizationToken.ToString().Substring("Bearer ".Length); } RequestInfor requestInfor = new RequestInfor() { UrlBase = StaticConfig.UrlCatalogGetListProduct + "/" + productCategoryId.ToString() + "/" + organizationId.ToString(), HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = _accessToken } }; var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.GET); if (responseData.Code == 200) { return(Helpers.Deserialize <List <Product> >(responseData.Data)); } return(new List <Product>()); }
// GET: Product public async Task <ActionResult> Index() { // Get list ProductCategory RequestInfor requestInfor = new RequestInfor() { UrlBase = Configuarations.Url_Product_GetListProductCategory, HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = AccessToken }, }; var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.GET); if (responseData.Code != 200) { ViewBag.ResultData = null; if (responseData.Code == 401) { ViewBag.ResultMessage = responseData.Message; } } else { ViewBag.ResultData = Helpers.Deserialize <List <ProductCategory> >(responseData.Data); } return(View()); }
public async Task <GridModel <Product> > GetListProductPG(RequestParams pr) { if (Request.Headers.TryGetValue("Authorization", out _authorizationToken)) { this._accessToken = _authorizationToken.ToString().Substring("Bearer ".Length); } RequestInfor requestInfor = new RequestInfor() { UrlBase = StaticConfig.UrlCatalogGetListProductPg + "/" + pr.PageIndex.ToString() + "/" + pr.ProductCategoryId.ToString() + "/" + pr.OrganizationId.ToString(), HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = _accessToken } }; var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.GET); GridModel <Product> listProduct = new GridModel <Product>(); if (responseData.Code == 200) { listProduct = Helpers.Deserialize <GridModel <Product> >(responseData.Data); string listProductString = Helpers.Serialize(listProduct.Data); requestInfor = new RequestInfor() { UrlBase = StaticConfig.UrlPriceGetPriceFromProduct, HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = _accessToken }, FormValue = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("listProductString", listProductString) } }; responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.POST); var listProductPrice = new List <Product>(); var oldListProduct = listProduct.Data; var newListProduct = new List <Product>(); if (responseData.Code == 200) { listProductPrice = Helpers.Deserialize <List <Product> >(responseData.Data); foreach (var item in oldListProduct) { item.Price = listProductPrice.FirstOrDefault(x => x.ProductId == item.ProductId).Price; newListProduct.Add(item); } listProduct.Data = newListProduct; } } return(listProduct); }
public async Task <PartialViewResult> ShopCart(List <Cart> cart) { if (SystemSession.ShopCart != null && SystemSession.ShopCart.Count > 0) { PaymentModel payment = new PaymentModel() { Payment = new Payment() { AccountId = SystemSession.CurrentAccount.AccountId, PaymentCode = Helpers.RandomString(8, false) }, ListPaymentDetail = SystemSession.ShopCart }; string paymentString = Helpers.Serialize(payment); RequestInfor requestInfor = new RequestInfor() { UrlBase = Configuarations.Url_Shop_Payment, FormValue = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("paymentString", paymentString) } }; var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.POST); if (responseData.Code == 200) { SystemSession.ShopCart = null; } } return(PartialView("_Cart", cart)); }
public Strategy(IStatistics st) { ema = new EMA(); bands = st.Base > 1 && st.Sigma > 0 && st.Percent > 0 && st.Max > 0 ? true : false; days = st.ShortDayPeriod > 1 && st.LongDayPeriod > 2 ? true : false; count = st.Quantity + 1; Headway = st.Time; if (bands) { over = new BollingerBands(st.Sigma * 0.1, st.Base, st.Percent, st.Max); baseTick = new List <double>(2097152); } if (days) { shortDay = new List <double>(512); longDay = new List <double>(512); } shortTick = new List <double>(2097152); longTick = new List <double>(2097152); Send += Analysis; this.st = st; GetChart(); Send -= Analysis; api = ConnectAPI.Get(); api.SendDatum += Analysis; balance = Balance.Get(); SendLiquidate += balance.OnReceiveLiquidate; }
public ConnectKHOpenAPI() { InitializeComponent(); api = ConnectAPI.Get(); api.SetAPI(axAPI); api.StartProgress(new RealType()); }
public async Task <ActionResult> LoadContent(int productCategoryId, int pageIndex) { RequestInfor requestInfor = new RequestInfor() { UrlBase = Configuarations.Url_Product_GetListByConditional + "/" + pageIndex.ToString() + "/" + productCategoryId.ToString() + "/" + OrganizationId.ToString(), HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = AccessToken }, }; GridModel <Product> listProduct = new GridModel <Product>(); if (productCategoryId > 0) { var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.GET); if (responseData.Code != 200) { ViewBag.ResultData = null; return(View("index")); } listProduct = Helpers.Deserialize <GridModel <Product> >(responseData.Data); } return(PartialView("_Content", listProduct)); }
/* --- Static Methods (Interface) --- */ public static void OnGoldBalance() { var pkt = ConnectAPI.GetGoldBalance(); long balance = pkt.GetTotal(); HSMPClient.Get().SendDebugMessage("OnGoldBalance: " + balance); HSMPClient.Get().Send(new MsgCurrencyBalance(MsgCurrencyBalance.CurrencyType.GOLD, balance)); }
public static void OnBoosterTally() { HSMPClient.Get().SendDebugMessage("OnBoosterTallyList(" + ConnectAPI.GetBoosterTallies().BoosterTallies.Count + ")"); foreach (var bt in ConnectAPI.GetBoosterTallies().BoosterTallies) { HSMPClient.Get().SendDebugMessage(bt.Id + " : " + bt.Count); } }
private void OnCommandResponseReceived() { Network.DebugConsoleResponse debugConsoleResponse = ConnectAPI.GetDebugConsoleResponse(); if (debugConsoleResponse != null) { this.SendDebugConsoleResponse((DebugConsoleResponseType)debugConsoleResponse.Type, debugConsoleResponse.Response); } }
public DocumentEventHandler(ModelDoc2 modDoc, SwAddin addin, ConnectAPI connect) { document = modDoc; userAddin = addin; connectAPI = connect; iSwApp = (ISldWorks)userAddin.SwApp; openModelViews = new Hashtable(); }
public static void OnMassDisenchantResponse() { var pkt = ConnectAPI.GetMassDisenchantResponse(); long balance = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance; HSMPClient.Get().SendDebugMessage("OnMassDisenchantResponse: " + balance + " +- " + pkt.Amount); HSMPClient.Get().Send(new MsgCurrencyBalance(MsgCurrencyBalance.CurrencyType.DUST, balance + pkt.Amount)); }
public static void OnPurchaseWithGoldResponse() { var pkt = ConnectAPI.GetPurchaseWithGoldResponse(); long balance = NetCache.Get().GetNetObject <NetCache.NetCacheArcaneDustBalance>().Balance; long used = pkt.GoldUsed; HSMPClient.Get().SendDebugMessage("OnPurchaseWithGoldResponse: " + balance + " - " + used); HSMPClient.Get().Send(new MsgCurrencyBalance(MsgCurrencyBalance.CurrencyType.GOLD, balance - used)); }
private void OnReceiveAccount(object sender, Account e) { account.Text = e.AccNo; id.Text = e.ID; ConnectAPI api = ConnectAPI.Get(); api.SendDeposit += OnReceiveDeposit; api.LookUpTheDeposit(e.AccNo, true); }
private void btnPrint_Click(object sender, EventArgs e) { List <CHITIETDONHANG> lstCTDH = dhDAO.GetCTDH(dh.ID); List <THONGTINCHITIETDH2> lstTTCT = new List <THONGTINCHITIETDH2>(); foreach (CHITIETDONHANG c in lstCTDH) { THONGTINCHITIETDH2 t2 = new THONGTINCHITIETDH2(); SANPHAM s = new SanphamDAO().getSanphamById(c.SANPHAM_ID); THONGTINCHITIETDH t = new THONGTINCHITIETDH(c, s); t2.ID = t.ID; t2.KHOILUONG = t.KHOILUONG; t2.SOLUONG = t.SOLUONG; t2.DONGIA = String.Format("{0:0,0}", t.DONGIA); t2.THANHTIEN = String.Format("{0:0,0}", t.THANHTIEN); t2.TEN = new LoaiSpDAO().getLOAISPById(t.LOAISP).TEN; lstTTCT.Add(t2); } //FormPrint formPrint = new FormPrint(lstTTCT, dh); //formPrint.ShowDialog(); string dir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName; string template = dir + @"\Template\DonHang.docx"; DataTable dt = new DataTable(); dt.Columns.Add("ngay"); dt.Columns.Add("thang"); dt.Columns.Add("nam"); dt.Columns.Add("NGUOINHAN"); dt.Columns.Add("SDT"); dt.Columns.Add("DIACHI"); dt.Columns.Add("NGAYDAT"); dt.Columns.Add("TONGTIEN"); dt.Rows.Add(new Object[] { DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year, dh.TENNGUOINHAN, dh.SDT, dh.DIACHI, String.Format("{0:dd-MM-yyyy}", dh.NGAYDAT), String.Format("{0:0,0}", dh.TONGTIEN) }); dt.TableName = "donhang"; DataTable dt2 = new ConnectAPI().ConvertToDataTable <THONGTINCHITIETDH2>(lstTTCT); dt2.TableName = "chitiet"; DataSet ds = new DataSet(); ds.Tables.Add(dt); ds.Tables.Add(dt2); Aspose.Words.Document doc = new Aspose.Words.Document(template); doc.MailMerge.ExecuteWithRegions(ds); string filePath = dir + String.Format("/DonHang_{0}_{1}.pdf", dh.TENNGUOINHAN, DateTime.Now.Day + "_" + DateTime.Now.Month + "_" + DateTime.Now.Year); doc.Save(filePath, Aspose.Words.SaveFormat.Pdf); Process.Start(filePath); }
public Quotes(Specify specify, ConnectAPI api) { this.specify = specify; this.api = api; strategy = specify.Strategy.Equals("TF"); api.OnReceiveBalance = false; api.SendQuotes += OnReceiveQuotes; api.WindingClass = string.Empty; }
public static void OnMedalHistory() { var pkt = ConnectAPI.GetMedalHistory(); HSMPClient.Get().SendDebugMessage(pkt); foreach (var m in pkt.Medals) { HSMPClient.Get().SendDebugMessage(m); } }
private void OnReceiveAccount(object sender, Account e) { if (e.Server.Equals("1")) FormSizes[2, 0] = 594; account.Text = e.AccNo; id.Text = e.ID; Api = ConnectAPI.Get(); Api.SendDeposit += OnReceiveDeposit; Api.LookUpTheDeposit(e.AccNo, true); }
private void TimerTick(object sender, EventArgs e) { ConnectAPI api = ConnectAPI.Get(); api.LookUpTheDeposit(account.Text, api.OnReceiveBalance); if (DateTime.Now.Hour > 14 && DateTime.Now.Minute > 44) { timer.Stop(); } }
/* --- Static Methods (Interface) --- */ public static void OnBoosterList() { HSMPClient.Get().SendDebugMessage("OnBoosterList(" + ConnectAPI.GetBoosters().BoosterStacks.Count + ")"); int count = 0; foreach (var bs in ConnectAPI.GetBoosters().BoosterStacks) { HSMPClient.Get().SendDebugMessage(bs.Id + " : " + bs.Count); count += bs.Count; } HSMPClient.Get().Send(new MsgCurrencyBalance(MsgCurrencyBalance.CurrencyType.PACKS, count)); }
public async Task Payment(string paymentString) { RequestInfor requestInfor = new RequestInfor() { UrlBase = StaticConfig.UrlPaymentPayment, FormValue = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("paymentString", paymentString) } }; var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.POST); }
/* --- Static Methods (Interface) --- */ public static void OnProfileNotices() { var pkt = ConnectAPI.GetProfileNotices(); foreach (var n in pkt) { HSMPClient.Get().SendDebugMessage("Reward: " + n.Type + " - " + n.Origin); switch (n.Type) { case NetCache.ProfileNotice.NoticeType.REWARD_BOOSTER: var n0 = (NetCache.ProfileNoticeRewardBooster)n; var id = n0.Id; var count = n0.Count; break; case NetCache.ProfileNotice.NoticeType.REWARD_CARD: var n1 = (NetCache.ProfileNoticeRewardCard)n; var cardID = n1.CardID; var premium = n1.Premium; break; case NetCache.ProfileNotice.NoticeType.REWARD_DUST: OnRewardDust((NetCache.ProfileNoticeRewardDust)n); break; case NetCache.ProfileNotice.NoticeType.REWARD_GOLD: OnRewardGold((NetCache.ProfileNoticeRewardGold)n); break; case NetCache.ProfileNotice.NoticeType.GAINED_MEDAL: OnRewardMedal((NetCache.ProfileNoticeMedal)n); break; case NetCache.ProfileNotice.NoticeType.DISCONNECTED_GAME: break; case NetCache.ProfileNotice.NoticeType.HERO_LEVEL_UP: break; case NetCache.ProfileNotice.NoticeType.PURCHASE: break; case NetCache.ProfileNotice.NoticeType.REWARD_FORGE: var n5 = (NetCache.ProfileNoticeRewardForge)n; HSMPClient.Get().SendDebugMessage("RewardForge: " + n5.Quantity); break; } } }