Esempio n. 1
0
 private void deleteBtn_Click(object sender, EventArgs e)
 {
     try
     {
         var confirmResult = MessageBox.Show("Сигурни ли сте, че искате да изтриете записа?",
                                             "Потвърждение!!",
                                             MessageBoxButtons.YesNo);
         if (confirmResult == DialogResult.Yes)
         {
             con.Open();
             SqlCommand cmd = con.CreateCommand();
             cmd.CommandType = CommandType.Text;
             cmd.CommandText = @"DELETE from CourseSkill 
             WHERE SkillID = '" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "' AND CourseID = '" + label3.Text + "'";
             cmd.ExecuteNonQuery();
             con.Close();
             MessageBox.Show("Успешно изтрити данни!");
             EditSkills srch = new EditSkills(label1.Text, label3.Text);
             srch.MdiParent = this.MdiParent;
             srch.Show();
             this.Hide();
         }
     }
     catch
     {
         MessageBox.Show("Невалидна команда!");
     }
 }
Esempio n. 2
0
        private void editSkillsBtn_Click(object sender, EventArgs e)
        {
            EditSkills srch = new EditSkills(nameCTxt.Text, noTxt.Text);

            srch.MdiParent = this.MdiParent;
            srch.Show();
        }
Esempio n. 3
0
 private void addBtn_Click(object sender, EventArgs e)
 {
     try
     {
         con.Open();
         SqlCommand cmd = con.CreateCommand();
         cmd.CommandType = CommandType.Text;
         cmd.CommandText = @"insert into CourseSkill(SkillID, CourseID) 
                             values('" + skillsCmb.SelectedValue + "', '" + label3.Text + "')";
         cmd.ExecuteNonQuery();
         con.Close();
         MessageBox.Show("Успешно добавени данни!");
         EditSkills srch = new EditSkills(label1.Text, label3.Text);
         srch.MdiParent = this.MdiParent;
         srch.Show();
         this.Hide();
     }
     catch
     {
         MessageBox.Show($"{skillsCmb.Text} вече съществува!");
     }
 }