Esempio n. 1
0
        private void ViewSaleDetailTab(int id, bool isSaleItemIncluded)
        {
            using (var repository = new SaleRepository())
            {
                if (id > 0)
                {
                    IsWork     = false;
                    RibbonMode = RibbonMode.Detail;

                    ChangeControlsEnabled(DetailTab.Controls, false, false);

                    var sale = repository.GetSale(id);

                    IDTextBox.Text           = sale.ID.ToString();
                    SoldDatePicker.Value     = sale.Sold;
                    CustomerNameTextBox.Text = sale.CustomerName;

                    if (isSaleItemIncluded)
                    {
                        SaleItemGrid.DataSource = repository.GetSaleItems(id);
                        IsSaleItemChanged       = false;
                        SaleItemGrid.Enabled    = !sale.IsApproved;
                    }

                    SaleTabControl.SelectedTab = DetailTab;

                    SaleItemGrid.ClearSelection();
                }
                else
                {
                    IsWork     = true;
                    RibbonMode = RibbonMode.Edit;

                    ChangeControlsEnabled(DetailTab.Controls, true, true);

                    IDTextBox.Enabled = false;
                    IDTextBox.Text    = repository.GetNextSaleID().ToString();

                    SaleTabControl.SelectedTab = DetailTab;
                }
            }
        }
Esempio n. 2
0
 private void SelectAllContextMenuItem_Click(object sender, EventArgs e)
 {
     SaleItemGrid.SelectAll();
 }