Beispiel #1
0
 private void tbtnAddItem_Click(object sender, EventArgs e)
 {
     if (EditDialog.ExecuteDialog_Insert(_IDatabase, SelectedTable) != "")
     {
         RefreshListviewItems();
         lvwItems.SelectedIndices.Add(0);
     }
 }
Beispiel #2
0
 private void tbtnEditItem_Click(object sender, EventArgs e)
 {
     TheAltisProjectDatabase.SqlItem sqlItem = SelectedItem;
     if (sqlItem != null)
     {
         if (EditDialog.ExecuteDialog_Update(_IDatabase, SelectedTable, sqlItem.Id, sqlItem.ItemId, sqlItem.ItemData) != "")
         {
             int index = lvwItems.SelectedIndices[0];
             RefreshListviewItems();
             lvwItems.SelectedIndices.Add(index);
         }
     }
 }
Beispiel #3
0
        private static string ExecuteDialog(TheAltisProjectDatabase.IDatabaseItemGui iDatabase, string table, Int64 id, string itemId, string itemData, bool insert)
        {
            using (EditDialog dlg = new EditDialog())
            {
                dlg.txtItemId.Text   = itemId;
                dlg.txtItemData.Text = itemData;

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    if (insert)
                    {
                        iDatabase.InsertItemId(table, dlg.txtItemId.Text, dlg.txtItemData.Text);
                    }
                    else
                    {
                        iDatabase.UpdateId(table, id, dlg.txtItemId.Text, dlg.txtItemData.Text);
                    }

                    return(dlg.txtItemId.Text);
                }

                return("");
            }
        }