﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.IO;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Web;
//using System.Net.Http;
//using System.Net.Http.Headers;
//using System.Threading.Tasks;
//using iTextSharp.text.pdf;
//using iTextSharp.text.pdf.parser;
//using System.Configuration;
//using Newtonsoft.Json;
//using Newtonsoft.Json.Serialization;
//using System.Diagnostics;
//using SaasprinEmailFetchJob.Data.AppacitiveCloud;
//namespace SaasprinEmailFetchJob
//{
//    public class Program1
//    {

//        public static void Main(string[] args)
//        {
//            FileStream stream = File.OpenRead(@"C:\Users\praveen\Desktop\Sample.pdf");
//            byte[] fileBytes = new byte[stream.Length];
//            stream.Read(fileBytes, 0, fileBytes.Length);
//            stream.Close();
//            Invoice invoice = new Invoice();

//            SendFileAndData(invoice);
//        }
//        private static async void SendFileAndData(Invoice invoice)
//        {
//            APInvoiceStorage invoiceStorage = new APInvoiceStorage();
//            invoice.File.FileId = await invoiceStorage.UploadFile(invoice.File.FileData, invoice.File.MimeType);
//            await invoiceStorage.SaveInvoice(invoice, ConfigurationManager.AppSettings["companyid"]);


//            //using (var client = new HttpClient())
//            //{
//            //    using (var content = new MultipartFormDataContent())
//            //    {
//            //        var values = new[]
//            //        {
//            //            new KeyValuePair<string, string>("Provider","Github"),
//            //            new KeyValuePair<string, string>("Amount","100"),
//            //            new KeyValuePair<string, string>("GeneratedOn","15/02/2015"),
//            //            new KeyValuePair<string, string>("DueDate", "15/02/2015"),
//            //            new KeyValuePair<string, string>("PeriodStartDate","15/02/2015"),
//            //            new KeyValuePair<string, string>("PeriodEndDate", "15/02/2015"),
//            //        };

//            //        foreach (var keyValuePair in values)
//            //        {
//            //            content.Add(new StringContent(keyValuePair.Value), keyValuePair.Key);
//            //        }

//            //        var fileContent = new ByteArrayContent(fs);
//            //        fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
//            //        {
//            //            FileName = "Sample.pdf"
//            //        };
//            //        content.Add(fileContent);
//            //        String companyId = ConfigurationManager.AppSettings["companyid"];
//            //        String url = "invoice/upload/" + companyId;

//            //        var requestUri = "http://saasprin-1.apphb.com/" + url;
//            //        var result = client.PostAsync(requestUri, content).Result;
//            //    }
//            //}

//        }

//    }

//}
            
