Beispiel #1
0
        //-----------------get ----------------------------------------------------
        private static HttpResponseMessage GetClientRequest(string RequestURI, eNCRDetails 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);
        }
Beispiel #2
0
        static string ProductNcr(string empCode, string ProncrType, string ProeventCat, string Profoundat, string ProDesc, string Proloc, string ProDept, string ProCat, string ProSubcat, string ProHolcon, string ProSubcon, string ProAttfilename, string ProAtturl, string ProStarttime, string ProEndtime)
        {
            string      responseString = "";
            eNCRDetails sDetails       = new eNCRDetails()
            {
                EmpCode = empCode, NCRType = ProncrType, EventCategory = ProeventCat, FountAt = Profoundat, Description = ProDesc, Location = Proloc, Department = ProDept, Category = ProCat, SubCategory = ProSubcat, HoldingContract = ProHolcon, SubContract = ProSubcon, AttFileName = ProAttfilename, AttFileDataURL = ProAtturl, StartTime = ProStarttime, EndTime = ProEndtime
            };
            HttpResponseMessage responsePostMethod = ClientPostRequest("api/eNCR/SaveeNCR/", sDetails);

            if (responsePostMethod.IsSuccessStatusCode)
            {
                responseString = responsePostMethod.Content.ReadAsStringAsync().Result;
            }
            return(responseString);
        }
Beispiel #3
0
        static string SystemNcr(string empCode, string Sysncrtype, string SyseventCat, string Sysfoundat, string Sysdesc, string Syslocation, string Sysdept, string Syscat, string Syssubcat, string Sysholcon, string Syssubcon, string SysAttachmentfileName, string SysAttachmentfileurl, string SysStarttime, string SysEndtime)
        {
            string responseString = "";

            eNCRDetails sDetails = new eNCRDetails()
            {
                EmpCode = empCode, NCRType = Sysncrtype, EventCategory = SyseventCat, FountAt = Sysfoundat, Description = Sysdesc, Location = Syslocation, Department = Sysdept, Category = Syscat, SubCategory = Syssubcat, HoldingContract = Sysholcon, SubContract = Syssubcon, AttFileName = SysAttachmentfileName, AttFileDataURL = SysAttachmentfileurl, StartTime = SysStarttime, EndTime = SysEndtime
            };
            HttpResponseMessage responsePostMethod = ClientPostRequest("api/eNCR/SaveeNCR/", sDetails);

            if (responsePostMethod.IsSuccessStatusCode)
            {
                responseString = responsePostMethod.Content.ReadAsStringAsync().Result;
            }
            return(responseString);
        }
Beispiel #4
0
        public async Task StartAsync(IDialogContext context)
        {
            var welcomeMessage = context.MakeMessage();

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

            DateTime Starttime = DateTime.Now;

            strStratTime = (Starttime.ToString("h:mm:ss tt"));
            eNCRDetails sDetails = new eNCRDetails()
            {
                EmpCode = EmpCodeFromUser
            };
            HttpResponseMessage responsePostMethod = GetClientRequest("api/eNCR/GeteNCRCombo/18", sDetails);

            string responseString = "";

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

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

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

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