コード例 #1
0
        private void ListBill_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Bill_Show bill = new Bill_Show();

            if (listBill.SelectedItem == null)
            {
                return;
            }
            bill                   = listBill.SelectedItem as Bill_Show;
            editAddress.Text       = bill.Address == "" ? "No address" : bill.Address;
            Editnameproduct.Text   = bill.Namepro;
            editNumber.Text        = bill.Amount.ToString();
            editOriginalPrice.Text = bill.Initial_price.ToString();
            editPhone.Text         = bill.Phone;
            editSellPrice.Text     = bill.Sale_price.ToString();
            editShipCost.Text      = bill.Ship.ToString();

            if (bill.status == "Complete" || bill.status == "Canceled")
            {
                btnComplete.IsEnabled = false;
                btnIgnore.IsEnabled   = false;
            }
            else
            {
                btnComplete.IsEnabled = true;
                btnIgnore.IsEnabled   = true;
            }
        }
コード例 #2
0
        private void BtnIgnore_Click(object sender, RoutedEventArgs e)
        {
            var confirm = new Dialog()
            {
                Message = "Hủy đơn hàng đang giao?"
            };

            confirm.Owner = Window.GetWindow(this);
            confirm.ShowDialog();
            if (true == confirm.DialogResult)
            {
                // Lấy đối tượng Bill đang chọn trong List View
                if (listBill.SelectedItem == null)
                {
                    return;
                }
                Bill_Show bill = listBill.SelectedItem as Bill_Show;

                try
                {
                    manage.CancelBill(bill);
                    // Cập nhật lên List View
                    int curIndex = listBill.SelectedIndex;
                    Bills = manage.Load_ListBill();
                    listBill.ItemsSource   = Bills;
                    listBill.SelectedIndex = curIndex;
                    // Tắt 2 button
                    btnComplete.IsEnabled = btnIgnore.IsEnabled = false;
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #3
0
        private void BtnSeeProduct_Click(object sender, RoutedEventArgs e)
        {
            if (listBill.SelectedItem == null)
            {
                return;
            }
            Bill_Show bill_ = listBill.SelectedItem as Bill_Show;

            try
            {
                var db     = new MANAGEMENT_STORE_Entities();
                var target = db.Detail_Product.Find(bill_.ID_PRO);
                NavigationService.Navigate(new DetailProductPage(target));
            }
            catch
            {
            }
        }
コード例 #4
0
        private void BtnConfirm_Click(object sender, RoutedEventArgs e)
        {
            if (CheckBill() == false)
            {
                return;
            }

            var bill = new Bill_Show();

            bill.DateCreate    = DateTime.Now;
            bill.Name_Cus      = editCustomerName.Text;
            bill.Phone         = editCustomerPhone.Text.Length == 0 ? null : editCustomerPhone.Text;
            bill.ID_PRO        = product.ID_Product;
            bill.Amount        = (int.Parse(editNumberBuy.Text));
            bill.Initial_price = (int.Parse(editSalePrice.Text));
            bill.Sale_price    = int.Parse(editTotalPrice.Text);
            bill.Online        = (bool)rdoGoToShop.IsChecked ? "No" : "Yes";
            bill.Address       = (bool)rdoShip.IsChecked ? editAddress.Text : null;
            bill.Ship          = (bool)rdoShip.IsChecked ? Int32.Parse(editShipCost.Text) : 0;
            bill.status        = (bool)rdoGoToShop.IsChecked ? "Complete" : "No complete";
            bill.Namepro       = product.NameProduct;
            bill.birthday      = DateTime.Parse(birthdate.Text);
            bill.Email         = editCustomerEmail.Text == null ? "" : editCustomerEmail.Text;

            bill.ID_output = manage.Create_NewIdOutput_Auto();

            manage.AddnewOutput(bill);

            Dialog a = new Dialog()
            {
                Message = "Đã tạo Bill!"
            };

            a.Owner = Window.GetWindow(this);
            a.ShowDialog();
            if (loadlistbill != null)
            {
                loadlistbill.Invoke(true);
            }
        }