Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
 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;
     }
 }
Esempio n. 3
0
        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());
                }
            }
        }
Esempio n. 4
0
        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());
                }
            }
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        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();
        }
Esempio n. 7
0
        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();
        }
Esempio n. 8
0
        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();
        }
Esempio n. 9
0
        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();
        }
Esempio n. 10
0
        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();
        }
Esempio n. 11
0
        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();
        }
Esempio n. 12
0
        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();
        }
Esempio n. 13
0
        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();
        }
Esempio n. 14
0
        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();
        }
Esempio n. 15
0
        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();
        }
Esempio n. 16
0
        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;
            }
        }
Esempio n. 17
0
        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();
                        }
                    }
                }
            }
        }
Esempio n. 18
0
        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();
        }
Esempio n. 19
0
        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();
        }