예제 #1
0
        public void loadGalleryPhong()
        {
            dt = QLThuePhong.getAll();
            galleryControl1.Gallery.Groups[0].Items.Clear();
            Bitmap image;

            foreach (DataRow dr in dt.Rows)
            {
                int tinhTrang = Int32.Parse(dr["TinhTrangPhong"].ToString());
                if (tinhTrang == 1)
                {
                    image = new Bitmap(Properties.Resources.close);
                }
                else if (tinhTrang == 0)
                {
                    image = new Bitmap(Properties.Resources.checkInRom);
                }
                else
                {
                    image = new Bitmap(Properties.Resources.open);
                }

                GalleryItem item = new GalleryItem(image, dr["TenPhong"].ToString(), dr["MoTaPhong"].ToString() == "" ? "Ghi Chú" : dr["MoTaPhong"].ToString());
                item.Tag = dr["MaPhong"].ToString() + "_" + dr["TinhTrangPhong"].ToString().Trim();
                galleryControl1.Gallery.Groups[0].Items.Add(item);
            }
        }
예제 #2
0
 private void btnChuyenPhong_Click(object sender, EventArgs e)
 {
     dt = QLThuePhong.getAll();
     lblPhongChuyen.Visible       = true;
     cboPhongChuyen.DataSource    = dt;
     cboPhongChuyen.DisplayMember = "TenPhong";
     cboPhongChuyen.ValueMember   = "MaPhong";
     cboPhongChuyen.Visible       = true;
 }
예제 #3
0
        private void btnThanhToan_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(DTRent.getAllWhere("PHIEUTHUE", "MaPhieuThue = " + txtMaPhieuThue.Text.ToString()).Rows[0]["NgayKetThuc"].ToString()))
                {
                    DTRent.update("NgayKetThuc = '" + DateTime.ParseExact(dtNgayTra.Text, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd HH:mm:ss") + "'", "MaPhieuThue = " + txtMaPhieuThue.Text.ToString());
                }
                loadHoaDon();

                DTBill.update("TinhTrang = 2", "MaHoaDon = " + txtSoBill.Text);
                Phong.update("PHONG", "TinhTrangPhong = -1", "MaPhong = " + txtSoPhong.Tag.ToString());
                DTRent.update("TinhTrangPhieuThue = 2", "MaPhieuThue = " + txtMaPhieuThue.Text.ToString());
                //load lại danh sách phòng
                dt = QLThuePhong.getAll();
                galleryControl1.Gallery.Groups[0].Items.Clear();
                Bitmap image;

                foreach (DataRow dr in dt.Rows)
                {
                    int tinhTrang = Int32.Parse(dr["TinhTrangPhong"].ToString());
                    if (tinhTrang == 1)
                    {
                        image = new Bitmap(Properties.Resources.close);
                    }
                    else if (tinhTrang == 0)
                    {
                        image = new Bitmap(Properties.Resources.checkInRom);
                    }
                    else
                    {
                        image = new Bitmap(Properties.Resources.open);
                    }

                    GalleryItem item = new GalleryItem(image, dr["TenPhong"].ToString(), dr["MoTaPhong"].ToString() == "" ? "Ghi Chú" : dr["MoTaPhong"].ToString());
                    item.Tag = dr["MaPhong"].ToString() + "_" + dr["TinhTrangPhong"].ToString().Trim();
                    galleryControl1.Gallery.Groups[0].Items.Add(item);
                }
                MessageBox.Show("Thanh Toán Thành Công!");
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi Trong Quá trình thanh toán");
                throw;
            }
        }