Пример #1
0
        // retrieves saved notification values from DB
        private void runLatestSet()
        {
            string constring2 = "datasource=localhost; port=3306; username=root; password=5011";
            string Query2     = "SELECT expirydays,levels FROM apms.notifications WHERE nid = 1;";

            MySqlConnection conDataBase2 = new MySqlConnection(constring2);
            MySqlCommand    cmdDataBase2 = new MySqlCommand(Query2, conDataBase2);
            MySqlDataReader myReader2;

            try
            {
                conDataBase2.Open();
                myReader2 = cmdDataBase2.ExecuteReader();

                string daExpirydays = "";
                string daLevels     = "";

                while (myReader2.Read())
                {
                    daExpirydays = myReader2["expirydays"].ToString();
                    daLevels     = myReader2["levels"].ToString();
                }

                // instance the event args and pass it each value
                NotifyUpdateEventArgs args = new NotifyUpdateEventArgs(daExpirydays, daLevels);
                // raise the event with the updated arguments
                NotifyUpdated(this, args);
                this.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void NotifyForm_ButtonClicked(object sender, NotifyUpdateEventArgs e)
 {
     ExpiryThreshold = Convert.ToInt32(e.getExpiryDays);
     LevelsThreshold = Convert.ToInt32(e.getLevels);
 }