private void LoadTree() { try { this.Cursor = Cursors.WaitCursor; tvSubject.ImageList = clsLxms.GetImageList(); DBGrid.DataSource = null; tvSubject.Nodes.Clear(); tvSubject.BackColor = frmOptions.BACKCOLOR; switch (cboSubjectType.SelectedIndex) { case 0: dalAccBankAccount dal0 = new dalAccBankAccount(); BindingCollection <modAccBankAccount> list0 = dal0.GetIList(out Util.emsg); if (list0 != null && list0.Count > 0) { foreach (modAccBankAccount mod in list0) { tvSubject.Nodes.Add(mod.AccountNo, mod.AccountNo + "(" + mod.BankName + ")", 0, 1); } } break; case 1: dalAccSubjectList dal1 = new dalAccSubjectList(); BindingCollection <modAccSubjectList> list1 = dal1.GetChildrenList(out Util.emsg); if (list1 != null && list1.Count > 0) { foreach (modAccSubjectList mod in list1) { tvSubject.Nodes.Add(mod.SubjectId, mod.SubjectName, 0, 1); } } break; } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void LoadData() { BindingCollection <modAccBankAccount> list = _dal.GetIList(out Util.emsg); DBGrid.DataSource = list; DBGrid.Enabled = true; if (list != null) { Status1 = DBGrid.Rows.Count.ToString(); Status2 = clsTranslate.TranslateString("Refresh"); } else { DBGrid.DataSource = null; MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void cboBookType_SelectedIndexChanged(object sender, EventArgs e) { prepared = false; DBGrid.DataSource = null; switch (cboBookType.SelectedIndex) { case 0: dalCustomerList dalCust = new dalCustomerList(); BindingCollection <modCustomerSimpleList> listCust = dalCust.GetSimpleList(out Util.emsg); DBGrid.DataSource = listCust; if (listCust != null) { for (int i = 2; i < DBGrid.ColumnCount; i++) { DBGrid.Columns[i].Visible = false; } DBGrid.Columns[0].Width = 90; DBGrid.Columns[1].Width = DBGrid.Width - 140; } break; case 1: dalVendorList dalVendor = new dalVendorList(); BindingCollection <modVendorList> listVendor = dalVendor.GetIList("1", string.Empty, out Util.emsg); DBGrid.DataSource = listVendor; if (listVendor != null) { for (int i = 1; i < DBGrid.ColumnCount; i++) { DBGrid.Columns[i].Visible = false; } DBGrid.Columns[0].Width = DBGrid.Width - 50; } break; case 2: dalOtherReceivableObject dalORec = new dalOtherReceivableObject(); BindingCollection <modOtherReceivableObject> listORec = dalORec.GetIList(true, out Util.emsg); DBGrid.DataSource = listORec; if (listORec != null) { for (int i = 1; i < DBGrid.ColumnCount; i++) { DBGrid.Columns[i].Visible = false; } DBGrid.Columns[0].Width = DBGrid.Width - 50; } break; case 3: dalOtherPayableObject dalOPay = new dalOtherPayableObject(); BindingCollection <modOtherPayableObject> listOPay = dalOPay.GetIList(true, out Util.emsg); DBGrid.DataSource = listOPay; if (listOPay != null) { for (int i = 1; i < DBGrid.ColumnCount; i++) { DBGrid.Columns[i].Visible = false; } DBGrid.Columns[0].Width = DBGrid.Width - 50; } break; case 4: dalAccBankAccount dalCash = new dalAccBankAccount(); BindingCollection <modAccBankAccount> listCash = dalCash.GetIList(out Util.emsg); DBGrid.DataSource = listCash; if (listCash != null) { for (int i = 2; i < DBGrid.ColumnCount; i++) { DBGrid.Columns[i].Visible = false; } DBGrid.Columns[0].Width = 90; DBGrid.Columns[1].Width = DBGrid.Width - 140; } break; } prepared = true; }