Example #1
0
        ////////        Working on undo button      ///////
        private void Undo_Click(object sender, EventArgs e)
        {
            Modname Bmod = sender as Modname;

            string connString = "Provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=E:\\ITS245\\STEFPROJ\\Database11.accdb";

            OleDbConnection connection = new OleDbConnection(connString);
            OleDbCommand    cmd        = connection.CreateCommand();

            connection.Open();


            cmd.CommandText = "Update allergyhistorytable set Allergen =" + "'" + Bmod.Allergen + "'" + ",AllergyDescription = " + "'" + Bmod.Allergen + "'" + " where AllergyID=" + listBox1.SelectedItem.ToString();
            OleDbDataReader reader = cmd.ExecuteReader();

            reader.Read();
            reader.Close();


            Allergen.ReadOnly    = true;
            Description.ReadOnly = true;
            Save.Hide();
            AddButton.Hide();
        }
Example #2
0
        ///////unlocks all the boxes essentially for now //////
        private void Modify_Click(object sender, EventArgs e)
        {
            Modname Amod = new Modname(Allergen.Text, Description.Text);

            Undo_Click(Amod, e);

            this.BackColor = Color.Blue;

            Allergen.ReadOnly    = false;
            Description.ReadOnly = false;
            Save.Show();
            AddButton.Show();
        }
Example #3
0
        //////////////     Modify Button        //////////
        private void Modify_Click(object sender, EventArgs e)
        {
            //// send it the object made from class and leave the e////
            Modname mod = new Modname(Fname.Text, Lname.Text, AGE.Text);

            Undo_Click(mod, e);

            this.BackColor = Color.Blue;
            Lname.ReadOnly = false;
            Fname.ReadOnly = false;
            AGE.ReadOnly   = false;

            Save.Show();
            ADDButton.Show();
        }
Example #4
0
        /////////////////    Undo Button     ////////////////////////

        private void Undo_Click(object sender, EventArgs e)
        {
            // Interprets sender as modname and sets mode equal to mod//
            Modname mode = sender as Modname;


            string connString = "Provider=Microsoft.ACE.OLEDB.12.0;" +
                                "Data Source=E:\\ITS245\\STEFPROJ\\Database11.accdb";

            OleDbConnection connection = new OleDbConnection(connString);
            OleDbCommand    cmd        = connection.CreateCommand();

            connection.Open();



            cmd.CommandText = "Update patienttable set PtLastName = " + "'" + mode.Tlname + "'" + ",PtFirstname = " + "'" + mode.Tfname + "'" + ",DOB=" + "'" + mode.Dob + "'" + " where PatientID = " + PatientID.Text;
            OleDbDataReader reader2 = cmd.ExecuteReader();

            reader2.Read();
            reader2.Close();

            cmd.CommandText = "Select PtLastName, PtFirstname, DOB from Patienttable where PatientID=" + PatientID.Text;
            cmd.Connection  = connection;

            OleDbDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                Lname.Text = reader[0].ToString();
                Fname.Text = reader[1].ToString();
                AGE.Text   = reader[2].ToString();
            }
            reader.Close();

            Lname.ReadOnly = true;
            Fname.ReadOnly = true;
            AGE.ReadOnly   = true;


            connection.Close();
        }