コード例 #1
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public MainPage()
        {
            InitializeComponent();
            this.DataContext = this;

            AWSCredentials credentials = new EnvironmentAWSCredentials();

            sqs = new AmazonSQSClient(credentials);

            this.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                if (string.Compare(e.PropertyName, "SelectedQueueIndex", System.StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (_selectedQueueIndex > -1)
                    {
                        this.QueueName    = this.QueueNames[_selectedQueueIndex];
                        this.HaveQueueUrl = true;
                    }
                }
            };
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Press any key to send mail!");
            Console.ReadKey();
            //Getting AWS credentials from App.config
            //note: see the app.config to get a example
            var credentials = new EnvironmentAWSCredentials();

            //Client SES instantiated
            var client      = new AmazonSimpleEmailServiceClient(credentials, RegionEndpoint.USEast1);
            var mimeMessage = new MimeMessage();

            //Add sender e-mail address
            //Note: this e-mail address must to be allowed and checked by AWS SES
            mimeMessage.From.Add(new MailboxAddress("Test Sender", "*****@*****.**"));

            //Add  e-mail address destiny
            mimeMessage.To.Add(new MailboxAddress("Joel", "*****@*****.**"));
            mimeMessage.Subject = "Test";
            //Getting attachment stream
            var fileBytes = File.ReadAllBytes(@"C:\anyfile.pdf");

            var bodyBuilder = new BodyBuilder();

            bodyBuilder.TextBody = "Testing the body message";

            //You must to inform the mime-type of the attachment and his name
            bodyBuilder.Attachments.Add("AnyAttachment.pdf", fileBytes, new ContentType("application", "pdf"));
            mimeMessage.Body = bodyBuilder.ToMessageBody();

            //Map MimeMessage to MemoryStream, that is what SenRawEmailRequest accepts
            var rawMessage = new MemoryStream();

            mimeMessage.WriteTo(rawMessage);

            client.SendRawEmail(new SendRawEmailRequest(new RawMessage(rawMessage)));
            Console.WriteLine("Email Sended");

            Console.ReadKey();
        }
コード例 #3
0
        public ViewResult Index(string SearchString, string SearchString1, string SearchString2)
        {
            string esDomain = WebConfigurationManager.AppSettings["EsEndpoint"];

            var credentials    = new EnvironmentAWSCredentials();
            var httpConnection = new AwsHttpConnection(credentials, RegionEndpoint.USEast1);

            var pool   = new SingleNodeConnectionPool(new Uri(esDomain));
            var config = new ConnectionSettings(pool, httpConnection);
            var client = new ElasticClient(config);

            var getTableData = client.Search <DocumentAttributes>(s => s.Index("resume")); // you can get maximum 10000 records at a time

            List <DocumentAttributes> lstData = new List <DocumentAttributes>();

            foreach (var hit in getTableData.Hits)
            {
                lstData.Add(hit.Source);
            }

            return(View(lstData));
        }