public override Task <ExternalReply> SayHello(ExternalRequest request, ServerCallContext context) { _logger.LogInformation($"Sending hello to {request.Name}"); return(Task.FromResult(new ExternalReply { Message = "Hello " + request.Name })); }
private void SaveExternalReport(bool value) { using (cAaMISContext ctx = new cAaMISContext()) { var externalReport = new ExternalRequest { partyOrganization = tb_PartyOrganization.Text, contactPerson = tb_ContactPerson.Text, contactNo = tb_ContactNo.Text, titleOfEvent = tb_TitleOfEvent.Text, dateOfEvent = dtp_Date.Value, timeOfEvent = tb_Time.Text, venueOfEvent = tb_Venue.Text, pd_Solo = checkBox_Solo.Checked, pd_Duet = checkBox_Duet.Checked, pd_Chorale = checkBox_Chorale.Checked, pd_RondallaBand = checkBox_RondallaBand.Checked, pd_FolkDance = checkBox_FolkDance.Checked, pd_HipHop = checkBox_HipHop.Checked, pd_Contemporary = checkBox_Contemporary.Checked, pd_DanceSports = checkBox_DanceSports.Checked, noOfPerformance = tb_NoOfPerformance.Text, noOfPerformer = tb_NoOfPerformers.Text, bitaw = checkBox_BITAW.Checked, specify = tb_Specify.Text, ExternalInternal = value }; ctx.ExternalRequest.Add(externalReport); ctx.SaveChanges(); } }
private void SaveExternalReport() { using (cAaMISContext ctx = new cAaMISContext()) { var externalReport = new ExternalRequest { er_ID = Convert.ToInt32(dgvr_ExternalRpt.Cells[0].Value.ToString()), partyOrganization = tb_PartyOrganization.Text, contactPerson = tb_ContactPerson.Text, contactNo = tb_ContactNo.Text, titleOfEvent = tb_TitleOfEvent.Text, dateOfEvent = dtp_Date.Value, timeOfEvent = tb_Time.Text, venueOfEvent = tb_Venue.Text, pd_Solo = checkBox_Solo.Checked, pd_Duet = checkBox_Duet.Checked, pd_Chorale = checkBox_Chorale.Checked, pd_RondallaBand = checkBox_RondallaBand.Checked, pd_FolkDance = checkBox_FolkDance.Checked, pd_HipHop = checkBox_HipHop.Checked, pd_Contemporary = checkBox_Contemporary.Checked, pd_DanceSports = checkBox_DanceSports.Checked, noOfPerformance = tb_NoOfPerformance.Text, noOfPerformer = tb_NoOfPerformers.Text, bitaw = checkBox_BITAW.Checked, specify = tb_Specify.Text }; // ctx.ExternalRequest.Attach(externalReport); ctx.Entry(externalReport).State = EntityState.Modified; ctx.SaveChanges(); } }
public static async Task <List <Update> > GetUpdatesAsync(this Telegram telegram) { var result = new List <Update>(); var url = telegram.GetFullPathUrl("getUpdates"); var request = new ExternalRequest <ResponseAnswer <List <Update> >, GetUpdatesRequest>() { Method = POST_METHOD, PostContentType = "application/json", }; if (offset != 0) { request.PostContent = new GetUpdatesRequest() { Offset = offset }; } var response = await RequestSender.Execute(DataAccessMode.Server, request, url).ConfigureAwait(false); result = response?.Result?.Result ?? new List <Update>(); if (result.Any()) { offset = result.LastOrDefault().Id + 1; } return(result); }
public async Task <IActionResult> CheckerAcceptTask(ExternalRequest request) { PushLineResponseModel response = new PushLineResponseModel(); MessageResponseModel message = new MessageResponseModel(); LineMessageTemplate template = new LineMessageTemplate(); dt = new DataTable(); DAC.REST_KeepEventTransaction("CheckerAcceptTask", func.JsonSerialize(request), "CheckerAcceptTask", "[487]"); dt = DAC.CheckApplicationNo(request.AppNo); if (dt.Rows.Count > 0) { dtifExists = new DataTable(); dtifExists = DAC.REST_CheckAceptTaskExisting(request.AppNo); try { if (dtifExists.Rows.Count > 0) { if (!string.IsNullOrEmpty(dtifExists.Rows[0]["Application_Responsibility"].ToString())) { message = api.SetMessage("ไม่สามารถทำรายการได้เนื่องจากมีคนกดรับงานไปแล้ว"); response.to = request.LineUserId; response.messages.Add(message); await api.CallApi(response); DAC.REST_KeepEventTransaction("CheckerAcceptTask", response.to, "DealerController -> CallApi", "[496]"); return(Ok()); } } else { DAC.REST_KeepEventTransaction("CheckerAcceptTask", request.AppNo, "DealerController -> REST_CheckAceptTaskExisting is Empty", "REST_CheckAceptTaskExisting " + request.AppNo); } try { checker.AcceptTask(request.LineUserId, request.AppNo); message = api.SetMessage("บันทึกข้อมูลสำเร็จ"); response.to = request.LineUserId; response.messages.Add(message); await api.CallApi(response); DAC.REST_KeepEventTransaction("CheckerAcceptTask", response.to, "DealerController -> CallApi", "[511]"); } catch (Exception e) { DAC.REST_KeepEventTransaction("CheckerAcceptTask", request.AppNo, "DealerController -> AcceptTask", e.StackTrace); } } catch (Exception e) { DAC.REST_KeepEventTransaction("CheckerAcceptTask", request.AppNo, "DealerController -> REST_CheckApplicationNo", e.StackTrace); } return(Ok()); } else { DAC.REST_KeepEventTransaction("CheckerAcceptTask", request.AppNo, "DealerController -> REST_CheckApplicationNo is Empty", "REST_CheckApplicationNo " + request.AppNo); } return(Ok()); }
public static async Task SendBotActionAsync(this Telegram telegram, SendBotActionRequest sendRequest) { var result = new Message(); var url = telegram.GetFullPathUrl("sendChatAction"); var request = new ExternalRequest <ResponseAnswer <Message>, SendBotActionRequest>() { Method = POST_METHOD, PostContentType = "application/json", PostContent = sendRequest }; await RequestSender.Execute(DataAccessMode.Server, request, url).ConfigureAwait(false); }
public static async Task <WebhookInfoEntity> GetWebhookInfoAsync(this Telegram telegram) { var url = telegram.GetFullPathUrl("getWebhookInfo"); var request = new ExternalRequest <ResponseAnswer <WebhookInfoEntity>, object>() { Method = POST_METHOD, PostContentType = "application/json" }; var result = await RequestSender.Execute(DataAccessMode.Server, request, url).ConfigureAwait(false); return(result.Result.Result); }
public async Task <IActionResult> TestNotice(ExternalRequest request) { dupBubbleMulticast bubble = new dupBubbleMulticast(); dupBubbleMulticastNoFooter nofooter = new dupBubbleMulticastNoFooter(); string strmessage = template.MessageAlertTaskList(); // Get Data for string format dt = new DataTable(); dt = DAC.REST_GetApplicationInformation(request.AppNo); if (dt.Rows.Count > 0) { DateTime date = Convert.ToDateTime(dt.Rows[0]["Application_CreateDate"].ToString()); strmessage = string.Format( strmessage, dt.Rows[0]["Application_DealerName"].ToString(), dt.Rows[0]["Application_No"].ToString(), date.ToString("dd/MM/yyyy HH:mm"), dt.Rows[0]["Application_CustomerName"].ToString(), dt.Rows[0]["Area"].ToString(), dt.Rows[0]["Application_PhoneNumber"].ToString(), dt.Rows[0]["Application_DealerCode"].ToString(), dt.Rows[0]["Dealer_BranchCode"].ToString(), dt.Rows[0]["PhoneNumber"].ToString() ); dt = new DataTable(); dt = DAC.REST_GetCheckerList(request.AppNo); for (int i = 0; i < dt.Rows.Count; i++) { bubble = new dupBubbleMulticast(); nofooter = new dupBubbleMulticastNoFooter(); if (dt.Rows[i]["action"].ToString() == "NoFooter") { nofooter = api.SetBubbleMessageMultiCastNoFooter(strmessage, request.AppNo); nofooter.to.Add(dt.Rows[i]["User_LineUserId"].ToString()); // await api.CallApiMultiCast(nofooter); } else { bubble = api.SetBubbleMessageMultiCast(strmessage, request.AppNo); bubble.to.Add(dt.Rows[i]["User_LineUserId"].ToString()); // await api.CallApiMultiCast(bubble); } } } return(Ok()); }
public static async Task <bool> SendCallbackAnswerAsync(this Telegram telegram, AnswerCallbackQueryRequest answer) { var url = telegram.GetFullPathUrl("answerCallbackQuery"); var request = new ExternalRequest <ResponseAnswer <bool>, AnswerCallbackQueryRequest>() { Method = POST_METHOD, PostContentType = "application/json", PostContent = answer }; var response = await RequestSender.Execute(DataAccessMode.Server, request, url).ConfigureAwait(false); var isSuccess = response.Result?.Result ?? false; return(isSuccess); }
public static async Task <bool> TryUnbanChatMemberAsync(this Telegram telegram, KickChatMemberRequest kickRequest) { var url = telegram.GetFullPathUrl("unbanChatMember"); var request = new ExternalRequest <ResponseAnswer <bool>, KickChatMemberRequest>() { Method = POST_METHOD, PostContentType = "application/json", PostContent = kickRequest }; var response = await RequestSender.Execute(DataAccessMode.Server, request, url).ConfigureAwait(false); var isSuccess = response.Result.Result; return(isSuccess); }
public static async Task SetWebhookAsync(this Telegram telegram, string webhookUrl) { var webhookRequest = new WebhookEntity() { Url = webhookUrl }; var url = telegram.GetFullPathUrl("setWebhook"); var request = new ExternalRequest <ResponseAnswer <object>, WebhookEntity>() { Method = POST_METHOD, PostContentType = "application/json", PostContent = webhookRequest }; var response = await RequestSender.Execute(DataAccessMode.Server, request, url).ConfigureAwait(false); }
public static async Task <Message> EditMessageReplyMarkupAsync(this Telegram telegram, EditReplyMarkupRequest sendMessageRequest) { var result = new Message(); var url = telegram.GetFullPathUrl("editMessageText"); var request = new ExternalRequest <ResponseAnswer <Message>, EditReplyMarkupRequest>() { Method = POST_METHOD, PostContentType = "application/json", PostContent = sendMessageRequest }; var response = await RequestSender.Execute(DataAccessMode.Server, request, url).ConfigureAwait(false); result = response.Result.Result; return(result); }
public static async Task <File> GetFileAsync(this Telegram telegram, GetFileRequest sendRequest) { var result = new File(); var url = telegram.GetFullPathUrl("getFile"); var request = new ExternalRequest <ResponseAnswer <File>, GetFileRequest>() { Method = POST_METHOD, PostContentType = "application/json", PostContent = sendRequest }; var response = await RequestSender.Execute(DataAccessMode.Server, request, url).ConfigureAwait(false); result = response.Result.Result; return(result); }
public async void ClickedNext() { OpentdbParams opentdbParams = new OpentdbParams(); if (SelectedCategoryIndex > 0) { opentdbParams.Category = "&category=" + (SelectedCategoryIndex + 8); } else { opentdbParams.Category = ""; } if (SelectedDifficulty == null || SelectedDifficulty.Equals("All difficulties", StringComparison.Ordinal)) { opentdbParams.Difficulty = ""; } else { opentdbParams.Difficulty = "&difficulty=" + SelectedDifficulty.ToLower(new CultureInfo("en-Us", false)); } if (SelectedAmount == 0) { opentdbParams.Amount = "&amount=3"; } else { opentdbParams.Amount = "&amount=" + selectedAmount; } RootObject rootObject = await ExternalRequest.GetQuizzesFromExternal(opentdbParams).ConfigureAwait(true); if (rootObject == null) { DisplayErrorMessageAsync("Didn't find enough quizzes to match your request!"); return; } Quiz quiz = new Quiz(); quiz.QuizName = SelectedCategoryItem + " Quiz"; quiz.QuizCategory = SelectedCategoryItem; foreach (var opentdbQuestion in rootObject.results) { Question question = new Question(); question.QuestionText = System.Web.HttpUtility.HtmlDecode(opentdbQuestion.question); question.CorrectAnswerNumber = 1; question.AnswersList.Add(new Answer(System.Web.HttpUtility.HtmlDecode(opentdbQuestion.correct_answer), question, 1, 0)); int i = 2; foreach (var answer in opentdbQuestion.incorrect_answers) { question.AnswersList.Add(new Answer(System.Web.HttpUtility.HtmlDecode(answer), question, i++, 0)); } quiz.QuestionList.Add(question); } QuizCompletionParams q = new QuizCompletionParams(); q.Quiz = quiz; q.QuestionToHandle = 1; if (quiz.QuestionList.Count == 0) { DisplayErrorMessageAsync("Didn't find enough quizzes to match your request!"); return; } foreach (var question in quiz.QuestionList) { ScrambleAnswers(question); } NavigationService.Navigate(typeof(TakeQuiz), q); }
public async Task <IActionResult> Push(ExternalRequest request) { dupBubbleMulticast bubble = new dupBubbleMulticast(); dupBubbleMulticastNoFooter nofooter = new dupBubbleMulticastNoFooter(); DAC.REST_KeepEventTransaction("PushMessage", func.JsonSerialize(request), "Push", "[364]"); string strmessage = template.MessageAlertTaskList(); // Get Data for string format dt = new DataTable(); dt = DAC.REST_GetApplicationInformation(request.AppNo); if (dt.Rows.Count > 0) { DateTime date = Convert.ToDateTime(dt.Rows[0]["Application_CreateDate"].ToString()); strmessage = string.Format( strmessage, dt.Rows[0]["Application_DealerName"].ToString(), dt.Rows[0]["Application_No"].ToString(), date.ToString("dd/MM/yyyy HH:mm"), dt.Rows[0]["Application_CustomerName"].ToString(), dt.Rows[0]["Area"].ToString(), dt.Rows[0]["Application_PhoneNumber"].ToString(), dt.Rows[0]["Application_DealerCode"].ToString(), dt.Rows[0]["Dealer_BranchCode"].ToString(), dt.Rows[0]["PhoneNumber"].ToString() ); dt = new DataTable(); dt = DAC.REST_GetCheckerList(request.AppNo); for (int i = 0; i < dt.Rows.Count; i++) { bubble = new dupBubbleMulticast(); nofooter = new dupBubbleMulticastNoFooter(); if (dt.Rows[i]["action"].ToString() == "NoFooter") { try { nofooter = api.SetBubbleMessageMultiCastNoFooter(strmessage, request.AppNo); nofooter.to.Add(dt.Rows[i]["User_LineUserId"].ToString()); await api.CallApiMultiCast(nofooter); DAC.REST_KeepEventTransaction("PushMessage : NoFooter", func.JsonSerialize(nofooter.to), "Push", "[395]"); } catch (Exception e) { DAC.REST_KeepEventTransaction("PushMessage : NoFooter", func.JsonSerialize(nofooter.to), "Push", e.StackTrace); } } else { try { bubble = api.SetBubbleMessageMultiCast(strmessage, request.AppNo); bubble.to.Add(dt.Rows[i]["User_LineUserId"].ToString()); await api.CallApiMultiCast(bubble); DAC.REST_KeepEventTransaction("PushMessage : haveFooter", func.JsonSerialize(bubble.to), "Push", "[409]"); } catch (Exception e) { DAC.REST_KeepEventTransaction("PushMessage : haveFooter", func.JsonSerialize(bubble.to), "Push", e.StackTrace); } } } } return(Ok()); }