Example #1
0
    //Get list of workshop for the given programme and major
    public List <WorkshopVO> GetAllWorkshopForPgmMajor(string inprogrammeId, string inmajorId)
    {
        List <WorkshopVO> workshops = new List <WorkshopVO>();

        try
        {
            DBConnection.conn.Open();
            String query = "SELECT w.WorkshopId, w.WorkshopName FROM dbo.Workshop W JOIN dbo.ProgrammeWorkshop pw" +
                           " ON pw.WorkshopID = w.WorkshopId WHERE pw.ProgrammeID=@ProgrammeId AND pw.MajorID=@MajorId";

            SqlCommand cmd = new SqlCommand(query, DBConnection.conn);
            cmd.Parameters.AddWithValue("@ProgrammeId", inprogrammeId);
            cmd.Parameters.AddWithValue("@MajorId", inmajorId);
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                WorkshopVO workshopVO;
                while (reader.Read())
                {
                    workshopVO              = new WorkshopVO();
                    workshopVO.WorkshopId   = Int32.Parse(reader[0].ToString());
                    workshopVO.WorkshopName = reader[1].ToString();
                    workshops.Add(workshopVO);
                }
            }
        }
        catch (SqlException e)
        {
            ExceptionUtility.LogException(e, "Error Page");
            throw new CustomException(ApplicationConstants.UnhandledException + ": " + e.Message);
        }
        catch (Exception e)
        {
            ExceptionUtility.LogException(e, "Error Page");
            throw new CustomException(ApplicationConstants.UnhandledException + ": " + e.Message);
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(workshops);
    }
Example #2
0
    private void AddNewRowToWorkshopGrid(int workshopId)
    {
        if (ViewState["CurrentTableWorkshop"] != null)
        {
            DataTable dtCurrentTable = (DataTable)ViewState["CurrentTableWorkshop"];
            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["CurrentTableWorkshop"] = dtCurrentTable;
                for (int i = 0; i < dtCurrentTable.Rows.Count - 1; i++)
                {
                    // Update the DataRow with the Selected Items
                    if (i != dtCurrentTable.Rows.Count - 2)
                    {
                    }
                    else
                    {
                        WorkshopBO workshopBO = new WorkshopBO();
                        WorkshopVO workshopVO = workshopBO.GetWorkshopForId(workshopId);
                        dtCurrentTable.Rows[i]["Column1"] = workshopVO.WorkshopName;
                    }
                }

                //Rebind the Grid with the current data
                gvWorkshop.DataSource = dtCurrentTable;
                gvWorkshop.DataBind();
            }
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('ViewState is null ');", true);
            Response.Write("ViewState is null");
        }

        //Set Previous Data on Postbacks
        SetPreviousDataInWorkShopGrid();
    }
Example #3
0
    public List <WorkshopVO> GetILMPWorkshopForId(int ilmpId)
    {
        List <WorkshopVO> workshopNames = new List <WorkshopVO>();

        try
        {
            DBConnection.conn.Open();
            string query = "SELECT w.Workshopid,w.Workshopname from dbo.Ilmp i "
                           + " inner join dbo.TemplateCourse tc on tc.TemplateID = i.TemplateId "
                           + " inner join dbo.Workshop w on w.WorkshopID = tc.WorkshopID "
                           + " where tc.WorkshopID!=0 and i.IlmpID=@IlmpID";
            SqlCommand cmd = new SqlCommand(query, DBConnection.conn);
            cmd.Parameters.AddWithValue("@IlmpID", ilmpId);
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                WorkshopVO workshop;
                while (reader.Read())
                {
                    workshop              = new WorkshopVO();
                    workshop.WorkshopId   = int.Parse(reader["Workshopid"].ToString());
                    workshop.WorkshopName = (reader["Workshopname"].ToString());
                    workshopNames.Add(workshop);
                }
            }
        }
        catch (SqlException ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw ex;
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(workshopNames);
    }
Example #4
0
    //Get workshop details for the given workshopid
    public WorkshopVO GetWorkshopForId(int inworkshopId)
    {
        WorkshopVO workshopVO = new WorkshopVO();

        try
        {
            DBConnection.conn.Open();
            string     query = "SELECT WorkshopID,WorkshopName FROM dbo.Workshop WHERE WorkshopID=@WorkshopId";
            SqlCommand cmd   = new SqlCommand(query, DBConnection.conn);
            cmd.Parameters.AddWithValue("@WorkshopId", inworkshopId);
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    workshopVO.WorkshopId   = Int32.Parse(reader["WorkshopID"].ToString());
                    workshopVO.WorkshopName = reader["WorkshopName"].ToString();
                }
                reader.Close();
            }
        }
        catch (SqlException ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw new CustomException(ApplicationConstants.UnhandledException + ": " + ex.Message);
        }
        catch (Exception ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw new CustomException(ApplicationConstants.UnhandledException + ": " + ex.Message);
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(workshopVO);
    }