Example #1
0
    /// <summary>
    /// Call when Update Button Click
    /// </summary>
    /// <param name="sender">sender object</param>
    /// <param name="e">EventArgs</param>
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        string staticErrorMessage = "There has been an error with your upload. Please ensure you use our template to upload attendees.<br/>&nbsp;";


        //check the upload file
        if (FileUpload1.PostedFile != null && FileUpload1.FileName != "")
        {
            if (FileUpload1.PostedFile.ContentType != "application/vnd.ms-excel" && FileUpload1.PostedFile.ContentType != "application/xml" && FileUpload1.PostedFile.ContentType != "application/octet-stream" && FileUpload1.PostedFile.ContentType.IndexOf("application/vnd.openxmlformats") < 0)
            {
                lb_error_message.InnerHtml = staticErrorMessage + "<br />" + FileUpload1.PostedFile.ContentType + "<br />location=8";// "Your provided file type is not supported.";
                return;
            }
            else
            {
                if (UploadExcelFile())
                {
                    //remove the created file from disk
                    LACESUtilities.RemoveCreatedFileFromDisk(fileLocation);
                }
            }
        }
        else
        {
            lb_error_message.InnerHtml = staticErrorMessage + "<br />location=9";//"File not received. Please upload the file again";
            return;
        }
    }
Example #2
0
    /// <summary>
    /// Send mail to Provider matches email address with saved email address
    /// </summary>
    /// <param name="smtpClient">SMTL object</param>
    /// <param name="password">Descrypted password of provider</param>
    /// <returns>confirm sending</returns>
    private bool SendEmail(SmtpClient smtpClient, string password)
    {
        try
        {
            MailMessage message = new MailMessage();

            string ToEmailAddress = txtEmail.Text.Trim();
            if (!string.IsNullOrEmpty(ToEmailAddress.Trim()))
            {
                message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());
                message.To.Add(new MailAddress(ToEmailAddress));

                message.Subject    = LACESConstant.FORGETPASSWORD_SUBJECT;
                message.IsBodyHtml = true;
                message.Body       = GetSendMessage(ToEmailAddress, password);//Send Email to Friend Message Body
                if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
                {
                    smtpClient.Send(message);//Sending A Mail to the Sender Friend
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Example #3
0
    /// <summary>
    ///  Populate State/Province List from database
    /// </summary>
    private void populateStateList()
    {
        StateDataAccess stateDAL          = new StateDataAccess();
        string          webroot           = LACESUtilities.GetApplicationConstants("ASLARoot");
        int             StateProvidenceID = int.Parse(LACESUtilities.GetApplicationConstants("StateProvinceContentID"));
        IList <State>   stateList         = stateDAL.GetAllStates(StateProvidenceID, webroot);

        ///Add default item
        ListItem defaultItem = new ListItem("- Location -", "");

        ddlLocation.Items.Add(defaultItem);

        /////Add Distance Education item
        //ListItem distanceEducation = new ListItem("Distance Education", "Distance Education");
        //ddlLocation.Items.Add(distanceEducation);

        foreach (State state in stateList)
        {
            ListItem item = new ListItem(state.StateName, state.StateCode);
            ddlLocation.Items.Add(item);
        }

        //for other International value
        ddlLocation.Items.Add(new ListItem("- Other International -", "OI"));
    }
Example #4
0
    /// <summary>
    /// Tranform email addresses given in web.conf into proper format
    /// </summary>
    /// <param name="EmailAddresses">Email Address in web.conf</param>
    /// <returns>formated email address to contact</returns>
    private string TranformEmailAddresses()
    {
        string ContactEmailAddressesTo = LACESUtilities.GetAdminToEmail();
        string ContactEmailAddressesCC = LACESUtilities.GetAdminCCEmail();
        string FormatedAddresses       = ContactEmailAddressesTo.Replace(",", ";") + "?cc=" + ContactEmailAddressesCC;

        return(FormatedAddresses);
    }
    /// <summary>
    /// Call every time when the page load occur
    /// </summary>
    /// <param name="sender">Sender object</param>
    /// <param name="e">EventArgs</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        string relativeURL = "\"" + LACESUtilities.GetApplicationConstants("LibraryASLARelative");
        string absoluteURL = "\"" + LACESUtilities.GetApplicationConstants("LibraryASLAAbsolute");
        string uri         = LACESUtilities.GetApplicationConstants("LACES_App_Pro_Guide_ASLA_CMS_Site_URL");

        appProviderLACESDiv.InnerHtml = GetExternalWebData(uri).Replace(relativeURL, absoluteURL);
    }
Example #6
0
    /// <summary>
    /// Send email to the on exception
    /// </summary>
    /// <param name="ex">Exception</param>
    public static void ReportError(Exception ex)
    {
        if (ex.Message == "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.")
        {
            return;
        }
        else if (ex.Message == "Thread was being aborted.")
        {
            return;
        }
        else if (ex.Message == "The content you have requested does not exist in the system.")
        {
            return;
        }

        SmtpClient  smtpClient = new SmtpClient();
        MailMessage message    = new MailMessage();

        try
        {
            //Get the SMTP server Address from Web.conf
            smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER);
            //Get the SMTP port from Web.conf
            smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT));
            //Get the email's TO addresses from Web.conf
            string   values        = LACESUtilities.GetApplicationConstants(LACESConstant.CONSTANT_ERROR_REPORT_MAIL_TO);
            string[] emailAddesses = values.Split(';');

            //add individual addresses to the MailMessage class instance
            for (int i = 0; i < emailAddesses.Length; i++)
            {
                message.To.Add(emailAddesses[i]);
            }

            //Get the email's Subject from Web.conf
            message.Subject = LACESUtilities.GetApplicationConstants(LACESConstant.CONSTANT_ERROR_MAIL_SUBJECT);
            //Whether the message body would be displayed as html or not
            message.IsBodyHtml = true;
            //Get the email's FROM address from Web.conf
            message.From = new System.Net.Mail.MailAddress(LACESUtilities.GetApplicationConstants(LACESConstant.CONSTANT_ERROR_MAIL_FROM));
            //Get the email's BODY
            message.Body = GetMailMessageBody(ex);
            //Send the mail
            if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
            {
                smtpClient.Send(message);
            }
        }
        catch (Exception exp)
        {
        }
        finally
        {
        }
    }
Example #7
0
    protected string GetPDFURL(string PDFLibraryID)
    {
        string      pdfurl    = "";
        XmlDocument GetPdfXML = new XmlDocument();

        GetPdfXML.Load(LACESUtilities.GetApplicationConstants("URLToGetPDFFilename") + "?id=" + PDFLibraryID);
        pdfurl = LACESUtilities.GetApplicationConstants("ASLABaseURL") + GetPdfXML.SelectSingleNode("root/filename").InnerText;;


        return(pdfurl);
    }
Example #8
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 #9
0
    /// <summary>
    ///  Populate Subject List
    /// </summary>
    private void populateSubjectList()
    {
        string            webroot     = LACESUtilities.GetApplicationConstants("ASLARoot");
        int               SubjectID   = int.Parse(LACESUtilities.GetApplicationConstants("SubjectContentID"));
        SubjectDataAccess subjectDAL  = new SubjectDataAccess();
        IList <Subject>   subjectList = subjectDAL.GetAllSubjects(SubjectID, webroot); // Get all Subjects

        foreach (Subject subject in subjectList)
        {
            ListItem item = new ListItem(subject.SubjectName, subject.SubjectID.ToString());
            drpSubject.Items.Add(item);
        }
    }
Example #10
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 #11
0
 /// <summary>
 /// Page load event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string relativeURL = "\"" + LACESUtilities.GetApplicationConstants("LibraryASLARelative");
         string absoluteURL = "\"" + LACESUtilities.GetApplicationConstants("LibraryASLAAbsolute");
         string uri         = LACESUtilities.GetApplicationConstants("AboutLACES_ASLA_CMS_Site_URL");
         aboutLACESDiv.InnerHtml = GetExternalWebData(uri).Replace(relativeURL, absoluteURL);
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
         Response.End();
     }
 }
Example #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string uri         = LACESUtilities.GetApplicationConstants("logosLACES_ASLA_CMS_Site_URL");
        string relativeURL = "\"" + LACESUtilities.GetApplicationConstants("ImagesASLARelative");
        string absoluteURL = "\"" + LACESUtilities.GetApplicationConstants("ImagesASLAAbsolute");

        logosLACESDiv.InnerHtml = GetExternalWebData(uri).Replace(relativeURL, absoluteURL);
        if (Session[LACESConstant.SessionKeys.LOGEDIN_INACTIVE_PROVIDER] != null)
        {
            sessionKeyForProvider = LACESConstant.SessionKeys.LOGEDIN_INACTIVE_PROVIDER;
        }

        if (Session[sessionKeyForProvider] != null)
        {
            //get the provider from session
            ApprovedProvider sessionProvider = (ApprovedProvider)Session[sessionKeyForProvider]; // Get provider information from Session

            //Show loggedin provider name
            Label lblProviderName = (Label)Master.FindControl("lblProviderName");
            if (lblProviderName != null)
            {
                lblProviderName.Text = "Signed in as: " + Server.HtmlEncode(sessionProvider.OrganizationName);
            }


            //load the provider menu bar
            HtmlTableCell oHtmlTableCell = (HtmlTableCell)Master.FindControl("tdMenu");
            oHtmlTableCell.Controls.Clear();

            //if provider is active,provider menu will be shown
            if (sessionProvider.Status == LACESConstant.ProviderStatus.ACTIVE)
            {
                oHtmlTableCell.Controls.Add(LoadControl("~/usercontrols/ProviderMenu.ascx"));
            }
            //if provider is inactive, inactive provider menu will be shown
            else if (sessionProvider.Status == LACESConstant.ProviderStatus.INACTIVE)
            {
                oHtmlTableCell.Controls.Add(LoadControl("~/usercontrols/InactiveProviderMenu.ascx"));
            }

            try
            {
                //change the login status
                ((HtmlTableCell)Master.FindControl("loginTd")).Attributes["class"] = "loggedIn providerloginStatus";
            }
            catch (Exception ex) { }
        }
    }
Example #13
0
    /// <summary>
    ///  Populate Subject List from Database
    /// </summary>
    private void populateSubjectList()
    {
        SubjectDataAccess subjectDAL = new SubjectDataAccess();
        string            webroot    = LACESUtilities.GetApplicationConstants("ASLARoot");
        int             SubjectID    = int.Parse(LACESUtilities.GetApplicationConstants("SubjectContentID"));
        IList <Subject> subjectList  = subjectDAL.GetAllSubjects(SubjectID, webroot);

        ListItem defaultItem = new ListItem("- Subject Area -", "");

        ddlSubject.Items.Add(defaultItem);
        foreach (Subject subject in subjectList)
        {
            ListItem item = new ListItem(subject.SubjectName, subject.SubjectName);
            ddlSubject.Items.Add(item);
        }
    }
Example #14
0
    /// <summary>
    ///  Populate State List
    /// </summary>
    private void populateStateList()
    {
        StateDataAccess stateDAL          = new StateDataAccess();
        string          webroot           = LACESUtilities.GetApplicationConstants("ASLARoot");
        int             StateProvidenceID = int.Parse(LACESUtilities.GetApplicationConstants("StateProvinceContentID"));
        IList <State>   stateList         = stateDAL.GetAllStates(StateProvidenceID, webroot); // Get all States

        ListItem defaultItem = new ListItem("-State List-", "");

        drpState.Items.Add(defaultItem);

        foreach (State state in stateList)
        {
            ListItem item = new ListItem(state.StateName, state.StateCode);
            drpState.Items.Add(item);
        }
        drpState.Items.Add(new ListItem("- Other International -", "OL"));
    }
Example #15
0
    protected void SendDeleteForeverEmail(string strSendEmailTo, string subject, string title)
    {
        StringBuilder strbDeletedBody = new StringBuilder();

        strbDeletedBody.Append("Dear LA CES Provider, <br /><br />");
        strbDeletedBody.Append("Thank you for submitting " + title + " to LA CES.  Unfortunately, we are unable to approve this course at this time as it does not meet LA CES <a href=\"http://laces.asla.org/ApprovedProviderGuidelines.aspx\">guidelines</a>.  We encourage you to resubmit the course after revising it to meet LA CES guidelines. Please contact us at <a href=\"mailto:[email protected]\">[email protected]</a> with any questions or for more information. <br /><br />");

        strbDeletedBody.Append("Sincerely,<br /><br />");

        strbDeletedBody.Append("LA CES Administrator");

        SmtpClient smtpClient = new SmtpClient();

        //Get the SMTP server Address from SMTP Web.conf
        smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER);

        //Get the SMTP port  25;
        smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT));

        //create the message body
        MailMessage message = new MailMessage();


        message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());
        message.To.Add(new MailAddress(strSendEmailTo));
        message.CC.Add(new MailAddress(LACESUtilities.GetApplicationConstants(LACESConstant.ADMIN_CONTACT_TO_EMAIL)));
        message.Subject    = subject;
        message.IsBodyHtml = true;
        message.Body       = strbDeletedBody.ToString();

        if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
        {
            try
            {
                smtpClient.Send(message);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
Example #16
0
    /// <summary>
    /// Use to populate state list in the UI. Get state data from database.
    /// Return none.
    /// </summary>
    private void populateStateList()
    {
        //Get all States from DB
        StateDataAccess stateDAL          = new StateDataAccess();
        string          webroot           = LACESUtilities.GetApplicationConstants("ASLARoot");
        int             StateProvidenceID = int.Parse(LACESUtilities.GetApplicationConstants("StateProvinceContentID"));
        IList <State>   stateList         = stateDAL.GetAllStates(StateProvidenceID, webroot);

        //Add the default value in to the DropDownList
        ListItem defaultItem = new ListItem("-State List-", "-State List-");

        drpState.Items.Add(defaultItem);

        //Prepare the list as a user friendly version and add into the DropDownList
        foreach (State state in stateList)
        {
            ListItem item = new ListItem(state.StateName, state.StateCode);
            drpState.Items.Add(item);
        }
    }
Example #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MailMessage message = new MailMessage();

        string     ToEmailAddress = "*****@*****.**";
        SmtpClient smtpClient     = new SmtpClient();

        smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER);
        //Get the SMTP post  25;
        smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT));

        message.From = new MailAddress("*****@*****.**");
        message.To.Add(new MailAddress(ToEmailAddress));

        message.Subject    = "Test Subject";
        message.IsBodyHtml = true;
        message.Body       = "TEST"; //Send Email to Friend Message Body
        smtpClient.Send(message);    //Sending A Mail to the Sender Friend
        Response.Write("Email sent");
    }
Example #18
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();
        }
    }
Example #19
0
    /// <summary>
    ///  Page Load Event Handler
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        // title of the page
        //this.Title = LACESConstant.LACES_TEXT +" - Course Details";

        // Manage participant button is inactive in add mode
        //btnManageParticipant.Enabled = false;
        // disable Save button for Administrator until populate the Course Information

        uiLnkDistanceLearning.HRef  = GetPDFURL(LACESUtilities.GetApplicationConstants("DistanceEducationPDF"));
        uiLnkHSWClassification.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("HSWClassificationPDF"));
        uiLnkCalculatingPDH.HRef    = GetPDFURL(LACESUtilities.GetApplicationConstants("CalculatingPDF"));
        uiLnkCourseEquiv.HRef       = GetPDFURL(LACESUtilities.GetApplicationConstants("CourseEquivPDF"));
        btnSave.Enabled             = false;

        if (!IsPostBack)
        {
            //trStatus.Attributes.Add("style", "display:none;"); // Status will not be displayed in Add mode

            populateStateList();         // populate state dropdown menu
            populateSubjectList();       // populate subject dropdown menu
            ///Commentd by Matin according to new business logic
            //populateCourseStatusList();  // populate status dropdown menu
            //populateCourseTypeList();    // populate course type dropdown menu
            populateCourseInfo();        // populate course details Information
        }

        //string redirectpage = "ManageCodeTypes.aspx";
        //hpRequestNewCodeType.NavigateUrl = "ManageCodeTypes.aspx";
        //hpRequestNewCodeType.Attributes.Add("onclick", "return redirectPage('" + redirectpage + "')");

        initializePage();

        if (Request.Form["hidAction"] != null && !Request.Form["hidAction"].ToString().Equals(string.Empty))
        {
            string redirect = Request.Form["hidAction"].ToString();
            saveInformation();
            Response.Redirect(redirect);
        }
    }
Example #20
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);
    }
Example #21
0
    protected void SendEmail(string Text, string ProviderEmail)
    {
        try
        {
            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));

            MailMessage message = new MailMessage();

            message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());

            //message.To.Add(LACESUtilities.GetAdminToEmail());
            //message.CC.Add(LACESUtilities.GetAdminCCEmail());

            //Get the email's TO from Web.conf
            message.To.Add(ProviderEmail);

            string BCC = LACESUtilities.GetApplicationConstants(LACESConstant.ADMIN_CONTACT_TO_EMAIL);
            message.CC.Add(LACESUtilities.GetApprovedProviderMailTo());

            message.Subject    = "New Courses Added - Pending Approval";
            message.IsBodyHtml = true;
            message.Body       = Text; // Message Body
            if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
            {
                smtpClient.Send(message);   //Sending A Mail to Admin
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
            Response.End();
        }
    }
Example #22
0
    /// <summary>
    /// Return string array by spliting the string by a delimiter
    /// </summary>
    /// <param name="stringList">string</param>
    /// <returns>Array of String</returns>
    ///
    protected void SendMoreDataNeededEmail(Course c)
    {
        string strMessageBody           = uiTxtEmailText.Text.Replace("\r\n", "<br />");
        ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess();
        ApprovedProvider           ap   = apda.GetApprovedProviderByID(c.ProviderID);
        string     strSendEmaiTo        = ap.ApplicantEmail;
        SmtpClient smtpClient           = new SmtpClient();

        //Get the SMTP server Address from SMTP Web.conf
        smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER);

        //Get the SMTP port  25;
        smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT));

        //create the message body
        MailMessage message = new MailMessage();


        message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());
        message.To.Add(new MailAddress(strSendEmaiTo));
        message.CC.Add(new MailAddress(LACESUtilities.GetApplicationConstants(LACESConstant.ADMIN_CONTACT_TO_EMAIL)));
        message.Subject    = "LA CES Course Needs More Information";
        message.IsBodyHtml = true;
        message.Body       = strMessageBody;

        if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
        {
            try
            {
                smtpClient.Send(message);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
Example #23
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 #24
0
    /// <summary>
    /// Uplaod an Excel file
    /// </summary>
    private bool UploadExcelFile()
    {
        string staticErrorMessage = "There has been an error with your upload. Please ensure you use our template to upload attendees.<br/>&nbsp;";

        lb_error_message.Style["color"] = "red";
        bool blnShowGetNewExcel = false;

        //check the file extension, if not .xls file then show error
        if (!FileUpload1.FileName.EndsWith(".xls") && !FileUpload1.FileName.EndsWith(".xlsx"))
        {
            lb_error_message.InnerHtml = staticErrorMessage + "<br />location=1";// "Your provided file type is not supported.";
            return(false);
        }

        //prepare the file path
        fileLocation = AppDomain.CurrentDomain.BaseDirectory + "xls\\" + System.DateTime.Now.Ticks + FileUpload1.FileName;

        try
        {
            //get the course id from query string
            long courseID = 0;
            List <Participant> participantList = new List <Participant>();

            //create the file loacton
            FileStream oFileStream = File.Create(fileLocation);

            foreach (byte b in FileUpload1.FileBytes)
            {
                oFileStream.WriteByte(b);
            }
            oFileStream.Close();
            Participant oParticipant = null;

            //Debugger.Break();

            //now load it to UI
            if (Request.QueryString["courseid"] != null)
            {
                try
                {
                    courseID = Convert.ToInt32(Request.QueryString["courseid"]);
                }
                catch
                {
                    courseID = 0;
                }


                //no course found
                if (courseID == 0)
                {
                    lb_error_message.InnerHtml = staticErrorMessage + "<br />location=2";//"Course ID is invalid/not exists.";
                    return(false);
                }

                //get the current login provider
                ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER];

                //check is the course available or not
                CourseDataAccess oCourseDataAccess = new CourseDataAccess();
                if (oCourseDataAccess.GetCoursesDetailsByIDandProviderID(courseID, provider.ID) == null)
                {
                    lb_error_message.InnerHtml = staticErrorMessage + "<br />location=3";// "Course ID is invalid/not exists.";
                    return(false);
                }
            }
            else
            {
                lb_error_message.InnerHtml = staticErrorMessage + "<br />location=4";//"Course ID is invalid.";
                return(false);
            }

            DataTable oDataTable = LACESUtilities.ReadXLFile(fileLocation, "Attendees");
            //  Response.Write(fileLocation);
//            Response.End();
            if (oDataTable == null)
            {
                lb_error_message.InnerHtml = staticErrorMessage + "<br />location=5";// "Attendees' information does not match with the template.";
                return(false);
            }

            foreach (DataRow dr in oDataTable.Rows)
            {
                oParticipant = new Participant();

                string last_name      = dr["Last"].ToString().Trim();
                string first_name     = dr["First"].ToString().Trim();
                string middle_name    = dr["Middle"].ToString().Trim();
                string asla_number    = dr["ASLA"].ToString().Trim();
                string clarb_number   = dr["CLARB"].ToString().Trim();
                string csla_name      = dr["CSLA"].ToString().Trim();
                string florida_number = dr["FL"].ToString().Trim();
                string email          = "";
                if (dr.Table.Columns.Contains("email"))
                {
                    email = dr["email"].ToString().Trim();
                }
                else
                {
                    blnShowGetNewExcel = true;
                }
                //if (last_name == "" && first_name == "")
                //{
                //  lb_error_message.InnerHtml = staticErrorMessage + "<br />location=6";//"In your uploaded file, one or more first name/last name are //empty.";
                //   return false;
                //}

                //if any field is empty then exit the process
                if (last_name != "" && first_name != "")// && asla_number != "" && clarb_number != "" && florida_number != "")
                {
                    oParticipant.LastName           = last_name;
                    oParticipant.FirstName          = first_name;
                    oParticipant.MiddleInitial      = middle_name;
                    oParticipant.ASLANumber         = asla_number;
                    oParticipant.CLARBNumber        = clarb_number;
                    oParticipant.CSLANumber         = csla_name;
                    oParticipant.FloridaStateNumber = florida_number;
                    oParticipant.Email = email;
                    //add in to the participant list
                    participantList.Add(oParticipant);
                }
                else if (csla_name == "" && middle_name == "" && last_name == "" && first_name == "" && asla_number == "" && clarb_number == "" && florida_number == "")
                {
                    //if empty row found then discard the row
                }
                else
                {
                    //some empty field found. so inform the error
                    lb_error_message.InnerHtml = staticErrorMessage + "<br />location=7";// "Attendees' information does not match with the template.";
                    return(false);
                }
            }
            if (participantList.Count > 0)
            {
                //finally add the participant in to the database
                ParticipantDataAccess oParticipantDataAccess = new ParticipantDataAccess();
                oParticipantDataAccess.AddParticipantByCourse(courseID, participantList);
            }

            //finally remove the excel file
            LACESUtilities.RemoveCreatedFileFromDisk(fileLocation);


            if (blnShowGetNewExcel)
            {
                lb_error_message.InnerHtml      = "ALERT: Please download new Excel Template that now captures attendee email. This did not prevent your current attendee file from being successfully uploaded.<br/>&nbsp;";
                lb_error_message.Style["color"] = "red";
            }
            else
            {
                lb_error_message.InnerHtml      = "Thank you. Your attendee file has been successfully uploaded.<br/>&nbsp;";
                lb_error_message.Style["color"] = "green";
            }
            //Response.Redirect("../Provider/ManageAttendees.aspx?courseid=" + courseID);
        }
        catch (Exception ex)
        {
            lb_error_message.InnerHtml = staticErrorMessage + "<br />location=1" + "<br />" + ex.Message;//"There has been an error with your upload. Please ensure you use our template to upload attendees.";
            if (File.Exists(fileLocation))
            {
                File.Delete(fileLocation);
            }
        }

        return(true);
    }
Example #25
0
    private bool UploadExcelFile(string strUploadCourseID, string strCourseCodeType)
    {
        try
        {
            string fileLocation = "";
            fileLocation = AppDomain.CurrentDomain.BaseDirectory + "xls\\MultipleCourseUpload\\" + System.DateTime.Now.Ticks + uiFUPSpreadsheet.FileName;
            //get the course id from query string
            List <Course> courseList = new List <Course>();

            //create the file loacton
            FileStream oFileStream = File.Create(fileLocation);

            foreach (byte b in uiFUPSpreadsheet.FileBytes)
            {
                oFileStream.WriteByte(b);
            }
            oFileStream.Close();
            Course oCourse = null;

            DataTable oDataTable = LACESUtilities.ReadXLFile(fileLocation, "Courses");

            bool                      useNext  = false;
            ApprovedProvider          provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // get approved provider information from Session
            System.Text.StringBuilder sbResult = new System.Text.StringBuilder();
            sbResult.Append("<br />");
            int CourseUploadSuccess  = 0;
            int CourseUploadMoreInfo = 0;
            int CourseUploadFailed   = 0;
            int currentRow           = 0;
            if (oDataTable != null)
            {
                foreach (DataRow dr in oDataTable.Rows)
                {
                    oCourse = new Course();

                    string strCol1 = dr[0].ToString().Trim();

                    if (useNext)
                    {
                        string strCourseTitle = dr[0].ToString().Trim();
                        if (strCourseTitle.Length > 0)
                        {
                            oCourse.Title = strCourseTitle;
                            string strCourseRegUrl = dr[1].ToString().Trim();
                            oCourse.Hyperlink = strCourseRegUrl;
                            string strRegEligibility = dr[2].ToString().Trim();
                            oCourse.RegistrationEligibility = strRegEligibility;
                            string   strStartDate = dr[3].ToString().Trim();
                            DateTime dtStart;
                            if (DateTime.TryParse(strStartDate, out dtStart))
                            {
                                oCourse.StartDate = dtStart;
                            }
                            else
                            {
                                oCourse.StartDate = DateTime.Parse("1/1/2010");
                            }

                            string   strEndDate = dr[4].ToString().Trim();
                            DateTime dtEndDate;
                            if (DateTime.TryParse(strEndDate, out dtEndDate))
                            {
                                oCourse.EndDate = dtEndDate;
                            }
                            else
                            {
                                oCourse.EndDate = DateTime.Parse("1/1/2010");
                            }

                            string strDescription = dr[5].ToString().Trim();
                            oCourse.Description = strDescription;
                            string strCity = dr[6].ToString().Trim();
                            oCourse.City = strCity;
                            string strState = dr[7].ToString().Trim();
                            oCourse.StateProvince = strState;
                            string strDistanceEd = dr[8].ToString();
                            if (strDistanceEd.Length == 0)
                            {
                                oCourse.DistanceEducation = " ";
                            }
                            else
                            {
                                oCourse.DistanceEducation = strDistanceEd;
                            }

                            string strCourseEquivalency = dr[9].ToString();
                            if (strCourseEquivalency.Length == 0)
                            {
                                oCourse.CourseEquivalency = " ";
                            }
                            else
                            {
                                oCourse.CourseEquivalency = strCourseEquivalency;
                            }
                            string strSubjects  = dr[10].ToString().Trim();
                            string strSubjects2 = dr[11].ToString().Trim();
                            if (strSubjects2.Length > 0)
                            {
                                strSubjects += ", " + strSubjects2;
                            }
                            oCourse.Subjects = strSubjects;

                            string strHealthSafety = dr[12].ToString().Trim();
                            oCourse.Healths = strHealthSafety;
                            string strPersonalDevelopmentHours = dr[13].ToString().Trim();
                            if (strPersonalDevelopmentHours.IndexOf(".") < 0)
                            {
                                strPersonalDevelopmentHours = strPersonalDevelopmentHours + ".00";
                            }
                            oCourse.Hours = strPersonalDevelopmentHours;
                            string strLearningOutcomes = dr[14].ToString().Trim();
                            oCourse.LearningOutcomes = strLearningOutcomes;
                            string strInstructors = dr[15].ToString().Trim();
                            oCourse.Instructors = strInstructors;
                            string strNoProprietary = dr[16].ToString().ToLower().Trim() == "yes" ? "Y" : "N";
                            oCourse.NoProprietaryInfo = strNoProprietary;
                            string strCourseCode = dr[17].ToString().Trim();
                            oCourse.ProviderID = provider.ID;
                            string strCourseErrors = LACESUtilities.CheckCourseValid(oCourse);
                            //oCourse.OrgStateCourseIDNumber = strCourseCode;
                            if (strCourseErrors.Length == 0)
                            {
                                oCourse.Status = "NP";
                            }
                            else
                            {
                                oCourse.Status = "IC";
                            }
                            oCourse.ProviderCustomCourseCode = strCourseCode;
                            CourseDataAccess cd          = new CourseDataAccess();
                            long             lngCourseID = -1;
                            try
                            {
                                if (long.TryParse(cd.AddCourseDetails(oCourse).ToString(), out lngCourseID))
                                {
                                    try
                                    {
                                        SqlConnection conn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["LACESConnectionString"].ToString());
                                        conn2.Open();
                                        DataSet ds           = new DataSet();
                                        string  sqlStatement = "LACES_InsertMultiCourse_Courses";

                                        SqlCommand cmd = new SqlCommand(sqlStatement, conn2);

                                        cmd.CommandType = CommandType.StoredProcedure;
                                        cmd.Parameters.AddWithValue("@MultiCourseID", strUploadCourseID);
                                        cmd.Parameters.AddWithValue("@CourseID", lngCourseID.ToString());
                                        cmd.ExecuteNonQuery();
                                        conn2.Close();
                                    }
                                    catch (Exception ex)
                                    {
                                        Response.Write(ex.Message);
                                        Response.End();
                                    }


                                    //    if (strCourseCode.Trim().Length > 0)
                                    //    {
                                    //        CourseCodeDataAccess codeDAL = new CourseCodeDataAccess();
                                    //        CourseCode code = new CourseCode();
                                    //        long CodeID = GetCodeIDfromName(strCourseCodeType.Trim());
                                    //        if (CodeID > 0)
                                    //        {
                                    //            //code.Description = descList[i];
                                    //            code.CodeID = Convert.ToInt32(CodeID);
                                    //            code.CourseID = lngCourseID;
                                    //            code.Description = strCourseCode.Trim();
                                    //            try
                                    //            {
                                    //                codeDAL.AddCourseCode(code); // Add course Code
                                    //            }
                                    //            catch (Exception ex)
                                    //            {
                                    //                uiLblResults.Text = ex.Message;
                                    //                Response.End();
                                    //            }
                                    //        }
                                    //        else
                                    //        {
                                    //            CourseTypeDataAccess courseTypeDAL = new CourseTypeDataAccess();
                                    //            int codeID = courseTypeDAL.AddCodeType(strCourseCodeType.Trim());
                                    //            code.CodeID = codeID;
                                    //            code.CourseID = lngCourseID;
                                    //            code.Description = strCourseCode.Trim();
                                    //            try
                                    //            {
                                    //                codeDAL.AddCourseCode(code); // Add course Code
                                    //            }
                                    //            catch (Exception ex)
                                    //            {
                                    //                uiLblResults.Text = ex.Message;
                                    //                Response.End();
                                    //            }

                                    //        }
                                    //    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Response.Write(ex.Message);
                                Response.End();
                            }



                            if (strCourseErrors.Length == 0)
                            {
                                CourseUploadSuccess++;
                                sbResult.Append("<span style=\"color:green\">SUCCESS </span>" + oCourse.Title + "<hr style=\"background-image: url(http://laces.asla.org/images/dotted.png); background-repeat: repeat-x; border: 0; height: 1px;\" />");
                            }
                            else
                            {
                                CourseUploadMoreInfo++;
                                sbResult.Append("<span style=\"color:orange\">ACTION REQUIRED</span> <a href=\"http://laces.asla.org/provider/CourseDetails.aspx?CourseID=" + lngCourseID.ToString() + "\" class=\"nostyle\">" + oCourse.Title + "</a><br />" + strCourseErrors + "<hr style=\"background-image: url(http://laces.asla.org/images/dotted.png); background-repeat: repeat-x; border: 0; height: 1px;\"/>");
                            }
                        }
                        else
                        {
                            DataRow drN        = oDataTable.Rows[currentRow];
                            bool    endprocess = true;
                            for (int i = 0; i < 17; i++)
                            {
                                if (drN[i].ToString().Trim().Length > 0)
                                {
                                    CourseUploadFailed++;
                                    sbResult.Append("<span style=\"color:red\"> ERROR: Excel Row " + (currentRow + 2).ToString() + " was missing a title which is required to begin processing</span><br /><hr style=\"background-image: url(http://laces.asla.org/images/dotted.png); background-repeat: repeat-x; border: 0; height: 1px;\"/>");
                                    endprocess = false;
                                    break;
                                }
                            }
                            if (endprocess)
                            {
                                DataRow drN1 = oDataTable.Rows[currentRow + 1];
                                if (drN1[0].ToString().Trim().Length == 0)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    if (strCol1 == "*Course Title")
                    {
                        useNext = true;
                    }
                    currentRow++;
                    //long newCourse = cd.AddCourseDetails(oCourse);
                }
                if (useNext && (CourseUploadMoreInfo + CourseUploadSuccess > 0))
                {
                    string strMultiName               = uiTxtMultiName.Text;
                    string strConfStartDate           = txtStartDate.Text;
                    string strConfEndDate             = txtEndDate.Text;
                    System.Text.StringBuilder Summary = new System.Text.StringBuilder();
                    Summary.Append("<br /><br /><br /><br /><strong>Thank you for your submission.</strong><br />");
                    Summary.Append("<br /><strong>Event Title: </strong> " + strMultiName + "<br />");
                    Summary.Append("<br /><strong>Start Date: </strong> " + strConfStartDate + "<br />");
                    Summary.Append("<br /><strong>End Date: </strong>" + strConfEndDate + "<br />");


                    Summary.Append("<br />" + (CourseUploadMoreInfo + CourseUploadSuccess).ToString() + " courses have been received.<br />");
                    Summary.Append(CourseUploadSuccess.ToString() + " courses are complete and pending approval by LA CES administrators.<br />");
                    Summary.Append(CourseUploadMoreInfo.ToString() + " courses are incomplete and require immediate attention.<br />");
                    if (CourseUploadFailed > 0)
                    {
                        Summary.Append(CourseUploadFailed.ToString() + " courses failed to upload and need to be resubmitted.<br />");
                    }
                    Summary.Append("<br />Please review the list below or go to <a href=\"http://laces.asla.org/provider/CourseList.aspx?status=NP\">Pending Courses</a> to review your individual course details. All pending courses that require additional information will be listed with a status of \"Action Required\".");
                    Summary.Append("<br /><br /><br />An email with this information will be sent to the primary contact for your account.");

                    Summary.Append("<br /><br /><br />Sincerely,");
                    Summary.Append("<br /><br /><br />LA CES Administrator");

                    uiLblResults.Text = Summary.ToString() + "<hr style=\"background-image: url(http://laces.asla.org/images/images/dotted.png); background-repeat: repeat-x; border: 0; height: 2px;\" />Upload Status – Course Title<br />" + sbResult.ToString();
                    SendEmail(Summary.ToString() + "<hr style=\"background-image: url(http://laces.asla.org/images/dotted.png); background-repeat: repeat-x; border: 0; height: 2px;\" />Upload Status– Course Title<br />" + sbResult.ToString(), provider.ApplicantEmail);
                }
                else
                {
                    BuildExcelError();
                    SendEmail(uiLblResults.Text, provider.ApplicantEmail);
                }
            }
            else
            {
                BuildExcelError();
            }
        }

        catch (Exception ex)
        {
            BuildExcelError();
        }
        return(false);
    }
Example #26
0
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        CourseDataAccess objCourseDAL = new CourseDataAccess();

        ///Loop all items in data list to check approve checkbox for approve one course
        foreach (RepeaterItem dl in dlCourseList.Items)
        {
            CheckBox chkApp = (CheckBox)dl.FindControl("chkApprove");

            ///Get Course Id from hidden field
            HiddenField hidCourseID = (HiddenField)dl.FindControl("hidCourseID");
            if (chkApp.Checked == true)
            {
                long courseId = Convert.ToInt64(hidCourseID.Value);
                if (courseId > 0)
                {
                    bool approved = objCourseDAL.ApproveCourseByCourseId(courseId);
                    if (approved)
                    {
                        Course approvedCourse           = objCourseDAL.GetCoursesDetailsByID(courseId);
                        string strTitle                 = approvedCourse.Title;
                        string strHyperlink             = approvedCourse.Hyperlink;
                        string strStartDate             = approvedCourse.StartDate.ToShortDateString();
                        string strEndDate               = approvedCourse.EndDate.ToShortDateString();
                        string strDesc                  = approvedCourse.Description;
                        string strCity                  = approvedCourse.City;
                        string strState                 = approvedCourse.StateProvince;
                        string strDistanceEd            = approvedCourse.DistanceEducation;
                        string strSubjects              = approvedCourse.Subjects;
                        string strHours                 = approvedCourse.Hours;
                        string strLearningOutcomes      = approvedCourse.LearningOutcomes;
                        ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess();
                        ApprovedProvider           ap   = apda.GetApprovedProviderByID(approvedCourse.ProviderID);
                        string strSendEmaiTo            = ap.ApplicantEmail;

                        StringBuilder strbApprovedEmail = new StringBuilder();
                        string        strEmailTitle     = "An LA CES Course has been approved";
                        string        strBodyIntro      = "Congratulations, a course has been approved by LA CES administrators. Please review the information below carefully as it may have been revised during the approval process. <br />";
                        string        strBodyEnd        = "Please contact <a href=\"mailto:[email protected]\"> LA CES administrators </a> with any questions about the course.";

                        strbApprovedEmail.Append(strBodyIntro + "<br />");
                        strbApprovedEmail.Append("Course Title: " + strTitle + "<br />");
                        strbApprovedEmail.Append("Course Hyperlink: " + strHyperlink + "<br />");
                        strbApprovedEmail.Append("Start Date: " + strStartDate + "<br />");
                        strbApprovedEmail.Append("End Date: " + strEndDate + "<br />");
                        strbApprovedEmail.Append("Description: " + strDesc + "<br />");
                        strbApprovedEmail.Append("City: " + strCity + "<br />");
                        strbApprovedEmail.Append("State: " + strState + "<br />");
                        strbApprovedEmail.Append("Distance Education: " + strDistanceEd + "<br />");
                        strbApprovedEmail.Append("Subject: " + strSubjects + "<br />");
                        strbApprovedEmail.Append("Hours: " + strHours + "<br />");
                        strbApprovedEmail.Append("Learning Outcomes: " + strLearningOutcomes + "<br /><br />");
                        strbApprovedEmail.Append(strBodyEnd + "<br />");
                        SmtpClient smtpClient = new SmtpClient();

                        //Get the SMTP server Address from SMTP Web.conf
                        smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER);

                        //Get the SMTP port  25;
                        smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT));

                        //create the message body
                        MailMessage message = new MailMessage();


                        message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());
                        message.To.Add(new MailAddress(strSendEmaiTo));
                        message.Subject    = strEmailTitle;
                        message.IsBodyHtml = true;
                        message.Body       = strbApprovedEmail.ToString();

                        if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
                        {
                            try
                            {
                                // smtpClient.Send(message);
                            }
                            catch (Exception ex)
                            {
                                Response.Write(ex.Message);
                            }
                        }
                    }
                }
            }
        }

        ///Re-load pending courses
        pendingCourses          = objCourseDAL.GetAllPendingCourses();
        dlCourseList.DataSource = pendingCourses;
        dlCourseList.DataBind();

        ///Show success message
        lblMsg.Visible   = true;
        lblMsg.ForeColor = System.Drawing.Color.Green;
        lblMsg.Text      = "Selected course(s) approved successfully.";
    }
Example #27
0
    /// <summary>
    ///  Page Load Event Handler
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        // title of the page 
        //this.Title = LACESConstant.LACES_TEXT + " - Course Details";

        // Manage participant button is inactive in add mode
        //btnManageParticipant.Enabled = false;
        uiLnkDistanceLearning.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("DistanceEducationPDF"));
        uiLnkCourseEquiv.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("CourseEquivPDF"));
        uiLnkHSWClassification.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("HSWClassificationPDF"));
        uiLnkCalculatingPDH.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("CalculatingPDF"));
        if (!IsPostBack)
        {
            trStatus.Attributes.Add("style", "display:none;"); // Status will not be displayed in Add mode

            populateStateList();         // populate state dropdown menu
            populateSubjectList();       // populate subject dropdown menu
          //  populateCourseTypeList();    // populate course type dropdown menu                        
            populateCourseInfo();        // populate course details Information
            if (Session["ReplicateCourseID"] != null && (Request.QueryString["ReplicateCourse"] == "Y" || Request.QueryString["RenewCourse"] == "Y"))
            {
                ReplicateCourse();
                if(Request.QueryString["RenewCourse"] == "Y")
                {
                    uiHdnCourseToRenew.Value = Session["ReplicateCourseID"].ToString();
                    DisableFieldsForAutoApproval();
                }
            }


        }

        initializePage();
        /**
         * Start v1.1
         * If course id is found in URL set request course code type hyperlink to RequestCourseCode.aspx with course id
         * else set request course code type hyperlink to RequestCourseCode.aspx page
         * */
        //string redirectpage = "RequestCourseCode.aspx";
        //if (Request.QueryString["CourseID"] != null)   
        //{
        //    hpRequestNewCodeType.NavigateUrl = "RequestCourseCode.aspx?CourseId=" + Request.QueryString["CourseID"].ToString();
        //    redirectpage= "RequestCourseCode.aspx?CourseId=" + Request.QueryString["CourseID"].ToString();
        //}
        //else
        //    hpRequestNewCodeType.NavigateUrl = "RequestCourseCode.aspx";

        /**
         * End v1.1
         **/

        //hpRequestNewCodeType.Attributes.Add("onclick", "return confirmonCloseLink(\"You have made changes to the course details. Would you like to save them before requesting a new code?\",'" + redirectpage + "')");
        //hpRequestNewCodeType.Attributes.Add("onclick", "return redirectPage('" + redirectpage + "')");
        
        if (Request.Form["hidAction"] != null && !Request.Form["hidAction"].ToString().Equals(string.Empty))
        {
            string redirect = Request.Form["hidAction"].ToString();
            saveInformation();
            Response.Redirect(redirect);
        }

    }
Example #28
0
    /// <summary>
    /// Sending a mail after adding a course to the system
    /// </summary>
    /// <param name="course">Details of the course for sending email</param>
    /// <param name="stateProvince">State name</param>
    private void sendMail(Course course, string stateProvince)
    {
        //Provider provider = (Provider)Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER]; // get provider information from Session
        ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // get approved provider information from Session 
        string RefrenceURL = String.Empty;
        RefrenceURL = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.ToLower().LastIndexOf(LACESConstant.URLS.PROVIDER_BASE.ToLower())) + LACESConstant.URLS.ADMIN_BASE + "/" + LACESConstant.URLS.PENDING_COURSE;
        string courseDistance = string.Empty;
        if(course.DistanceEducation.Equals("Y"))
        {
            courseDistance = "Yes";
        }
        else
        {
            courseDistance = "No";
        }            
        if(course.StateProvince.Trim().Equals(string.Empty))
        {
            stateProvince = string.Empty;
        }

        StringBuilder EmailBody = new StringBuilder();
        EmailBody.Append("<table border='0' width='100%>");
        EmailBody.Append("<tr><td width='130'>&nbsp;</td><td>&nbsp;</td></tr>");
        EmailBody.Append("<tr><td colspan='2'>A new course has been added to the system by " + Server.HtmlEncode(provider.OrganizationName) + " and is <a href='" + RefrenceURL + "'>pending approval</a>. Please review the details of the course and either approve or reject the course.</td></tr>");
        EmailBody.Append("<tr><td colspan='2'><br/>The details of the new course are as follows:<br/></td></tr>");
        EmailBody.Append("<tr><td valign='top' width='130'>Course Title:</td><td>" + Server.HtmlEncode(course.Title) + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>Course Hyperlink:</td><td>" + Server.HtmlEncode(course.Hyperlink) + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>Start Date:</td><td>" + course.StartDate.ToString("MM/dd/yyyy") + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>End Date:</td><td>" + course.EndDate.ToString("MM/dd/yyyy") + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>Description:</td><td>" + Server.HtmlEncode(course.Description) + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>City:</td><td>" + Server.HtmlEncode(course.City) + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>State:</td><td>" + Server.HtmlEncode(stateProvince) + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>Distance Education:</td><td>" + courseDistance + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>Subjects:</td><td>" + course.Subjects + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>Health:</td><td>" + course.Healths + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>Hours:</td><td>" + course.Hours + "</td></tr>");
        EmailBody.Append("<tr><td valign='top'>Learning Outcomes:</td><td>" + Server.HtmlEncode(course.LearningOutcomes) + "</td></tr>");
        EmailBody.Append("<tr><td colspan='2'><br/>If you wish to add this course to the " + LACESConstant.LACES_TEXT + " system, please <a href='" + RefrenceURL + "'>manage the list of pending courses</a> in the administration system to approve it.<br/></td></tr>");
        EmailBody.Append("<tr><td colspan='2'><br/>If you are going to reject the course, or wish to discuss the course further, please contact the course provider <a href='mailto:" + provider.ApplicantEmail + "'>via email</a>.<br/></td></tr>");
        EmailBody.Append("</table>");
        string mailBody = EmailBody.ToString();


        try
        {
            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));

            MailMessage message = new MailMessage();

            message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());
            
            //message.To.Add(LACESUtilities.GetAdminToEmail());
            //message.CC.Add(LACESUtilities.GetAdminCCEmail());

            //Get the email's TO from Web.conf
            message.To.Add(LACESUtilities.GetCourseNotificationMailTo());

            message.Subject = "New Course Added - Pending Approval";
            message.IsBodyHtml = true;
            message.Body = mailBody;    // Message Body
            if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
            {
                smtpClient.Send(message);   //Sending A Mail to Admin
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Example #29
0
    protected void SendApprovedEmail(long courseId)
    {
        CourseDataAccess           objCourseDAL        = new CourseDataAccess();
        Course                     approvedCourse      = objCourseDAL.GetCoursesDetailsByID(courseId);
        string                     strTitle            = approvedCourse.Title;
        string                     strHyperlink        = approvedCourse.Hyperlink;
        string                     strStartDate        = approvedCourse.StartDate.ToShortDateString();
        string                     strEndDate          = approvedCourse.EndDate.ToShortDateString();
        string                     strDesc             = approvedCourse.Description;
        string                     strCity             = approvedCourse.City;
        string                     strState            = approvedCourse.StateProvince;
        string                     strDistanceEd       = approvedCourse.DistanceEducation;
        string                     strSubjects         = approvedCourse.Subjects;
        string                     strHours            = approvedCourse.Hours;
        string                     strLearningOutcomes = approvedCourse.LearningOutcomes;
        ApprovedProviderDataAccess apda          = new ApprovedProviderDataAccess();
        ApprovedProvider           ap            = apda.GetApprovedProviderByID(approvedCourse.ProviderID);
        string                     strSendEmaiTo = ap.ApplicantEmail;

        StringBuilder strbApprovedEmail = new StringBuilder();
        string        strEmailTitle     = "An LA CES Course has been approved";
        string        strBodyIntro      = "Congratulations, a course has been approved by LA CES administrators. Please review the information below carefully as it may have been revised during the approval process. <br />";
        string        strBodyEnd        = "Please contact <a href=\"mailto:[email protected]\"> LA CES administrators </a> with any questions about the course.";

        strbApprovedEmail.Append(strBodyIntro + "<br />");
        strbApprovedEmail.Append("Course Title: " + strTitle + "<br />");
        strbApprovedEmail.Append("Course Hyperlink: " + strHyperlink + "<br />");
        strbApprovedEmail.Append("Start Date: " + strStartDate + "<br />");
        strbApprovedEmail.Append("End Date: " + strEndDate + "<br />");
        strbApprovedEmail.Append("Description: " + strDesc + "<br />");
        strbApprovedEmail.Append("City: " + strCity + "<br />");
        strbApprovedEmail.Append("State: " + strState + "<br />");
        strbApprovedEmail.Append("Distance Education: " + strDistanceEd + "<br />");
        strbApprovedEmail.Append("Subject: " + strSubjects + "<br />");
        strbApprovedEmail.Append("Hours: " + strHours + "<br />");
        strbApprovedEmail.Append("Learning Outcomes: " + strLearningOutcomes + "<br /><br />");
        strbApprovedEmail.Append(strBodyEnd + "<br />");
        SmtpClient smtpClient = new SmtpClient();

        //Get the SMTP server Address from SMTP Web.conf
        smtpClient.Host = LACESUtilities.GetApplicationConstants(LACESConstant.SMTPSERVER);

        //Get the SMTP port  25;
        smtpClient.Port = Convert.ToInt32(LACESUtilities.GetApplicationConstants(LACESConstant.SMTPPORT));

        //create the message body
        MailMessage message = new MailMessage();


        message.From = new MailAddress(LACESUtilities.GetAdminFromEmail());
        message.To.Add(new MailAddress(strSendEmaiTo));
        message.Subject    = strEmailTitle;
        message.IsBodyHtml = true;
        message.Body       = strbApprovedEmail.ToString();

        if (ConfigurationManager.AppSettings["SendOutgoingEmail"].ToString() == "Y")
        {
            try
            {
                smtpClient.Send(message);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
    /// <summary>
    /// Call every time when the page load occur
    /// </summary>
    /// <param name="sender">Sender object</param>
    /// <param name="e">EventArgs</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        string uri = LACESUtilities.GetApplicationConstants("LACES_App_Pro_Guide_ASLA_CMS_Site_URL");

        appProviderLACESDiv.InnerHtml = GetExternalWebData(uri);
    }