예제 #1
0
 public static bool DangKiDichVu(OderDichVuDTO infor)
 {
     if (infor.SoLuong > 0)
     {
         return(OderServiceDAO.DangKiDichVu(infor));
     }
     else
     {
         return(false);
     }
 }
예제 #2
0
        public static bool DangKiDichVu(OderDichVuDTO infor)
        {
            SqlParameter MaDichVu = new SqlParameter("@MaDichVu", infor.MaDichVu);
            SqlParameter maphong  = new SqlParameter("@MaPhong", infor.MaPhong);
            SqlParameter soluong  = new SqlParameter("@SoLuong", infor.SoLuong);

            try
            {
                context.Database.ExecuteSqlCommand("spDangKiDichVu @MaDichVu, @MaPhong , @SoLuong", MaDichVu, maphong, soluong);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #3
0
        private void btnOder_Click(object sender, EventArgs e)
        {
            List <OderDichVuDTO> lst = new List <OderDichVuDTO>();
            string tendichvu         = cmbDichVu.Text;

            lst = OderDichVuBUS.LayMaDichVuDangKi(tendichvu);
            OderDichVuDTO infor = new OderDichVuDTO();

            infor.MaPhong  = Convert.ToInt32(cmbMaPhong.Text);
            infor.SoLuong  = Convert.ToInt32(txtSoLuong.Text);
            infor.MaDichVu = lst[0].MaDichVu;
            if (OderDichVuBUS.DangKiDichVu(infor) == true)
            {
                MessageBox.Show("Đăng kí dịch vụ thành công", "Thông báo",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Lỗi hệ thống hoặc chưa nhập số lượng", "Thông báo",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #4
0
        private void cmbMaPhong_SelectedIndexChanged(object sender, EventArgs e)
        {
            HoaDonDTO infor = new HoaDonDTO();

            infor.MaPhong = int.Parse(cmbMaPhong.Text);
            List <HoaDonDTO> lst = new List <HoaDonDTO>();

            lst = BillBUS.LayThongTinPhongThue(infor);
            //txtDonGiaPhong.Text = lst[0].DonGia.ToString();
            txtDonGia.Text       = string.Format("{0:0,0}", lst[0].DonGia);
            txtTenKhachHang.Text = lst[0].TenKhachHang.ToString();
            txtDiaChi.Text       = lst[0].DiaChi.ToString();
            int maphieuthue = lst[0].MaPhieuThue.Value;

            infor.NgayBatDauThue = Convert.ToDateTime(lst[0].NgayBatDauThue.ToString());

            BillBUS.TinhSoNgayDaThue(infor);
            lst = BillBUS.LaySoNgayDaThue();
            txtSoNgayThue.Text = lst[0].SoNgayDaThue.ToString();
            if (Convert.ToInt32(txtSoNgayThue.Text) < 0)
            {
                btnThanhToan.Enabled = false;
                MessageBox.Show("Chưa thể thanh toán khách hàng này", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            if (txtSoNgayThue.Text == "0")
            {
                txtSoNgayThue.Text = "1";
            }
            int num = BillBUS.LaySoLuongKhach(maphieuthue);

            lst = BillBUS.LayKhachNuocNgoai();
            int kpt = lst[0].KhachPTThu.Value;
            int kng = lst[0].SLKhachNG.Value;

            if (num >= kpt)
            {
                lst            = BillBUS.TinhPhuThu(num);
                txtPhuThu.Text = lst[0].PhuThu.ToString();
            }
            else
            {
                txtPhuThu.Text = "0";
            }
            int nc = BillBUS.DemSoLuongKhachNuocNgoai(infor);

            if (nc >= kng)
            {
                lst          = BillBUS.TinhHeSo();
                txtHeSo.Text = lst[0].HeSo.ToString();
            }
            else
            {
                txtHeSo.Text = "0";
            }
            decimal phidichvu = 0;
            int     numdv     = OderDichVuBUS.LaySoLuongDichVuDK(infor.MaPhong);

            if (numdv == 0)
            {
                txtPhiDichVu.Text = "0";
            }
            else
            {
                for (int i = 0; i < numdv; i++)
                {
                    List <OderDichVuDTO> lst2   = new List <OderDichVuDTO>();
                    OderDichVuDTO        infor2 = new OderDichVuDTO();
                    lst2            = OderDichVuBUS.DanhSachDichVuDK(infor.MaPhong);
                    infor2.MaDichVu = lst2[i].MaDichVu;
                    infor2.SoLuong  = lst2[i].SoLuong;
                    List <DichVuDTO> lst3 = new List <DichVuDTO>();
                    lst3 = ServiceBUS.LayDonGia(infor2.MaDichVu);
                    DichVuDTO dongiadv = new DichVuDTO();
                    dongiadv.DonGia = lst3[0].DonGia;
                    decimal tiendv = dongiadv.DonGia;
                    phidichvu += infor2.SoLuong * tiendv;
                }
                txtPhiDichVu.Text = string.Format("{0:0,0  }", phidichvu);
            }


            bool flag = true;

            for (int i = 0; i < dgvHoaDon.RowCount; i++)
            {
                if (dgvHoaDon.Rows[i].Cells["colMaPhong"].Value.ToString() != null)
                {
                    if (dgvHoaDon.Rows[i].Cells["colMaPhong"].Value.ToString() == cmbMaPhong.Text)
                    {
                        btnThemHoaDon.Enabled = false;
                        flag = false;
                        break;
                    }
                }
            }

            if (flag == true)
            {
                btnThemHoaDon.Enabled = true;
            }
        }