Exemplo n.º 1
0
        void LoadCbNgonNgu()
        {
            NgonNguDAO nn = new NgonNguDAO();

            cbNgonNgu.DataSource    = nn.GetListNgonNgu();
            cbNgonNgu.DisplayMember = "TenNgonNgu";
        }
Exemplo n.º 2
0
        void ShowNN()
        {
            NgonNguDAO n = new NgonNguDAO();

            nnList.DataSource = n.GetListNgonNgu();
            dgvNN.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGray;
        }
Exemplo n.º 3
0
        public NgonNguDTO LayTenNgonNgu(int maNN)
        {
            NgonNguDAO nnDAO = new NgonNguDAO();
            NgonNguDTO nnDTO = null;

            nnDTO = nnDAO.LayTenNgonNgu(maNN);
            return(nnDTO);
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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");
            }
        }
Exemplo n.º 6
0
        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");
            }
        }
Exemplo n.º 7
0
        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
            {
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
 public static void Insert(NgonNguDTO ngonNgu)
 {
     NgonNguDAO.Insert(ngonNgu);
 }
Exemplo n.º 10
0
 public static void Modify(NgonNguDTO ngonNgu)
 {
     NgonNguDAO.Modify(ngonNgu);
 }
Exemplo n.º 11
0
 public static IList GetList()
 {
     return(NgonNguDAO.GetList());
 }