예제 #1
0
        public void RefreshDataBinding()
        {
            //Lấy tất cả ngày lễ
            listNgayLe = NgayLeBUS.LayTatCaNgayLe_List();

            txtNgayLe.Properties.Items.Clear();
            foreach (NgayLeDTO ngayLe in listNgayLe)
            {
                txtNgayLe.Properties.Items.Add(new MyComboBoxItem(ngayLe.NgayLe.ToString("dd - MM"), ngayLe.MaNgayLe));
            }

            spinThongBaoDatPhong.EditValue = ThamSoBUS.LayKhoangThoiGianChoDatPhong();

            spinHuyDatPhong.EditValue           = ThamSoBUS.LayKhoangThoiGianTuDongHuyDatPhong();
            spinHuyDatPhong.Properties.MaxValue = Convert.ToDecimal(spinThongBaoDatPhong.EditValue);

            txtNgayVao.EditValue      = ThamSoBUS.LayKhoangThoiGianToiThieuGiuaHaiLanThue();
            txtTienTraTruoc.EditValue = ThamSoBUS.QuyDoiDiem(1);

            if (ThamSoBUS.LayChuyenSangChoDonDepSauKhiThanhToan())
            {
                cbChoDonDep.SelectedIndex = 0;
            }
            else
            {
                cbChoDonDep.SelectedIndex = 1;
            }

            ThamSoBUS.GetSoTienLamTron(521234);
        }
예제 #2
0
        public void UpdateTimeNotify()
        {
            Dictionary <int, PhongDTO> tempSapDat = BUS.ThuePhongBUS.LayCacPhongDangSapDuocDat(ThamSoBUS.LayKhoangThoiGianChoDatPhong());
            //Dictionary<int, PhongDTO> tempSapDat = BUS.ThuePhongBUS.LayCacPhongDangSapDuocDat(-5);
            Dictionary <int, DatPhongDTO> tempDatPhongHetHanDat = BUS.DatPhongBUS.LayCacDatPhongDangHetHanDat(ThamSoBUS.LayKhoangThoiGianTuDongHuyDatPhong());

            if (listDanhSachPhongDangDat == null)
            {
                return;
            }



            foreach (PhongDTO phong in tempSapDat.Values)
            {
                if (!listDanhSachPhongDangDat.ContainsKey(phong.MaPhong))
                {
                    //if(!listThoiGianDat.ContainsKey(phong.MaPhong))
                    //{
                    //    listThoiGianDat.Add(phong.MaPhong, DatPhongBUS.LayThongTinThuePhongCuaPhongDangDat(phong.MaPhong,DateTime.Now).ThoiGianDatPhong);
                    //}
                    //else
                    //{

                    //}

                    if (phong.MaTinhTrangPhong == 0)
                    {
                        (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Header = "THÔNG BÁO PHÒNG SẮP ĐƯỢC ĐẶT";
                        (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body   = "Phòng " + phong.TenPhong + " được đặt trong " + ThamSoBUS.LayKhoangThoiGianChoDatPhong() + " phút nữa!";
                        (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body2  = "";
                        (this.ParentForm as MainForm).GeToastNotifications().ShowNotification((this.ParentForm as MainForm).GeToastNotifications().Notifications[0]);

                        BUS.PhongBUS.CapNhatTinhTrangPhong(phong.MaPhong, 4);
                    }
                    else if (phong.MaTinhTrangPhong == 5)
                    {
                        (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Header = "THÔNG BÁO PHÒNG SẮP ĐƯỢC ĐẶT";
                        (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body   = "Phòng " + phong.TenPhong + " được đặt trong " + ThamSoBUS.LayKhoangThoiGianChoDatPhong() + " phút nữa! Phòng vẫn đang trong trạng thái chờ dọn dẹp!";
                        (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body2  = "";
                        (this.ParentForm as MainForm).GeToastNotifications().ShowNotification((this.ParentForm as MainForm).GeToastNotifications().Notifications[0]);

                        BUS.PhongBUS.CapNhatTinhTrangPhong(phong.MaPhong, 6);
                    }
                    else if (phong.MaTinhTrangPhong == 1)
                    {
                        (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Header = "THÔNG BÁO PHÒNG SẮP ĐƯỢC ĐẶT";
                        (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body   = "Phòng " + phong.TenPhong + " được đặt trong " + ThamSoBUS.LayKhoangThoiGianChoDatPhong() + " phút nữa! Phòng vẫn đang trong trạng thái sử dụng!";
                        (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body2  = "";
                        (this.ParentForm as MainForm).GeToastNotifications().ShowNotification((this.ParentForm as MainForm).GeToastNotifications().Notifications[0]);

                        BUS.PhongBUS.CapNhatTinhTrangPhong(phong.MaPhong, 7);
                    }
                }
            }


            foreach (DatPhongDTO datPhong in tempDatPhongHetHanDat.Values)
            {
                foreach (ChiTietDatPhongDTO chiTiet in DatPhongBUS.LayTatCaCacChiTietDatPhong(datPhong.MaDatPhong))
                {
                    //if (listThoiGianDat.ContainsKey(chiTiet.MaPhong))
                    //{
                    //    listThoiGianDat.Remove(chiTiet.MaPhong);
                    //}

                    if (listDanhSachPhongDangDat.ContainsKey(chiTiet.MaPhong))
                    {
                        if (PhongBUS.LayThongTinPhong(chiTiet.MaPhong).MaTinhTrangPhong == 4)
                        {
                            (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Header = "THÔNG BÁO PHÒNG ĐƯỢC ĐẶT QUÁ THỜI GIAN CHỜ";
                            (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body   = "Phòng " + BUS.PhongBUS.LayThongTinPhong(chiTiet.MaPhong).TenPhong + " được đặt quá thời gian chờ nên sẽ chuyển về trạng thái trống và đặt phòng được tự động hủy. ";
                            (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body2  = "";
                            (this.ParentForm as MainForm).GeToastNotifications().ShowNotification((this.ParentForm as MainForm).GeToastNotifications().Notifications[0]);

                            BUS.PhongBUS.CapNhatTinhTrangPhong(chiTiet.MaPhong, 0);
                        }
                        else if (PhongBUS.LayThongTinPhong(chiTiet.MaPhong).MaTinhTrangPhong == 6)
                        {
                            (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Header = "THÔNG BÁO PHÒNG ĐƯỢC ĐẶT QUÁ THỜI GIAN CHỜ";
                            (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body   = "Phòng " + BUS.PhongBUS.LayThongTinPhong(chiTiet.MaPhong).TenPhong + " được đặt quá thời gian chờ nên sẽ chuyển về trạng thái trống và đặt phòng được tự động hủy. ";
                            (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body2  = "";
                            (this.ParentForm as MainForm).GeToastNotifications().ShowNotification((this.ParentForm as MainForm).GeToastNotifications().Notifications[0]);

                            BUS.PhongBUS.CapNhatTinhTrangPhong(chiTiet.MaPhong, 5);
                        }
                        else if (PhongBUS.LayThongTinPhong(chiTiet.MaPhong).MaTinhTrangPhong == 7)
                        {
                            (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Header = "THÔNG BÁO PHÒNG ĐƯỢC ĐẶT QUÁ THỜI GIAN CHỜ";
                            (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body   = "Phòng " + BUS.PhongBUS.LayThongTinPhong(chiTiet.MaPhong).TenPhong + " được đặt quá thời gian chờ nên sẽ chuyển về trạng thái trống và đặt phòng được tự động hủy. ";
                            (this.ParentForm as MainForm).GeToastNotifications().Notifications[0].Body2  = "";
                            (this.ParentForm as MainForm).GeToastNotifications().ShowNotification((this.ParentForm as MainForm).GeToastNotifications().Notifications[0]);

                            BUS.PhongBUS.CapNhatTinhTrangPhong(chiTiet.MaPhong, 1);
                        }
                    }
                    DatPhongBUS.CapNhatTinhTrangDatPhong(3, chiTiet.MaDatPhong);
                }
            }



            RefreshDataBinding();

            //MessageBox.Show("Notification #2 Clicked");
        }