Пример #1
0
        private void BtOk_Click(object sender, EventArgs e)
        {
            try
            {
                Aclass cl      = Data.DataStudent.Aclasses.Where(p => p.name.Equals(cbClass.Text)).SingleOrDefault();
                string idclass = cl.id;

                if (lbTitle.Text == "Add Student")
                {
                    StudentDAO.Instance.addStudent(idclass, tbNameDetail.Text, dtpDateOfBirth.Value, tbTelephone.Text, tbEmail.Text,
                                                   cbMale.Text, float.Parse(tbMath.Text), float.Parse(tbPhysical.Text), float.Parse(tbChemistry.Text));
                }
                else if (lbTitle.Text == "Repair Class Of Student")
                {
                    string id = dgvData.SelectedCells[0].OwningRow.Cells["Id"].Value.ToString();
                    StudentDAO.Instance.repairStudent(id, idclass, tbNameDetail.Text, dtpDateOfBirth.Value, tbTelephone.Text, tbEmail.Text,
                                                      cbMale.Text, float.Parse(tbMath.Text), float.Parse(tbPhysical.Text), float.Parse(tbChemistry.Text));
                }
                else if (lbTitle.Text == "Delete A Student")
                {
                    string id = dgvData.SelectedCells[0].OwningRow.Cells["Id"].Value.ToString();
                    StudentDAO.Instance.deleteStudent(id);
                }
            }
            catch (System.Exception)
            {
                MessageBox.Show("Dữ Liệu Nhập Vào Lỗi");
            }

            loadDataStudent();
        }
Пример #2
0
        private void loadDataDetails(DataGridViewCellEventArgs e)
        {
            string idClass = dgvData.SelectedCells[0].OwningRow.Cells["Idclass"].Value.ToString();
            Aclass cl      = Data.DataStudent.Aclasses.Where(p => p.id.Equals(idClass)).SingleOrDefault();

            string   id = dgvData.SelectedCells[0].OwningRow.Cells["Id"].Value.ToString();
            Astudent st = Data.DataStudent.Astudents.Where(p => p.id.Equals(id)).SingleOrDefault();

            cbClass.Text         = cl.name;
            tbNameDetail.Text    = st.name;
            dtpDateOfBirth.Value = st.dateOfbirth;
            tbTelephone.Text     = st.telephone;
            tbEmail.Text         = st.email;

            cbMale.Text = "Male";
            if (st.male == 0)
            {
                cbMale.Text = "Female";
            }

            tbMath.Text      = st.mathPoint.ToString();
            tbPhysical.Text  = st.physicalPoint.ToString();
            tbChemistry.Text = st.chemicalPoint.ToString();
        }
 partial void DeleteAclass(Aclass instance);
 partial void UpdateAclass(Aclass instance);
 partial void InsertAclass(Aclass instance);