public void UpdateAllRecords()
        {
            DataSet ds = new DataSet();

            //grdWithdrawDJsActiveBookings.DataSource = DJs.GetAllBookings(ds, txtEnterName.Text.ToUpper()).Tables["Bookings"];
            ds = DJs.GetAllBookingsOutsideNoticePeriod(ds, Convert.ToInt32(txtDJID.Text));
            grdWithdrawDJActiveBookings3.DataSource = ds.Tables["searchBookingsOutsideNotice"];

            //reference fellow student Carraig McNulty for help with foreach loop to declare array

            foreach (DataRow row in ds.Tables["searchBookingsOutsideNotice"].Rows)
            {
                StringBuilder query = new StringBuilder();
                for (int i = 0; i < grdWithdrawDJActiveBookings3.Rows.Count; i++)
                {
                    //DataGridViewRow row = grdWithdrawDJActiveBookings3.Rows[i];
                    Bookings.updateBookingsWhereDJWithdrawn(Convert.ToInt32(grdWithdrawDJActiveBookings3.Rows[i].Cells[0].Value), Convert.ToInt32(15));
                }
            }
        }
        private void btnWithdrawDJPrintBookings_Click(object sender, EventArgs e)
        {
            String ClientID = txtDJID.Text;
            String Forename = txtDJForename.Text;

            grpWithdrawMatchingDJs.Visible = false;
            grdWithdrawDJActiveBookings.AllowUserToAddRows  = false;
            grdWithdrawDJActiveBookings.Visible             = true;
            grpWithdrawDJActiveBookings.Visible             = true;
            grdWithdrawDJActiveBookings2.Visible            = true;
            grpWithdrawDJActiveBookings2.Visible            = true;
            grdWithdrawDJActiveBookings2.AllowUserToAddRows = false;
            btnDJWithdrawDJPrintBookings.Visible            = false;
            btnLegendDJsWithdrawDJPrintBookings.Visible     = false;
            grpWithdrawDJ.Visible = false;
            btnSelectAll.Visible  = false;
            btnLegendDJsWithBookingsWithdrawDJ.Visible      = false;
            btnDJWithBookingsWithdrawDJ.Visible             = false;
            grdWithdrawDJActiveBookings3.AllowUserToAddRows = false;
            grdWithdrawDJActiveBookings3.Visible            = true;
            grpWithdrawDJActiveBookings3.Visible            = true;

            DataSet ds = new DataSet();

            //grdWithdrawDJsActiveBookings.DataSource = DJs.GetAllBookings(ds, txtEnterName.Text.ToUpper()).Tables["Bookings"];
            ds = DJs.GetAllBookingsOutsideNoticePeriod(ds, Convert.ToInt32(txtDJID.Text));
            grdWithdrawDJActiveBookings3.DataSource = ds.Tables["searchBookingsOutsideNotice"];

            UpdateAllRecords();

            DJs.WithdrawDJ(Convert.ToInt32(txtDJID.Text));

            MessageBox.Show(text: "DJ Withdrawn");

            txtDJID.Clear();
            txtDJForename.Clear();
            txtDJSurname.Clear();
            txtDJContactNo.Clear();
            txtDJEmail.Clear();
            txtDJStreet.Clear();
            txtDJTown.Clear();
            txtDJCounty.Clear();
            txtDJCity.Clear();
            txtDJEircode.Clear();
            txtDJHourlyRate.Clear();

            //Reference for being able to send emails http://karmic-development.blogspot.com/2013/10/send-email-from-aspnet-using-gmail-as.html
            //Reference to set up various security aspects to be able to send email through google mail https://stackoverflow.com/questions/704636/sending-email-through-gmail-smtp-server-with-c-sharp/9572958#9572958
            MailMessage mail = new MailMessage();

            mail.From = new MailAddress("*****@*****.**", "Legend DJs");
            mail.To.Add("*****@*****.**");
            mail.IsBodyHtml = true;
            mail.Subject    = "DJ Withdrawn";
            //string html = "";
            mail.Body =
                "Dear " + Forename + "," +
                "<br/><br/>In relation to your request to withdraw your services form Legend DJs' system, and in accordance with the terms and conditions of your employment, " +
                "we will be withdrawing you from our system." +
                "<br/><br/>Please find attached a list of final bookings to fulfil before you officially leave Legend DJs." +
                "<br/><br/>We would like to thank you, again, for your great service to this point." +
                "<br/><br/><br/>Kind regards," +
                "<br/><br/>Legend DJs" +
                "<br/><br/><h1>Contact Us</h1>" +
                "<br/><br/>Legend DJs" +
                "<br/>Main Street" +
                "<br/>Tralee" +
                "<br/>Co. Kerry" +
                "<br/>087 170 1459" +
                "<br/><br/><html><body><a href=\"http://www.livinglegendcolmg.com/\" > LegendDJs.com</a></body></html>" +
                "<br/><br/><html><body><a href=\"https://www.facebook.com/colm.l.gallagher/\" > LegendDJs @ facebook</a></body></html>" +
                "<br/><br/><html><body><a href=\"https://twitter.com/LivingLegendDJ/\" > LegendDJs @ twitter</a></body></html>" +
                "<br/><br/><html><body><a href=\"https://www.instagram.com/livinglegendcolmg/?hl=en/\" > LegendDJs @ instagram</a></body></html>";

            mail.Priority = MailPriority.High;

            SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);

            smtp.UseDefaultCredentials = false;
            //smtp.UseDefaultCredentials = true;
            smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "jcxvqxkvqrfanhqj");
            smtp.EnableSsl   = true;
            //smtp.DeliveryMethod = SmtpDeliveryMethod.Network;

            smtp.Send(mail);

            //send email to client
            MessageBox.Show(text: "Confirmation email sent to DJ");

            grdWithdrawDJActiveBookings.AllowUserToAddRows  = false;
            grdWithdrawDJActiveBookings.Visible             = false;
            grpWithdrawDJActiveBookings.Visible             = false;
            grdWithdrawDJActiveBookings2.Visible            = false;
            grpWithdrawDJActiveBookings2.Visible            = false;
            grdWithdrawDJActiveBookings2.AllowUserToAddRows = false;
            btnDJWithdrawDJPrintBookings.Visible            = false;
            btnLegendDJsWithdrawDJPrintBookings.Visible     = false;
            grpWithdrawDJ.Visible = false;
            btnSelectAll.Visible  = false;
            btnLegendDJsWithBookingsWithdrawDJ.Visible      = false;
            btnDJWithBookingsWithdrawDJ.Visible             = false;
            grdWithdrawDJActiveBookings3.AllowUserToAddRows = false;
            grdWithdrawDJActiveBookings3.Visible            = false;
            grpWithdrawDJActiveBookings3.Visible            = false;

            txtEnterSurname.Select();
        }