Exemplo n.º 1
0
    /// <summary>
    ///  Page Load Event Handler
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        //  uiLnkDistanceLearning.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("DistanceEducationPDF"));
        //  uiLnkCalculatingPDH.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("CalculatingPDF"));
        //  uiLnkModelCertificateForm.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("ModelCertificateForm"));
        //  uiLnkModelEvaluationForm.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("ModelEvaluationForm"));
        //  uiLnkHSWClassification.HRef = GetPDFURL(LACESUtilities.GetApplicationConstants("HSWClassificationPDF"));
        if (!Page.IsPostBack)
        {
            //get id from query string
            if (Request.QueryString[LACESConstant.QueryString.PROVIDER_ID] != null)
            {
                int providerID = 0;

                int.TryParse(Request.QueryString[LACESConstant.QueryString.PROVIDER_ID].ToString(), out providerID);

                if (providerID > 0)
                {
                    ApprovedProviderDataAccess providerDA      = new ApprovedProviderDataAccess();
                    ApprovedProvider           currentProvider = providerDA.GetApprovedProviderByID(providerID); // Get provider by id

                    //if provider exists
                    if (currentProvider != null)
                    {
                        PreparePreviewData(currentProvider);
                    }
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //get id from query string
            if (Request.QueryString[LACESConstant.QueryString.PROVIDER_ID] != null)
            {
                int providerID = 0;

                int.TryParse(Request.QueryString[LACESConstant.QueryString.PROVIDER_ID].ToString(), out providerID);

                if (providerID > 0)
                {
                    ApprovedProviderDataAccess providerDA = new ApprovedProviderDataAccess();
                    currentProvider = providerDA.GetApprovedProviderByID(providerID); // Get provider by id

                    //if provider exists
                    if (currentProvider != null)
                    {
                        PreparePreviewData(currentProvider);
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER];

        if (provider != null)
        {
            string stritemsperpage = Request.QueryString["itemsperpage"] != null ? Request.QueryString["itemsperpage"] : "99999";
            int    itemsPerPage    = 99999;
            if (int.TryParse(stritemsperpage, out itemsPerPage))
            {
            }

            string strpage = Request.QueryString["page"] != null ? Request.QueryString["page"] : "1";
            int    page    = 1;
            if (int.TryParse(strpage, out page))
            {
            }

            string           strKeyword   = Request.QueryString["keyword"] != null ? Request.QueryString["keyword"] : "";
            string           strEndDate   = Request.QueryString["enddate"] != null ? Request.QueryString["enddate"] : "";
            string           strStartDate = Request.QueryString["startdate"] != null ? Request.QueryString["startdate"] : "";
            string           strState     = Request.QueryString["state"] != null ? Request.QueryString["state"] : "";
            string           strStatus    = Request.QueryString["status"] != null ? Request.QueryString["status"] : "";
            string           strSubject   = Request.QueryString["subject"] != null ? Request.QueryString["subject"] : "";
            int              totalCount   = 0;
            CourseDataAccess objCourseDAL = new CourseDataAccess();
            IList <Course>   courseResult = new List <Course>();
            courseResult = objCourseDAL.GetPagedCourseBySearchByProvider(strStartDate, strEndDate, strKeyword, 1, 99999, strStatus, provider.ID, strSubject, strState, ref totalCount);
            Response.Write(courseResult.Count.ToString());
        }
    }
Exemplo n.º 4
0
 protected void FilterCoursesBind(string strStartDate, string strEndDate, string strKeyword, string strState, string strSubject, string strStatus, string strProviderList, string courseType)
 {
     try
     {
         int totalCount                = 0;
         ApprovedProvider provider     = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER];
         CourseDataAccess objCourseDAL = new CourseDataAccess();
         IList <Course>   courseResult = new List <Course>();
         courseResult = objCourseDAL.GetPagedCourseBySearchAdmin(strStartDate, strEndDate, strKeyword, 0, 10000, strStatus, strProviderList, strSubject, strState, courseType, ref totalCount);
         if (courseResult.Count < 1)
         {
             dlCourseList.Visible = false;
             NoResult.Visible     = true;
         }
         else
         {
             dlCourseList.DataSource = courseResult;
             dlCourseList.DataBind();
             dlCourseList.Visible = true;
             NoResult.Visible     = false;
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 5
0
    /// <summary>
    /// Used to populate course information into UI. It get a course id from query string
    /// which detail information needed. Return none.
    /// </summary>
    private void populateCourseInfo()
    {
        long courseID = 0;

        if (Request.QueryString[LACESConstant.QueryString.COURSE_ID] != null)
        {
            try
            {
                //get the course id from query string
                courseID = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID]);

                //get course detail by courseid and providerid
                ApprovedProvider provider  = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // Get provider information from Session
                CourseDataAccess courseDAL = new CourseDataAccess();
                Course           course    = courseDAL.GetCoursesDetailsByIDandProviderID(courseID, provider.ID);            // Get Courses Details from Course ID and Provider ID

                if (course == null || course.ID < 1)
                {
                    //btnSaveAddMore.Enabled = false;
                    //btnSaveFinish.Enabled = false;
                    lblMsg.Text = LACESConstant.Messages.COURSE_NOT_FOUND_IN_PROVIDER;
                    // dvParticipantList.Visible = false;
                    return;
                }

                Label lblMasterCourseName = (Label)Master.FindControl("lblCourseName");
                lblMasterCourseName.Text = "Selected Course: <a href='CourseDetails.aspx?" + LACESConstant.QueryString.COURSE_ID + "=" + Server.HtmlEncode(course.ID.ToString()) + "'>" + Server.HtmlEncode(course.Title) + "</a>";
                lblMasterCourseName.Attributes.Add("onclick", "javascript:return CheckChange(2,-1)");
            }
            catch (Exception ex)
            {
            }
        }
    }
Exemplo n.º 6
0
 /// <summary>
 /// Page Load Event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.TemplateControl.AppRelativeVirtualPath.ToLower().IndexOf("addattendee.aspx") < 1)
     {
         if (Session[LACESConstant.SessionKeys.LOGEDIN_ADMIN] == null || Session[LACESConstant.SessionKeys.LOGEDIN_ADMIN].ToString() != "Yes")
         {
             if (Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] == null && Session[LACESConstant.SessionKeys.LOGEDIN_INACTIVE_PROVIDER] == null)
             {
                 ASP.usercontrols_visitormenu_ascx visitorMenu = (ASP.usercontrols_visitormenu_ascx)Page.LoadControl("~/usercontrols/VisitorMenu.ascx");
                 uiPhMenu.Controls.Add(visitorMenu);
             }
             else
             {
                 string           sessionKeyForProvider = LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER;
                 ApprovedProvider sessionProvider       = (ApprovedProvider)Session[sessionKeyForProvider]; // Get provider information from Session
                 if (sessionProvider.Status == LACESConstant.ProviderStatus.ACTIVE)
                 {
                     uiPhMenu.Controls.Add(LoadControl("~/usercontrols/ProviderMenu.ascx"));
                 }
                 //if provider is inactive, inactive provider menu will be shown
                 else if (sessionProvider.Status == LACESConstant.ProviderStatus.INACTIVE)
                 {
                     uiPhMenu.Controls.Add(LoadControl("~/usercontrols/InactiveProviderMenu.ascx"));
                 }
             }
         }
     }
     //for aboutus and ApprovedProviderGuidelines page do not include javascript files
     //otherwise it will produce error
     if (Request.CurrentExecutionFilePath.ToUpper().Contains("/LACES/ABOUTUS.ASPX") ||
         Request.CurrentExecutionFilePath.ToUpper().Contains("/LACES/APPROVEDPROVIDERGUIDELINES.ASPX"))
     {
         LoadJavascript = false;
     }
 }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER];

        if (provider != null)
        {
            string courseTitle = Request.QueryString["title"] != null ? Request.QueryString["title"] : "";
            string StartDate   = Request.QueryString["startdate"] != null ? Request.QueryString["startdate"] : "";
            string EndDate     = Request.QueryString["enddate"] != null ? Request.QueryString["enddate"] : "";
            string Location    = Request.QueryString["location"] != null ? Request.QueryString["location"] : "";
            string FirstName   = Request.QueryString["first"] != null ? Request.QueryString["first"] : "";
            string LastName    = Request.QueryString["last"] != null ? Request.QueryString["last"] : "";
            string Email       = Request.QueryString["email"] != null ? Request.QueryString["email"] : "";
            string strOrderBy;
            if (Request.QueryString["Sort"] != null && Request.QueryString["Sort"].Length > 0)
            {
                strOrderBy = Request.QueryString["Sort"].ToString();
            }
            else
            {
                strOrderBy = "S";
            }
            //create the coures data access
            CourseDataAccess objCourseDAL = new CourseDataAccess();

            //get the current provider

            IList <Course> courses;
            if (FirstName.Length == 0 && LastName.Length == 0 && Email.Length == 0)
            {
                courses = objCourseDAL.GetCoursesByProviderId(provider.ID, strOrderBy);
            }
            else
            {
                courses = objCourseDAL.GetCoursesByProviderIdAndAttendee(provider.ID, strOrderBy, FirstName, LastName, Email);
            }
            if (courseTitle.Length > 0)
            {
                courses = courses.Where(x => x.Title.ToLower().Contains(courseTitle.ToLower())).ToList();
            }
            if (StartDate.Length > 0)
            {
                DateTime dtStartDate = new DateTime();
                if (DateTime.TryParse(StartDate, out dtStartDate))
                {
                    courses = courses.Where(x => x.StartDate >= dtStartDate && x.EndDate >= dtStartDate).ToList();
                }
            }
            if (EndDate.Length > 0)
            {
                DateTime dtEndDate = new DateTime();
                if (DateTime.TryParse(EndDate, out dtEndDate))
                {
                    courses = courses.Where(x => x.EndDate < dtEndDate).ToList();
                }
            }
            Response.Write(courses.Count.ToString());
        }
    }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER];

        if (provider != null)
        {
            string stritemsperpage = Request.QueryString["itemsperpage"] != null ? Request.QueryString["itemsperpage"] : "99999";
            int    itemsPerPage    = 99999;
            if (int.TryParse(stritemsperpage, out itemsPerPage))
            {
            }

            string strpage = Request.QueryString["page"] != null ? Request.QueryString["page"] : "1";
            int    page    = 1;
            if (int.TryParse(strpage, out page))
            {
            }

            string           strKeyword   = Request.QueryString["keyword"] != null ? Request.QueryString["keyword"] : "";
            string           strEndDate   = Request.QueryString["enddate"] != null ? Request.QueryString["enddate"] : "";
            string           strStartDate = Request.QueryString["startdate"] != null ? Request.QueryString["startdate"] : "";
            string           strState     = Request.QueryString["state"] != null ? Request.QueryString["state"] : "";
            string           strStatus    = Request.QueryString["status"] != null ? Request.QueryString["status"] : "";
            string           strSubject   = Request.QueryString["subject"] != null ? Request.QueryString["subject"] : "";
            int              totalCount   = 0;
            CourseDataAccess objCourseDAL = new CourseDataAccess();
            IList <Course>   courseResult = new List <Course>();
            courseResult           = objCourseDAL.GetPagedCourseBySearchByProvider(strStartDate, strEndDate, strKeyword, 1, 99999, strStatus, provider.ID, strSubject, strState, ref totalCount);
            uiHdnResultCount.Value = courseResult.Count.ToString();
            if (courseResult.Count < 1)
            {
                dlCourseList.Visible = false;
                NoResult.Visible     = true;
            }
            else
            {
                int pageBegin = 0;
                if (page > 1)
                {
                    pageBegin = (itemsPerPage * page) - itemsPerPage;
                }
                dlCourseList.Visible = true;
                NoResult.Visible     = false;
                if (itemsPerPage < 999)
                {
                    dlCourseList.DataSource = courseResult.Skip(pageBegin).Take(itemsPerPage);
                }
                else
                {
                    dlCourseList.DataSource = courseResult;
                }
                dlCourseList.DataBind();
            }
        }
    }
Exemplo n.º 9
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;
        }
    }
Exemplo n.º 10
0
    /// <summary>
    /// Call every time when user click on Save Details button.
    /// Update provider information in database
    /// </summary>
    /// <param name="sender">sender object</param>
    /// <param name="e">EventArgs</param>
    protected void btnSaveDetails_Click(object sender, EventArgs e)
    {
        if (Password.Text == PasswordConfirm.Text)
        {
            HidPass.Value = Password.Text;
        }
        //create Provider Data Access object
        ApprovedProviderDataAccess providerDA = new ApprovedProviderDataAccess();

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

        //provider in session
        ApprovedProvider sessionProvider = null;

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

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

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

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

                    //data saved successfully
                    lblMsg.Text      = "Contact information updated successfully.<br /><br />";
                    lblMsg.ForeColor = System.Drawing.Color.Green;
                }
            }
        }
    }
Exemplo n.º 11
0
    /// <summary>
    ///  Page Load Event Handler
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        string sessionKeyForProvider = LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER;

        //if current user is inactive
        if (Session[LACESConstant.SessionKeys.LOGEDIN_INACTIVE_PROVIDER] != null)
        {
            sessionKeyForProvider = LACESConstant.SessionKeys.LOGEDIN_INACTIVE_PROVIDER;
        }

        //if current user is inactive
        if (Session[sessionKeyForProvider] == null)
        {
            Response.Redirect("Login.aspx");
        }
        //show provider spacific menu in edit mode
        else
        {
            //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) { }
        }
    }
Exemplo n.º 12
0
 /// <summary>
 /// Get course details information if any course found otherwise null
 /// </summary>
 /// <returns>course object</returns>
 private Course getCourseInfo()
 {
     try
     {
         //get course detail by courseid and providerid
         //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
         CourseDataAccess courseDAL = new CourseDataAccess();
         return(courseDAL.GetCoursesDetailsByIDandProviderID(courseID, provider.ID));                                 // Get Courses Details from Course ID and Provider ID
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 13
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) { }
        }
    }
Exemplo n.º 14
0
    /// <summary>
    /// Page load event handler
    /// Loads the course name based on course id
    /// Generates the redirect URL
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            long   courseID   = 0;
            string courseName = "";
            //If CourseId is defined in URL
            if (Request.QueryString["CourseID"] != null)
            {
                try
                {
                    courseID = Convert.ToInt64(Request.QueryString["CourseID"]);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                //Get course information by courseId
                //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

                CourseDataAccess courseDAL = new CourseDataAccess();
                Course           course    = courseDAL.GetCoursesDetailsByIDandProviderID(courseID, provider.ID); // Get Courses Details from Course ID and Provider ID
                //Generate linked course name to display
                courseName = "<a href=\"CourseDetails.aspx?CourseID=" + courseID + "\">" + Server.HtmlEncode(course.Title) + "</a>";
            }
            else//If courseId is not defined in URL, display None
            {
                courseName = "<i>None</i>";
            }

            //System.Diagnostics.Debugger.Break();


            //Set value for the lblCourseName control of master page
            Label lblCourseName = (Label)Master.FindControl("lblCourseName");
            if (lblCourseName != null)
            {
                lblCourseName.Text = "Selected Course: " + courseName;
            }
        }
        lblMessage.Text    = "";
        lblMessage.Visible = false;
        message            = "";
        txtCodeType.Focus();
    }
Exemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //show provider spacific menu in edit mode
        if (Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] != null)
        {
            //get the provider from session
            ApprovedProvider sessionProvider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // 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();
            oHtmlTableCell.Controls.Add(LoadControl("~/usercontrols/ProviderMenu.ascx"));

            try
            {
                //change the login status
                ((HtmlTableCell)Master.FindControl("loginTd")).Attributes["class"] = "loggedIn providerloginStatus";
            }
            catch (Exception ex) { }
        }

        //now check weather it is in renew mode
        if (Request.QueryString["Renew"] != null && Request.QueryString["Renew"] == "true")
        {
            lblMsg.Text = "Thank you for renewing your LA CES Approved Provider certification.  If you have any questions, please contact <a href='mailto:[email protected]'>[email protected]</a>.";
        }
        else if (Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] != null)
        {
            lblMsg.Text = "Thank you for renewing your LA CES Approved Provider certification.  If you have any questions, please contact <a href='mailto:[email protected]'>[email protected]</a>.";
        }
        else
        {
            lblMsg.Text = "The American Society of Landscape Architects received your application and $295 application fee for the Landscape Architecture Continuing Education System today.<br/><br/>American Society of Landscape Architects<br/>636 I Street, NW<br/>Washington, DC 20001<br/>202-898-2444<br/>FEID - 53-0259019<br/><br/><em>Note: Please print this page for your records and use as a receipt.</em><br /><br />To ensure you receive your login and password and renewal notifications from LA CES, please be sure to add <strong>[email protected]</strong> and <strong>[email protected]</strong> to your e-mail “safe” list. You can also check your SPAM filter settings. If you have any questions, please contact <a href='mailto:[email protected];[email protected];[email protected]'> the LA CES administrators</a>.";
        }
    }
Exemplo n.º 16
0
    protected void btDelete_Click(object sender, EventArgs e)
    {
        if (Request.QueryString[LACESConstant.QueryString.COURSE_ID] != null &&
            Request.QueryString[LACESConstant.QueryString.COURSE_ID].ToString() != "")
        {
            CourseDataAccess objCourseDAL   = new CourseDataAccess();
            long             courseId       = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID].ToString());
            Course           deletingCourse = objCourseDAL.GetCoursesDetailsByID(courseId);
            string           coursetitle    = deletingCourse.Title;
            string           strSubject     = coursetitle + " – Course Declined";

            ApprovedProviderDataAccess apda = new ApprovedProviderDataAccess();
            ApprovedProvider           ap   = apda.GetApprovedProviderByID(deletingCourse.ProviderID);
            string strSendEmaiTo            = ap.ApplicantEmail;

            bool deleted = objCourseDAL.Delete(courseId);    //call dal method to delete
            SendDeleteForeverEmail(strSendEmaiTo, strSubject, coursetitle);
            Response.Redirect("FindCourses.aspx?status=NP"); // redirect after saving course information
        }
    }
Exemplo n.º 17
0
    protected void uilnkDownloadAttendees_Click(object sender, EventArgs e)
    {
        long courseID;

        LinkButton btn       = (LinkButton)(sender);
        string     yourValue = btn.CommandArgument;

        if (long.TryParse(yourValue, out courseID))
        {
            DataGrid         dg = new DataGrid();
            CourseDataAccess oCourseDataAccess = new CourseDataAccess();

            ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // Get provider information from Session

            ParticipantDataAccess participantDAL  = new ParticipantDataAccess();
            IList <Participant>   participantList = participantDAL.GetAllParticipantByCourseIDProviderID(courseID, provider.ID); // Get Participants of the course

            DataTable tab = ConvertToDataTable(participantList);
            ConvertToCSV(tab);
        }
    }
Exemplo n.º 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();
        }
    }
Exemplo n.º 19
0
 /// <summary>
 /// Page Load Event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] == null && Session[LACESConstant.SessionKeys.LOGEDIN_INACTIVE_PROVIDER] == null)
     {
         ASP.usercontrols_visitormenu_ascx visitorMenu = (ASP.usercontrols_visitormenu_ascx)Page.LoadControl("~/usercontrols/VisitorMenu.ascx");
         uiPhMenu.Controls.Add(visitorMenu);
     }
     else
     {
         string           sessionKeyForProvider = LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER;
         ApprovedProvider sessionProvider       = (ApprovedProvider)Session[sessionKeyForProvider]; // Get provider information from Session
         if (sessionProvider.Status == LACESConstant.ProviderStatus.ACTIVE)
         {
             uiPhMenu.Controls.Add(LoadControl("~/usercontrols/ProviderMenu.ascx"));
         }
         //if provider is inactive, inactive provider menu will be shown
         else if (sessionProvider.Status == LACESConstant.ProviderStatus.INACTIVE)
         {
             uiPhMenu.Controls.Add(LoadControl("~/usercontrols/InactiveProviderMenu.ascx"));
         }
     }
 }
Exemplo n.º 20
0
    /// <summary>
    /// Populate course details in the UI using course object
    /// </summary>
    /// <param name="course">course object</param>
    /// <returns></returns>
    private void populateCourseInfo(Course course)
    {
        try
        {
            //get master page label for showing the course name
            Label lblMasterCourseName = (Label)Master.FindControl("lblCourseName");

            //course is null if current provider is not assign for that course
            if (course == null || course.ID < 1)
            {
                ///Disable buttons
                btnRemovePerticipant.Enabled = false;
                btnSaveFinish.Enabled        = false;

                lblMsg.Text = LACESConstant.Messages.COURSE_NOT_FOUND_IN_PROVIDER;
            }
            else
            {
                //this is for message in the right side of the page
                divRightMessage.InnerHtml = "Use this page to edit an attendees who attended the " + Server.HtmlEncode(course.Title) + " course. Removing an attendees from the course is a permanent action, and can not be undone.";

                //assign course name in to the master page control
                lblMasterCourseName.Text = "Selected Course: <a href='CourseDetails.aspx?" + LACESConstant.QueryString.COURSE_ID + "=" + Server.HtmlEncode(course.ID.ToString()) + "'>" + Server.HtmlEncode(course.Title) + "</a>";

                //get course detail by courseid and providerid
                //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

                //set the provider name to the master page ProviderName label
                Label lblMasterProviderName = (Label)Master.FindControl("lblProviderName");
                lblMasterProviderName.Text = Server.HtmlEncode("Signed in as: " + provider.OrganizationName);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemplo n.º 21
0
    /// <summary>
    /// Populate the participants of the course. Get a course id which participant information want to get
    /// from database. Return none.
    /// </summary>
    /// <param name="courseID">Course ID</param>
    private void populateParticipantList(long courseID)
    {
        try
        {
            CourseDataAccess oCourseDataAccess = new CourseDataAccess();

            ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // Get provider information from Session

            ParticipantDataAccess participantDAL  = new ParticipantDataAccess();
            IList <Participant>   participantList = participantDAL.GetAllParticipantByCourseIDProviderID(courseID, provider.ID); // Get Participants of the course
            rptParticipantList.DataSource = participantList;
            rptParticipantList.DataBind();
            //prepare the header
            //dvParticipantList.InnerHtml = "<div class='title'>Edit Attendees for: " + Server.HtmlEncode(oCourseDataAccess.GetCoursesDetailsByID(courseID).Title) + "</div><div class=''><table border='0' style='text-align:center;' cellpadding='0' cellspacing='0'>";

            //if (participantList.Count > 0)
            //{
            //    dvParticipantList.InnerHtml += "<tr><td style='text-align:left; vertical-align:middle;' class='participantList'><strong>Last Name</strong></td><td style='text-align:left; vertical-align:middle;' class='participantList'><strong>First Name</strong></td></tr>";

            //    //dynamically add rest of the rows
            //    foreach (Participant participant in participantList)
            //    {

            //        dvParticipantList.InnerHtml += "<tr><td style='text-align:left; vertical-align:middle;' class='participantList'><a href='EditAttendees.aspx?ParticipantID=" + participant.ID.ToString() + "&CourseID=" + courseID.ToString() + "'>" + Server.HtmlEncode(participant.LastName) + "</a></td>";
            //        dvParticipantList.InnerHtml += "<td style='text-align:left; vertical-align:middle;' class='participantList'>" + Server.HtmlEncode(participant.FirstName) + "</td></tr>";
            //    }
            //}
            //else
            //{
            //    dvParticipantList.InnerHtml += "<tr><td style='color:red'>No attendees found.</td></tr>";
            //}
            //dvParticipantList.InnerHtml += "</div></table>";
            //dvParticipantList.InnerHtml += "<br/><div><a href='../provider/UploadAttendees.aspx?courseid=" + courseID + "'>Upload Attendees in Excel</a><div>";
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemplo n.º 22
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)
    {
        if (!IsPostBack)
        {
            //now check weather it is in edit provider mode
            if (Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] != null)
            {
                //get the provider from session
                ApprovedProvider sessionProvider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // Get provider information from Session

                //fill form by provider in session
                FillFormValuesByProviderObject(sessionProvider);
                //PopulateStateBasedOnCountry(OrganizationState, null);
            }
        }

        //reset the error message label
        lblMsg.Text      = "";
        lblMsg.ForeColor = System.Drawing.Color.Red;

        CheckUnsavedData();
    }
Exemplo n.º 23
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);
    }
Exemplo n.º 24
0
    /// <summary>
    /// Override the onload event handler
    /// </summary>
    /// <param name="e"></param>
    protected override void OnLoad(EventArgs e)
    {
        try
        {
            ///Check Session for logged in provider information
            if (Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER] != null)
            {
                //Provider provider = (Provider)Session[LACESConstant.SessionKeys.LOGEDIN_PROVIDER];
                ApprovedProvider provider = (ApprovedProvider)Session[LACESConstant.SessionKeys.LOGEDIN_APPROVED_PROVIDER]; // get approved provider information from Session

                if (provider.ID > 0)
                {
                    ///Show loggedin provider name
                    Label lblProviderName = (Label)Master.FindControl("lblProviderName");
                    if (lblProviderName != null)
                    {
                        lblProviderName.Text = "Signed in as: " + Server.HtmlEncode(provider.OrganizationName);
                    }
                    try
                    {
                        //change the login status
                        ((HtmlGenericControl)Master.FindControl("loginTd")).Attributes["class"] = "loggedIn providerloginStatus";
                    }
                    catch (Exception ex) { }

                    base.OnLoad(e);
                }
            }
            else
            {
                Response.Redirect(LACESConstant.URLS.HOME_PAGE);
            }
        }
        catch (Exception ex)
        {
        }
    }
Exemplo n.º 25
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);
            }
        }
    }
Exemplo n.º 26
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);
    }
Exemplo n.º 27
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);
    }
Exemplo n.º 28
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);
    }
Exemplo n.º 29
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.";
    }
Exemplo n.º 30
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);
            }
        }
    }