Example #1
0
 private void btn_timkiem_Click(object sender, EventArgs e)
 {
     Clearr();
     if (nhapid.Text != "")
     {
         int  id  = Convert.ToInt32(nhapid.Text);
         eDVD dvd = dVDBUL.FindDVDById(id);
         if (dvd != null)
         {
             eTieuDe  tieuDe  = tieuDe = tieuDeBUL.Find(dvd.id_TieuDe);
             eTheLoai theLoai = tieuDeBUL.FindTheLoaiById(tieuDe.id_TieuDe);
             txt_tendia.Text   = tieuDe.tenTieuDe;
             txtgiathue.Text   = theLoai.giaThue.ToString();
             txttgthue.Text    = theLoai.thoiGianThue.ToString();
             txt_iddia.Text    = dvd.id_DVD.ToString();
             txt_tragthai.Text = dvd.trangThai.ToString();
             btn_timkiem.Text  = " Tìm kiếm";
         }
         else
         {
             MessageBox.Show("Không có đĩa trong danh sách");
         }
     }
     else
     {
         MessageBox.Show("Nhap ma can tim");
     }
 }
Example #2
0
        public void Save(eTheLoai d)
        {
            TheLoai item = new TheLoai();

            item.id_TheLoai   = d.id_TheLoai;
            item.tenTheLoai   = d.tenTheLoai;
            item.giaThue      = d.giaThue;
            item.thoiGianThue = d.thoiGianThue;
            tldal.Save(item);
        }
Example #3
0
        public eTheLoai FindDVDById(int id)
        {
            TheLoai  t = tldal.Find(id);
            eTheLoai e = new eTheLoai();

            e.id_TheLoai   = t.id_TheLoai;
            e.tenTheLoai   = t.tenTheLoai;
            e.giaThue      = t.giaThue;
            e.thoiGianThue = t.thoiGianThue;
            return(e);
        }
 private void dgv_dsdiathue_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
 {
     if (dgv_dsdiathue.SelectedRows.Count > 0)
     {
         string  str = e.Row.Cells["id_DVD"].Value.ToString();
         eTieuDe t   = td.GetTieuDeByID(Convert.ToInt32(str));
         txt_tieude.Text = t.tenTieuDe;
         eTheLoai theloai = tl.GetTheLoaiByID(t.id_TheLoai);
         DateTime dt      = (DateTime)e.Row.Cells["ngayThue"].Value;
         txt_nghethan.Text = dt.AddDays(theloai.thoiGianThue).ToShortDateString();
     }
 }
 private void cb_listkh_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cb_listkh.SelectedIndex == 1)
     {
         List <eKhachHang> lskh  = khbul.getKhachHangs();
         List <eKhachHang> lskh1 = new List <eKhachHang>();
         foreach (var item in lskh)
         {
             List <ePhieuThueTra> lsp = phieu.getPhieuThueTraByKHBaoCao(item.id_KhachHang);
             foreach (var item1 in lsp)
             {
                 eDVD     dvd1    = dvd.FindDVDById(item1.id_DVD);
                 eTieuDe  t       = td.GetTieuDeByID(dvd1.id_TieuDe);
                 eTheLoai theloai = tl.GetTheLoaiByID(t.id_TheLoai);
                 DateTime dt      = (DateTime)item1.ngayThue;
                 DateTime today   = DateTime.Now;
                 if (item1.ngayTra == null && DateTime.Compare(today, dt.AddDays(theloai.thoiGianThue)) == 1)
                 {
                     lskh1.Add(item);
                     break;
                 }
             }
         }
         dgv_dskh.DataSource = lskh1;
         FormatLaiDataGridviewkh(dgv_dskh);
     }
     else if (cb_listkh.SelectedIndex == 0)
     {
         List <eKhachHang> ls = khbul.getKhachHangs();
         dgv_dskh.DataSource = ls;
         FormatLaiDataGridviewkh(dgv_dskh);
     }
     else
     {
         List <eKhachHang> lskh  = khbul.getKhachHangs();
         List <eKhachHang> lskh1 = new List <eKhachHang>();
         foreach (var item in lskh)
         {
             List <ePhieuThueTra> lsp = phieu.getPhieuThueTraByKHBaoCao(item.id_KhachHang);
             foreach (var item1 in lsp)
             {
                 if (item1.ngayTraPhiTreHen == null)
                 {
                     lskh1.Add(item);
                     break;
                 }
             }
         }
         dgv_dskh.DataSource = lskh1;
         FormatLaiDataGridviewkh(dgv_dskh);
     }
 }
Example #6
0
        public List <eTheLoai> getTheLoais()
        {
            List <eTheLoai> list = new List <eTheLoai>();

            foreach (var item in tldal.getTheLoais())
            {
                eTheLoai tam = new eTheLoai();
                tam.id_TheLoai = item.id_TheLoai;
                tam.tenTheLoai = item.tenTheLoai;
                list.Add(tam);
            }
            return(list);
        }
Example #7
0
        public eTheLoai GetTheLoaiByID(int id)
        {
            eTheLoai tam  = new eTheLoai();
            TheLoai  item = tldal.Find(id);

            if (item != null)
            {
                tam.id_TheLoai   = item.id_TheLoai;
                tam.tenTheLoai   = item.tenTheLoai;
                tam.thoiGianThue = item.thoiGianThue;
                tam.giaThue      = item.giaThue;
                return(tam);
            }
            return(null);
        }
Example #8
0
        public eTheLoai FindTheLoaiById(int id)
        {
            TheLoai t = tddal.FindTheLoaiById(id);

            if (t != null)
            {
                eTheLoai e = new eTheLoai();

                e.id_TheLoai   = t.id_TheLoai;
                e.tenTheLoai   = t.tenTheLoai;
                e.giaThue      = t.giaThue;
                e.thoiGianThue = t.thoiGianThue;
                return(e);
            }
            return(null);
        }
Example #9
0
        private DataTable ConvertListToDataTable(List<eDVD> list)
        {
            DataTable table = new DataTable();
            table.Columns.Add("id_DVD", typeof(int));
            table.Columns.Add("id_TieuDe", typeof(int));
            table.Columns.Add("string_TieuDe", typeof(string));
            table.Columns.Add("gia", typeof(string));
            table.Columns.Add("thoigian", typeof(string));

            foreach (eDVD item in list)
            {
                eTheLoai theLoai = tieuDeBUL.FindTheLoaiById(tieuDeBUL.Find(item.id_TieuDe).id_TheLoai);
                table.Rows.Add(item.id_DVD, item.id_TieuDe, tieuDeBUL.GetTieuDeByID(item.id_TieuDe).tenTieuDe, theLoai.giaThue, theLoai.thoiGianThue);
            }
            return table;
        }
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            int            strMa;
            List <eTieuDe> ls = new List <eTieuDe>();

            if (treeView1.SelectedNode != null)
            {
                eTheLoai tl = new eTheLoai();
                tl            = tlbul.GetTheLoaiByID(Convert.ToInt32(treeView1.SelectedNode.Tag.ToString()));
                txt_time.Text = tl.thoiGianThue.ToString();
                txt_Gia.Text  = tl.giaThue.ToString();
                /// ds tieu de
                strMa = Convert.ToInt32(treeView1.SelectedNode.Tag.ToString());
                ls    = tdbul.GetTieuDeByIDTL(strMa);
                dgv_tieude.DataSource = ls;
                FormatLaiDataGridview(dgv_tieude);
            }
        }
Example #11
0
 private void dgv_dsdia_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         DataGridViewRow row = this.dgv_dsdia.Rows[e.RowIndex];
         if (!row.Cells[1].Value.ToString().Trim().Equals(""))
         {
             //Lưu lại dòng dữ liệu vừa kích chọn
             //Đưa dữ liệu vào textbox
             txt_iddia.Text    = row.Cells[0].Value.ToString();
             txt_tragthai.Text = row.Cells[4].Value.ToString();
             int      s       = Convert.ToInt32(row.Cells[1].Value.ToString());
             eTieuDe  tieuDe  = new eTieuDe();
             eTheLoai theLoai = new eTheLoai();
             tieuDe          = tieuDeBUL.Find(s);
             theLoai         = theLoaiBUL.FindDVDById(tieuDe.id_TheLoai);
             txt_tendia.Text = tieuDe.tenTieuDe;
             txtgiathue.Text = theLoai.giaThue.ToString();
             txttgthue.Text  = theLoai.thoiGianThue.ToString();
         }
     }
 }
Example #12
0
        private void dgv_dsdia_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                //Lưu lại dòng dữ liệu vừa kích chọn
                DataGridViewRow row = this.dgv_dsdia.Rows[e.RowIndex];
                //Đưa dữ liệu vào textbox
                txt_iddia.Text    = row.Cells[0].Value.ToString();
                txt_tragthai.Text = row.Cells[2].Value.ToString();

                int      s       = Convert.ToInt32(row.Cells[2].Value.ToString());
                eTieuDe  tieuDe  = new eTieuDe();
                eTheLoai theLoai = new eTheLoai();
                tieuDe          = tieuDeBUL.Find(s);
                theLoai         = theLoaiBUL.FindDVDById(tieuDe.id_TieuDe);
                txt_tendia.Text = tieuDe.tenTieuDe;
                txtgiathue.Text = theLoai.giaThue.ToString();
                txttgthue.Text  = theLoai.thoiGianThue.ToString();

                //Không cho phép sửa trường STT
                ///txtSTT.Enabled = false;
            }
        }