public ActionResult keepalive_ttl(string ClientID, string SessionID) { try { var res = new APIController().callSoapQuery <TTLITradeWSDEV.isClientLoginResponseIsLoginResp>( new TTLAPIRequest( "isClientLogin", new Dictionary <string, object> { ["ClientID"] = ClientID, ["SessionID"] = SessionID, }) ); //TTLITradeWSDEV.ItradeWebServicesClient soap = new TTLITradeWSDEV.ItradeWebServicesClient(); var resp = (TTLITradeWSDEV.isClientLoginResponseIsLoginResp)res; if (resp.errorCode != null || resp.errorMessage != null) { return(this.Json(BaseResponse.MakeResponse("F001", resp.errorCode, null, resp.errorMessage))); } return(this.Json(BaseResponse.MakeResponse(resp))); } catch (Exception e) { return(this.Json(BaseResponse.MakeResponse("F001", e))); } }
public ActionResult submitSoapQuery() { try { String json = new StreamReader(this.Request.InputStream).ReadToEnd(); TTLAPIRequestForm wrapper = (TTLAPIRequestForm)JsonConvert.DeserializeObject(json, typeof(TTLAPIRequestForm)); TTLAPIRequest form = wrapper.form; // validate form OTP here var disable = ConstantDbContext.getInstance().findActiveByKeyNoTracking("INSTRUCTION_FORM_OTP_DISABLE"); if (disable == null || disable.Value != "1") { if (form.otp != null && form.otp != "") { BaseControllerSession session = getSession(); string email = session.email; if (!(new UserCodeController().VerifyEmailCodeCombination(email, form.otp))) { return(this.Json(BaseResponse.MakeResponse("F002", null, null, "OTP Incorrect"))); } } } var res = new APIController().callSoapQuery <object>(form); return(this.Json(BaseResponse.MakeResponse(res))); } catch (Exception e) { return(this.Json(BaseResponse.MakeResponse("F001", e))); } }
public bool keepalive_ttl_internal(string ClientID, string SessionID) { if (ClientID == null || SessionID == null) { return(false); } try { var res = new APIController().callSoapQuery <TTLITradeWSDEV.isClientLoginResponseIsLoginResp>( new TTLAPIRequest( "isClientLogin", new Dictionary <string, object> { ["ClientID"] = ClientID, ["SessionID"] = SessionID, }) ); //TTLITradeWSDEV.ItradeWebServicesClient soap = new TTLITradeWSDEV.ItradeWebServicesClient(); var resp = (TTLITradeWSDEV.isClientLoginResponseIsLoginResp)res; if (resp.errorCode != null || resp.errorMessage != null) { AuditLogDbContext.getInstance().createAuditLog(new AuditLog { is_private = true, action = "TTL INTERNAL", remarks = "FAIL KEEP ALIVE (" + ClientID + ")", }); return(false); } AuditLogDbContext.getInstance().createAuditLog(new AuditLog { is_private = true, action = "TTL INTERNAL", remarks = "SUCCESS KEEP ALIVE (" + ClientID + ")", }); return(true); } catch (Exception e) { return(false); } }
public ActionResult login(string username, string password) { try { var res = new APIController().callSoapQuery <TTLITradeWSDEV.clientLoginResponseLoginResp>( new TTLAPIRequest( "clientLogin", new Dictionary <string, object> { ["ChannelID"] = "INT", ["ClientID"] = username, ["Password"] = password, ["TradingAccSeq"] = "-1", ["Encrypt"] = "Y", }) ); //TTLITradeWSDEV.ItradeWebServicesClient soap = new TTLITradeWSDEV.ItradeWebServicesClient(); var resp = (TTLITradeWSDEV.clientLoginResponseLoginResp)res; if (resp.errorCode != null || resp.errorMessage != null) { return(this.Json(BaseResponse.MakeResponse("F001", resp.errorCode, null, resp.errorMessage))); } setSession(resp); BaseControllerSession session = getSession(); if (session != null) { try { var isNonTradingAccField = "1"; if (session.hasTradingAcc) { isNonTradingAccField = "-1"; } var res2 = new APIController().callSoapQuery <TTLITradeWSDEV.queryAccountDetailsResponseQueryAccountDetailsResp>( new TTLAPIRequest( "queryAccountDetails", new Dictionary <string, object> { ["ClientID"] = session.clientID, ["SessionID"] = session.sessionID, ["isNonTradingAccField"] = isNonTradingAccField, ["version"] = "1", ["deviceID"] = "", ["osVersion"] = "1", }) ); if (res2 != null) { setAccSession(res2); } } catch (Exception e) { AuditLogDbContext.getInstance().createAuditLog(new AuditLog { action = "queryAccountDetails", remarks = "failed", }); } } /* * var jsession = loginQPI(username, password, resp); * * if (jsession.Result != null) * { * setJSession(jsession.Result); * } */ var is_sso_enabled = false; var sso_enabled = ConstantDbContext.getInstance().findActiveByKeyNoTracking("SSO_enabled"); if (sso_enabled != null && sso_enabled.Value != null) { is_sso_enabled = sso_enabled.Value == "1"; } SSO_UpsertUser(is_sso_enabled); return(this.Json(BaseResponse.MakeResponse(resp))); } catch (Exception e) { return(this.Json(BaseResponse.MakeResponse("F001", e))); } }
public ActionResult Register( string username, string email, string firstname, string lastname, string password, string tel, string otp ) { // register and call ttl var codeController = new UserCodeController(); if (codeController.VerifyEmailCodeCombination(email, otp)) { TTLAPIRequest form = new TTLAPIRequest( "createClient", new Dictionary <string, object> { ["username"] = username, ["name"] = firstname, ["cname"] = lastname, ["birthday"] = "1989-01-01", ["idType"] = "H", ["placeOfIssue"] = "HK", ["IDNumber"] = "Y012345(6)", ["sex"] = "M", ["occupationID"] = "1", ["countryOfResidence"] = "HK", ["remark"] = "", ["password"] = password, ["email"] = email, ["mobile"] = tel, ["homeTel"] = tel, ["officeTel"] = tel, ["addressType"] = "1", ["addressTypeSpecified"] = "true", ["address1"] = "Room1", ["address2"] = "", ["address3"] = "", ["address4"] = "", ["address5"] = "" } ); var apiController = new APIController(); var res = apiController.callSoapQuery <TTLITradeWSDEV.createClientResponseCreateClientResp>(form); var mailbody = string.Format( "Dear {0} {1}, <br/><br/>" + "<p>Welcome! Your Registration is Complete. <br/>Your client ID is: {2}</p>" + "<p>Geminis CMS Team</p>", firstname, lastname, res.clientID ); var subject = string.Format( "Welcome to Geminis!" ); EmailHelper.SendEmail(new List <string> { email }, mailbody, subject); return(this.Json(BaseResponse.MakeResponse(res))); } return(this.Json(BaseResponse.MakeResponse("F001", null, null, "OTP Incorrect"))); }