public void updateContractors() { Forms.ContractorsSelectForm childForm = new Forms.ContractorsSelectForm(); foreach (var item in this.MdiChildren) { if (item is Forms.ContractorsSelectForm) { childForm = item as Forms.ContractorsSelectForm; break; } } childForm.gridControl1.DataSource = null; childForm.gridControl1.MainView = childForm.gvList; var contractsBindingSource = dbContext.Contractors.Where(y => y.IsRemoved != true).Select(x => new { ID = x.ID, Name = x.Name }).ToList(); childForm.gridControl1.DataSource = contractsBindingSource; childForm.gvList.Columns["ID"].Visible = false; childForm.gvList.Columns["Name"].Caption = "Наименование"; }
private void bbtnRemoveContractor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractorsSelectForm childForm = (xtraTabbedMdiManager1.SelectedPage.MdiChild as Forms.ContractorsSelectForm); int rowIndex = childForm.gvList.GetSelectedRows()[0]; int id = Convert.ToInt32(childForm.gvList.GetRowCellValue(rowIndex, "ID")); childForm.RemoveContractor(id); updateContractors(); }
private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Forms.ContractorsSelectForm tmpForm = Forms.ContractorsSelectForm.getInst(); tmpForm.MdiParent = this; tmpForm.Show(); xtraTabbedMdiManager1.SelectedPage = xtraTabbedMdiManager1.Pages[tmpForm]; rpContractors.Visible = true; ribbonControl1.SelectedPage = rpContractors; }