private void tmApprovals_Tick(object sender, EventArgs e) { using (SqlConnection conn = new SqlConnection(ClassDBUtils.DBConnString)) { try { conn.Open(); if (ClassDBUtils.IsAllowed(ClassGenLib.username, "APPROVE TRANSACTION") == true) { SqlCommand cmdNotify = new SqlCommand("select count(reqid) from requisitions where approved = 0 and cancelled = 0", conn); int approvals = Convert.ToInt32(cmdNotify.ExecuteScalar()); if (approvals > 0) { //MessageBox.Show("approvals"); lblNotify.Text = "You have pending approvals"; } else { lblNotify.Text = ""; } } } catch (Exception ex) { MessageBox.Show("Failed to connect to database! " + ex.Message); } } }
private void editUserDetailsToolStripMenuItem_Click(object sender, EventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "EDIT USER DETAILS") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } }
private void btnRemovePermission_Click(object sender, EventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "REMOVE USER PERMISSION") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } using (SqlConnection conn = new SqlConnection(ClassDBUtils.DBConnString)) { try { conn.Open(); string profile = ""; string module = ""; string function = ""; if (MessageBox.Show("Delete the selected permission?", "Falcon", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { for (int i = 0; i < vwProfiles.RowCount; i++) { if (vwProfiles.IsRowSelected(i)) { profile = vwProfiles.GetRowCellValue(i, "profilename").ToString(); break; } } for (int i = 0; i < vwPermissions.RowCount; i++) { if (vwPermissions.IsRowSelected(i)) { module = vwPermissions.GetRowCellValue(i, "modname").ToString(); function = vwPermissions.GetRowCellValue(i, "screenname").ToString(); break; } } SqlCommand cmd = new SqlCommand("spRemovePermission", conn); cmd.CommandType = CommandType.StoredProcedure; SqlParameter p1 = new SqlParameter("@profile", profile); SqlParameter p2 = new SqlParameter("@module", module); SqlParameter p3 = new SqlParameter("@function", function); cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); cmd.Parameters.Add(p3); cmd.ExecuteNonQuery(); grdProfiles_Click(sender, e); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //ScreenShot.EmailScreenShot(ex.ToString()); } } }
private void btnAddPermission_Click(object sender, EventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "ASSIGN USER PERMISSION") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } //add a permission to a user group string profile = ""; for (int i = 0; i < vwProfiles.RowCount; i++) { if (vwProfiles.IsRowSelected(i)) { profile = vwProfiles.GetRowCellValue(i, "profilename").ToString(); break; } } string module = ""; string function = ""; for (int i = 0; i < vwAvailable.RowCount; i++) { if (vwAvailable.IsRowSelected(i)) { module = vwAvailable.GetRowCellValue(i, "modname").ToString(); function = vwAvailable.GetRowCellValue(i, "screenname").ToString(); break; } } using (SqlConnection conn = new SqlConnection(ClassDBUtils.DBConnString)) { try { conn.Open(); SqlCommand cmd = new SqlCommand("spAddUserPermission", conn); cmd.CommandType = CommandType.StoredProcedure; SqlParameter p1 = new SqlParameter("@profile", profile); SqlParameter p2 = new SqlParameter("@module", module); SqlParameter p3 = new SqlParameter("@function", function); cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); cmd.Parameters.Add(p3); cmd.ExecuteNonQuery(); grdProfiles_Click(sender, e); } catch (Exception ex) { MessageBox.Show(ex.Message, "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //ScreenShot.EmailScreenShot(ex.ToString()); } } }
private void navBarItem4_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "VIEW TRADING SUMMARY") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } Reports.TradingSummary trade = new Reports.TradingSummary(); trade.ShowDialog(); }
private void btnOnScreenTB_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "VIEW TRIAL BALANCE") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } Transactions.OnscreenTB onTB = new Transactions.OnscreenTB(); onTB.ShowDialog(); }
private void btnNewTxn_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "POST NEW TRANSACTION") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } Transactions.NewTransaction ntxn = new Transactions.NewTransaction(); ntxn.ShowDialog(); }
private void btnSTatements_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "VIEW CLIENT REPORTS") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } Reports.frmClientStatement stmt = new Reports.frmClientStatement(); stmt.ShowDialog(); }
private void btnCashbook_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "VIEW CASHBOOKS") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } ViewCashBook vbook = new ViewCashBook(); vbook.ShowDialog(); }
private void btnTaxPayments_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "POST TAX PAYMENT") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } TaxPayments tax = new TaxPayments(); tax.ShowDialog(); }
private void btnLedgers_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "VIEW LEDGERS") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } SelectReport srpt = new SelectReport(1); srpt.ShowDialog(); }
private void navBarItem2_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "UPLOAD DEALS FROM FILE") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } DealsFromFile dfile = new DealsFromFile(); dfile.ShowDialog(); }
private void btnTrades_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "VIEW CLIENT TRADES") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } ClientTrades trades = new ClientTrades(); trades.ShowDialog(); }
private void btnNewClient_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "ADD NEW CLIENT") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } NewClient client = new NewClient("0"); client.ShowDialog(); }
private void btnViewDeals_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "VIEW DEAL ALLOCATIONS") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } ViewDeals vdeal = new ViewDeals(); vdeal.ShowDialog(); }
private void addNewUserToolStripMenuItem_Click(object sender, EventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "ADD NEW USER") == true) { NewUser nu = new NewUser(); nu.ShowDialog(); UserListsing_Load(sender, e); } else { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } }
private void unLockUserToolStripMenuItem_Click(object sender, EventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "(UN)LOCK USER") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (MessageBox.Show("A locked user cannot login. Proceed?", "Falcon", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { string user = ""; for (int i = 0; i < vwUsers.RowCount; i++) { if (vwUsers.IsRowSelected(i)) { user = vwUsers.GetRowCellValue(i, "LOGIN").ToString(); break; } } using (SqlConnection conn = new SqlConnection(ClassDBUtils.DBConnString)) { try { conn.Open(); SqlCommand cmd = new SqlCommand("spLockUnlockUser", conn); cmd.CommandType = CommandType.StoredProcedure; SqlParameter p1 = new SqlParameter("@user", user); cmd.Parameters.Add(p1); cmd.ExecuteNonQuery(); UserListsing_Load(sender, e); } catch (Exception ex) { MessageBox.Show("Error connecting to database! Reason " + ex.Message, "Falcon", 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(); }
private void resetPasswordToolStripMenuItem_Click(object sender, EventArgs e) { if (ClassDBUtils.IsAllowed(ClassGenLib.username, "RESET USER PASSWORD") == false) { MessageBox.Show("Access denied! Insufficient rights to perform the function.", "Falcon", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } string usr = ""; for (int i = 0; i < vwUsers.RowCount; i++) { if (vwUsers.IsRowSelected(i)) { usr = vwUsers.GetRowCellValue(i, "LOGIN").ToString(); break; } } UserResetPassword rest = new UserResetPassword(usr); rest.ShowDialog(); }