private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if(txtFirstName.Text=="")
            {
                ErrorProvider errFN = new ErrorProvider();
                errFN.SetError(txtFirstName,"Required Field");
                return;
            }

            if (txtLastName.Text == "")
            {
                ErrorProvider errLN = new ErrorProvider();
                errLN.SetError(txtLastName, "Required Field");
                return;
            }

            if (txtNickName.Text == "")
            {
                ErrorProvider errNN = new ErrorProvider();
                errNN.SetError(txtNickName, "Required Field");
                return;
            }

            if (txtNameOnId.Text == "")
            {
                ErrorProvider errNID = new ErrorProvider();
                errNID.SetError(txtNameOnId, "Required Field");
                return;
            }

            if (txtMobile.Text == "")
            {
                ErrorProvider errMobile = new ErrorProvider();
                errMobile.SetError(txtMobile, "Required Field");
                return;
            }

            if (txtEmail.Text == "")
            {
                ErrorProvider errEmail = new ErrorProvider();
                errEmail.SetError(txtEmail, "Required Field");
                return;
            }

            Picture = txtFirstName.Text+txtLastName.Text + "_" + DateTime.Now.ToString("mm.ss") +  ".jpg";

            if(this.Tag=="edit")
            {
                Volunteers vol = (Volunteers) btnSave.Tag;

                vol.setName(txtFirstName.Text, txtLastName.Text, txtNickName.Text, txtNameOnId.Text);
                vol.setAddress(txtStreet.Text, txtCity.Text);
                vol.setContact(txtEmail.Text, txtMobile.Text);
                vol.setVGDetails(txtVGL.Text, txtContactNo.Text, chkLeading.Checked);
                //int s = int.Parse(js.Lookup("fldID","tblEvent","fldEventTitle='" + cboService.Text + "'"));
                //int c = int.Parse(js.Lookup("fldID","tblGroup","fldGroup='" + cboClass.Text + "'"));
                //vol.setServiceDetails(s, cboWeek.Text, c);
                vol.setNFCCode(txtNFCCode.Text);
                vol.setPicPath(Picture);
                //System.IO.File.Delete(AccessRegistryTool.ReadValue("PicPath") + @"\volunteer\" + Picture);

                if (vol.Update())
                {
                    pictureBox1.Image.Save(AppSettingsHelper.GetAppSettingsValue("PicturePath") + @"\volunteer\" + Picture);
                    LoadVolunteers();
                    txtFirstName.Text = "";
                    txtLastName.Text = "";
                    txtNickName.Text = "";
                    txtNameOnId.Text = "";
                    txtMobile.Text = "";
                    txtEmail.Text = "";
                    txtStreet.Text = "";
                    txtCity.Text = "";
                    txtVGL.Text = "";
                    txtContactNo.Text = "";
                    LoadService();
                    LoadWeek();
                    LoadClass();
                    chkLeading.Checked = false;
                    txtNFCCode.Text = "";
                    pictureBox1.Image.Dispose();
                    pictureBox1.Image = Image.FromFile(AppSettingsHelper.GetAppSettingsValue("PicturePath") + @"\download.jpg");
                }
                else
                {
                    js.showExclamation("Failed Updating Volunteer Details");
                }

                this.Tag = null;

            }
            else
            {
                Volunteers vol = new Volunteers();
                vol.setName(txtFirstName.Text, txtLastName.Text, txtNickName.Text, txtNameOnId.Text);
                vol.setAddress(txtStreet.Text, txtCity.Text);
                vol.setContact(txtEmail.Text, txtMobile.Text);
                vol.setVGDetails(txtVGL.Text, txtContactNo.Text, chkLeading.Checked);
                //int s = int.Parse(js.Lookup("fldID", "tblEvent", "fldEventTitle='" + cboService.Text + "'"));
                //int c = int.Parse(js.Lookup("fldID", "tblGroup", "fldGroup='" + cboClass.Text + "'"));
               // vol.setServiceDetails(s, cboWeek.Text, c);
                vol.setPicPath(Picture);

                if(vol.Save())
                {
                    pictureBox1.Image.Save(AppSettingsHelper.GetAppSettingsValue("PicturePath") + Picture);
                    LoadVolunteers();
                    txtFirstName.Text = "";
                    txtLastName.Text = "";
                    txtNickName.Text = "";
                    txtNameOnId.Text = "";
                    txtMobile.Text = "";
                    txtEmail.Text = "";
                    txtStreet.Text = "";
                    txtCity.Text = "";
                    txtVGL.Text = "";
                    txtContactNo.Text = "";
                    LoadService();
                    LoadWeek();
                    LoadClass();
                    chkLeading.Checked = false;
                    txtNFCCode.Text = "";
                    Picture = "";
                    pictureBox1.Image.Dispose();
                    pictureBox1.Image = Image.FromFile(AppSettingsHelper.GetAppSettingsValue("PicturePath") + @"\volunteer\download.jpg");
                }
            }

            tmrLogin.Enabled = false;

            //pictureBox1.Image.Save(AccessRegistryTool.ReadValue("PicPath") + @"\volunteer\" + Picture);
        }
        private void dgvVolunteers_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string id = dgvVolunteers.CurrentRow.Cells["fldID"].Value.ToString();
            this.Tag = "edit";
            Volunteers volunteer = new Volunteers(id);
            btnSave.Tag = volunteer;
            txtFirstName.Text = volunteer.getFirstName();
            txtLastName.Text = volunteer.getLastName();
            txtNickName.Text = volunteer.getNickName();
            txtNameOnId.Text = volunteer.getNameOnID();
            txtMobile.Text = volunteer.getMobile();
            txtEmail.Text = volunteer.getEmail();
            txtStreet.Text = volunteer.getStreet();
            txtCity.Text = volunteer.getCity();
            txtVGL.Text = volunteer.getVGL();
            txtContactNo.Text = volunteer.getVGLContact();
            //cboService.Text = js.Lookup("fldEventTitle", "tblEvent", "fldID='" + volunteer.getService() + "'");
            //cboWeek.Text = volunteer.getWeek();
            //cboClass.Text = js.Lookup("fldGroup", "tblGroup", "fldID='" + volunteer.getClass() + "'");
            chkLeading.Checked = volunteer.getLeading();
            txtNFCCode.Text = volunteer.getNFCCode();
            Picture = volunteer.getPicPath();

            string imageFullPath = AppSettingsHelper.GetAppSettingsValue("PicturePath") + @"\volunteer\" + Picture;

            if (System.IO.File.Exists(imageFullPath))
            {
                pictureBox1.Image = Image.FromFile(imageFullPath);
            }
            else
            {
                pictureBox1.Image = Image.FromFile(AppSettingsHelper.GetAppSettingsValue("PicturePath") + @"\download.jpg");
            }
        }