Ejemplo n.º 1
0
        public void insertSV()
        {
            DTO_SINHVIEN sv = new DTO_SINHVIEN();

            Input_SV(sv);
            dal_dkhp.insertSV(sv);
        }
Ejemplo n.º 2
0
        private void themsv_Click(object sender, EventArgs e)
        {
            DTO_SINHVIEN sv = new DTO_SINHVIEN();

            sv.MaSV          = masv.Text;
            sv.HoTen         = hoten.Text;
            sv.NgaySinh      = ngaysinh.Value.Date.ToString();
            sv.Phai          = phai.Text;
            sv.Lop           = lop.Text;
            sv.DiemTrugnBinh = float.Parse(diemtb.Text);
            DAL_SINHVIEN dal_sv = new DAL_SINHVIEN();

            dal_sv.insertSV(sv);
            MessageBox.Show("Bạn đã thêm thành công ^^");
        }
Ejemplo n.º 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DTO_SINHVIEN a = new DTO_SINHVIEN();

            a.MaSV          = txtMSSV.Text;
            a.HoTen         = txtName.Text;
            a.NgaySinh      = dateTimePicker1.Value.Date.ToString();
            a.Phai          = cbPhai.Text;
            a.Lop           = cbClass.Text;
            a.DiemTrugnBinh = float.Parse(txtDTB.Text);
            DAL_SINHVIEN dal = new DAL_SINHVIEN();

            dal.insertSV(a);
            MessageBox.Show("Bạn đã thêm thành công ^^");
        }
Ejemplo n.º 4
0
        private void capnhatsinhvien_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow r in dssv.Rows)
            {
                if ((bool)r.Cells["chon"].Value == true && (string)r.Cells["an"].Value.ToString() == "them")
                {
                    DTO_SINHVIEN sv = new DTO_SINHVIEN();
                    sv.MaSV     = r.Cells["masv"].Value.ToString();
                    sv.HoTen    = r.Cells["hoten"].Value.ToString();
                    sv.NgaySinh = r.Cells["ngaysinh"].Value.ToString();
                    sv.Phai     = r.Cells["phai"].Value.ToString();
                    sv.Lop      = r.Cells["lop"].Value.ToString();


                    if (r.Cells["diemtb"].Value.ToString() != "")
                    {
                        sv.DiemTrugnBinh = float.Parse(r.Cells["diemtb"].Value.ToString());
                    }
                    dal_sv.insertSV(sv);
                    MessageBox.Show("Thêm thành công");
                }
                else if ((bool)r.Cells["chon"].Value == true)
                {
                    DTO_SINHVIEN sv = new DTO_SINHVIEN();
                    sv.MaSV     = r.Cells["masv"].Value.ToString();
                    sv.HoTen    = r.Cells["hoten"].Value.ToString();
                    sv.NgaySinh = r.Cells["ngaysinh"].Value.ToString();
                    sv.Phai     = r.Cells["phai"].Value.ToString();
                    sv.Lop      = r.Cells["lop"].Value.ToString();


                    if (r.Cells["diemtb"].Value.ToString() != "")
                    {
                        sv.DiemTrugnBinh = float.Parse(r.Cells["diemtb"].Value.ToString());
                    }
                    dal_sv.updateSV(sv);
                    MessageBox.Show("cập nhật thành công");
                }
            }


            dt1 = dal_sv.loadDSSV(cboLop.SelectedValue.ToString());
            initGrid(cboLop.SelectedValue.ToString());
        }