Example #1
0
    /// <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;
        }
    }
Example #2
0
    /// <summary>
    /// Used to load provider information into UI control.
    /// Get provider information from session variable.
    /// Return none.
    /// </summary>
    private void populateProviderInformation()
    {
        try
        {
            //check session variable
            if (Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER] != null)
            {
                //get the provider from session
                Provider1 currentProvider = (Provider1)Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER]; // Get provider information from Session

                //check weather the provider is exist
                if (currentProvider != null)
                {
                    txtOrganization.Text   = currentProvider.Organization;
                    txtStreetAddress.Text  = currentProvider.StreetAddress;
                    txtCity.Text           = currentProvider.City;
                    drpState.SelectedValue = currentProvider.State.Trim();
                    txtZip.Text            = currentProvider.Zip;
                    txtCountry.Text        = currentProvider.Country;
                    txtPhone.Text          = currentProvider.Phone;

                    txtFax.Text         = currentProvider.Fax;
                    txtWebsite.Text     = currentProvider.Website;
                    txtIndName.Text     = currentProvider.IndividualsName;
                    txtIndPosition.Text = currentProvider.IndividualsPosition;
                    txtIndPhone.Text    = currentProvider.IndividualsPhone;
                    txtIndFax.Text      = currentProvider.IndividualsFax;
                    txtEmail.Text       = currentProvider.IndividualsEmail;

                    //radStatus.SelectedValue = currentProvider.Status.Trim();
                    //set the password fields
                    txtPassword.Attributes.Add("value", LACESUtilities.Decrypt(currentProvider.IndividualsPassword));
                    txtPasswordConfirm.Attributes.Add("value", LACESUtilities.Decrypt(currentProvider.IndividualsPassword));

                    //update provider name in the UI
                    Label lblMasterProviderName = (Label)Master.FindControl("lblProviderName");
                    lblMasterProviderName.Text = Server.HtmlEncode("Signed in as: " + currentProvider.Organization);
                }
                else
                {
                    //show error message
                    lblMsg.Text      = "Organization not exists.";
                    lblMsg.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Example #3
0
    /// <summary>
    /// Populate form fields from provider object
    /// </summary>
    /// <param name="currentProvider"></param>
    private void FillFormValuesByProviderObject(ApprovedProvider currentProvider)
    {
        OrganizationName.Text          = currentProvider.OrganizationName;
        OrganizationStreetAddress.Text = currentProvider.OrganizationStreetAddress;
        OrganizationCity.Text          = currentProvider.OrganizationCity;
        OrganizationState.Text         = currentProvider.OrganizationState;
        OrganizationZip.Text           = currentProvider.OrganizationZip;
        OrganizationCountry.Text       = currentProvider.OrganizationCountry;
        OrganizationPhone.Text         = currentProvider.OrganizationPhone;
        OrganizationFax.Text           = currentProvider.OrganizationFax;
        OrganizationWebSite.Text       = currentProvider.OrganizationWebSite;

        ApplicantName.Text         = currentProvider.ApplicantName;
        ApplicantPosition.Text     = currentProvider.ApplicantPosition;
        ApplicantPhone.Text        = currentProvider.ApplicantPhone;
        ApplicantFax.Text          = currentProvider.ApplicantFax;
        ApplicantEmail.Text        = currentProvider.ApplicantEmail;
        ApplicantEmailConfirm.Text = currentProvider.ApplicantEmail;

        //set the password fields
        HidPass.Value = LACESUtilities.Decrypt(currentProvider.Password);
        Password.Attributes.Add("value", HidPass.Value);
        PasswordConfirm.Attributes.Add("value", HidPass.Value);
    }
Example #4
0
    /// <summary>
    ///  Page Load Event Handler. Call every time when the page is loaded.
    /// </summary>
    /// <param name="sender">Sender object</param>
    /// <param name="e">EventArgs</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        //reset the error message label
        lblMsg.Text      = "";
        lblMsg.ForeColor = System.Drawing.Color.Red;

        //set focus the first textbox
        txtOrganization.Focus();

        if (!IsPostBack)
        {
            //default set the status "Active"
            radStatus.SelectedIndex = 0;

            //Load the state list
            populateStateList();

            //check weather it is in edit provider mode
            if (Request.QueryString[LACESConstant.QueryString.PROVIDER_ID] != null)
            {
                try
                {
                    //get the provider id from query string
                    long providerID = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.PROVIDER_ID]);

                    //get provider object from DAL
                    Provider1 currentProvider = new Provider1();
                    currentProvider.ID = providerID;
                    ProviderDataAccess oProviderDataAccess = new ProviderDataAccess();
                    currentProvider = oProviderDataAccess.GetById(currentProvider.ID);

                    //check weather the provider is exist
                    if (currentProvider != null)
                    {
                        txtOrganization.Text   = currentProvider.Organization;
                        txtStreetAddress.Text  = currentProvider.StreetAddress;
                        txtCity.Text           = currentProvider.City;
                        drpState.SelectedValue = currentProvider.State.Trim();
                        txtZip.Text            = currentProvider.Zip;
                        txtCountry.Text        = currentProvider.Country;
                        txtPhone.Text          = currentProvider.Phone;

                        txtFax.Text             = currentProvider.Fax;
                        txtWebsite.Text         = currentProvider.Website;
                        txtIndName.Text         = currentProvider.IndividualsName;
                        txtIndPosition.Text     = currentProvider.IndividualsPosition;
                        txtIndPhone.Text        = currentProvider.IndividualsPhone;
                        txtIndFax.Text          = currentProvider.IndividualsFax;
                        txtEmail.Text           = currentProvider.IndividualsEmail;
                        radStatus.SelectedValue = currentProvider.Status.Trim();

                        //set the password fields
                        txtPassword.Attributes.Add("value", LACESUtilities.Decrypt(currentProvider.IndividualsPassword));
                        txtPasswordConfirm.Attributes.Add("value", LACESUtilities.Decrypt(currentProvider.IndividualsPassword));
                    }
                    else
                    {
                        //show error message
                        lblMsg.Text      = LACESConstant.Messages.PROVIDER_NOT_FOUND_IN_ADMIN;
                        lblMsg.ForeColor = System.Drawing.Color.Red;
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
    }