private void txtBuyer_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { //get the seller client number ClientListing list = new ClientListing(); list.ShowDialog(); using (SqlConnection conn = new SqlConnection(ClassDBUtils.DBConnString)) { try { conn.Open(); string strSQL = "select clientname from vwClientListing where clientno = '" + ClassGenLib.selectedClient + "'"; SqlCommand cmd = new SqlCommand(strSQL, conn); if (sender == txtBuyer) { Buyer = ClassGenLib.selectedClient; txtBuyer.Text = cmd.ExecuteScalar().ToString(); } else { Seller = ClassGenLib.selectedClient; txtSeller.Text = cmd.ExecuteScalar().ToString(); } } catch (Exception ex) { MessageBox.Show("Error connecting to database! Reason : " + ex.Message, "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void txtClient_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { ClientListing lstClients = new ClientListing(); lstClients.ShowDialog(); using (SqlConnection conn = new SqlConnection(ClassDBUtils.DBConnString)) { try { conn.Open(); SqlCommand cmd = new SqlCommand("select clientname from vwClientListing where clientno = '" + ClassGenLib.selectedClient + "'", conn); string strSQL = cmd.CommandText; txtClient.Text = cmd.ExecuteScalar().ToString(); } catch (Exception ex) { MessageBox.Show("Error connecting to database! Reason:- " + ex.Message, "Falcon20", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (conn != null) { conn.Close(); } } } }
private void navBarItem1_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "EDIT CLIENT DETAILS") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } ClientListing lst = new ClientListing(); lst.ShowDialog(); NewClient client = new NewClient(GenLib.ClassGenLib.selectedClient); client.ShowDialog(); }