Esempio n. 1
0
        private async void btnTestJurisLeges_Click(object sender, EventArgs e)
        {
            OpenStateClientLib.OpenStateClient cli;
            cli = new OpenStateClientLib.OpenStateClient();
            var resultsJL = await cli.GetStateLegesAsync("Texas");

            string s = resultsJL.Data.ToString();


            OpenStateClientLib.LegeSet lset = await cli.GetStatePeopleAsync("Texas");

            string ss = lset.SummarizeLeges();

            rtbResults.Clear();
            rtbResults.AppendText(ss);
        }
        public async Task LegislatorIntent(IDialogContext context, LuisResult result)
        {
            // await context.PostAsync("result.Query = " + result.Query);
            // context.Wait(MessageReceived);

            string State = Continuity.GetSavedState(context);

            if (State == null || State == "")
            {
                await context.PostAsync("No State selected" + ".");

                context.Wait(MessageReceived);
                return;
            }
            string SearchTerm = BillDialogUtil.GetSearchTerm(result);


            OpenStateClientLib.OpenStateClient cli = new OpenStateClientLib.OpenStateClient();

            OpenStateClientLib.LegeSet lset = await cli.GetStatePeopleAsync(State);

            if (lset == null)
            {
                await context.PostAsync("Cannot get legislator list" + ".");

                context.Wait(MessageReceived);
                return;
            }
            string Summary = lset.SummarizeLeges();

            if (SearchTerm == null || SearchTerm == "")
            {
                string OldLegislator = Continuity.GetSavedLegislator(context);
                if (OldLegislator != null && OldLegislator != "")
                {
                    Summary += "Selected Legislator is " + OldLegislator + "!\n";
                }
                // await context.PostAsync(Summary);
                await PostIt(context, Summary);

                context.Wait(MessageReceived);
                return;
            }

            if (SearchTerm != null || SearchTerm != "")
            {
                Continuity.SetSavedLegislator(context, SearchTerm);
                string Msg;
                if (SearchTerm.ToLower() == "all")
                {
                    string Msg2 = $"We will show the votes made by all legislators\nwhen you search for bills.";
                    Msg = Msg2;
                    await context.PostAsync(Msg);

                    context.Wait(MessageReceived);
                    return;
                }
                else if (SearchTerm.ToLower() == "none")
                {
                    string Msg2 = $"We will show no votes made by legislators\nwhen you search for bills.";
                    Msg = Msg2;
                    await context.PostAsync(Msg);

                    context.Wait(MessageReceived);
                    return;
                }
                else
                {
                    int NumFound = lset.FindLegislator(SearchTerm, out Msg);
                    if (NumFound == 1)
                    {
                        string Msg2 = $"We will show the votes made by this legislator\nwhen you search for bills.";
                        Msg += ("\n" + Msg2);
                        await context.PostAsync(Msg);

                        context.Wait(MessageReceived);
                        return;
                    }
                    if (NumFound >= 0)
                    {
                        string Msg2 = $"We will show the votes made by these legislators\nwhen you search for bills.";
                        Msg += ("\n" + Msg2);
                        await context.PostAsync(Msg);

                        context.Wait(MessageReceived);
                        return;
                    }
                    else
                    {
                        await context.PostAsync(Msg);

                        context.Wait(MessageReceived);
                        return;
                    }
                }
            }
        }