/// <summary>
    /// Checking Provider email address exist in the database and send forgot password email to provider email address.
    /// </summary>
    private void CheckAuthentication()
    {
        try
        {
            string DecryptedPassword = String.Empty;
            ApprovedProviderDataAccess providerDAL = new ApprovedProviderDataAccess();

            ApprovedProvider provider = providerDAL.GetApprovedProviderByEmail(txtEmail.Text);
            if (provider != null && provider.ID > 0)
            {
                ///Decrypt provider password.
                DecryptedPassword = LACESUtilities.Decrypt(provider.Password);
                Response.Write(DecryptedPassword);
                Response.End();
                SmtpClient smtpClient = new SmtpClient();
                //Get the SMTP server Address from SMTP Web.conf
                smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER);
                //Get the SMTP post  25;
                smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT));
                //send email
                bool IsSent = SendEmail(smtpClient, DecryptedPassword);
                //Checking the email has sent
                if (IsSent == true)
                {
                    lblErrorSummary.Visible = false;
                    lblPostBackMessage.Text = LACESConstant.Messages.FORGETPASSWORD_POSTBACK_MESSAGE.Replace("{0}", txtEmail.Text.Trim());
                    tblControls.Visible     = false;
                }
            }
            //if the provider does not existing in the database send invalid email address message.
            else
            {
                //if the provider does not existing in the database send invalid email address message.
                if (IsPostBack == true)
                {
                    string ContactEmailAddresses = TranformEmailAddresses();
                    string AdminEmailWithFormat  = "<a href=\"mailto:" + ContactEmailAddresses + "\">contact the " + LACESConstant.LACES_TEXT + " Administrators</a> ";

                    lblErrorSummary.Text    = LACESConstant.Messages.PORGETPASSEORD_INVALID_MESSAGE.Replace("{0}", AdminEmailWithFormat);
                    lblPostBackMessage.Text = "";
                    isInvalidEmail          = true;
                }
                else
                {
                    lblErrorSummary.Text    = "";
                    lblPostBackMessage.Text = "";
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    /// <summary>
    /// Call every time when user click on Save Details button.
    /// Update provider information in database
    /// </summary>
    /// <param name="sender">sender object</param>
    /// <param name="e">EventArgs</param>
    protected void btnSaveDetails_Click(object sender, EventArgs e)
    {
        if (Password.Text == PasswordConfirm.Text)
        {
            HidPass.Value = Password.Text;
        }
        //create Provider Data Access object
        ApprovedProviderDataAccess providerDA = new ApprovedProviderDataAccess();

        //Check for existence for Email address
        ApprovedProvider oProvider = providerDA.GetApprovedProviderByEmail(ApplicantEmail.Text);

        //provider in session
        ApprovedProvider sessionProvider = null;

        //now check weather it is in edit provider mode
        if (Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] != null)
        {
            //get the provider from session
            sessionProvider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // Get provider information from Session

            //provider changed email and that is set for other provider
            if (oProvider != null && oProvider.ID != sessionProvider.ID)
            {
                //The email is already used, so not allowed
                lblMsg.Text      = "Email already exists. Please provide another email.<br /><br />";
                lblMsg.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                sessionProvider = FIllApprovedProviderObjectByFormValues(sessionProvider);

                //update provider contact info
                ApprovedProvider currentProvider = providerDA.UpdateApprovedProvider(sessionProvider);

                if (currentProvider == null)
                {
                    //exception occured
                    lblMsg.Text      = "Contact information information cannot be saved.<br /><br />";
                    lblMsg.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    //update the current provider information in the session
                    Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] = currentProvider;

                    //data saved successfully
                    lblMsg.Text      = "Contact information updated successfully.<br /><br />";
                    lblMsg.ForeColor = System.Drawing.Color.Green;
                }
            }
        }
    }