Beispiel #1
0
    /// <summary>
    ///  Populate Course Code Information
    /// </summary>
    /// <param name="courseID"></param>
    private void populateCourseCodeInfo(long courseID)
    {
        CourseCodeDataAccess courseCodeDAL  = new CourseCodeDataAccess();
        IList <CourseCode>   courseCodeList = courseCodeDAL.GetAllCourseCodeByCourseID(courseID); // Get all Course code of the course

        // On load Script for Populate Course Code Dynamic Table in Edit Mode
        string StartupScriptString = "<script language=\"JavaScript\">";

        StartupScriptString += "function initializeValueOnLoad(){ init(); ";

        foreach (CourseCode courseCode in courseCodeList)
        {
            StartupScriptString += " AddNewCourseCodeTypeRow(\"" + courseCode.Description.Replace("\"", "&quot;").Replace("\\", "\\\\") + "\",\"" + courseCode.CodeType + "\",\"" + courseCode.CodeID + "\",\"" + txtTitle.ClientID + "\"); ";

            // Starts - used for Prompting user for unsaved Course Code when navigating
            if (courseTypeValue == string.Empty)
            {
                courseTypeValue = courseCode.CodeID.ToString();
                courseDescValue = courseCode.Description.Replace("\"", "\"");
            }
            else
            {
                courseTypeValue = courseTypeValue + delimiter + courseCode.CodeID.ToString();
                courseDescValue = courseDescValue + delimiter + courseCode.Description.Replace("\"", "\"");  //&quot;
            }
            //txtHidType.Text = courseTypeValue + courseDescValue;
            // Ends - used for Prompting user for unsaved Course Code when navigating
        }
        StartupScriptString += " } ";
        StartupScriptString += " window.onload = initializeValueOnLoad; ";
        StartupScriptString += " </script> ";

        Page.ClientScript.RegisterStartupScript(System.Type.GetType("System.String"), "PageIni", StartupScriptString);
    }
Beispiel #2
0
    /// <summary>
    ///  Populate comma seperated Course Code Information
    /// </summary>
    /// <param name="courseID"></param>
    protected string populateCourseCodeInfo(long courseID)
    {
        CourseCodeDataAccess courseCodeDAL  = new CourseCodeDataAccess();
        IList <CourseCode>   courseCodeList = courseCodeDAL.GetAllCourseCodeByCourseID(courseID); // Get all Course code of the course

        string courseCodes = "";

        foreach (CourseCode courseCode in courseCodeList)
        {
            courseCodes += courseCode.CodeType.ToString() + ": " + courseCode.Description.Replace("\"", "\"") + ", ";
        }

        if (courseCodes.LastIndexOf(',') > 1)
        {
            courseCodes = courseCodes.Substring(0, courseCodes.LastIndexOf(','));
        }

        return(courseCodes);
    }