private void LoadDataGrid() { // string searchBy = "Name"; if (isOpenAsChild) { dgvItemList.ColumnHeadersVisible = false; } if (isAddEditFormClosed) { StagingData.SetItemListData(applicationFacade.GetAllItemsBySearch()); } else if (!useMemoryForItem) { StagingData.SetItemListData(applicationFacade.GetAllItemsBySearch()); } dgvItemList.DataSource = StagingData.ItemList; //applicationFacade.GetAllItemsBySearch(null, searchBy).OrderBy(p=>p.ItemName).ToList(); ExtensionMethods.SetGridDefaultProperty(dgvItemList); dgvItemList.Columns["ItemName"].Visible = true; // dgvItemList.Columns["ItemName"].HeaderText = "Item"; dgvItemList.Columns["CompanyName"].Visible = true; dgvItemList.Columns["BalanceQuantity"].Visible = true; // dgvItemList.Columns["CompanyName"].HeaderText = "Company"; dgvItemList.Columns["Packing"].Visible = true; // dgvItemList.Columns["Packing"].HeaderText = "Pack"; dgvItemList.Columns["QtyPerCase"].Visible = true; // dgvItemList.Columns["QtyPerCase"].HeaderText = "Qty"; // txtSearch_TextChanged(null, null); }
private void frmMainForm_Load(object sender, EventArgs e) { try { pnlMain.Dock = DockStyle.Fill; List <Control> allControls = ExtensionMethods.GetAllControls(this); allControls.ForEach(k => k.Font = new System.Drawing.Font(ExtensionMethods.FontFamily, ExtensionMethods.FontSize)); // ToggleMenuItems(menuStrip1.Items); frmDefault form = new frmDefault(); ExtensionMethods.AddFormToPanel(form, pnlMain); form.Show(); StagingData.SetItemListData(applicationFacade.GetAllItemsBySearch()); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }