private void btnTruKho_Click(object sender, RoutedEventArgs e)
        {
            ChiTietClient = new ChiTietPhieuNhapKhoSVCClient();
            ChiTietClient.ChiTietPhieuNhapKho_GetItemsCompleted += new EventHandler<ChiTietPhieuNhapKho_GetItemsCompletedEventArgs>(ChiTietClient_ChiTietPhieuNhapKho_GetItemsCompleted);
            ChiTietClient.ChiTietPhieuNhapKho_GetItemsAsync(PhieuNhapID);

            PhieuNhapKhoClient = new PhieuNhapKhoSVCClient();
            PhieuNhapKhoClient.PhieuNhapKho_DeleteCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(PhieuNhapKhoClient_PhieuNhapKho_DeleteCompleted);
            PhieuNhapKhoClient.PhieuNhapKho_DeleteAsync(PhieuNhapID, User.UserID, DateTime.Now.ToString("MM/dd/yyyy"));
        }
 public frmPhieuNhapKho()
 {
     InitializeComponent();
     Nam_Load();
     Thang_Load();
     LoadingPanel.Visibility = Visibility.Visible;
     LoadingPanel.IsBusy = true;
     rdbTheoNgay.IsChecked = true;
     PhieuNhapKhoClient = new PhieuNhapKhoSVCClient();
     PhieuNhapKhoClient.PhieuNhapKho_GetItemsCompleted += new EventHandler<PhieuNhapKho_GetItemsCompletedEventArgs>(PhieuNhapKhoClient_PhieuNhapKho_GetItemsCompleted);
     PhieuNhapKhoClient.PhieuNhapKho_GetItemsAsync();
 }
        public void PhieuNhapKhoEdit_Load(int _PhieuNhapKhoID)
        {
            rdpNgayNhap.SelectedDate = DateTime.Now.Date;
            if (_PhieuNhapKhoID != 0)
            {
                LoadingPanel.IsBusy = true;
                btnThemPhieuNhap.Content = "Cập nhật phiếu nhập";
                btnAddDichVu.IsEnabled = true;
                PhieuNhapKhoID = _PhieuNhapKhoID;

                PhieuNhapKhoClient = new PhieuNhapKhoSVCClient();
                PhieuNhapKhoClient.PhieuNhapKho_GetItemCompleted += new EventHandler<PhieuNhapKho_GetItemCompletedEventArgs>(PhieuNhapKhoClient_PhieuNhapKho_GetItemCompleted);
                PhieuNhapKhoClient.PhieuNhapKho_GetItemAsync(PhieuNhapKhoID);

                ChiTietClient = new ChiTietPhieuNhapKhoSVCClient();
                ChiTietClient.ChiTietPhieuNhapKho_GetItemsCompleted += new EventHandler<ChiTietPhieuNhapKho_GetItemsCompletedEventArgs>(ChiTietClient_ChiTietPhieuNhapKho_GetItemsCompleted);
                ChiTietClient.ChiTietPhieuNhapKho_GetItemsAsync(PhieuNhapKhoID);
            }
        }
 private void btnThemPhieuNhap_Click(object sender, RoutedEventArgs e)
 {
     string ngaynhap = string.Empty;
     int thangnhap = 0;
     int namnhap = 0;
     int ngaynhapso = 0;
     if (!String.IsNullOrEmpty(rdpNgayNhap.SelectedDate.ToString()))
     {
         ngaynhap = rdpNgayNhap.SelectedDate.Value.ToString("MM/dd/yyyy");
         thangnhap = rdpNgayNhap.SelectedDate.Value.Month;
         namnhap = rdpNgayNhap.SelectedDate.Value.Year;
         ngaynhapso = int.Parse(rdpNgayNhap.SelectedDate.Value.ToString("yyyyMMdd"));
     }
     else
     {
         rdpNgayNhap.SelectedDate = DateTime.Now;
         ngaynhap = DateTime.Now.ToString("MM/dd/yyyy");
         thangnhap = DateTime.Now.Month;
         namnhap = DateTime.Now.Year;
         ngaynhapso = int.Parse(DateTime.Now.ToString("yyyyMMdd"));
     }
     if (PhieuNhapKhoID == -1)
     {
         PhieuNhapKhoClient = new PhieuNhapKhoSVCClient();
         PhieuNhapKhoClient.PhieuNhapKho_AddCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(PhieuNhapKhoClient_PhieuNhapKho_AddCompleted);
         PhieuNhapKhoClient.PhieuNhapKho_AddAsync(ngaynhap, thangnhap, namnhap, ngaynhapso, txtGhiChu.Text.Trim(), User.UserID, DateTime.Now.ToString("MM/dd/yyyy"));
     }
     else
     {
         PhieuNhapKhoClient = new PhieuNhapKhoSVCClient();
         PhieuNhapKhoClient.PhieuNhapKho_EditAsync(PhieuNhapKhoID, ngaynhap, thangnhap, namnhap, ngaynhapso, txtGhiChu.Text.Trim(), User.UserID, DateTime.Now.ToString("MM/dd/yyyy"));
     }
 }
 void PhieuNhapKhoClient_PhieuNhapKho_AddCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
 {
     btnThemPhieuNhap.Content = "Cập nhật phiếu nhập";
     btnAddDichVu.IsEnabled = true;
     PhieuNhapKhoClient = new PhieuNhapKhoSVCClient();
     PhieuNhapKhoClient.PhieuNhapKho_GetLatestItemCompleted += new EventHandler<PhieuNhapKho_GetLatestItemCompletedEventArgs>(PhieuNhapKhoClient_PhieuNhapKho_GetLatestItemCompleted);
     PhieuNhapKhoClient.PhieuNhapKho_GetLatestItemAsync();
 }
 private void btnXoaPhieu_Click(object sender, RoutedEventArgs e)
 {
     PhieuNhapKhoClient = new PhieuNhapKhoSVCClient();
     PhieuNhapKhoClient.PhieuNhapKho_DeleteCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(PhieuNhapKhoClient_PhieuNhapKho_DeleteCompleted);
     PhieuNhapKhoClient.PhieuNhapKho_DeleteAsync(PhieuNhapID, User.UserID, DateTime.Now.ToString("MM/dd/yyyy"));
 }