void LoadCbNgonNgu() { NgonNguDAO nn = new NgonNguDAO(); cbNgonNgu.DataSource = nn.GetListNgonNgu(); cbNgonNgu.DisplayMember = "TenNgonNgu"; }
void ShowNN() { NgonNguDAO n = new NgonNguDAO(); nnList.DataSource = n.GetListNgonNgu(); dgvNN.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGray; }
public NgonNguDTO LayTenNgonNgu(int maNN) { NgonNguDAO nnDAO = new NgonNguDAO(); NgonNguDTO nnDTO = null; nnDTO = nnDAO.LayTenNgonNgu(maNN); return(nnDTO); }
private void txtSearchTLorNN_TextChanged(object sender, EventArgs e) { string key = txtSearchTLorNN.Text; if (radMaTL.Checked == true) { PhanLoaiDAO pl = new PhanLoaiDAO(); tlList.DataSource = pl.SearchPhanLoai(key); } if (radMaNN.Checked == true) { NgonNguDAO nn = new NgonNguDAO(); nnList.DataSource = nn.searchNgonNgu(key); } }
private void btnDeleteNN_Click(object sender, EventArgs e) { string mann = txtMaNN.Text; string tennn = txtTenNN.Text; NgonNguDAO pl = new NgonNguDAO(); if (pl.DeleteNgonNgu(mann)) { MessageBox.Show("Xóa Ngôn ngữ thành công"); ShowNN(); } else { MessageBox.Show("Có lỗi"); } }
private void btnAddNN_Click(object sender, EventArgs e) { string mann = TaoMaNN(); string tennn = txtTenNN.Text; NgonNguDAO pl = new NgonNguDAO(); if (pl.InsertNgonNgu(mann, tennn)) { MessageBox.Show("Thêm Ngôn ngữ thành công"); ShowNN(); } else { MessageBox.Show("Có lỗi"); } }
private void txtMaSach_TextChanged(object sender, EventArgs e) { try { string MaSach = dgvBook.SelectedCells[0].OwningRow.Cells["MaSach"].Value.ToString(); PhanLoaiDAO phanloai = new PhanLoaiDAO(); PhanLoai pl = phanloai.GetListPhanLoaiByMaSach(txtMaSach.Text); int index = -1; int i = 0; foreach (PhanLoai item in cbTheLoai.Items) { if (item.MaLoai == pl.MaLoai) { index = i; break; } i++; } cbTheLoai.SelectedIndex = index; NgonNguDAO nn = new NgonNguDAO(); NgonNgu ngonNgu = nn.GetListNgonNguByMaSach(txtMaSach.Text); int index1 = -1; int j = 0; foreach (NgonNgu item in cbNgonNgu.Items) { if (item.MaNgonNgu == ngonNgu.MaNgonNgu) { index1 = j; break; } j++; } cbNgonNgu.SelectedIndex = index1; } catch { } }
string TaoMaNN() { NgonNguDAO nv = new NgonNguDAO(); string old = nv.GetMaxMaNN(); old = old.TrimStart('N'); old = old.TrimStart('N'); int newCode = int.Parse(old); newCode += 1; string code = "NN"; if (newCode < 10) { code = code + "0" + newCode; } else { code = code + newCode; } return(code); }
public static void Insert(NgonNguDTO ngonNgu) { NgonNguDAO.Insert(ngonNgu); }
public static void Modify(NgonNguDTO ngonNgu) { NgonNguDAO.Modify(ngonNgu); }
public static IList GetList() { return(NgonNguDAO.GetList()); }