private void EmitRejected(GenericOrderItem item, string message) { TextResponse r = new TextResponse() { Error = EnumError.OTHER, StatusMsg = message, }; foreach (var leg in item.GetLegs()) { r.OpenClose = leg.OpenClose; leg.Order.Text = r.ToString(); EmitRejected(leg.Order, r.ToString()); } }
private void EmitCancelReject(GenericOrderItem item, int error_id, string message) { TextResponse r = new TextResponse() { Error = CTPAPI.FromCTP(error_id), ErrorID = error_id, ErrorMsg = message, }; foreach (var leg in item.GetLegs()) { r.OpenClose = leg.OpenClose; leg.Order.Text = r.ToString(); EmitCancelReject(leg.Order, leg.Order.OrdStatus, r.ToString()); } }
internal static (string txt, string err) TranslateText(string text, string pair) { Console.WriteLine("TranslateText"); if (string.IsNullOrWhiteSpace(pair)) { return("", "No language pair provided"); } Configuration cfg = new Configuration { AppKey = Common.GroupDocsKey, AppSid = Common.GroupDocsSID }; TranslationApi api = new TranslationApi(cfg); TextInfo textInfo = new TextInfo { Pair = pair, Text = text }; string userRequest = $"'[{JsonConvert.SerializeObject(textInfo)}]'"; TranslateTextRequest request = new TranslateTextRequest(userRequest); TextResponse textResponse = api.RunTranslationTextTask(request); if (textResponse.Status != "ok") { return("", textResponse.ToString()); } return(textResponse.Translation, ""); }