示例#1
0
 private void deleteMemberButton_Click(object sender, EventArgs e)
 {
     if (FirstNameTextBox.Text == "" || SecondNameTextBox.Text == "" || LastNameTextBox.Text == "")
     {
         warningLabel.Text      = "Invalid data";
         warningLabel.ForeColor = Color.Red;
         warningLabel.Visible   = true;
     }
     else
     {
         Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
         dataAccess.DeleteInfoMembers(FirstNameTextBox.Text, SecondNameTextBox.Text, LastNameTextBox.Text);
         warningLabel.Text      = "Data deleted succeessfuly";
         warningLabel.ForeColor = Color.Green;
         warningLabel.Visible   = true;
         FirstNameTextBox.Text  = "";
         SecondNameTextBox.Text = "";
         LastNameTextBox.Text   = "";
         //gospodin vasilev ne mi dade inforaciq help
         //durjat me v kilera molq pomosht
         //бтв аз съм сингъл уинкифейс
     }
 }
示例#2
0
 private void RemoveButton_Click(object sender, EventArgs e)
 {
     if (MemberListBox.SelectedItem == null)
     {
         warningLabel.Text      = "Please select a name";
         warningLabel.ForeColor = Color.Red;
         warningLabel.Visible   = true;
     }
     else
     {
         string   fullName = MemberListBox.SelectedItem.ToString();
         string[] names    = new string[3];
         names = fullName.Split(' ').ToArray();
         Database_Elements.DataAccess dataAccess = new Database_Elements.DataAccess();
         dataAccess.DeleteInfoMembers(names[0], names[1], names[2]);
         warningLabel.Visible = true;
         int numberOfMembers = int.Parse(MemberCounterLabel.Text);
         numberOfMembers--;
         MemberCounterLabel.Text = numberOfMembers.ToString();
         MemberListBox.Items.Remove(MemberListBox.SelectedItem);
         warningLabel.Text      = "Data deleted succeessfuly";
         warningLabel.ForeColor = Color.Green;
     }
 }