public override async Task <Response> Send(SendBody request, ServerCallContext context)
        {
            RepeatedField <string> recipients = new RepeatedField <string>
            {
                "*****@*****.**"
            };

            return(await _emailService.SendAsync(request.Sender, recipients, request.Subject, request.BodyText));
        }
Ejemplo n.º 2
0
 private void SendButton_Click(object sender, RoutedEventArgs e)
 {
     if (SendBody.Text.Length != 0)
     {
         string date = DateTime.Now.ToString();
         SendMessage(SendBody.Text, date);
         SendToBody(date, "ВЫ", SendBody.Text, 0);
         SendBody.Clear();
     }
     else
     {
         MessageBox.Show("Введите сообщение!");
     }
 }
Ejemplo n.º 3
0
 private void SendBody_KeyDown(object sender, KeyEventArgs e)//Отправка сообщений по нажатию кнопки.
 {
     if (e.KeyCode == Keys.Return)
     {
         if (SendBody.Text.Length != 0)
         {
             string date = DateTime.Now.ToString();
             SendMessage(SendBody.Text, date);
             SendToBody(date, "ВЫ", SendBody.Text, 0);
             SendBody.Clear();
         }
         else
         {
             MessageBox.Show("Введите сообщение!");
         }
     }
 }
Ejemplo n.º 4
0
        public override async Task <SendOrderReply> SendOrder(SendOrderRequest request, ServerCallContext context)
        {
            try
            {
                this._logger.LogInformation($"Sent order {request.OrderId}");

                StringBuilder contentSb = new StringBuilder();
                contentSb.Append("Hi, ");
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append("The Payment of your Order has been processed. Thanks for using your debit card. ");
                contentSb.Append("We have saved the card details for future references. ");
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append("The details of your Order are here as under:");
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append($"The Order# {request.OrderId}, is Shipped and Delivered ");
                contentSb.Append($"to {request.Address} at ");
                contentSb.Append($"{string.Format("{0:hh:mm:ss tt}", DateTime.Now)}.");
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append($"The box contains {request.Quantity} set(s) of {request.ProductId}. We hope you love it !!! :-) ");
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append("This mail is sent by Payment Processing Application, a POC which involves gRPC communication between Microservices over Http/2 protocol. ");
                contentSb.Append("The idea is to create a payment processing scenario for a particular order and ");
                contentSb.Append("trigger shippment process for the same. ");
                contentSb.Append("Once the payment is processed the shipping service would ship the order and ");
                contentSb.Append("notification service would notify the user.");
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append("The POC implements the mailing service to send notification to the user. " +
                                 "And hence you are reading this mail.");
                contentSb.Append(Environment.NewLine);
                contentSb.Append("This POC could be used for demos or for further research on gRPC. ");
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append("For more details on gRPC, please visit: https://grpc.io/. ");
                contentSb.Append(Environment.NewLine);
                contentSb.Append("For demo/walkthrough, please contact the developer on weekdays. ");
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append(Environment.NewLine);
                contentSb.Append("Thanks & Regards,");
                contentSb.Append(Environment.NewLine);
                contentSb.Append("Divyesh Bhartiya");

                SendBody body = new SendBody
                {
                    Sender   = "*****@*****.**",
                    Subject  = "Payment Processed",
                    BodyText = contentSb.ToString()
                };

                _ = _mailClient.SendAsync(body);

                return(new SendOrderReply
                {
                    Ok = true
                });
            }
            catch
            {
                return(new SendOrderReply
                {
                    Ok = false
                });
            }
        }