private void OKButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //Kiem Tra Tinh Trang Phong
         object itemSelected = cbxPhong.SelectedValue;
         if (CheckStatusInValid(int.Parse(itemSelected.ToString())))
         {
             MessageBox.Show("Phòng bạn chọn đã có người nhận.Vui lòng chọn phòng khác!", "Thông báo", MessageBoxButton.OK);
             return;
         }
         int LoaiThue = int.Parse(cbxLoaiThue.SelectedValue.ToString());
         int Ca = int.Parse(cbxCa.SelectedValue.ToString());
         decimal TraTruoc = 0;
         if (LoaiThue != 0)
         {
             if (txtTraTruoc.Text == "")
             {
                 MessageBox.Show("Vui lòng nhập trả trước!", "Thông báo", MessageBoxButton.OK);
                 return;
             }
         }
         if (String.IsNullOrEmpty(txtTraTruoc.Text))
         {
             TraTruoc = 0;
         }
         else
         {
             TraTruoc = decimal.Parse(txtTraTruoc.Text.ToString());
         }
         string GhiChu = txtGhiChu.Text;
         string sNgayVao = "";
         int iNgayVao_So;
         int iGioVao;
         int iPhutVao;
         int iThangVao;
         int iNamVao;
         string sNgayRa = "";
         int iNgayRa_So;
         int iGiora;
         int iPhutRa;
         int iThangRa;
         int iNamRa;
         //validate
         if (String.IsNullOrEmpty(calNgayVao.SelectedDate.ToString()))
         {
             MessageBox.Show("Bạn chưa chọn ngày nhận phòng.Vui lòng kiểm tra lại");
             return;
         }
         if (!String.IsNullOrEmpty(calNgayVao.SelectedDate.ToString()))
             sNgayVao = calNgayVao.SelectedDate.Value.ToString("MM/dd/yyyy");
         iGioVao = int.Parse(cbxGioVao.Text.ToString());
         iPhutVao = int.Parse(cbxPhutVao.Text.ToString());
         iNgayVao_So = DateToNumberConverter.Date2Number(sNgayVao);
         iThangVao = DateToNumberConverter.Date2Month(sNgayVao);
         iNamVao = DateToNumberConverter.Date2Year(sNgayVao);
         if (!String.IsNullOrEmpty(calNgayRa.SelectedDate.ToString()))
             sNgayRa = calNgayRa.SelectedDate.Value.ToString("MM/dd/yyyy");
         iGiora = int.Parse(cbxGioRa.Text.ToString());
         iPhutRa = int.Parse(cbxPhutRa.Text.ToString());
         iNgayRa_So = DateToNumberConverter.Date2Number(sNgayRa);
         iThangRa = DateToNumberConverter.Date2Month(sNgayRa);
         iNamRa = DateToNumberConverter.Date2Year(sNgayRa);
         HoaDonSVCClient HoaDonClient = new HoaDonSVCClient();
         HoaDonClient.HoaDon_AddCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(HoaDonClient_HoaDon_AddCompleted);
         HoaDonClient.HoaDon_AddAsync(LoaiThue, Ca, "NhanPhong", TraTruoc, GhiChu, sNgayVao, iNgayVao_So, iGioVao, iPhutVao, iThangVao, iNamVao, sNgayRa, iNgayRa_So, iGiora, iPhutRa, iThangRa, iNamRa,int.Parse( User.UserID));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.StackTrace.ToString());
     }
 }
 private void OKButton_Click(object sender, RoutedEventArgs e)
 {
     int LoaiThue = int.Parse(cbxLoaiThue.SelectedValue.ToString());
     int Ca = int.Parse(cbxCa.SelectedValue.ToString());
     decimal KhuyenMai;
     if (String.IsNullOrEmpty(txtKhuyenMai.Text))
     {
         KhuyenMai = 0;
     }
     else
     {
         KhuyenMai = decimal.Parse(txtKhuyenMai.Text.ToString());
     }
     string GhiChu = txtGhiChu.Text;
     string sNgayVao = "";
     int iNgayVao_So;
     int iGioVao;
     int iPhutVao;
     int iThangVao;
     int iNamVao;
     string sNgayRa = "";
     int iNgayRa_So;
     int iGiora;
     int iPhutRa;
     int iThangRa;
     int iNamRa;
     //validate
     if (String.IsNullOrEmpty(calNgayVao.SelectedDate.ToString()))
     {
         MessageBox.Show("Bạn chưa chọn ngày nhận phòng.Vui lòng kiểm tra lại");
         return;
     }
     if (!String.IsNullOrEmpty(calNgayVao.SelectedDate.ToString()))
         sNgayVao = calNgayVao.SelectedDate.Value.ToString("MM/dd/yyyy");
     iGioVao = int.Parse(cbxGioVao.Text.ToString());
     iPhutVao = int.Parse(cbxPhutVao.Text.ToString());
     iNgayVao_So = DateToNumberConverter.Date2Number(sNgayVao);
     iThangVao = DateToNumberConverter.Date2Month(sNgayVao);
     iNamVao = DateToNumberConverter.Date2Year(sNgayVao);
     if (!String.IsNullOrEmpty(calNgayRa.SelectedDate.ToString()))
         sNgayRa = calNgayRa.SelectedDate.Value.ToString("MM/dd/yyyy");
     iGiora = int.Parse(cbxGioRa.Text.ToString());
     iPhutRa = int.Parse(cbxPhutRa.Text.ToString());
     iNgayRa_So = DateToNumberConverter.Date2Number(sNgayRa);
     iThangRa = DateToNumberConverter.Date2Month(sNgayRa);
     iNamRa = DateToNumberConverter.Date2Year(sNgayRa);
     HoaDonSVCClient HoaDonClient = new HoaDonSVCClient();
     HoaDonClient.HoaDon_AddCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(HoaDonClient_HoaDon_AddCompleted);
     HoaDonClient.HoaDon_AddAsync(LoaiThue, Ca, "DatPhong", KhuyenMai, GhiChu, sNgayVao, iNgayVao_So, iGioVao, iPhutVao, iThangVao, iNamVao, sNgayRa, iNgayRa_So, iGiora, iPhutRa, iThangRa, iNamRa, int.Parse(User.UserID));
 }
 void TraTruocClient_TinhTrang_Phong_EditIsActiveCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
 {
     //Edit TinhTrangPhong
     HoaDonClient = new HoaDonSVCClient();
     HoaDonClient.HoaDon_GetItemCompleted += new EventHandler<HoaDon_GetItemCompletedEventArgs>(HoaDonClient_HoaDon_GetItemCompleted);
     HoaDonClient.HoaDon_GetItemAsync(HoaDonID);
 }