private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (phong.TenPhong != null)
            {
                tb_tenphong.Text  = phong.TenPhong;
                tb_loaiphong.Text = phong.LoaiPhong;
                tb_gia.Text       = phong.DonGia.ToString();
                tb_ghichu.Text    = phong.GhiChu;
            }

            ThamSoBUS bus  = new ThamSoBUS();
            var       data = bus.SelectThamSo();
            var       a    = data.Rows[0].Field <int>(0);
            int       sott = 1;

            while (a != 0)
            {
                TextBlock stt = new TextBlock();
                stt.Name       = "stt" + a.ToString();
                stt.Height     = 30;
                stt.Width      = 60;
                stt.Text       = sott.ToString();
                stt.Background = Brushes.LightGray;
                sott++;
                TextBox ten = new TextBox();
                ten.Name   = "ten" + a.ToString();
                ten.Height = 30;
                ten.Width  = 200;
                TextBox cmt = new TextBox();
                cmt.Name   = "cmt" + a.ToString();
                cmt.Height = 30;
                cmt.Width  = 200;
                ComboBox loai = new ComboBox();
                loai.Name   = "loai" + a.ToString();
                loai.Height = 30;
                loai.Width  = 100;
                loai.Items.Add("Khach nội địa");
                loai.Items.Add("Khach nươc ngoai");
                loai.SelectedIndex = 0;
                TextBox diachi = new TextBox();
                diachi.Name   = "diachi" + a.ToString();
                diachi.Height = 30;
                diachi.Width  = 300;
                DockPanel dock = new DockPanel();
                dock.Name = "dpn_kh" + a.ToString();
                dock.HorizontalAlignment = HorizontalAlignment.Left;
                dock.Children.Add(stt);
                dock.Children.Add(ten);
                dock.Children.Add(cmt);
                dock.Children.Add(loai);
                dock.Children.Add(diachi);
                pn_khachhang.Children.Add(dock);
                a--;
                listTB.Add(ten);
                listTB.Add(cmt);
                listTB.Add(diachi);
                listCBB.Add(loai);
            }
            dp_ngaybd.SelectedDate = DateTime.Now.Date;
        }
예제 #2
0
        private void buttonYes_Click(object sender, EventArgs e)
        {
            bool flag = true;

            if (dataGridViewThamSo.Rows[Index].Cells["ColTenThamSo"].Value == null)
            {
                MessageBox.Show("Tên tham số không được để trống");
                dataGridViewThamSo.CurrentCell = dataGridViewThamSo.Rows[Index].Cells["ColTenThamSo"];
                dataGridViewThamSo.BeginEdit(true);
                flag = false;
            }
            else if (dataGridViewThamSo.Rows[Index].Cells["ColGiaTri"].Value == null)
            {
                MessageBox.Show("Giá trị không được để trống");
                dataGridViewThamSo.CurrentCell = dataGridViewThamSo.Rows[Index].Cells["ColGiaTri"];
                dataGridViewThamSo.BeginEdit(true);
                flag = false;
            }

            if (flag)
            {
                ThamSoDTO thamSoDTO = new ThamSoDTO();
                thamSoDTO.TenThamSo = dataGridViewThamSo.Rows[Index].Cells["ColTenThamSo"].Value.ToString();
                thamSoDTO.GiaTri    = dataGridViewThamSo.Rows[Index].Cells["ColGiaTri"].Value.ToString();
                if (Status == 1)//Them tham so
                {
                    thamSoDTO.MaThamSo = ThamSoBUS.CreateThamSoId();
                    dataGridViewThamSo.Rows[Index].Cells["ColMaThamSo"].Value = thamSoDTO.MaThamSo;
                    dataGridViewThamSo.Rows[Index].Cells["ColSTT"].Value      = (Index + 1).ToString();
                    if (ThamSoBUS.InsertThamSo(thamSoDTO))
                    {
                        dataGridViewThamSo.Rows[Index].ReadOnly = true;
                        MessageBox.Show("Thêm thành công");
                    }
                    else
                    {
                        dataGridViewThamSo.Rows.RemoveAt(Index);
                        MessageBox.Show("Thêm thất bại");
                    }
                }
                else if (Status == 2)
                {
                    thamSoDTO.MaThamSo = dataGridViewThamSo.Rows[Index].Cells["ColMaThamSo"].Value.ToString();
                    if (ThamSoBUS.UpdateThamSoById(thamSoDTO))
                    {
                        dataGridViewThamSo.Rows[Index].ReadOnly = true;
                        MessageBox.Show("Cập nhật thành công");
                    }
                    else
                    {
                        MessageBox.Show("Cập nhật thất bại");
                        dataGridViewThamSo.Rows[Index].Cells["ColTenThamSo"].Value = BackupThamSoDTO.TenThamSo;
                        dataGridViewThamSo.Rows[Index].Cells["ColGiaTri"].Value    = BackupThamSoDTO.GiaTri;
                        dataGridViewThamSo.Rows[Index].ReadOnly = true;
                    }
                }

                Reset();
            }
        }
예제 #3
0
        //Load các thành phần mặc định, bất kể Status
        private void Load_Default()
        {
            //tao MaStockist va Dia chi Stockist
            List <ThamSoDTO> listthamSoDTO  = ThamSoBUS.SelectThamSoAll();
            string           MaStockist     = "";
            string           DiaChiStockist = "";


            foreach (ThamSoDTO thamSo in listthamSoDTO)
            {
                if (thamSo.TenThamSo == "MaStockist")
                {
                    MaStockist = thamSo.GiaTri;
                }
                if (thamSo.TenThamSo == "DiaChiStockist")
                {
                    DiaChiStockist = thamSo.GiaTri;
                }
                if (thamSo.TenThamSo == "ChietKhau")
                {
                    ChietKhau = float.Parse(thamSo.GiaTri.ToString());
                }
            }
            Label_ChietKhau.Text   = "Chiết khấu: " + ChietKhau.ToString();
            txtMaStockist.Text     = MaStockist;
            txtDiaChiStockist.Text = DiaChiStockist;
        }
예제 #4
0
 private void ThayDoiQD_Load(object sender, EventArgs e)
 {
     tsBUS  = new ThamSoBUS();
     lctBUS = new LoaiCauThuBUS();
     lbtBUS = new LoaiBanThangBUS();
     loadData();
 }
예제 #5
0
        private void bt_sua_Click(object sender, EventArgs e)
        {
            ThamSoDTO ts = new ThamSoDTO();

            ts.MaTS1      = textBox_MaTS.Text;
            ts.TenThamSo1 = textBox_TenTS.Text;
            ts.GiaTri1    = int.Parse(textBox_GiaTri.Text);
            tsbus         = new ThamSoBUS();
            bool kq = tsbus.sua(ts);

            if (kq == false)
            {
                MessageBox.Show("Sữa bệnh nhân thất bại. Vui lòng kiểm tra lại dũ liệu");
            }
            else
            {
                MessageBox.Show("Sữa bệnh nhân thành công");
            }
            bt_sua.Visible          = true;
            textBox_TenTS.ReadOnly  = true;
            textBox_GiaTri.ReadOnly = true;
            bt_luu.Visible          = false;
            bt_Huy.Visible          = false;
            dataGridView1.Enabled   = false;
        }
예제 #6
0
        private void RefreshDataBindingDatPhong()
        {
            schedulerControl1.Storage.Appointments.Clear();

            List <DatPhongDTO> listDatPhong = DatPhongBUS.LayTatCaCacDatPhong(phong.MaPhong);

            foreach (DatPhongDTO datPhong in listDatPhong)
            {
                Appointment apt = schedulerControl1.Storage.CreateAppointment(AppointmentType.Normal);
                apt.Start       = datPhong.ThoiGianDatPhong;
                apt.Duration    = TimeSpan.FromMinutes(ThamSoBUS.LayKhoangThoiGianToiThieuGiuaHaiLanThue());
                apt.Subject     = "Đặt phòng";
                apt.StatusKey   = datPhong.MaDatPhong;
                apt.Description = "Khách hàng: " + KhachHangBUS.LayKhachHang(datPhong.MaKH).TenKH + "\nTiền trả trước: " + datPhong.SoTienDatTruoc.ToString("###,###,##0 VNĐ") + "\nGhi chú: " + datPhong.GhiChu;

                if (datPhong.MaTinhTrangDatPhong == 1)
                {
                    apt.LabelId = 3;
                }
                else if (datPhong.MaTinhTrangDatPhong == 2)
                {
                    apt.LabelId = 2;
                }
                else if (datPhong.MaTinhTrangDatPhong == 3)
                {
                    apt.LabelId = 1;
                }

                schedulerControl1.Storage.Appointments.Add(apt);
            }
        }
예제 #7
0
        private void Bt_ThayDoiPTKNN_Click(object sender, RoutedEventArgs e)
        {
            ThamSoBUS ts = new ThamSoBUS();

            if (tb_HePTKNN.Text == ts.SelectThamSo().Rows[0].Field <double>(2).ToString())
            {
                MessageBox.Show("Giá trị vẫn chưa thay đổi, bạn cần nhập giá trị mới", "Chưa thay đổi giá trị", MessageBoxButton.OK);
            }
            else if (tb_HePTKNN.Text != "")
            {
                if (",".Contains(tb_HePTKNN.Text) == false)
                {
                    MessageBoxResult kq = MessageBox.Show("Bạn có đồng ý sẽ thay đổi hệ số phụ thu với phòng có khách nước ngoài không", "Xác nhận", MessageBoxButton.YesNo);

                    if (kq == MessageBoxResult.Yes)
                    {
                        ts.updateHeSoPhuThuKhachNuocNgoai(double.Parse(tb_HePTKNN.Text));
                        MessageBox.Show("Đã thay đổi hệ số phụ thu với khách nước ngoài thành công", "Thay đổi thành công", MessageBoxButton.OK);
                    }
                }
                else
                {
                    MessageBox.Show("Vui lòng không để ký tự ',' trong ô nhập liệu bạn có thể thay bằng '.' ", "Lỗi nhập liệu", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            else
            {
                MessageBox.Show("Vui lòng nhập dữ liệu ", "Dữ liệu để trống", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
예제 #8
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);
        }
예제 #9
0
 public frmLapPhieuNhapSach()
 {
     InitializeComponent();
     busts = new ThamSoBUS();
     HienThiDSSach();
     HienThiDanhSachPhieuNhap();
 }
예제 #10
0
    private void LayThamSo()
    {
        ThamSoBUS bus = new ThamSoBUS();

        ThamSoDTO dto = bus.LayThamSo();

        XL_THE kq = new XL_THE("ThamSo");

        XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("GiaTriDiemSo", ((int)dto.GiaTriDiemSo).ToString());

        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("DiemKhachHangThanThiet", ((int)dto.DiemKhachHangThanThiet).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("TiLeGiamGiaThucDon", ((int)(dto.TiLeGiamGiaThucDon * 100)).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("Thue", ((int)(dto.Thue * 100)).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("GiaTriDoiDiemKhuyenMai", ((int)dto.GiaTriDoiDiemKhuyenMai).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        Thuoc_tinh = new XL_THUOC_TINH("GioiHanDoiDiemKhuyenMai", ((int)(dto.GioiHanDoiDiemKhuyenMai * 100)).ToString());
        kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        XL_CHUOI.XuatXML(Response, kq.Chuoi());
    }
예제 #11
0
 public frmLapHoaDonBanSach()
 {
     InitializeComponent();
     bushd = new HoaDonBUS();
     busts = new ThamSoBUS();
     HienThiDSSach();
     HienThiDanhSachHoaDon();
 }
예제 #12
0
        void Session_Start(object sender, EventArgs e)
        {
            // Code that runs when a new session is started
            ThamSoBUS soLuongTruyCap = new ThamSoBUS();

            soLuongTruyCap.Update();
            // Code that runs when a new session is started
            Application["SoNguoiOnLine"] = (int)Application["SoNguoiOnLine"] + 1;
        }
 private void XoaCay_Load(object sender, EventArgs e)
 {
     thamso      = new ThamSoBUS();
     cayBus      = new CayCanhBUS();
     ViTriBus    = new ViTriBUS();
     tsDTO       = thamso.selectThamSo();
     listViTri   = ViTriBus.selectVT();
     listcayCanh = cayBus.select();
 }
예제 #14
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ThamSoBUS ts     = new ThamSoBUS();
            var       thamso = ts.SelectThamSo();

            tb_soluongkhach.Text = thamso.Rows[0].Field <int>(0).ToString();
            tb_HeSoPTKT3.Text    = thamso.Rows[0].Field <double>(1).ToString();
            tb_HePTKNN.Text      = thamso.Rows[0].Field <double>(2).ToString();
        }
예제 #15
0
        public void RefreshDataBinding()
        {
            dsDatPhong                  = new DataSet();
            dtDatPhong                  = DatPhongBUS.LayTatCaDatPhong_TinhTrangPhong_KhachHang_NhanVien_DataTable();
            dtDatPhong.TableName        = "datphong";
            dtChiTietDatPhong           = ChiTietDatPhongBUS.LayTatCaChiTietDatPhong_DataTable();
            dtChiTietDatPhong.TableName = "chitietdatphong";
            dsDatPhong.Tables.Add(dtDatPhong);
            dsDatPhong.Tables.Add(dtChiTietDatPhong);
            dsDatPhong.Relations.Add(new DataRelation("thongtinchitietdatphong", dtDatPhong.Columns["MaDatPhong"], dtChiTietDatPhong.Columns["MaDatPhong"]));

            gridControl1.LevelTree.Nodes.Add("thongtinchitietdatphong", gridViewThongTinChiTietDatPhong);

            dtDatPhong_ChiTietDatPhong = DatPhongBUS.LayTatCaDatPhong_ChiTietDatPhong_DataTable();
            dtDatPhong_ChiTietDatPhong.Columns.Add("END_DATE");
            dtDatPhong_ChiTietDatPhong.Columns.Add("MaTinhTrangDatPhong_1", typeof(int));
            int thoiGianToiThieu = ThamSoBUS.LayKhoangThoiGianToiThieuGiuaHaiLanThue();

            foreach (DataRow row in dtDatPhong_ChiTietDatPhong.Rows)
            {
                row["END_DATE"] = DateTime.Parse(row["ThoiGianDatPhong"].ToString()).AddMinutes(thoiGianToiThieu);
                if ((int)row["MaTinhTrangDatPhong"] == 1)
                {
                    row["MaTinhTrangDatPhong_1"] = 3;
                }
                else if ((int)row["MaTinhTrangDatPhong"] == 2)
                {
                    row["MaTinhTrangDatPhong_1"] = 2;
                }
                else
                {
                    row["MaTinhTrangDatPhong_1"] = 1;
                }
            }


            schedulerStorage1.Appointments.DataSource = dtDatPhong_ChiTietDatPhong;
            schedulerStorage1.Resources.DataSource    = dtPhong = PhongBUS.LayTatCaPhong_TinhTrangPhong_LoaiPhong();
            dtPhong.TableName = "phong";
            dsDatPhong.Tables.Add(dtPhong);
            dsDatPhong.Relations.Add(new DataRelation("thongtinphong", dtPhong.Columns["MaPhong"], dtChiTietDatPhong.Columns["MaPhong"]));


            schedulerStorage1.Appointments.Mappings.Subject    = "MaDatPhong";
            schedulerStorage1.Appointments.Mappings.Label      = "MaTinhTrangDatPhong_1";
            schedulerStorage1.Appointments.Mappings.Start      = "ThoiGianDatPhong";
            schedulerStorage1.Appointments.Mappings.End        = "END_DATE";
            schedulerStorage1.Appointments.Mappings.ResourceId = "MaPhong";

            schedulerStorage1.Resources.Mappings.Id      = "MaPhong";
            schedulerStorage1.Resources.Mappings.Caption = "TenPhong";


            //Grid
            gridControl1.DataSource = dsDatPhong.Tables[0];
        }
 private void SuaCay_Load(object sender, EventArgs e)
 {
     cayBus            = new CayCanhBUS();
     ViTriBus          = new ViTriBUS();
     LoaiCayBus        = new LoaiCayBUS();
     TinhTrangBus      = new TinhTrangBUS();
     thamso            = new ThamSoBUS();
     tsDTO             = thamso.selectThamSo();
     TenCaytb.ReadOnly = true;
 }
예제 #17
0
 private void frmPhieuGuiTien_Load(object sender, EventArgs e)
 {
     pgtBUS          = new PhieuGuiTienBUS();
     stkBUS          = new SoTietKiemBUS();
     khBUS           = new KhachHangBUS();
     tsBUS           = new ThamSoBUS();
     txtMaSoPGT.Text = pgtBUS.getNewMaSo();
     loadKhachhHang_Combobox();
     Load_MaSoSTk();
 }
    protected void LayTiLeGiamGiaThucDon()
    {
        ThamSoBUS bus = new ThamSoBUS();
        ThamSoDTO dto = bus.LayThamSo();

        XL_THE Kq = new XL_THE("THAM_SO");

        Kq.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("TiLeGiam", dto.TiLeGiamGiaThucDon.ToString()));

        XL_CHUOI.XuatChuoi(Response, Kq.Chuoi());
    }
예제 #19
0
 private void cbChoDonDep_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cbChoDonDep.SelectedIndex == 0)
     {
         ThamSoBUS.SetKChuyenSangChoDonDepSauKhiThanhToan(true);
     }
     else if (cbChoDonDep.SelectedIndex == 1)
     {
         ThamSoBUS.SetKChuyenSangChoDonDepSauKhiThanhToan(false);
     }
 }
예제 #20
0
        private void frmQuyDinh_Load(object sender, EventArgs e)
        {
            ltkBUS = new LoaiTietKiemBUS();
            tsBUS  = new ThamSoBUS();

            ThamSoDTO ts       = new ThamSoDTO();
            DataTable dtThamSo = tsBUS.getThamSo();                         // get Tham so

            txtTienGuiToiThieu.Text     = (dtThamSo.Rows[0][1]).ToString(); // tu dong hien thi tham so
            txtThoiGianGuiToiThieu.Text = (dtThamSo.Rows[0][3]).ToString(); // tu dong hien thi tham so
            loadLoaiTietKiemVao_Combobox();                                 // load thong tin cac loai tiet kiem dang co
        }
 private void ThemCay_Load(object sender, EventArgs e)
 {
     thamso       = new ThamSoBUS();
     cayBus       = new CayCanhBUS();
     ViTriBus     = new ViTriBUS();
     LoaiCayBus   = new LoaiCayBUS();
     TinhTrangBus = new TinhTrangBUS();
     tsDTO        = thamso.selectThamSo();
     loadViTriVao_Combobox();
     loadLoaiCayVao_Combobox();
     loadTinhTrangVao_Combobox();
 }
        private bool IsDocGiaValid(DateTime ngaySinh)
        {
            int tuoiToiThieu = ThamSoBUS.GetTuoiToiThieu();
            int tuoiToiDa    = ThamSoBUS.GetTuoiToiDa();
            int tuoiDG       = DateTime.Now.Year - ngaySinh.Year;

            if (tuoiToiThieu <= tuoiDG && tuoiDG <= tuoiToiDa)
            {
                return(true);
            }
            MessageBox.Show(this, "Tuổi độc giả không phù hợp với quy định", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            return(false);
        }
        public void LoadThamSo()
        {
            //ThamSoBUS tsBUS = new ThamSoBUS();
            THAMSO thamso = ThamSoBUS.LoadThamSo();

            txtTuoiToiThieu.Text         = thamso.TuoiToiThieu.ToString();
            txtTuoiToiDa.Text            = thamso.TuoiToiDa.ToString();
            txtThoiHanGiaTriThe.Text     = thamso.ThoiHanGiaTriThe.ToString();
            txtKhoangCachNamXuatBan.Text = thamso.KhoangCachNamXuatBanToiDa.ToString();
            txtSoLuongSachMuon.Text      = thamso.SoLuongSachMuonToiDa.ToString();
            txtSoNgayMuon.Text           = thamso.SoNgayMuonToiDa.ToString();
            txtTienPhat.Text             = thamso.TienPhat.ToString();
        }
        private void btnApply_Click(object sender, EventArgs e)
        {
            if (IsNumber(tbSoTienNo.Text) == false)
            {
                MessageBox.Show("Số tiền nợ là số.Mời nhập lại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            if (IsNumber(tbSoXeSua.Text) == false)
            {
                MessageBox.Show("Số xe sửa là số.Mời nhập lại.", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            //if there is nothing in any text boxes
            if (tbSoTienNo.Text == "" || tbSoXeSua.Text == "")
            {
                MessageBox.Show("Xin hãy điền đầy đủ thông tin!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //store exception
            string ex = "";
            //we have to save the old ThamSo for sure
            //if we didn't save that and exception occur, we have to revert them
            decimal oldSoTienNoToiDa    = ThamSoDTO.SoTienNoToiDa;
            decimal oldSoXeSuaChuaToiDa = ThamSoDTO.SoXeSuaChuaToiDa;
            bool    oldSuDungQuyDinh4   = ThamSoDTO.SuDungQuyDinh4;

            //set thamso's information
            ThamSoDTO.SoTienNoToiDa    = decimal.Parse(tbSoTienNo.Text);
            ThamSoDTO.SoXeSuaChuaToiDa = decimal.Parse(tbSoXeSua.Text);
            ThamSoDTO.SuDungQuyDinh4   = checkSuDungQuyDinh.Checked;

            //update ThamSo
            ThamSoBUS.UpdateParameters(ex);

            //if there is exception, show it
            if (ex != "")
            {
                MessageBox.Show(ex, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Revert
                ThamSoDTO.SoTienNoToiDa    = oldSoTienNoToiDa;
                ThamSoDTO.SoXeSuaChuaToiDa = oldSoXeSuaChuaToiDa;
                ThamSoDTO.SuDungQuyDinh4   = oldSuDungQuyDinh4;
                //Update ThamSo again
                ThamSoBUS.UpdateParameters(ex);
                return;
            }
            //show success message
            MessageBox.Show("Cập nhật thành công", "Thành Công", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void Dp_ngaythanhtoan_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            TimeSpan time = new TimeSpan();

            time = Convert.ToDateTime(dp_ngaythanhtoan.Text) - Convert.ToDateTime(dp_ngaybd.Text);
            int day = time.Days;

            if (day <= 0 || tb_tenphong.Text == "" || tb_loaiphong.Text == "")
            {
                MessageBox.Show("Chọn ngày thanh toán không hợp lệ hoặc dữ liệu trống, vui lòng chọn lại ngày khác và kiểm tra dữ liệu", "Chọn ngày không hợp lệ", MessageBoxButton.OK);
                dp_ngaythanhtoan.SelectedDate = DateTime.Now.Date.AddDays(1);
            }
            else
            {
                tb_songaythue.Text = day.ToString();
                KhachHangBUS      kh = new KhachHangBUS();
                PhieuThuePhongBUS pt = new PhieuThuePhongBUS();
                var khachhang        = kh.selectKhachHang(pt.selectPhieuThuePhongGanNhat(tb_tenphong.Text).Rows[0].Field <string>(0));
                int SoKhachNuocNgoai = 0;
                int Soluongkhach     = 0;
                foreach (DataRow row in khachhang.Rows)
                {
                    if (row.Field <string>(2) == "khach nuoc ngoai")
                    {
                        SoKhachNuocNgoai++;
                    }
                    Soluongkhach++;
                }
                ThamSoBUS ts     = new ThamSoBUS();
                var       thamso = ts.SelectThamSo();
                tb_tienphong.Text = (double.Parse(tb_gia.Text) * day).ToString();
                if (SoKhachNuocNgoai > 0 && Soluongkhach >= thamso.Rows[0].Field <int>(0))
                {
                    tb_phuthu.Text = ((double.Parse(tb_tienphong.Text) * thamso.Rows[0].Field <double>(2) - double.Parse(tb_tienphong.Text)) + double.Parse(tb_tienphong.Text) * thamso.Rows[0].Field <double>(1)).ToString();
                }
                if (SoKhachNuocNgoai == 0 && Soluongkhach >= thamso.Rows[0].Field <int>(0))
                {
                    tb_phuthu.Text = (double.Parse(tb_tienphong.Text) * thamso.Rows[0].Field <double>(1)).ToString();
                }
                if (SoKhachNuocNgoai > 0 && Soluongkhach < thamso.Rows[0].Field <int>(0))
                {
                    tb_phuthu.Text = ((double.Parse(tb_tienphong.Text) * thamso.Rows[0].Field <double>(2) - double.Parse(tb_tienphong.Text))).ToString();
                }
                if (SoKhachNuocNgoai == 0 && Soluongkhach < thamso.Rows[0].Field <int>(0))
                {
                    tb_phuthu.Text = "0";
                }
                tb_tongtien.Text = (double.Parse(tb_phuthu.Text) + double.Parse(tb_tienphong.Text)).ToString();
                tb_tienchu.Text  = DocTienBangChu(long.Parse(tb_tongtien.Text), " VNĐ");
            }
        }
 private void Vattu_Load(object sender, EventArgs e)
 {
     vattuBus     = new VattuBUS();
     DonViTinhBus = new DonViTinhBUS();
     GiaVatTuBus  = new GiaVatTuBUS();
     phieumuaBUS  = new PhieuMuaVatTuBUS();
     loadMaVatTu_Combobox();
     listVatTu    = vattuBus.selectvattu();
     listDonVi    = DonViTinhBus.selectDonVi();
     listGiaVatTu = GiaVatTuBus.selectGiaVat();
     thamso       = new ThamSoBUS();
     tsDTO        = thamso.selectThamSo();
     Donvi_Combobox();
 }
        private void fThayDoiQuyDinh_Load(object sender, EventArgs e)
        {
            //a variable to store exception
            string ex = "";

            ThamSoBUS.GetParameters(ex);

            //if there is exception
            if (ex != "")
            {
                MessageBox.Show(ex, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //Set the text in text boxes by thamso's information
            tbSoXeSua.Text             = ThamSoDTO.SoXeSuaChuaToiDa.ToString();
            tbSoTienNo.Text            = ThamSoDTO.SoTienNoToiDa.ToString();
            checkSuDungQuyDinh.Checked = ThamSoDTO.SuDungQuyDinh4;
        }
예제 #28
0
        private void Bt_ThayDoiSoLuongKhach_Click(object sender, RoutedEventArgs e)
        {
            if (tb_soluongkhach.Text != "")
            {
                MessageBoxResult kq = MessageBox.Show("Bạn có đồng ý sẽ thay đổi số lượng khách tối đa của tất cả các phòng không", "Xác nhận", MessageBoxButton.YesNo);

                if (kq == MessageBoxResult.Yes)
                {
                    ThamSoBUS ts = new ThamSoBUS();
                    ts.updateSoLuongKhachToiDa(int.Parse(tb_soluongkhach.Text));
                    MessageBox.Show("Đã thay đổi số lượng khách tối đa thành công", "Thay đổi thành công", MessageBoxButton.OK);
                }
            }
            else
            {
                MessageBox.Show("Vui lòng nhập dữ liệu ", "Dữ liệu để trống", MessageBoxButton.OK, MessageBoxImage.Hand);
            }
        }
예제 #29
0
        private void buttonXoa_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Xóa tham số", "Tham số", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            //Lấy vị trí cần xóa
            if (res == DialogResult.Yes)
            {
                Index = dataGridViewThamSo.CurrentRow.Index;
                string id  = dataGridViewThamSo.CurrentRow.Cells["ColMaThamSo"].Value.ToString().Trim();
                int    stt = int.Parse(dataGridViewThamSo.CurrentRow.Cells["ColSTT"].Value.ToString());
                if (ThamSoBUS.DeleteThamSoById(id))
                {
                    dataGridViewThamSo.Rows.RemoveAt(Index);
                    if (dataGridViewThamSo.Rows.Count > 0)
                    {
                        bool flag = false;
                        for (int i = 0; i < Index; i++)
                        {
                            if (dataGridViewThamSo.Rows[i].Visible == true)
                            {
                                flag = true;
                            }
                        }
                        for (int i = Index; i < dataGridViewThamSo.Rows.Count; i++)
                        {
                            if (dataGridViewThamSo.Rows[i].Visible == true)
                            {
                                dataGridViewThamSo.Rows[i].Cells["ColSTT"].Value = stt.ToString();
                                stt++;
                                flag = true;
                            }
                        }
                        if (flag == false)
                        {
                            buttonDisabled();
                        }
                    }
                    else
                    {
                        buttonDisabled();
                    }
                }
            }
        }
예제 #30
0
        public void CapNhat( )
        {
            var dialog = IoC.Get <DialogViewModel>();

            dialog.Question    = "Xác nhận đơn hàng đã chọn?";
            dialog.DisplayName = "";

            var result = _windowManager.ShowDialog(dialog);

            if (result != true)
            {
                return;
            }

            ThamSoBUS.UpdatePhiThuHo(PhiThuHo);
            ThamSoBUS.UpdateSoTienTrenKm(PhiVanChuyenTrenKm);

            Refresh(  );
        }