/// <summary> /// 啟動報價元件服務 /// </summary> /// <param name="quoteServiceInformation">報價服務資訊</param> /// <param name="userId">使用者ID</param> /// <param name="password">使用者密碼</param> /// <returns>返回值:true=登入成功, false=登入失敗</returns> public bool StartQuoteService(QuoteServiceInformation quoteServiceInformation, string userId = null, string password = null) { bool bRet = quoteServiceInformation.Enabled; if (!bRet) { AbstractQuoteService cQuoteService = GetQuoteService(quoteServiceInformation); if (userId != null && password != null) { cQuoteService.UserId = userId; cQuoteService.Password = password; } bool bLogin = cQuoteService.Login(); //登入報價伺服器 if (bLogin) { quoteServiceInformation.Enabled = bLogin; quoteServiceInformation.DataSource = cQuoteService.DataSource; AddQuoteService(cQuoteService); bRet = bLogin; } } return(bRet); }
private void btnReLogin_Click(object sender, EventArgs e) { _QuoteServiceInfo cQuoteInfo = dataGrid.SelectedDataRows[0] as _QuoteServiceInfo; if (cQuoteInfo.Enabled) { AbstractQuoteService cService = QuoteManager.Manager.GetQuoteService(cQuoteInfo.DataSource); if (cService != null) { cService.Logout(); cService.Login(); } } }