コード例 #1
0
ファイル: Form1.cs プロジェクト: bonvahoang321/QLSV3Cai
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            SinhVien s = null;

            if (dgvList.SelectedRows.Count == 1)
            {
                if (rdUni.Checked == true)
                {
                    s = new SinhVienDaiHoc()
                    {
                        ChuyenNganh = ((CBBItems)cbbUni.SelectedItem).Text
                    };
                }
                else if (rdBang2.Checked == true)
                {
                    s = new SinhVienBangHai()
                    {
                        Bang1        = txtBang1.Text,
                        DonViCongTac = txtCongTac.Text
                    };
                }
                else
                {
                    s = new SinhVienCaoDang();
                }
                s.MSSV     = Convert.ToInt32(txtId.Text);
                s.HovaTen  = txtName.Text;
                s.NgaySinh = dtDate.Value;
                s.DiaChi   = txtAddress.Text;
                s.SDT      = txtPhone.Text;
                s.NienKhoa = Convert.ToInt32(txtYear.Text);
                CSDL_OOP.Instance.ExcuteDB(s);
            }
            show();
        }
コード例 #2
0
ファイル: CSDL_OOP.cs プロジェクト: bonvahoang321/QLSV3Cai
        public SinhVien GetSV(DataRow i)
        {
            SinhVien s    = null;
            string   CN   = i["ChuyenNganh"].ToString();
            string   B1   = i["Bang1"].ToString();
            string   DVCT = i["DonViCongTac"].ToString();

            if (CN != "")
            {
                s = new SinhVienDaiHoc()
                {
                    ChuyenNganh = CN
                };
            }
            else if (B1 != "" || DVCT != "")
            {
                s = new SinhVienBangHai()
                {
                    Bang1        = B1,
                    DonViCongTac = DVCT
                };
            }
            else
            {
                s = new SinhVienCaoDang()
                {
                };
            }
            s.MSSV     = Convert.ToInt32(i["MSSV"].ToString());
            s.HovaTen  = i["HovaTen"].ToString();
            s.NgaySinh = Convert.ToDateTime(i["NgaySinh"].ToString());
            s.DiaChi   = i["DiaChi"].ToString();
            s.SDT      = i["SDT"].ToString();
            s.NienKhoa = Convert.ToInt32(i["NienKhoa"].ToString());
            return(s);
        }