private void xem_Click(object sender, EventArgs e) { namhoc1 = namhoc.selectedIndex; hocky1 = bunifuDropdown2.selectedIndex; List <ChuyenDe_DTO> listCD = ChuyenDe_BUS.loadChuyenDeXem(bunifuDropdown2.selectedIndex + 1, namhoc.selectedValue); ttcd_dtgv.AutoGenerateColumns = false; ttcd_dtgv.DataSource = listCD; List <string> items; items = HocKy_BUS.loadNamHoc(); int n = items.Count, i = 0; string[] a = new string[n]; foreach (String it in items) { a[i] = it; i++; } namhoc.Items = a; //namhoc.selectedIndex = namhoc.selectedIndex; namhoc.selectedIndex = namhoc1; String[] itemshk = { "1", "2" }; bunifuDropdown2.Items = itemshk; //bunifuDropdown2.selectedIndex = bunifuDropdown2.selectedIndex; bunifuDropdown2.selectedIndex = hocky1; string taikhoan = Form1.taikhoan; int magv = ChuyenDe_BUS.layMaGV(taikhoan); List <ChuyenDe_DTO> listCD2 = ChuyenDe_BUS.loadChuyenDe2(magv, namhoc.selectedValue, (hocky1 + 1)); bunifuCustomDataGrid1.AutoGenerateColumns = false; bunifuCustomDataGrid1.DataSource = listCD2; //ttcd_dtgv.Show(); }
private void bunifuCustomDataGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e) { int y = e.ColumnIndex; int x = e.RowIndex; if (y == 6) { try { ChuyenDe_BUS.updateCD(int.Parse(bunifuCustomDataGrid1.Rows[x].Cells[0].Value.ToString()), int.Parse(bunifuCustomDataGrid1.Rows[x].Cells[2].Value.ToString()), int.Parse(bunifuCustomDataGrid1.Rows[x].Cells[4].Value.ToString()), DateTime.Parse(bunifuCustomDataGrid1.Rows[x].Cells[3].Value.ToString())); ok.Show(); } catch (Exception) { MessageBox.Show("Loi kieu du lieu!"); } } if (y == 7) { mcd = int.Parse(bunifuCustomDataGrid1.Rows[x].Cells[0].Value.ToString()); tencd = bunifuCustomDataGrid1.Rows[x].Cells[1].Value.ToString(); //this.SendToBack(); //bunifuImageButton3_Click(sender, e); //frm3.Show(); if (ButtonClick != null) { ButtonClick(sender, e); } blev = true; } }
//private void comboBox1_Click(object sender, EventArgs e) //{ // gv2_Load_1(sender, e); //} private void gv2_Load_1(object sender, EventArgs e) { if (gv1.mcd.ToString() != "-1") { comboBox1.Text = gv1.mcd.ToString(); } //MessageBox.Show(gv1.mcd.ToString()); if (gv1.tencd.ToString() != "") { bunifuMetroTextbox2.Text = gv1.tencd.ToString(); } List <ChuyenDe_DTO> listCD = ChuyenDe_BUS.loadChuyenDe1(); List <string> items; items = HocKy_BUS.loadNamHoc(); int n = items.Count, i = 0; string[] a = new string[n]; foreach (String it in items) { a[i] = it; i++; } namhoc.Items = a; namhoc.selectedIndex = gv1.namhoc1; String[] itemshk = { "1", "2" }; bunifuDropdown2.Items = itemshk; bunifuDropdown2.selectedIndex = gv1.hocky1; }
private void bunifuThinButton21_Click(object sender, EventArgs e) { int k = 1; if (comboBox1.Text == "" && bunifuMetroTextbox2.Text == "") { MessageBox.Show("Nhap ma chuyen de hoac ten chuyen de"); k = 0; } if (comboBox2.Text == "" && bunifuMetroTextbox1.Text == "") { MessageBox.Show("Nhap ma sinh vien hoac ten sinh vien"); k = 0; } if (comboBox1.Text == "" && bunifuMetroTextbox2.Text != "") { comboBox1.Text = ChuyenDe_BUS.laymacd(bunifuMetroTextbox2.Text).ToString(); } if (comboBox2.Text == "" && bunifuMetroTextbox1.Text != "") { comboBox2.Text = SinhVien_BUS.layMaSV(bunifuMetroTextbox1.Text).ToString(); } if (k == 1) { List <KetQua_DTO> listKQ = KetQua_BUS.loadKetQua(int.Parse(comboBox2.Text), int.Parse(comboBox1.Text), HocKy_BUS.layMaHK(namhoc.selectedValue, bunifuDropdown2.selectedIndex + 1)); thongtintracuudtgd.AutoGenerateColumns = false; thongtintracuudtgd.DataSource = listKQ; } }
private void ttcd_dtgv_CellContentClick(object sender, DataGridViewCellEventArgs e) { int y = e.ColumnIndex; int x = e.RowIndex; string taikhoan = Form1.taikhoan; int magv = ChuyenDe_BUS.layMaGV(taikhoan); if (y == 7) { ChuyenDe_BUS.phutrachCD(int.Parse(ttcd_dtgv.Rows[x].Cells[0].Value.ToString()), magv); ok.Show(); } }
public void loadThongTinChuyenDe() { List <ChuyenDe_DTO> listCD = ChuyenDe_BUS.loadChuyenDe1(); ttcd_dtgv.AutoGenerateColumns = false; ttcd_dtgv.DataSource = listCD; List <string> items; items = HocKy_BUS.loadNamHoc(); int n = items.Count, i = 0; string[] a = new string[n]; foreach (String it in items) { a[i] = it; i++; } namhoc.Items = a; namhoc.selectedIndex = items.Count() - 1; namhoc1 = items.Count() - 1; namhoc11 = namhoc.selectedValue; hocky1 = 0; String[] itemshk = { "1", "2" }; bunifuDropdown2.Items = itemshk; if (n % 2 == 0) { bunifuDropdown2.selectedIndex = 1; hocky1 = 1; } else { bunifuDropdown2.selectedIndex = 0; hocky1 = 0; } string taikhoan = Form1.taikhoan; int magv = ChuyenDe_BUS.layMaGV(taikhoan); List <ChuyenDe_DTO> listCD2 = ChuyenDe_BUS.loadChuyenDe2(magv, namhoc11, (hocky1 + 1)); bunifuCustomDataGrid1.AutoGenerateColumns = false; bunifuCustomDataGrid1.DataSource = listCD2; }
public void loadThongTinChuyenDe() { List <ChuyenDe_DTO> listCD = ChuyenDe_BUS.loadChuyenDe(); dtgv2.AutoGenerateColumns = false; dtgv2.DataSource = listCD; //for (int i = 0; i < dtgv2.Rows.Count; i++) //{ // if(dtgv2.Rows[i].Cells[4].Value.ToString()=="MỞ") // { // dtgv2.Rows[i].Cells[5].ReadOnly = true; // } // else // { // dtgv2.Rows[i].Cells[6].ReadOnly = true; // } //} //dtgv2.Rows[1].Cells[4].Text = "aa"; //dtgv2.Columns[8].Visible = false; }
private void dtgv2_CellContentClick(object sender, DataGridViewCellEventArgs e) { //int x = e.RowIndex; int y = e.ColumnIndex; if (y == 5) { ChuyenDe_BUS.updateCDM(int.Parse(dtgv2.Rows[e.RowIndex].Cells[0].Value.ToString())); dtgv2.Rows[e.RowIndex].Cells[4].Value = "MỞ"; ok.Show(); } if (y == 6) { ChuyenDe_BUS.updateCDĐ(int.Parse(dtgv2.Rows[e.RowIndex].Cells[0].Value.ToString())); dtgv2.Rows[e.RowIndex].Cells[4].Value = "ĐÓNG"; ok.Show(); } if (y == 7) { try { ChuyenDe_BUS.updateCDUD(int.Parse(dtgv2.Rows[e.RowIndex].Cells[0].Value.ToString()), dtgv2.Rows[e.RowIndex].Cells[1].Value.ToString(), int.Parse(dtgv2.Rows[e.RowIndex].Cells[2].Value.ToString()), DateTime.Parse(dtgv2.Rows[e.RowIndex].Cells[3].Value.ToString())); ok.Show(); } catch (Exception) { MessageBox.Show("Loi kieu du lieu!"); } } if (y == 8) { ChuyenDe_BUS.xoaCD(int.Parse(dtgv2.Rows[e.RowIndex].Cells[0].Value.ToString())); //dtgv2.Rows.RemoveAt(2); List <ChuyenDe_DTO> listCD = ChuyenDe_BUS.loadChuyenDe(); dtgv2.AutoGenerateColumns = false; dtgv2.DataSource = listCD; ok.Show(); } }
private void bunifuThinButton22_Click(object sender, EventArgs e) { try { ChuyenDe_BUS.insertCD(textbox2.Text, int.Parse(textbox3.Text), DateTime.Parse(textbox4.Text)); List <ChuyenDe_DTO> listCD = ChuyenDe_BUS.loadChuyenDe(); dtgv2.AutoGenerateColumns = false; dtgv2.DataSource = listCD; ok.Show(); } catch (Exception) { if (textbox2.Text == "" || textbox3.Text == "" || textbox4.Text == "") { MessageBox.Show("Vui lòng nhập dữ liệu!"); } else { MessageBox.Show("Loi kieu du lieu!"); } } }