Esempio n. 1
0
 private void populateILMPDetails(ILMPVO ilmpVO)
 {
     txtStudentId.Text   = ilmpVO.StudentId.ToString();
     txtName.Text        = ilmpVO.Name;
     txtActive.Text      = ilmpVO.Active;
     txtDescription.Text = ilmpVO.Description;
 }
Esempio n. 2
0
    public Boolean UpdateILMP(ILMPVO inilmpVO)
    {
        Boolean status = false;

        try
        {
            DBConnection.conn.Open();
            string     query = "UPDATE dbo.Ilmp SET Active=@Active, Description=@Description from dbo.Ilmp where ilmpId=@IlmpId";
            SqlCommand cmd   = new SqlCommand(query, DBConnection.conn);
            cmd.Parameters.AddWithValue("@IlmpId", inilmpVO.IlmpId);
            cmd.Parameters.AddWithValue("@Description", inilmpVO.Description);
            cmd.Parameters.AddWithValue("@Active", inilmpVO.Active);
            int result = cmd.ExecuteNonQuery();

            if (result > 0)
            {
                if (null != inilmpVO.IlmpCourses && inilmpVO.IlmpCourses.Count > 0)
                {
                    foreach (ILMPCourseVO coursesVO in inilmpVO.IlmpCourses)
                    {
                        String     query1 = " UPDATE DBO.IlmpCourse SET Semester=@Semester,Year=@Year,Result=@Result WHERE IlmpId=@IlmpId AND CourseCode=@CourseCode";
                        SqlCommand cmd1   = new SqlCommand(query1, DBConnection.conn);
                        cmd1.Parameters.AddWithValue("@IlmpId", inilmpVO.IlmpId);
                        cmd1.Parameters.AddWithValue("@CourseCode", coursesVO.CourseCode);
                        cmd1.Parameters.AddWithValue("@Semester", coursesVO.Semester);
                        cmd1.Parameters.AddWithValue("@Year", coursesVO.Year);
                        cmd1.Parameters.AddWithValue("@Result", coursesVO.Result);
                        // Add other parameters here
                        int result1 = cmd1.ExecuteNonQuery();
                        if (result1 <= 0)
                        {
                            status = false;
                            break;
                        }
                        else
                        {
                            status = true;
                        }
                    }
                }
            }
        }
        catch (SqlException ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw new CustomException("Error in updating ILMP");
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(status);
    }
Esempio n. 3
0
    private void AddNewRowToStudentILMPGrid(ILMPVO ilmpVO)
    {
        if (ViewState["CurrentTable"] != null)
        {
            DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"];
            DataRow   drCurrentRow   = null;

            if (dtCurrentTable.Rows.Count > 0)
            {
                drCurrentRow = dtCurrentTable.NewRow();
                //add new row to DataTable
                dtCurrentTable.Rows.Add(drCurrentRow);
                //Store the current data to ViewState
                ViewState["CurrentTable"] = dtCurrentTable;
                for (int i = 0; i < dtCurrentTable.Rows.Count - 1; i++)
                {
                    if (i != dtCurrentTable.Rows.Count - 2)
                    {
                        // to skip the last empty row in grid from populating data
                    }
                    else
                    {
                        dtCurrentTable.Rows[i]["Column1"] = ilmpVO.StudentId;
                        dtCurrentTable.Rows[i]["Column2"] = ilmpVO.IlmpId;
                        dtCurrentTable.Rows[i]["Column3"] = ilmpVO.Active;
                        string changestatus = "";
                        if (ilmpVO.Active == "Yes")
                        {
                            changestatus = "DeActivate";
                        }
                        else
                        {
                            changestatus = "Activate";
                        }
                        dtCurrentTable.Rows[i]["Column4"] = changestatus;
                    }
                }
                //Rebind the Grid with the current data
                gvStudentILMPList.DataSource = dtCurrentTable;
                gvStudentILMPList.DataBind();
                gvStudentILMPList.Rows[0].Cells[0].Width = 40;
            }
        }
        else
        {
            Response.Write("ViewState is null");
        }

        //Set Previous Data on Postbacks
        SetPreviousDataInGrid();
    }
Esempio n. 4
0
    public ILMPVO GetILMPCoursesWorkshopForId(int ilmpId)
    {
        ILMPVO ilmp = new ILMPVO();

        try
        {
            ilmp = ilmpDao.GetILMPCoursesWorkshopForId(ilmpId);
        }
        catch (CustomException e)
        {
            throw e;
        }
        return(ilmp);
    }
Esempio n. 5
0
    public ILMPVO GetILMPDetailsForId(int ilmpId)
    {
        ILMPVO ilmp = new ILMPVO();

        try
        {
            ilmp = ilmpDao.GetILMPDetailsForId(ilmpId);
        }
        catch (CustomException e)
        {
            throw e;
        }
        return(ilmp);
    }
Esempio n. 6
0
    public string AddILMP(ILMPVO inilmpVO)
    {
        string status = "";

        try
        {
            status = ilmpDao.AddILMP(inilmpVO);
        }
        catch (CustomException e)
        {
            throw e;
        }
        return(status);
    }
Esempio n. 7
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         ILMPVO ilmpVO = new ILMPVO();
         ilmpVO.IlmpId      = int.Parse(hfIlmpId.Value);
         ilmpVO.Active      = ddActive.SelectedItem.Text;
         ilmpVO.Description = txtDescription.Text;
         // description to be added
         List <ILMPCourseVO> ilmpCourses = new List <ILMPCourseVO>();
         ILMPCourseVO        ilmpCourseVO;
         for (int i = 0; i < gvIlmpCourse.Rows.Count - 1; i++)
         {
             ilmpCourseVO            = new ILMPCourseVO();
             ilmpCourseVO.CourseCode = ((Label)gvIlmpCourse.Rows[i].Cells[0].FindControl("lblCourseCode")).Text;
             DropDownList ddl1 = (DropDownList)gvIlmpCourse.Rows[i].Cells[1].FindControl("ddCourseType");
             DropDownList ddl2 = (DropDownList)gvIlmpCourse.Rows[i].Cells[2].FindControl("ddSemester");
             DropDownList ddl3 = (DropDownList)gvIlmpCourse.Rows[i].Cells[3].FindControl("ddYear");
             DropDownList ddl4 = (DropDownList)gvIlmpCourse.Rows[i].Cells[3].FindControl("ddResult");
             // type to be added if required
             ilmpCourseVO.Semester = int.Parse(ddl2.SelectedItem.Text);
             if (ddl3.SelectedItem.Text != null && ddl3.SelectedItem.Text != "Select")
             {
                 ilmpCourseVO.Year = int.Parse(ddl3.SelectedItem.Text);
             }
             ilmpCourseVO.Result = ddl4.SelectedItem.Text;
             ilmpCourses.Add(ilmpCourseVO);
         }
         ilmpVO.IlmpCourses = ilmpCourses;
         Boolean status = ilmpBO.UpdateILMP(ilmpVO);
         if (status)
         {
             ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert(' ILMP updated successfully ');", true);
             //Response.Write("<script>alert(' ILMP updated successfully ');</script>");
             // btnUpdate.Enabled = false;
         }
         else
         {
             ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert(' Error in updating ILMP ');", true);
             //Response.Write("<script>alert(' Error in updating ILMP ');</script>");
             //btnUpdate.Enabled = true;
         }
     }
     catch (CustomException ex)
     {
         ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + ex.Message + " ');", true);
     }
 }
Esempio n. 8
0
    public List <ILMPVO> GetILMPListForStudentId(int studentId)
    {
        List <ILMPVO> ilmps = new List <ILMPVO>();

        try
        {
            DBConnection.conn.Open();
            string     query = "select StudentID, IlmpID, Active from dbo.Ilmp where studentid=@StudentId order by Active desc";
            SqlCommand cmd   = new SqlCommand(query, DBConnection.conn);
            cmd.Parameters.AddWithValue("@StudentId", studentId);

            /*  dt = new DataTable();
             * using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
             * {
             *    sda.Fill(dt);
             * }*/

            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                ILMPVO ilmp;
                while (reader.Read())
                {
                    ilmp           = new ILMPVO();
                    ilmp.StudentId = int.Parse(reader["StudentID"].ToString());
                    ilmp.IlmpId    = int.Parse(reader["IlmpID"].ToString());
                    ilmp.Active    = reader["Active"].ToString();
                    ilmps.Add(ilmp);
                }
            }
        }
        catch (SqlException ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw ex;
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(ilmps);
    }
Esempio n. 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            String ilmpIdStr = Request.QueryString["id"];
            int    ilmpId    = int.Parse(ilmpIdStr);
            hfIlmpId.Value = ilmpIdStr;

            ILMPVO ilmpVO = ilmpBO.GetILMPDetailsForId(ilmpId);
            populateILMPDetails(ilmpVO);

            populateWorkshop(ilmpId);
            FillSemesterDropDown();
            FillYearDropDown();
            if (rbtnlViewMode.SelectedItem.Text == "Overall")
            {
                ddSemester.Enabled = false;
                ddYear.Enabled     = false;
            }
            else
            {
                ddSemester.Enabled = true;
                ddYear.Enabled     = true;
            }
            try
            {
                SqlDataSource sqlDataSource = new SqlDataSource();
                sqlDataSource.ID = "SqlDataSource4";
                this.Page.Controls.Add(sqlDataSource);
                sqlDataSource.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["dbILMPV1ConnectionString"].ConnectionString;
                sqlDataSource.SelectCommand    = "SELECT ic.CourseCode, ic.CourseType, c.Title, c.Credits, c.Level, cp.AllPrerequisites, ic.Semester, ic.Year FROM Ilmp AS i " +
                                                 "INNER JOIN IlmpCourse AS ic ON i.IlmpID = ic.IlmpID INNER JOIN Course AS c ON c.CourseCode = ic.CourseCode " +
                                                 "LEFT OUTER JOIN CoursePrerequisite AS cp ON cp.CourseCode = c.CourseCode " +
                                                 "WHERE (i.IlmpID =" + ilmpId + ") ORDER BY ic.Year,ic.Semester";

                gvIlmp.DataSource = sqlDataSource;
                gvIlmp.DataBind();
            }
            catch (Exception ex)
            {
                ExceptionUtility.LogException(ex, "Error Page");
                Response.Write("<script>alert('" + ex.Message + "');</script>");
            }
        }
    }
Esempio n. 10
0
    public ILMPVO GetILMPCoursesWorkshopForId(int ilmpId)
    {
        ILMPVO ilmpVO = new ILMPVO();
        List <ILMPCourseVO> ilmpCourses = new List <ILMPCourseVO>();

        try
        {
            ilmpVO = GetILMPDetailsForId(ilmpId);
            DBConnection.conn.Open();
            string query = "SELECT ic.Semester,ic.Year, ic.CourseCode FROM dbo.ilmp i"
                           + " LEFT OUTER JOIN dbo.IlmpCourse ic ON ic.IlmpID = i.IlmpID WHERE i.IlmpID=@IlmpID"
                           + " ORDER BY ic.year, ic.Semester";
            SqlCommand cmd = new SqlCommand(query, DBConnection.conn);
            cmd.Parameters.AddWithValue("@IlmpID", ilmpId);
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                ILMPCourseVO ilmpCourse;
                while (reader.Read())
                {
                    ilmpCourse            = new ILMPCourseVO();
                    ilmpCourse.Semester   = Int32.Parse(reader["Semester"].ToString());
                    ilmpCourse.Year       = Int32.Parse(reader["Year"].ToString());
                    ilmpCourse.CourseCode = reader["CourseCode"].ToString();
                    ilmpCourses.Add(ilmpCourse);
                }
                ilmpVO.IlmpCourses = ilmpCourses;
                reader.Close();
            }
        }
        catch (SqlException ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw ex;
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(ilmpVO);
    }
Esempio n. 11
0
    public Boolean UpdateILMP(ILMPVO inilmpVO)
    {
        Boolean status = false;

        try
        {
            status = ilmpDao.UpdateILMP(inilmpVO);
            if (inilmpVO.Active == "Yes")
            {
                ilmpDao.UpdateILMPStatusForStudent(inilmpVO.StudentId, inilmpVO.IlmpId);
            }
        }
        catch (CustomException e)
        {
            throw e;
        }

        return(status);
    }
Esempio n. 12
0
    public ILMPVO GetILMPDetailsForId(int ilmpId)
    {
        ILMPVO ilmp = new ILMPVO();

        try
        {
            DBConnection.conn.Open();
            string query = "SELECT i.TemplateId, i.IlmpId,i.StudentId,s.FirstName+' '+s.LastName as Name, i.Active, i.Description "
                           + " FROM dbo.Ilmp i "
                           + " INNER JOIN dbo.Student s ON s.StudentID = i.StudentID WHERE i.IlmpID=@IlmpID";
            SqlCommand cmd = new SqlCommand(query, DBConnection.conn);
            cmd.Parameters.AddWithValue("@IlmpID", ilmpId);
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    ilmp.TemplateId  = int.Parse(reader["TemplateId"].ToString());
                    ilmp.IlmpId      = int.Parse(reader["IlmpId"].ToString());
                    ilmp.StudentId   = int.Parse(reader["StudentId"].ToString());
                    ilmp.Name        = reader["Name"].ToString();
                    ilmp.Active      = reader["Active"].ToString();
                    ilmp.Description = reader["Description"].ToString();
                }
            }
        }
        catch (SqlException ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw ex;
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(ilmp);
    }
Esempio n. 13
0
    public string AddILMP(ILMPVO inilmpVO)
    {
        string status = "";
        int    ilmpId = 0;

        try
        {
            DBConnection.conn.Open();
            SqlCommand cmd = new SqlCommand("dbo.spAddILMP", DBConnection.conn);
            cmd.Parameters.AddWithValue("@StudentId", inilmpVO.StudentId);
            cmd.Parameters.AddWithValue("@Name", inilmpVO.Name);
            cmd.Parameters.AddWithValue("@TemplateId", inilmpVO.TemplateId);
            cmd.Parameters.AddWithValue("@Description", inilmpVO.Description);
            cmd.Parameters.AddWithValue("@Active", inilmpVO.Active);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    ilmpId = int.Parse(reader[0].ToString());
                }
                reader.Close();
                if (ilmpId > 0)
                {
                    if (null != inilmpVO.IlmpCourses && inilmpVO.IlmpCourses.Count > 0)
                    {
                        foreach (ILMPCourseVO coursesVO in inilmpVO.IlmpCourses)
                        {
                            String     query = "INSERT INTO dbo.IlmpCourse (IlmpId,CourseCode,Semester,Year,CourseType) VALUES(@IlmpId,@CourseCode,@Semester,@Year,@CourseType)";
                            SqlCommand cmd1  = new SqlCommand(query, DBConnection.conn);
                            cmd1.Parameters.AddWithValue("@IlmpId", ilmpId);
                            cmd1.Parameters.AddWithValue("@CourseCode", coursesVO.CourseCode);
                            cmd1.Parameters.AddWithValue("@Semester", coursesVO.Semester);
                            cmd1.Parameters.AddWithValue("@Year", coursesVO.Year);
                            cmd1.Parameters.AddWithValue("@CourseType", coursesVO.CourseType);
                            int result = cmd1.ExecuteNonQuery();
                            if (result <= 0)
                            {
                                status = "ILMPCourse creation failed";
                                break;
                            }
                            else
                            {
                                status = "ILMP added successfully";
                            }
                        }
                        if (inilmpVO.Active == "Yes")
                        {
                            string     query2 = "UPDATE dbo.Ilmp SET Active='Yes' WHERE StudentId=@StudentId AND IlmpID=@IlmpID";
                            SqlCommand cmd2   = new SqlCommand(query2, DBConnection.conn);
                            cmd2.Parameters.AddWithValue("@StudentId", inilmpVO.StudentId);
                            cmd2.Parameters.AddWithValue("@IlmpID", ilmpId);
                            int result = cmd2.ExecuteNonQuery();
                            if (result > 0)
                            {
                                string     query3 = "UPDATE dbo.Ilmp SET Active='No' WHERE StudentId=@StudentId AND IlmpID!=@IlmpID";
                                SqlCommand cmd3   = new SqlCommand(query3, DBConnection.conn);
                                cmd3.Parameters.AddWithValue("@StudentId", inilmpVO.StudentId);
                                cmd3.Parameters.AddWithValue("@IlmpID", ilmpId);
                                int result1 = cmd3.ExecuteNonQuery();
                                if (result1 > 0)
                                {
                                    status = "ILMP added successfully";
                                }
                                else
                                {
                                    status = "Error in Ilmp addition";
                                }
                            }
                        }
                    }
                    else
                    {
                        status = "No courses found in the ILMP";
                    }
                }
                else
                {
                    status = "Error in Ilmp addition";
                }
            }
            else
            {
                status = "Error in ILMP addition";
            }
        }
        catch (SqlException ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw ex;
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(status);
    }
Esempio n. 14
0
    public string AddILMPTemplate(ILMPVO inIlmpVO)
    {
        string status = "";//ilmpTemplateObj.AddILMPTemplate(inIlmpVO);

        return(status);
    }
Esempio n. 15
0
    private void SetInitialRowInGrids()
    {
        ILMPVO ilmpVO = new ILMPVO();

        ilmpVO = ilmpBO.GetILMPCoursesWorkshopForId(ilmpId);
        populateILMPDetails(ilmpVO);
        StudentMajorBO studentMajorBO = new StudentMajorBO();

        studentMajorVO = studentMajorBO.GetStudentMajor(ilmpVO.StudentId);
        //  ILMPTemplateVO ilmpTemplateVO = ilmpTemplateBO.GetTemplateForId(ilmpVO.TemplateId);
        if (ilmpVO.IlmpCourses.Count > 0)
        {
            DataTable dt = new DataTable();
            DataRow   dr = null;
            //Define the Columns
            dt.Columns.Add(new DataColumn("Column1", typeof(string)));
            dt.Columns.Add(new DataColumn("Column2", typeof(string)));
            dt.Columns.Add(new DataColumn("Column3", typeof(string)));
            dt.Columns.Add(new DataColumn("Column4", typeof(string)));
            dt.Columns.Add(new DataColumn("Column5", typeof(string)));
            dt.Columns.Add(new DataColumn("Column6", typeof(string)));
            dt.Columns.Add(new DataColumn("Column7", typeof(string)));
            dt.Columns.Add(new DataColumn("Column8", typeof(string)));
            dt.Columns.Add(new DataColumn("Column9", typeof(string)));
            //Add a Dummy Data on Initial Load
            dr = dt.NewRow();
            dt.Rows.Add(dr);
            //Store the DataTable in ViewState
            ViewState["CurrentTable"] = dt;
            //Bind the DataTable to the Grid
            gvIlmpCourse.DataSource = dt;
            gvIlmpCourse.DataBind();
            gvIlmpCourse.Rows[0].Cells[0].Width = 40;

            // AddNewRowToGrid();

            DataTable dt1 = new DataTable();
            DataRow   dr1 = null;
            dt1.Columns.Add(new DataColumn("Column1", typeof(string)));
            //Add a Dummy Data on Initial Load
            dr1 = dt1.NewRow();
            dt1.Rows.Add(dr1);
            //Store the DataTable in ViewState
            ViewState["CurrentTableWorkshop"] = dt1;
            //Bind the DataTable to the Grid
            gvWorkshop.DataSource = dt1;
            gvWorkshop.DataBind();

            foreach (ILMPCourseVO ilmpCourseVO in ilmpVO.IlmpCourses)
            {
                AddNewRowToCourseGrid(ilmpCourseVO);
            }
            List <WorkshopVO> workshops = ilmpBO.GetILMPWorkshopForId(ilmpId);
            foreach (WorkshopVO workshopVO in workshops)
            {
                AddNewRowToWorkshopGrid(workshopVO.WorkshopId);
            }

            /* foreach (TemplateCourseVO templateCourseVO in ilmpTemplateVO.TemplateCourses)
             * {
             *   if (templateCourseVO.WorkshopId == 0 && templateCourseVO.CourseCode != "")
             *   {
             *       AddNewRowToCourseGrid(templateCourseVO);
             *   }
             *   else
             *   {
             *       AddNewRowToWorkshopGrid(templateCourseVO.WorkshopId);
             *   }
             * }*/
            if ((gvIlmpCourse.Rows[gvIlmpCourse.Rows.Count - 1].Cells[0].FindControl("lblCourseCode") as Label).Text == "")
            {
                gvIlmpCourse.Rows[gvIlmpCourse.Rows.Count - 1].Visible = false;
            }
            if ((gvWorkshop.Rows[gvWorkshop.Rows.Count - 1].Cells[0].FindControl("lblWorkshop") as Label).Text == "")
            {
                gvWorkshop.Rows[gvWorkshop.Rows.Count - 1].Visible = false;
            }
        }
        List <ILMPCourseGridVO> ilmpCourses = ilmpBO.GetILMPCoursesForId(ilmpId);

        for (int i = 0; i < gvIlmpCourse.Rows.Count - 1; i++)
        {
            ((DropDownList)gvIlmpCourse.Rows[i].Cells[2].FindControl("ddSemester")).Text   = ilmpCourses[i].Semester.ToString();
            ((DropDownList)gvIlmpCourse.Rows[i].Cells[3].FindControl("ddYear")).Text       = ilmpCourses[i].Year.ToString();
            ((DropDownList)gvIlmpCourse.Rows[i].Cells[1].FindControl("ddCourseType")).Text = ilmpCourses[i].CourseType.ToString();
            ((DropDownList)gvIlmpCourse.Rows[i].Cells[1].FindControl("ddResult")).Text     = ilmpCourses[i].Result.ToString();
        }
    }
Esempio n. 16
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ILMPVO ilmpVO = new ILMPVO();

        try
        {
            ilmpVO.Name = txtName.Text;
            if (txtStudentId.Text.Trim() != "")
            {
                try
                {
                    ilmpVO.StudentId = Int32.Parse(txtStudentId.Text);
                }
                catch (ParseException)
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert(' StudentId is not valid ');", true);
                    // Response.Write("<script>alert('StudentId is not valid');</script>");
                    return;
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert(' Please enter student id');", true);
                // Response.Write("<script>alert('Please enter student id');</script>");
                return;
            }
            ilmpVO.Active      = ddActive.SelectedItem.Text;
            ilmpVO.Description = txtDescription.Text;
            List <ILMPCourseVO> templateCourses = new List <ILMPCourseVO>();
            if (ViewState["CurrentTable"] != null)
            {
                DataTable dt = (DataTable)ViewState["CurrentTable"];

                // storing the grid values in KeyValue Pair because every semester will have multiple entries, it should be consolidated to store in database
                if (dt.Rows.Count > 0)
                {
                    ILMPCourseVO ilmpCourseVO = new ILMPCourseVO();
                    for (int i = 0; i < dt.Rows.Count - 1; i++)
                    {
                        ilmpCourseVO = new ILMPCourseVO();
                        Label        courseCode = (Label)gvIlmp.Rows[i].Cells[0].FindControl("lblCourseCode");
                        DropDownList ddl1       = (DropDownList)gvIlmp.Rows[i].Cells[1].FindControl("ddCourseType");
                        DropDownList ddl2       = (DropDownList)gvIlmp.Rows[i].Cells[2].FindControl("ddSemester");
                        DropDownList ddl3       = (DropDownList)gvIlmp.Rows[i].Cells[3].FindControl("ddYear");
                        string       courseType = ddl1.SelectedItem.Text;
                        int          semester   = Int32.Parse(ddl2.SelectedItem.Text);
                        int          year       = 0;
                        if (ddl3.SelectedItem.Text != null && ddl3.SelectedItem.Text != "Select")
                        {
                            year = Int32.Parse(ddl3.SelectedItem.Text);
                        }
                        ilmpCourseVO.CourseCode = courseCode.Text;
                        ilmpCourseVO.Semester   = semester;
                        ilmpCourseVO.Year       = year;
                        ilmpCourseVO.CourseType = courseType;
                        templateCourses.Add(ilmpCourseVO);
                    }
                    ilmpVO.IlmpCourses = templateCourses;
                    ilmpVO.TemplateId  = int.Parse(hfTemplateId.Value);
                    ILMPBO ilmpBO = new ILMPBO();
                    string status = ilmpBO.AddILMP(ilmpVO);
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + status + "');", true);
                    //Response.Write("<script>alert('" + status + "');</script>");

                    /* if (status.Contains("success"))
                     * {
                     * //  btnSave.Enabled = false;
                     * }
                     * else
                     * {
                     *   btnSave.Enabled = true;
                     * }*/
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('There are no courses added in ILMP');", true);
                    // Response.Write("<script>alert('There are no courses added in ILMP');</script>");
                }
            }
        }
        catch (CustomException ex)
        {
            ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('" + ex.Message + "');", true);
        }
    }