コード例 #1
0
        public JsonResult GetDatas(TableProcessModel table)
        {
            IDataTableService dataTableService = new DataTableService();
            var result = dataTableService.GetData(table.TableName);

            return(new JsonResult {
                Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: fabien367/Gladys-Mathys
        static void Main(string[] args)
        {
            //var credentials = new NetworkCredential("fabien", "test");
            //var handler = new HttpClientHandler { Credentials = credentials };
            //CryptDecrypt c = new CryptDecrypt();
            //var id = c.DataEncrypted("57e5ad63-5e01-4fdc-adae-a7ef9ecff759");
            //using (HttpClient client = new HttpClient(handler))
            //{
            //    var req = new HttpRequestMessage() { RequestUri = new Uri("http://localhost:55493/Outlook/GetAppointments") };
            //    req.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            //    req.Headers.Add("username", "fabien");
            //    //req.Headers.Add("Authorization", id);
            //    var byteArray =  Encoding.Default.GetBytes(id);
            //    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", id);
            //    var reponse = Task.Run(async () => await client.SendAsync(req));
            //    reponse.Wait();
            //    //client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
            //    //client.Headers.Add("Authorization", "3987345394580");
            //    //client.Headers.Add("username", "user");
            //    //client.Headers.Add("password", "pwd");
            //    //var token = client.UploadString("http://localhost:55493/Outlook/GetAppointments", "POST", "grant_type=username=fabien&password=test");
            //}
            //using (HttpClient client = new HttpClient())
            //{
            //    var req = new HttpRequestMessage() { RequestUri = new Uri("http://localhost:55493/Outlook/GetAppointments") };

            //    req.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            //    req.Headers.Add("username", "user");
            //    var byteArray = new UTF8Encoding().GetBytes("<clientid>:<clientsecret>");
            //    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
            //    var reponse = Task.Run(async () => await client.SendAsync(req));
            //    reponse.Wait();
            //    //client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
            //    //client.Headers.Add("Authorization", "3987345394580");
            //    //client.Headers.Add("username", "user");
            //    //client.Headers.Add("password", "pwd");
            //    //var token = client.UploadString("http://localhost:55493/Outlook/GetAppointments", "POST", "grant_type=username=fabien&password=test");
            //}
            ////GenerateToken(null, DateTime.Now, "test");
            ///
            DataTableService s = new DataTableService();

            s.GetData("TemplateTable");
        }