Esempio n. 1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            set     s = new set(); s.recall();
            Methods m = new Methods(); m.MemExpire();


            if (db.con.State.Equals(ConnectionState.Open))
            {
                db.con.Close();
            }

            //Open login form
            frmLogin f = new frmLogin(); f.ShowDialog();

            if (cvar.UType == "Mem")
            {
                Mem.Visible = true; User.Text = "Member";
            }
            else if (cvar.UType == "Lib")
            {
                Issues.Visible = MgBook.Visible = MgMem.Visible = Notif.Visible = true;
            }
            else if (cvar.UType == "Admin")
            {
                Mem.Visible = Issues.Visible = MgBook.Visible = MgMem.Visible = Admin.Visible = Notif.Visible = EditAcc.Visible = true;
            }

            if (cvar.UType == "Admin" || cvar.UType == "Lib")
            {
                User.Text = cvar.UText;

                //Check for Notifications
                if (db.con.State.Equals(ConnectionState.Closed))
                {
                    db.con.Open();
                }

                int N = 0; DateTime[] nLend = new DateTime[] { };; string[] nMemID = new string[] { }; string[] nMemType = new string[] { }; string[] nBookID = new string[] { }; string[] nTitleID = new string[] { }; string[] nTitle = new string[] { }; double[] nPrice = new double[] { }; bool NError = false;
                m.Notif(ref N, ref nLend, ref nMemID, ref nMemType, ref nBookID, ref nTitleID, ref nTitle, ref nPrice, ref NError);

                if (N > 0) // If notifications are there.
                {
                    Notif.BackColor = Color.Red;
                    DialogResult notif = MessageBox.Show(string.Format("There are {0} alert notifications about the books which have not been returned for a long time. Do you want to check the notification window?", N), "Alert Notifications Pending", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (notif == DialogResult.Yes)
                    {
                        frmNotif n = new frmNotif(); n.ShowDialog();
                    }
                }
                if (db.con.State.Equals(ConnectionState.Closed))
                {
                    db.con.Open();
                }
            }
        }
Esempio n. 2
0
 private void notificationsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frmNotif f = new frmNotif(); f.MdiParent = this; f.Show();
 }