Esempio n. 1
0
        private void AddField_Click(object sender, EventArgs e)
        {
            int          i;
            ComboboxItem item2 = new ComboboxItem();

            SingleInputForm DatabaseSingleInputFormStuff = new SingleInputForm("New Database Field", "New Field", "", "");

            DatabaseSingleInputFormStuff.ShowDialog();
            if (DatabaseSingleInputFormStuff.Saved)
            {
                for (i = 0; i < Fields.Items.Count; i++)
                {
                    item2 = (ComboboxItem)Fields.Items[i];
                    if (DatabaseSingleInputFormStuff.Result.Trim().ToUpper().Replace(" ", "") == item2.Text.Trim().ToUpper())
                    {
                        MessageBox.Show("Duplicate Field", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }



                ComboboxItem item = new ComboboxItem();
                item.Text  = DatabaseSingleInputFormStuff.Result.Trim().Replace(" ", "");
                item.Value = LastStoredStuff;

                i = Fields.Items.Add(item);
                LastStoredStuff++;
                Fields.SelectedIndex = i;
                Save.Enabled         = true;
            }
        }
Esempio n. 2
0
        private void NewModualSerialNumber_Click(object sender, EventArgs e)
        {
            SingleInputForm DatabaseSingleInputFormStuff = new SingleInputForm("New Module Serial Number", "Serial Number", "", "00000-00000");

            DatabaseSingleInputFormStuff.ShowDialog();
            if (DatabaseSingleInputFormStuff.Saved)
            {
                SQLiteConnection LBcn = new SQLiteConnection("Data Source=" + FileToUse + "; FailIfMissing=true");
                LBcn.Open();
                const string DATABASEQUOTE = "\"";
                string       S             = "insert into Configuration values (" + DATABASEQUOTE + DatabaseSingleInputFormStuff.Result + DATABASEQUOTE + "," + DATABASEQUOTE + "Placeholder" + DATABASEQUOTE + "," + DATABASEQUOTE + DatabaseSingleInputFormStuff.Result + DATABASEQUOTE + "," + DATABASEQUOTE + "P" + DATABASEQUOTE + ")";
                try
                {
                    SQLiteCommand mycommand = new SQLiteCommand(S, LBcn);
                    mycommand.ExecuteNonQuery();
                    int x = ModuleSerialNumber.Items.Add(DatabaseSingleInputFormStuff.Result);
                    if (x == ModuleSerialNumber.SelectedIndex)
                    {
                        FillGrid();
                    }
                    else
                    {
                        ModuleSerialNumber.SelectedIndex = x;
                    }
                    LBcn.Close();
                }
                catch
                {
                }
            }
        }