private void CreateButton_Click(object sender, EventArgs e) { PhantomForm PhantomForm = new PhantomForm(); PhantomForm.Show(); AddContractorForm AddContractorForm = new AddContractorForm(ref TopForm, ref Contractors); TopForm = AddContractorForm; AddContractorForm.ShowDialog(); if (AddContractorForm.bNewCategory) { CategoriesMenu.InitializeItems(); SubCategoriesMenu.InitializeItems(); } if (AddContractorForm.bCanceled == false) { CoverUpdatePanel(); Contractors.FillContractors(SubCategoriesMenu.SelectedContractorSubCategoryID); ContractorsList.ItemColor = SubCategoriesMenu.ItemsColor; ContractorsList.InitializeItems(); Uncover(); } PhantomForm.Close(); PhantomForm.Dispose(); TopForm = null; }
private void Initialize() { Contractors = new Contractors(); CategoriesMenu.ItemsDataTable = Contractors.CategoriesDataTable; CategoriesMenu.InitializeItems(); if (Contractors.CategoriesDataTable.Rows.Count > 0) { CategoriesMenu.Selected = 0; } SubCategoriesMenu.ItemsDataTable = Contractors.SubCategoriesDataTable; SubCategoriesMenu.InitializeItems(); ContractorsList.ItemsDataTable = Contractors.ContractorsDataTable; ContractorsList.CitiesDataTable = Contractors.CitiesDataTable; ContractorsList.CountriesDataTable = Contractors.CountriesDataTable; ContractorsList.ContactsDataTable = Contractors.ContactsDataTable; DataTable PermissionsDataTable = RolesAndPermissionsManager.GetPermissions(Security.CurrentUserID, "ContractorsForm"); if (PermissionsDataTable.Rows.Count > 0) { ContractorsList.bCanEdit = true; EditButtonsPanel.Visible = true; } if (Contractors.SubCategoriesDataTable.Rows.Count > 0) { Contractors.FillContractors(SubCategoriesMenu.SelectedContractorSubCategoryID); ContractorsList.InitializeItems(); } }
private void CategoriesMenu_SelectedChanged(object sender, string Name, int ContractorCategoryID) { Contractors.SubCategoriesDataTable.DefaultView.RowFilter = "ContractorCategoryID = " + ContractorCategoryID; SubCategoriesMenu.ItemsColor = CategoriesMenu.SelectedColor; SubCategoriesMenu.InitializeItems(); if (Contractors.SubCategoriesDataTable.DefaultView.Count == 0) { SubCategoriesMenu_SelectedChanged(null, "", -1); } }
private void ContractorsList_EditClicked(object sender, int iContractorID) { PhantomForm PhantomForm = new PhantomForm(); PhantomForm.Show(); AddContractorForm AddContractorForm = new AddContractorForm(ref TopForm, ref Contractors, iContractorID); TopForm = AddContractorForm; AddContractorForm.ShowDialog(); PhantomForm.Close(); PhantomForm.Dispose(); TopForm = null; if (AddContractorForm.bNewCategory) { // CoverForm(); CategoriesMenu.InitializeItems(); SubCategoriesMenu.InitializeItems(); // Uncover(); } if (AddContractorForm.bCanceled == false) { CoverUpdatePanel(); Contractors.FillContractors(SubCategoriesMenu.SelectedContractorSubCategoryID); ContractorsList.ItemColor = SubCategoriesMenu.ItemsColor; ContractorsList.InitializeItems(); Uncover(); } }