private void Xoa_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MessageBoxResult result =
                    MessageBox.Show("Are you sure?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question);

                switch (result)
                {
                case MessageBoxResult.Yes:

                {
                    try
                    {
                        ImportHistoryEntity tmp = (sender as Button).DataContext as ImportHistoryEntity;

                        GoodsImportEntity entity = new GoodsImportEntity()
                        {
                            ImportDate = tmp.ImportDate,
                            ProductID  = tmp.ProductID,
                            Quantity   = tmp.Quantity
                        };

                        (new GoodsImportDAO()).delete(entity);
                        RefreshImportHistory();

                        MessageBox.Show("Xóa đơn nhập hàng thành công",
                                        "Result",
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Information);

                        Import_Product.LoadMain();
                    }
                    catch { }
                }

                break;

                case MessageBoxResult.No:

                    break;
                }
            }
            catch
            {
                MessageBox.Show("Đã xảy ra lỗi khi xóa. Vui lòng thử lại",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }
Example #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.btnMinimize = ((System.Windows.Controls.Button)(target));

            #line 19 "..\..\StorageManagerDashboard.xaml"
                this.btnMinimize.Click += new System.Windows.RoutedEventHandler(this.BtnMinimize_OnClick);

            #line default
            #line hidden
                return;

            case 2:
                this.btnMaximize = ((System.Windows.Controls.Button)(target));

            #line 24 "..\..\StorageManagerDashboard.xaml"
                this.btnMaximize.Click += new System.Windows.RoutedEventHandler(this.BtnMaximize_OnClick);

            #line default
            #line hidden
                return;

            case 3:
                this.btnClose = ((System.Windows.Controls.Button)(target));

            #line 29 "..\..\StorageManagerDashboard.xaml"
                this.btnClose.Click += new System.Windows.RoutedEventHandler(this.BtnClose_OnClick);

            #line default
            #line hidden
                return;

            case 4:
                this.importProduct = ((StoreManagement.UserControls.Import_Product)(target));
                return;

            case 5:
                this.importHistory = ((StoreManagement.UserControls.ImportHistory)(target));
                return;

            case 6:
                this.editInformation = ((StoreManagement.UserControls.Edit_Information)(target));
                return;

            case 7:
                this.lblName = ((System.Windows.Controls.Label)(target));
                return;

            case 8:
                this.TrainsitionigContentSlide = ((MaterialDesignThemes.Wpf.Transitions.TransitioningContent)(target));
                return;

            case 9:
                this.GridCursor = ((System.Windows.Controls.Grid)(target));
                return;

            case 10:
                this.ListViewMenu = ((System.Windows.Controls.ListView)(target));

            #line 54 "..\..\StorageManagerDashboard.xaml"
                this.ListViewMenu.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListViewMenu_SelectionChanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }