Beispiel #1
0
        private void UpdateListSinhVien()
        {
            if (sinhvienSV == null)
            {
                sinhvienSV = new SinhvienSerivices();
            }
            listSinhvien.Clear();
            listSinhvien.AddRange(sinhvienSV.getDsSinhvien());
            List <String> listDataAutoComplete = new List <string>();

            foreach (sinhvien itemSinhVien in listSinhvien)
            {
                if (itemSinhVien != null)
                {
                    listDataAutoComplete.Add(itemSinhVien.hoten);
                    listDataAutoComplete.Add(itemSinhVien.malop);
                    listDataAutoComplete.Add(itemSinhVien.masv);
                    listDataAutoComplete.Add(itemSinhVien.tenkhoa);
                    listDataAutoComplete.Add(itemSinhVien.diachi);
                    listDataAutoComplete.Add(itemSinhVien.ngaysinh);
                    listDataAutoComplete.Add(itemSinhVien.gioitinh);
                }
            }
            bindAutoCompleteToTextbox(listDataAutoComplete.ToArray());
            bindDataSource <sinhvien>(listSinhvien, gridSv);
        }
Beispiel #2
0
 private void searchSinhVien(String search)
 {
     if (sinhvienSV == null)
     {
         sinhvienSV = new SinhvienSerivices();
     }
     listSinhvien.Clear();
     listSinhvien.AddRange(sinhvienSV.searchSinhvien(search));
     bindDataSource <sinhvien>(listSinhvien, gridSv);
 }
Beispiel #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            bool result = new SinhvienSerivices().update(getDataFromView());

            if (result)
            {
                this.Hide();
                //refresh list
                response.onResponse(Constants.CODE_SV);
            }
            else
            {
                MessageBox.Show("Khong the sua sinh vien");
            }
        }
Beispiel #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            sinhvien khoa   = getDataFromView();
            bool     result = new SinhvienSerivices().add(khoa);

            if (result)
            {
                this.Hide();
                //refresh list
                response.onResponse(Constants.CODE_SV);
            }
            else
            {
                MessageBox.Show("Khong the them vao danh sach");
            }
        }
Beispiel #5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Bạn chắc chắn muốn xóa?", "Xóa", MessageBoxButtons.YesNoCancel,
                                              MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                bool result = new SinhvienSerivices().delete(getDataFromView());
                if (result)
                {
                    this.Hide();
                    //refresh list
                    response.onResponse(Constants.CODE_SV);
                }
                else
                {
                    MessageBox.Show("Khong the xoa sinh vien");
                }
            }
        }