Ejemplo n.º 1
0
    /// <summary>
    /// Checking the  Email And Password Match Existing Provider values and return provider details
    /// </summary>
    /// <param name="email">Email of Provider</param>
    /// <param name="password">password</param>
    private void SignInUser(string email, string password)
    {
        ///Encrypt password using DES encryption
        string EncriptedPassword = LACESUtilities.Encrypt(password);
        ApprovedProviderDataAccess providerDAL = new ApprovedProviderDataAccess();

        //inactivate all expired providers
        providerDAL.InactivateApprovedProviders(0, DateTime.Now);

        ApprovedProvider provider = providerDAL.GetByEmailandPassword(email, EncriptedPassword);



        if (provider != null && provider.ID > 0 && provider.Status == LACESConstant.ProviderStatus.ACTIVE)
        {
            //Set Active Provider Details to Session
            Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] = provider;

            //Set Inactive Provider Details to null
            Session[LACESConstant.SessionKeys.LOGEDIN_INACTIVE_PROVIDER] = null;

            ///Redirect to CourseListing page of Provider
            Response.Redirect("AddCourses.aspx");
        }
        else if (provider != null && provider.ID > 0 && provider.Status == LACESConstant.ProviderStatus.INACTIVE)
        {
            //Set Inactive Provider Details to Session
            Session[LACESConstant.SessionKeys.LOGEDIN_INACTIVE_PROVIDER] = provider;

            //Set Active Provider Details to null
            Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] = null;

            ///Redirect to CourseListing page of Provider
            Response.Redirect("Renew.aspx");
        }
        else
        {
            DisplayInvalidLogin();
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// This function fills an approved provider object with form values
    /// </summary>
    /// <returns></returns>
    private ApprovedProvider FIllApprovedProviderObjectByFormValues(ApprovedProvider sessionProvider)
    {
        sessionProvider.OrganizationName          = OrganizationName.Text;
        sessionProvider.OrganizationStreetAddress = OrganizationStreetAddress.Text;
        sessionProvider.OrganizationCity          = OrganizationCity.Text;
        sessionProvider.OrganizationState         = OrganizationState.Text;
        sessionProvider.OrganizationZip           = OrganizationZip.Text;
        sessionProvider.OrganizationCountry       = OrganizationCountry.Text;
        sessionProvider.OrganizationPhone         = OrganizationPhone.Text;
        sessionProvider.OrganizationFax           = OrganizationFax.Text;
        sessionProvider.OrganizationWebSite       = OrganizationWebSite.Text;

        sessionProvider.ApplicantName     = ApplicantName.Text;
        sessionProvider.ApplicantPosition = ApplicantPosition.Text;
        sessionProvider.ApplicantPhone    = ApplicantPhone.Text;
        sessionProvider.ApplicantFax      = ApplicantFax.Text;
        sessionProvider.ApplicantEmail    = ApplicantEmail.Text;

        //set the password fields
        sessionProvider.Password = LACESUtilities.Encrypt(HidPass.Value);

        return(sessionProvider);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Call every time when user click on Save Details button.
    /// </summary>
    /// <param name="sender">sender object</param>
    /// <param name="e">EventArgs</param>
    protected void btnSaveDetails_Click(object sender, EventArgs e)
    {
        //create Provider Data Access object
        ProviderDataAccess oProviderDataAccess = new ProviderDataAccess();

        //Check for existence for Email address
        Provider1 oProvider = oProviderDataAccess.GetbyEmail(txtEmail.Text);

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

            //check weather it is the same person
            if (oProvider != null && oProvider.ID == providerID)
            {
                oProvider = null;
            }
        }

        if (oProvider == null)
        {
            // The email is not already used, means the current provider can use the email
            Provider1 currentProvider = new Provider1();


            currentProvider.Organization        = txtOrganization.Text.Trim();
            currentProvider.StreetAddress       = txtStreetAddress.Text.Trim();
            currentProvider.City                = txtCity.Text.Trim();
            currentProvider.State               = drpState.SelectedValue.Trim();
            currentProvider.Zip                 = txtZip.Text.Trim();
            currentProvider.Country             = txtCountry.Text.Trim();
            currentProvider.Phone               = txtPhone.Text.Trim();
            currentProvider.Fax                 = txtFax.Text.Trim();
            currentProvider.Website             = txtWebsite.Text.Trim();
            currentProvider.IndividualsName     = txtIndName.Text.Trim();
            currentProvider.IndividualsPosition = txtIndPosition.Text.Trim();
            currentProvider.IndividualsPhone    = txtIndPhone.Text.Trim();
            currentProvider.IndividualsFax      = txtIndFax.Text.Trim();
            currentProvider.IndividualsEmail    = txtEmail.Text.Trim();

            //set the password fields
            txtPassword.Attributes.Add("value", txtPassword.Text);
            txtPasswordConfirm.Attributes.Add("value", txtPasswordConfirm.Text);


            //Encode the password before saving the provider details information
            currentProvider.IndividualsPassword = LACESUtilities.Encrypt(txtPassword.Text);

            //set the provider status
            currentProvider.Status = radStatus.SelectedValue;

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

                currentProvider.ID = providerID;

                if (oProviderDataAccess.Update(currentProvider) == null)
                {
                    lblMsg.Text      = "Cannot save data.";
                    lblMsg.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    //data saved successfully so prepare and send mail to the respective provider
                    if (SendMailToProvider(true))
                    {
                        //send mail successfull
                        lblMsg.Text      = "Contact information updated successfully and email sent to the contact.";
                        lblMsg.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        //send mail error
                        lblMsg.Text      = "Contact information updated successfully and email sent to the contact.";
                        lblMsg.ForeColor = System.Drawing.Color.Green;
                    }
                }
            }

            else //it is in add provider mode, so add a new provider
            {
                //all thing ok, so store provider into the DB
                if (oProviderDataAccess.Add(currentProvider) == null)
                {
                    lblMsg.Text      = "Cannot save data.";
                    lblMsg.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    //data add successfully so prepare and send mail to the respective provider
                    if (SendMailToProvider(false))
                    {
                        //send mail successfull
                        lblMsg.Text      = "Contact information added successfully and email sent to the contact.";
                        lblMsg.ForeColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        //send mail error
                        lblMsg.Text      = "Contact information added successfully and email sent to the contact.";
                        lblMsg.ForeColor = System.Drawing.Color.Green;
                    }
                    clearForm();
                }
            }
        }
        else
        {
            //The email is already used, so not allowed
            lblMsg.Text      = "Email already exists. Please provide another email.";
            lblMsg.ForeColor = System.Drawing.Color.Red;
            txtEmail.Focus();
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Call every time when user click on 'Save Details' button.
    /// </summary>
    /// <param name="sender">sender object</param>
    /// <param name="e">EventArgs</param>
    protected void btnSaveDetails_Click(object sender, EventArgs e)
    {
        //create Provider Data Access object
        ProviderDataAccess oProviderDataAccess = new ProviderDataAccess();

        //Check for existence for Email address
        Provider1 oProvider = oProviderDataAccess.GetbyEmail(txtEmail.Text);

        //now check weather it is in edit provider mode
        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 it is the same person
            if (oProvider != null && oProvider.ID == currentProvider.ID)
            {
                oProvider = null;
            }
        }

        if (oProvider == null)
        {
            // The email is not already used, means the current provider can use the email
            Provider1 currentProvider = new Provider1();

            currentProvider.Organization  = txtOrganization.Text.Trim();
            currentProvider.StreetAddress = txtStreetAddress.Text.Trim();
            currentProvider.City          = txtCity.Text.Trim();
            currentProvider.State         = drpState.SelectedValue.Trim();
            currentProvider.Zip           = txtZip.Text.Trim();
            currentProvider.Country       = txtCountry.Text.Trim();
            currentProvider.Phone         = txtPhone.Text.Trim();
            currentProvider.Fax           = txtFax.Text.Trim();
            currentProvider.Website       = txtWebsite.Text.Trim();

            currentProvider.IndividualsName     = txtIndName.Text.Trim();
            currentProvider.IndividualsPosition = txtIndPosition.Text.Trim();
            currentProvider.IndividualsPhone    = txtIndPhone.Text.Trim();
            currentProvider.IndividualsFax      = txtIndFax.Text.Trim();
            currentProvider.IndividualsEmail    = txtEmail.Text.Trim();

            //set the password fields
            txtPassword.Attributes.Add("value", txtPassword.Text);
            txtPasswordConfirm.Attributes.Add("value", txtPasswordConfirm.Text);

            //Encode the password before saving the provider details information
            currentProvider.IndividualsPassword = LACESUtilities.Encrypt(txtPassword.Text);

            //set the provider status
            //currentProvider.Status = "Y";

            //now check session variable
            if (Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER] != null)
            {
                //get the provider id from query string
                long providerID = ((Provider1)Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER]).ID;

                currentProvider.ID = providerID;

                currentProvider = oProviderDataAccess.Update(currentProvider);

                if (currentProvider == null)
                {
                    lblMsg.Text      = "Cannot save data.";
                    lblMsg.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    //send mail successfull
                    lblMsg.Text      = "Contact information updated successfully.";
                    lblMsg.ForeColor = System.Drawing.Color.Green;

                    //update the current provider information in the session
                    Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER] = currentProvider;

                    //populate provider updated information from session
                    populateProviderInformation();
                }
            }
        }
        else
        {
            //The email is already used, so not allowed
            lblMsg.Text      = "Email already exists. Please provide another email.";
            lblMsg.ForeColor = System.Drawing.Color.Red;
            txtEmail.Focus();
        }
    }