private void buttonDeleteEntry_Click(object sender, EventArgs e) { if (UsePassWord) { if (labLog.metaInformation.UsePassword) { PasswordEntry pw = new PasswordEntry(labLog.metaInformation.Password); if (pw.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } } } labLog.RemoveColoumnEntryAt(activeEntry); ModifiedDataBase = true; treeEntries = fillTree(labLog, treeEntries.sortOrder); }
private void buttonAddNewEntry_Click(object sender, EventArgs e) { if (operationMode == OperationMode.None) { panelTimeTable.Enabled = false; panelSelection.Enabled = false; buttonClose.Enabled = false; panelEditNew.Enabled = true; // edit entry if (((Button)sender).Name == buttonEditNewEntry1.Name) { if (UsePassWord) { if (labLog.metaInformation.UsePassword) { PasswordEntry pw = new PasswordEntry(labLog.metaInformation.Password); if (pw.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } } } labelOperation.Text = ButtonText.labelOperationEdit; operationMode = OperationMode.EditEntry; buttonEditNewEntry1.Text = ButtonText.buttonEditNewEntry1_Dialog; buttonEditNewEntry2.Text = ButtonText.buttonEditNewEntry2_Dialog; } // new entry if (((Button)sender).Name == buttonEditNewEntry2.Name) { labelOperation.Text = ButtonText.labelOperationNew; operationMode = OperationMode.NewEntry; buttonEditNewEntry1.Text = ButtonText.buttonEditNewEntry1_Dialog; buttonEditNewEntry2.Text = ButtonText.buttonEditNewEntry2_Dialog; setUserbuttons(false); setCategories(); dTP1.Value = DateTime.Now; dTP2.Value = dTP1.Value.AddHours(1); textBoxInfo.Text = ""; } } else if (operationMode == OperationMode.EditEntry || operationMode == OperationMode.NewEntry) { panelUsers.Controls.Clear(); panelTimeTable.Enabled = true; panelSelection.Enabled = true; buttonEditNewEntry1.Enabled = true; buttonClose.Enabled = true; panelEditNew.Enabled = false; labelOperation.Text = ""; buttonEditNewEntry1.Text = ButtonText.buttonEditNewEntry1; buttonEditNewEntry2.Text = ButtonText.buttonEditNewEntry2; if (((Button)sender).Name == buttonEditNewEntry1.Name) { Entry newEntry = getEntry(); if (operationMode == OperationMode.EditEntry) { labLog.RemoveColoumnEntryAt(activeEntry); } else if (operationMode == OperationMode.NewEntry) { // Nothing to do } int entryNumber = -1; LabLog.insertEntry(ref labLog, ref newEntry, false, out entryNumber); ModifiedDataBase = true; treeEntries = fillTree(labLog, treeEntries.sortOrder); } else { if (treeEntries.treeList.Count == 0) { buttonDeleteEntry.Enabled = false; buttonEditNewEntry1.Enabled = false; panelUsers.Controls.Clear(); } else { buttonDeleteEntry.Enabled = true; buttonEditNewEntry1.Enabled = true; } } operationMode = OperationMode.None; } }