Beispiel #1
0
        public Generator()
        {
            InitializeComponent();

            PriorQueryCombo.DropDownClosed += PriorQueryComboOnDropDownClosed;

            if (ScriptResults != null && ScriptResults.Any())
            {
                PriorQueryCombo.ItemsSource = ScriptResults.OrderByDescending(r => r.ScriptTime);

                var result = ScriptResults.OrderByDescending(r => r.ScriptTime).FirstOrDefault();

                if (result != null)
                {
                    PriorQueryCombo.SelectedItem = result;
                    SqlEditor.Text = result.InputScript;

                    SqlOutput.Text    = result.OutputSql;
                    CSharpOutput.Text = result.OutputCSharp;
                    ServerCombo.Text  = result.Server;
                }
            }
            else
            {
                SqlEditor.Text = "SELECT TOP 100 * FROM Nutshell.dbo.Customer -- Example Script";
            }
        }
Beispiel #2
0
        private void ClearHistory_Click(object sender, RoutedEventArgs e)
        {
            ScriptResults.Clear();
            SqlGenerator.Properties.Settings.Default.Save();

            PriorQueryCombo.ItemsSource = null;
        }
Beispiel #3
0
        private static void TestScript(IScript script, string artist, string album)
        {
            ScriptResults scriptResults = new ScriptResults();

            Thread searchThread = new Thread(new ThreadStart(delegate
            {
                try
                {
                    script.Search(artist, album, scriptResults);
                }
                catch (ThreadAbortException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    Console.WriteLine("FAILED: Script {0} threw an exception while searching: {1}", script.Name, e.Message);
                    return;                     //Skip this script, try the next
                }
            }));

            searchThread.Start();
            searchThread.Join();
            if (!scriptResults.ResultFound)
            {
                Console.WriteLine("FAILED: Script {0} produced no results for {1} / {2}", script.Name, artist, album);
            }
        }
Beispiel #4
0
        //Input se utiliza en las páginas de keypad para ingreso de numeros

        public static ScriptResults Input(ref ReceptionPointState rpState, string data, string source)
        {
            ScriptResults rs = new ScriptResults();
            Customer oCustomer = null;

            if (rpState.CurrentPageKey == "CelPag3")
            {
                try
                {
                    oCustomer = Customer.Get(data, 0);
                    rpState.SessionParameters.Set("IDCliente", oCustomer.Id.ToString());
                    rpState.SessionParameters.Set("FirstName", oCustomer.FirstName.ToString());
                    rpState.SessionParameters.Set("LastName", oCustomer.LastName.ToString());
                    rpState.SessionParameters.Set("Texto", "SI"); //variable para servicio condicional - muestra boton
                    rpState.GotoPage("CelPag4", _universalTimeout);
                }
                catch (Exception ex)
                {
                    rpState.SessionParameters.Set("Texto","NO");
                    SaveLog("Kiosko1Cel", "Error en busqueda de cliente: " + ex.Message + " datavalue: " + data, EventLogEntryType.Error);
                }
               
               
            }
            else if (rpState.CurrentPageKey == "CelPag8")
            {
                rpState.SessionParameters.Set("Telefono", data);
                rpState.SessionParameters.Set("Saldo", DateTime.Now.ToString());
                rpState.GotoPage("CelPag9", _universalTimeout);
            }
            
            return rs;
        }
Beispiel #5
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SqlOutput.Text    = "Generating Script...";
                CSharpOutput.Text = "Generating Script...";

                _CodeGenerator = new CodeGenerator(ConnectionString);

                await _CodeGenerator.GenerateQuerySchema(Query);

                var sqlResult = await _CodeGenerator.GetSqlScript();

                var cSharpResult = await _CodeGenerator.GetPocoScript();

                SqlOutput.Text    = sqlResult;
                CSharpOutput.Text = cSharpResult;

                if (ScriptResults == null)
                {
                    ScriptResults = new ScriptResultList();
                }

                var          lastResult = ScriptResults.FirstOrDefault(r => r.InputScript == Query);
                ScriptResult newResult  = new ScriptResult();

                // If there already is a matching result, update the run time
                if (lastResult != null)
                {
                    lastResult.ScriptTime = DateTime.Now;
                }
                else
                {
                    newResult.Server       = Server;
                    newResult.InputScript  = Query;
                    newResult.OutputCSharp = cSharpResult;
                    newResult.OutputSql    = sqlResult;
                    newResult.ScriptTime   = DateTime.Now;

                    ScriptResults.CullList(newResult);

                    ScriptResults.Add(newResult);
                }

                PriorQueryCombo.ItemsSource = ScriptResults.OrderByDescending(r => r.ScriptTime);
                PriorQueryCombo.Text        = (lastResult == null) ? newResult.ToString() : lastResult.ToString();

                SqlGenerator.Properties.Settings.Default.Save();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                SqlOutput.Text    = string.Format("/*{0}*/", ex.Message);
                CSharpOutput.Text = string.Format("/*{0}*/", ex.Message);
            }
        }
Beispiel #6
0
        private void BuildDynamicData(PythonModel pe, OrganizationMember om)
        {
            pe.DictionaryAdd("PeopleId", PeopleId ?? 0);
            pe.DictionaryAdd("OrganizationId", om.OrganizationId);
            var notifyIds = DbUtil.Db.StaffPeopleForOrg(om.OrganizationId);

            pe.DictionaryAdd("OnlineNotifyId", notifyIds[0].PeopleId);
            pe.DictionaryAdd("OnlineNotifyEmail", notifyIds[0].EmailAddress);
            pe.DictionaryAdd("OnlineNotifyName", notifyIds[0].Name);
            var props = typeof(OnlineRegPersonModel).GetProperties(BindingFlags.Public | BindingFlags.Instance);

            foreach (var pi in props.Where(vv => vv.CanRead && vv.CanWrite))
            {
                switch (pi.Name)
                {
                case "ExtraQuestion":
                    AddQuestions(pe);
                    break;

                case "Text":
                    AddText(pe);
                    break;

                case "YesNoQuestion":
                    AddYesNo(pe);
                    break;

                case "option":
                    AddDropDownOptions(pe);
                    break;

                case "Checkbox":
                    AddCheckboxes(pe);
                    break;

                case "MenuItem":
                    AddMenuItems(pe);
                    break;

                case "ScriptResults":
                    if (ScriptResults.HasValue())
                    {
                        pe.DictionaryAdd(pi.Name, ScriptResults);
                    }

                    break;

                case "memberus":
                    if (memberus)
                    {
                        pe.DictionaryAdd("MemberUs", memberus);
                    }

                    break;

                case "otherchurch":
                    if (otherchurch)
                    {
                        pe.DictionaryAdd("OtherChurch", otherchurch);
                    }

                    break;

                case "LoggedIn":
                    pe.DictionaryAdd(pi.Name, LoggedIn);
                    break;

                case "FirstName":
                    pe.DictionaryAdd(pi.Name, FirstName);
                    break;

                case "LastName":
                    pe.DictionaryAdd(pi.Name, LastName);
                    break;
                }
            }
        }