예제 #1
0
파일: SupplyForm.cs 프로젝트: Auxistus/STO
        private void ViewSupplyDetailTab(int id, bool isSupplyItemIncluded)
        {
            using (var repository = new SupplyRepository())
            {
                if (id > 0)
                {
                    IsWork     = false;
                    RibbonMode = RibbonMode.Detail;

                    ChangeControlsEnabled(DetailTab.Controls, false, false);

                    var supply = repository.GetSupply(id);

                    IDTextBox.Text            = supply.ID.ToString();
                    DeliveredDatePicker.Value = supply.Delivered;
                    SupplierNameTextBox.Text  = supply.SupplierName;
                    DescriptionTextBox.Text   = supply.Description;

                    if (isSupplyItemIncluded)
                    {
                        SupplyItemGrid.DataSource = repository.GetSupplyItems(id);
                        IsSupplyItemChanged       = false;
                        SupplyItemGrid.Enabled    = !supply.IsApproved;
                    }

                    SupplyTabControl.SelectedTab = DetailTab;

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

                    ChangeControlsEnabled(DetailTab.Controls, true, true);

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

                    SupplyTabControl.SelectedTab = DetailTab;
                }
            }
        }
예제 #2
0
파일: SupplyForm.cs 프로젝트: Auxistus/STO
 private void SelectAllContextMenuItem_Click(object sender, EventArgs e)
 {
     SupplyItemGrid.SelectAll();
 }