Esempio n. 1
0
        //-----------------get -------------------
        private static HttpResponseMessage GetClientRequest(string RequestURI, TQDetails sDetails)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://epmschatbotapi.azurewebsites.net");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage response = client.GetAsync(RequestURI).Result;

            return(response);
        }
Esempio n. 2
0
        //-------------------post------------------
        static string SaveTqDetails(string empCode, string tqCat, string tqSubCat, string tqClientref, string tqDrawingref, string tqDesc, string tqClosure, string tqExpected, string tqHoldCon, string tqSubCon, string tqissued, string tqAttachmentName, string tqAttachmentUrl, string tqStarttime, string tqEndtime)
        {
            string responseString = "";

            TQDetails sDetails = new TQDetails()
            {
                EmpCode = empCode, TQCategory = tqCat, TQSubCategory = tqSubCat, ClientRefNo = tqClientref, DrawingRefNo = tqDrawingref, TQDescription = tqDesc, ClosureType = tqClosure, ExpectedResponse = tqExpected, HoldingContract = tqHoldCon, SubContract = tqSubCon, IssuedTo = tqissued, AttFileName = tqAttachmentName, AttFileDataURL = tqAttachmentUrl, TQStartTime = tqStarttime, TQEndTime = tqEndtime
            };
            HttpResponseMessage responsePostMethod = ClientPostRequest("api/TQ/SaveTQ", sDetails);

            if (responsePostMethod.IsSuccessStatusCode)
            {
                responseString = responsePostMethod.Content.ReadAsStringAsync().Result;
            }
            return(responseString);
        }
Esempio n. 3
0
        public async Task StartAsync(IDialogContext context)
        {
            // context.Wait(this.MessageReceivedAsync);
            // return Task.CompletedTask;

            var welcomeMessage = context.MakeMessage();

            welcomeMessage.Text = "You have selected TqManager";
            await context.PostAsync(welcomeMessage);

            TQDetails sDetails = new TQDetails()
            {
                EmpCode = EmpCodeFromUser
            };
            HttpResponseMessage responsePostMethod = GetClientRequest("api/TQ/GetTQCombo/18", sDetails);

            string responseString = "";

            if (responsePostMethod.IsSuccessStatusCode)
            {
                responseString = responsePostMethod.Content.ReadAsStringAsync().Result;
            }
            ds = JsonConvert.DeserializeObject <DataSet>(responseString);

            result1 = new string[ds.Tables[1].Rows.Count];

            foreach (DataRow dr in ds.Tables[1].Rows)
            {
                if (strArry == "")
                {
                    strArry = dr[1].ToString();
                }
                else
                {
                    strArry = strArry + "," + dr[1].ToString();
                }
            }
            List <string> resultArry = strArry.Split(',').ToList();

            PromptDialog.Choice(context, NextOnAsync, resultArry,
                                "Please select Category", "Sorry, I didn't get that", 3);
        }