void LoadData() { //student load and display Student_Model s1 = new Student_Model(); s1.GetAll(); grdStudent.DataSource = s1.Table; grdStudent.Refresh(); //Parent load and display Parent_Model p1 = new Parent_Model(); p1.GetAll(); grdParent.DataSource = p1.Table; grdParent.Refresh(); //Menu load and display Menu_Model m1 = new Menu_Model(); m1.GetAll(); grdMenu.DataSource = m1.Table; grdMenu.Refresh(); }
private void button3_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBox2.Text)) { MessageBox.Show("Parent Name is required"); return; } if (comboBox2.SelectedItem == null) { MessageBox.Show("Parent type is required"); return; } Parent_Model p1 = new Parent_Model(); p1.Name = textBox2.Text; p1.Type = comboBox2.SelectedItem.ToString() == "Father" ? 0 : 1; p1.Create(); textBox2.Text = ""; comboBox2.SelectedItem = null; LoadData(); }