private void LoadOptions() { cboBranch.Items.Clear(); Data.Branch clsBranch = new Data.Branch(); foreach (System.Data.DataRow dr in clsBranch.ListAsDataTable(TerminalNo: TerminalDetails.TerminalNo).Rows) { cboBranch.Items.Add(dr["BranchCode"]); } Int32 iBranchCount = new Data.Terminal(clsBranch.Connection, clsBranch.Transaction).BranchCount(txtTerminalNo.Text); clsBranch.CommitAndDispose(); if (iBranchCount == 0) { cboBranch.Items.Add("No Applicable Branch"); } else if (iBranchCount != 0) { cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode); cboBranch.Enabled = false; } else { cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode); cboBranch.Enabled = true; } txtTerminalName.Text = TerminalDetails.TerminalName; txtTerminalNo.Text = TerminalDetails.TerminalNo; }
private void LoadOptions() { cboBranch.Items.Clear(); Data.Branch clsBranch = new Data.Branch(); foreach (System.Data.DataRow dr in clsBranch.ListAsDataTable().Rows) { cboBranch.Items.Add(dr["BranchCode"]); } clsBranch.CommitAndDispose(); if (cboBranch.Items.Count == 0) cboBranch.Items.Add("Please Reload"); else if (BranchDetails.BranchID != 0) cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode); else cboBranch.SelectedIndex = 0; }
private void txtTerminalNo_TextChanged(object sender, EventArgs e) { try { Int32 iTerminalNo = Int32.Parse(txtTerminalNo.Text); if (iTerminalNo > 0) { Data.Terminal clsTerminal = new Data.Terminal(); TerminalDetails = clsTerminal.Details(txtTerminalNo.Text); BranchDetails = TerminalDetails.BranchDetails; Int32 iBranchCount = clsTerminal.BranchCount(txtTerminalNo.Text); cboBranch.Items.Clear(); Data.Branch clsBranch = new Data.Branch(clsTerminal.Connection, clsTerminal.Transaction); foreach (System.Data.DataRow dr in clsBranch.ListAsDataTable(TerminalNo: txtTerminalNo.Text).Rows) { cboBranch.Items.Add(dr["BranchCode"]); } clsTerminal.CommitAndDispose(); if (iBranchCount == 0) { cboBranch.Items.Add("No Applicable Branch"); } else if (iBranchCount == 1) { cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode); cboBranch.Enabled = false; } else { cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode); cboBranch.Enabled = true; } txtTerminalName.Text = TerminalDetails.TerminalName; } } catch { } }
private void txtTerminalNo_TextChanged(object sender, EventArgs e) { try { Int32 iTerminalNo = Int32.Parse(txtTerminalNo.Text); if (iTerminalNo > 0) { Data.Terminal clsTerminal = new Data.Terminal(); TerminalDetails = clsTerminal.Details(txtTerminalNo.Text); BranchDetails = TerminalDetails.BranchDetails; Int32 iBranchCount = clsTerminal.BranchCount(txtTerminalNo.Text); cboBranch.Items.Clear(); Data.Branch clsBranch = new Data.Branch(clsTerminal.Connection, clsTerminal.Transaction); foreach (System.Data.DataRow dr in clsBranch.ListAsDataTable(TerminalNo: txtTerminalNo.Text).Rows) { cboBranch.Items.Add(dr["BranchCode"]); } clsTerminal.CommitAndDispose(); if (iBranchCount == 0) cboBranch.Items.Add("No Applicable Branch"); else if (iBranchCount == 1) { cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode); cboBranch.Enabled = false; } else { cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode); cboBranch.Enabled = true; } txtTerminalName.Text = TerminalDetails.TerminalName; } } catch { } }
private void LoadOptions() { cboBranch.Items.Clear(); Data.Branch clsBranch = new Data.Branch(); foreach (System.Data.DataRow dr in clsBranch.ListAsDataTable().Rows) { cboBranch.Items.Add(dr["BranchCode"]); } clsBranch.CommitAndDispose(); if (cboBranch.Items.Count == 0) { cboBranch.Items.Add("Please Reload"); } else if (BranchDetails.BranchID != 0) { cboBranch.SelectedIndex = cboBranch.Items.IndexOf(BranchDetails.BranchCode); } else { cboBranch.SelectedIndex = 0; } }