Ejemplo n.º 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string Del   = "Do you want to delete : ";
            string Title = "Delete Confirm!";
            string Op    = (this.Owner as ToolMenu).btnOption.Text;

            if (Op == "    ជម្រើស")
            {
                Del   = "តើអ្នកចង់លុបសិស្សឈ្មោះ  ";
                Title = "លុប";
            }
            Database.Open();
            SL_List s = new SL_List();

            student = s.GetSelected();
            if (student != null)
            {
                var result = MessageBox.Show(Del + student.Name, Title, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    StudentListDB.Delete(student.Id);
                    Database.Close();
                    this.btnList_Click(sender, e);
                }
            }
            else
            {
                MessageBox.Show("Please Select Student First!!!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Ejemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Database.Open();
            SL_List s = new SL_List();

            student = s.GetSelected();
            if (student != null)
            {
                var result = MessageBox.Show("Do you want to delete: " + student.Name, "Delete Confirm!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    StudentListDB.Delete(student.Id);
                    Database.Close();
                    this.btnList_Click(sender, e);
                }
            }
            else
            {
                MessageBox.Show("Please Select Student First!!!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }