Exemplo n.º 1
0
    protected void btnSEARCH_Click(object sender, EventArgs e)
    {
        TQF.Course course = new TQF.Course().getCourse(txtCOURSECODE.Text);

        txtCOURSTHENAME.Text = course.CourseThName;
        txtCOURSENENAME.Text = course.CourseEnName;
        txtCREDIT.Text       = course.Credit;
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            code  = Request.QueryString["token"];
            facId = Request.QueryString["facId"];
            lblElectiveCourseTitle.Text = new CourseElective().getCourseElective(code).CourseElectiveThName + " (" + new CourseElective().getCourseElective(code).CourseElectiveEnName + ")";

            // Head Table
            string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "วิชาของคณะ" };
            tblElective.Attributes.Add("class", "table table-bordered table-striped table-hover");
            tblElective.Attributes.Add("id", "dt_basic");
            TableHeaderRow tRowHead = new TableHeaderRow();
            tRowHead.TableSection = TableRowSection.TableHeader;
            for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
            {
                // Create a new cell and add it to the row.
                TableHeaderCell cellHead = new TableHeaderCell();
                cellHead.Text = ar[cellCtr - 1];
                tRowHead.Cells.Add(cellHead);
            }
            tblElective.Rows.Add(tRowHead);

            string sql = "Select * From COURSEELECTIVEMEMBER Where COURSEELECTIVECODE='" + code + "' And FACULTYCODE='" + facId + "'";
            List <CourseElectiveMember> courseElectiveMember = new List <CourseElectiveMember>();
            courseElectiveMember = new CourseElectiveMember().getCourseElectiveMemberManual(sql);


            foreach (CourseElectiveMember data in courseElectiveMember)
            {
                TableRow tRowBody = new TableRow();
                tRowBody.TableSection = TableRowSection.TableBody;

                TableCell cellCourseCode = new TableCell();
                cellCourseCode.Text     = data.CourseCode; //data.CourseElectiveCode;
                cellCourseCode.CssClass = "text-center";
                cellCourseCode.Width    = 100;
                tRowBody.Cells.Add(cellCourseCode);

                TQF.Course course           = new TQF.Course().getCourse(data.CourseCode);
                TableCell  cellCourseEnName = new TableCell();
                cellCourseEnName.Text = course.CourseThName + "<br>" + course.CourseEnName;
                tRowBody.Cells.Add(cellCourseEnName);

                TableCell cellCredit = new TableCell();
                cellCredit.Text  = course.Credit;
                cellCredit.Width = 80;
                tRowBody.Cells.Add(cellCredit);

                TableCell cellFacultyCode = new TableCell();
                cellFacultyCode.Text  = new Faculty().getFaculty(data.FacultyOwner).Faculty_Thai;
                cellFacultyCode.Width = 200;
                tRowBody.Cells.Add(cellFacultyCode);

                tblElective.Rows.Add(tRowBody);
            }
        }
    }
Exemplo n.º 3
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        TQF.Course data = new TQF.Course();

        data.LevelCode         = ddlDegree.SelectedValue;
        data.FacultyCode       = ddlCURR_FACULTY.SelectedValue;
        data.CourseCode        = txtCOURSE_CODE.Text;
        data.CourseEnShortName = txtSHORT_COURSENAME.Text;
        data.CourseThName      = txtCOURSE_THAINAME.Text;
        data.CourseEnName      = txtCOURSE_ENGNAME.Text;
        data.CourseFlagCode    = ddlCOURSE_Flag.SelectedValue;
        data.CourseTypeCode    = ddlCOURSE_TYPE.SelectedValue;
        data.SuFlage           = ddlSU_Flag.SelectedValue;
        data.Credit            = txtCOURSE_CREDIT.Text;
        data.TheoryHour        = txtTHEORY.Text;
        data.PracticeHour      = txtPRACTICE.Text;
        data.SelfStudyHour     = txtSELF_STUDY.Text;
        data.ServiceStatus     = ddl_SERVICESTATUS.SelectedValue;
        data.CourseThDesc      = txtCOURSE_DESC_TH.Text;
        data.CourseEnDesc      = txtCOURSE_DESC_EN.Text;
        data.MinCredits        = MIN_CREDITS.Text;
        data.DateApprove       = txtdate.Text;
        if (rBtnOpen.Checked == true)
        {
            data.CourseStatus = "Y";
        }
        if (rBtnClose.Checked == true)
        {
            data.CourseStatus = "N";
        }
        data.Comments = COURSE_COMMENT.Text;

        string            sql    = "Select * From COURSE Where COURSECODE='" + data.CourseCode + "'";
        List <TQF.Course> chkDup = new TQF.Course().getCourseManual(sql);

        if (chkDup.Count > 0)
        {
            //lblError.Visible = true;
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('รหัสวิชาซ้ำ!');", true);
        }
        else
        {
            string insertCourse = new TQF.Course().insertCourse(data);
            if (insertCourse == "Success")
            {
                Response.Redirect("listCOURSE.aspx");
            }
            else
            {
                Session["response"] = "ข้อมูลผิดพลาด ไม่สามารถทำงานได้ในขณะนี้";
                Response.Redirect("../err_response.aspx");
            }
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.QueryString["CurrCode"] != "" && Request.QueryString["YearVersion"] != "")
            {
                code        = Request.QueryString["token"];
                CurrCode    = Request.QueryString["CurrCode"];
                YearVersion = Request.QueryString["YearVersion"];
            }
            else
            {
                code        = Request.QueryString["token"];
                CurrCode    = "";
                YearVersion = "";
            }

            TQF.Course course = new TQF.Course().getCourse(code);

            lblCourseName.Text = course.CourseThName + " (" + course.CourseEnName + ")";

            lblLevelCode.Text         = new Levels().getLevels(course.LevelCode).LevelName;
            lblCourseCode.Text        = course.CourseCode;
            lblCourseEnShortName.Text = course.CourseEnShortName;
            lblCourseFlagCode.Text    = new CourseFlag().getCourseFlag(course.CourseFlagCode).CourseFlagName;
            lblCourseTypeCode.Text    = new TQF.CourseType().getCourseType(course.CourseTypeCode).CourseTypeThaiName;
            lblSuFlage.Text           = new SuFlage().getSuFlage(course.SuFlage).SuFlageName;
            lblCourseThDesc.Text      = course.CourseThDesc;
            lblCourseEnDesc.Text      = course.CourseEnDesc;
            lblServiceStatus.Text     = new ServiceStatus().getServiceStatus(course.ServiceStatus).ServiceStatusName;
            lblMinCredits.Text        = course.MinCredits;
            lblDateApprove.Text       = course.DateApprove;

            string sqlPreRequisite           = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And COURSECODE='" + course.CourseCode + "'";
            List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sqlPreRequisite);
            if (preRequisite.Count > 0)
            {
                foreach (PreRequisite data in preRequisite)
                {
                    lblPrequisite.Text += data.PreRequisiteCourseCode + "   " + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseThName + " (" + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseEnName + ")<br>";
                }
            }
            else
            {
                lblPrequisite.Text = "ไม่มี";
            }

            lblComments.Text = course.Comments;
        }
    }
Exemplo n.º 5
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string deleteCourse = new TQF.Course().deleteCourse(code);

        if (deleteCourse == "Success")
        {
            Response.Redirect("listCOURSE.aspx");
        }
        else
        {
            Session["response"] = "ข้อมูลผิดพลาด ไม่สามารถทำงานได้ในขณะนี้";
            Response.Redirect("../err_response.aspx");
        }
    }
Exemplo n.º 6
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        TQF.Course data = new TQF.Course();

        data.LevelCode         = ddlDegree.SelectedValue;
        data.FacultyCode       = ddlCURR_FACULTY.SelectedValue;
        data.CourseCode        = code;
        data.CourseEnShortName = txtSHORT_COURSENAME.Text;
        data.CourseThName      = txtCOURSE_THAINAME.Text;
        data.CourseEnName      = txtCOURSE_ENGNAME.Text;
        data.CourseFlagCode    = ddlCOURSE_Flag.SelectedValue;
        data.CourseTypeCode    = ddlCOURSE_TYPE.SelectedValue;
        data.SuFlage           = ddlSU_Flag.SelectedValue;
        data.Credit            = txtCOURSE_CREDIT.Text;
        data.TheoryHour        = txtTHEORY.Text;
        data.PracticeHour      = txtPRACTICE.Text;
        data.SelfStudyHour     = txtSELF_STUDY.Text;
        data.ServiceStatus     = ddl_SERVICESTATUS.SelectedValue;
        data.CourseThDesc      = txtCOURSE_DESC_TH.Text;
        data.CourseEnDesc      = txtCOURSE_DESC_EN.Text;
        data.MinCredits        = MIN_CREDITS.Text;
        data.DateApprove       = txtdate.Text;
        if (rBtnOpen.Checked == true)
        {
            data.CourseStatus = "Y";
        }
        if (rBtnClose.Checked == true)
        {
            data.CourseStatus = "N";
        }
        data.Comments = COURSE_COMMENT.Text;

        string updateCourse = new TQF.Course().updateCourse(data);

        if (updateCourse == "Success")
        {
            Response.Redirect("listCOURSE.aspx");
        }
        else
        {
            Session["response"] = "ข้อมูลผิดพลาด ไม่สามารถทำงานได้ในขณะนี้";
            Response.Redirect("../err_response.aspx");
        }
    }
Exemplo n.º 7
0
    //private TableRow tRowSave;

    protected void Page_Load(object sender, EventArgs e)
    {
        CurrCode       = Request.QueryString["CurrCode"];
        DomainTypeCode = Request.QueryString["DomainTypeCode"];
        CourseCode     = Request.QueryString["CourseCode"];
        YearVersion    = Request.QueryString["YearVersion"];

        TQF.Course course = new TQF.Course().getCourse(CourseCode);
        lblCourseCode.Text   = course.CourseCode;
        lblCourseThName.Text = course.CourseThName;
        lblCourseEnName.Text = course.CourseEnName;

        CourseElective courseElective = new CourseElective().getCourseElective(CourseCode);

        lblCourseCode.Text   += courseElective.CourseElectiveCode;
        lblCourseThName.Text += courseElective.CourseElectiveThName;
        lblCourseEnName.Text += courseElective.CourseElectiveEnName;

        tableBody(tblDomain, CurrCode, DomainTypeCode);
    }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrCode       = Request.QueryString["CurrCode"];
        YearVersion    = Request.QueryString["YearVersion"];
        CurrFormatCode = Request.QueryString["CurrFormatCode"];
        CurrTypeCode   = Request.QueryString["CurrTypeCode"];
        MajorCode      = Request.QueryString["MajorCode"];
        Year           = Request.QueryString["Year"];
        Semester       = Request.QueryString["Semester"];


        if (!Page.IsPostBack)
        {
            lblHead.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + ": " + new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")";

            ddlEDUCATIONYEAR.Items.FindByValue(Year).Selected         = true;
            ddlEDUCATIONSEMESTER.Items.FindByValue(Semester).Selected = true;
        }

        // Head Table
        string[] ar = { "เลือก", "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต" };
        tblCourse.Attributes.Add("class", "table table-bordered table-striped table-hover");
        tblCourse.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            // Create a new cell and add it to the row.
            TableHeaderCell cellHead = new TableHeaderCell();
            cellHead.Text = ar[cellCtr - 1];
            tRowHead.Cells.Add(cellHead);

            switch (cellCtr)
            {
            case 1:
                cellHead.Width = 50;
                break;

            case 2:
                cellHead.Width = 80;
                break;

            case 3:
                break;

            case 4:
                cellHead.Width = 80;
                break;

            case 5:
                cellHead.Width = 80;
                break;
            }
        }
        tblCourse.Rows.Add(tRowHead);

        //string sql = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' Order By COURSECODE";
        //List<TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql);

        //List<TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetail(CurrCode, YearVersion);

        string sql1 = "Select Distinct COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And MAJORCODE='" + MajorCode + "' Order By COURSECODE";
        List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetailManual(sql1);
        int i = 0;

        foreach (TQF2Sec3PlanDetail data in tqf2Sec3PlanDetail)
        {
            i++;

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            //Cell [0]
            TableCell cellCheck = new TableCell();
            CheckBox  chk       = new CheckBox();
            chk.ID = data.CourseCode + i.ToString();
            cellCheck.Controls.Add(chk);
            cellCheck.CssClass = "text-center";
            cellCheck.Width    = 50;
            tRowBody.Cells.Add(cellCheck);

            //Cell [1]
            TableCell cellCourseCode = new TableCell();
            cellCourseCode.Text     = data.CourseCode;
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            //Cell [2]
            TQF.Course     course           = new TQF.Course().getCourse(data.CourseCode);
            CourseElective courseElective   = new CourseElective().getCourseElective(data.CourseCode);
            TableCell      cellCourseEnName = new TableCell();
            //cellCourseEnName.Text = course.CourseThName + "<br>" + course.CourseEnName;
            cellCourseEnName.Text  = course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
            cellCourseEnName.Text += course.CourseEnName + courseElective.CourseElectiveEnName;
            tRowBody.Cells.Add(cellCourseEnName);

            //Cell [3]
            TableCell cellCredit = new TableCell();
            cellCredit.Text = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
            tRowBody.Cells.Add(cellCredit);

            //Cell [4]
            //เลือกค่า Id ของตาราง Elective course ไปเก็บ ไม่แสดงผลออกทางหน้าจอ
            TableCell cellId = new TableCell();
            cellId.Visible = false;
            cellId.Text    = "null";
            tRowBody.Cells.Add(cellId);

            tblCourse.Rows.Add(tRowBody);
        }

        TQF.Curriculum curriculum = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);

        //แสดงวิชาเลือก -> วิชา xxx
        List <CourseElective> electiveCourse = new List <CourseElective>();
        string sql2 = "Select * From COURSEELECTIVE Order By COURSEELECTIVECODE";

        electiveCourse = new CourseElective().getCourseElectiveManual(sql2);

        int k = 0;

        foreach (CourseElective data in electiveCourse)
        {
            k++;
            string sql3 = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And COURSECODE='" + data.CourseElectiveCode + "'";
            List <TQF2Sec3PlanDetail> chkDupTqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql3);

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            if (chkDupTqf2Sec3PlanDetail.Count > 0)
            {
                continue;
            }
            else
            {
                //Cell [0]
                TableCell cellCheck = new TableCell();
                CheckBox  chk       = new CheckBox();
                chk.ID = data.CourseElectiveCode + k.ToString();
                cellCheck.Controls.Add(chk);
                cellCheck.CssClass = "text-center";
                cellCheck.Width    = 50;
                tRowBody.Cells.Add(cellCheck);

                //Cell [1]
                TableCell cellCourseCode = new TableCell();
                cellCourseCode.Text     = data.CourseElectiveCode;
                cellCourseCode.CssClass = "text-center";
                cellCourseCode.Width    = 80;
                tRowBody.Cells.Add(cellCourseCode);

                //Cell [2]
                TableCell cellCourseEnName = new TableCell();
                cellCourseEnName.Text  = data.CourseElectiveThName + "<BR>";
                cellCourseEnName.Text += data.CourseElectiveEnName;
                tRowBody.Cells.Add(cellCourseEnName);

                //Cell [3]
                TableCell cellCredit = new TableCell();
                cellCredit.Text = data.Credit + " (" + "-" + "-" + ")";
                tRowBody.Cells.Add(cellCredit);

                //Cell [4]
                //เลือกค่า Id ของตาราง Elective course ไปเก็บ ไม่แสดงผลออกทางหน้าจอ
                TableCell cellId = new TableCell();
                cellId.Visible = false;
                cellId.Text    = data.Id;
                tRowBody.Cells.Add(cellId);

                tblCourse.Rows.Add(tRowBody);
            }
        }
    }
Exemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        T2S3No          = Request.QueryString["T2S3No"];
        CurrCode        = Request.QueryString["CurrCode"];
        YearVersion     = Request.QueryString["YearVersion"];
        CurrFormatCode  = Request.QueryString["CurrFormatCode"];
        CurrTypeCode    = Request.QueryString["CurrTypeCode"];
        MajorCode       = Request.QueryString["MajorCode"];
        CourseGroupCode = Request.QueryString["CourseGroupCode"];
        CategoryCode    = Request.QueryString["CategoryCode"];
        CourseTypeCode  = Request.QueryString["CourseTypeCode"];

        TQF.Curriculum currTitle = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);
        lblHeader1.Text = currTitle.CurrCode + " หลักสูตร" + currTitle.CurrThName;
        lblHeader2.Text = currTitle.CurrEnName;

        string currStatus;

        if (currTitle.CurrStatus == "1")
        {
            currStatus      = "หลักสูตรใหม่";
            lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
        }
        if (currTitle.CurrStatus == "2")
        {
            currStatus      = "หลักปรับปรุง";
            lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
        }

        lblBody1.Text = new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (" + new TQF.Major().getMajor(MajorCode).MajorThName + ")";
        lblBody2.Text = new Category().getCategory(CategoryCode).CategoryThName;
        lblBody3.Text = new CourseGroup().getCourseGroup(CourseGroupCode).CourseGroupThName;
        lblBody4.Text = new CourseSubjectType().getCourseSubjectType(CourseTypeCode).CourseTypeThaiName;


        if (!Page.IsPostBack)
        {
            List <FacultyData> faculty = new Faculty().getAllFaculty();
            ddlCURR_FACULTY.Items.Clear();
            ddlCURR_FACULTY.Items.Insert(0, new ListItem("-- เลือกรายวิชาคณะ --", "00"));
            foreach (FacultyData row in faculty)
            {
                ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(row.Faculty_Thai, row.Faculty_Code));
            }
        }

        // Head Table
        string[] ar = { "เลือก", "รหัสวิชา", "ชื่อวิชา", "หน่วย" };
        tblCourse.Attributes.Add("class", "table table-striped table-bordered table-hover");
        tblCourse.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            TableHeaderCell cellHead = new TableHeaderCell();

            if (cellCtr == 1)
            {
                cellHead.Width = 80;
            }
            if (cellCtr == 2 || cellCtr == 4)
            {
                cellHead.Width = 150;
            }

            cellHead.Text = ar[cellCtr - 1];
            tRowHead.Cells.Add(cellHead);
        }
        tblCourse.Rows.Add(tRowHead);

        string sql = "";

        if (currTitle.FacultyCode == ddlCURR_FACULTY.SelectedValue)
        {
            sql = "Select * From COURSE Where FACULTYCODE='" + ddlCURR_FACULTY.SelectedValue + "' And COURSESTATUS='Y'";
        }
        else
        {
            sql = "Select * From COURSE Where FACULTYCODE='" + ddlCURR_FACULTY.SelectedValue + "' And SERVICESTATUS='A' And COURSESTATUS='Y'";
        }

        List <TQF.Course> course = new TQF.Course().getCourseManual(sql);
        int i = 0;

        foreach (TQF.Course data in course)
        {
            i++;
            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            //Cell [0]
            TableCell cellCheck = new TableCell();
            CheckBox  chk       = new CheckBox();
            chk.ID = i + data.CourseCode;
            cellCheck.Controls.Add(chk);
            cellCheck.CssClass = "text-center";
            cellCheck.Width    = 50;
            tRowBody.Cells.Add(cellCheck);

            //Cell [1]
            TableCell cellCourseCode = new TableCell();
            string    urlShow        = "showCOURSE.aspx?token=" + data.CourseCode;
            HyperLink hypShow        = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            hypShow.Text        = data.CourseCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            //Cell [2]
            TableCell cellCourseThName = new TableCell();
            cellCourseThName.Text = data.CourseThName + "<BR>" + data.CourseEnName;
            tRowBody.Cells.Add(cellCourseThName);

            //Cell [3]
            TableCell cellNumCredit = new TableCell();
            cellNumCredit.Text  = data.Credit + "(" + data.TheoryHour + "-" + data.PracticeHour + "-" + data.SelfStudyHour + ")";
            cellNumCredit.Width = 100;
            tRowBody.Cells.Add(cellNumCredit);

            //Cell [4]
            //ไม่แสดงผลออกทางหน้าจอ แต่ นำค่าไปใช้เก็บลงฐานข้อมูล
            TableCell cellCourseCodeHide = new TableCell();
            cellCourseCodeHide.Text    = data.CourseCode;
            cellCourseCodeHide.Visible = false;
            tRowBody.Cells.Add(cellCourseCodeHide);

            tblCourse.Rows.Add(tRowBody);
        }

        //แสดงวิชาเลือก -> วิชา xxx
        List <CourseElective> electiveCourse = new List <CourseElective>();
        string sql2 = "Select * From COURSEELECTIVE Where FACULTYCODE='" + ddlCURR_FACULTY.SelectedValue + "'";

        electiveCourse = new CourseElective().getCourseElectiveManual(sql2);
        int j = 0;

        foreach (CourseElective data in electiveCourse)
        {
            j++;

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            //Cell [0]
            TableCell cellCheck = new TableCell();
            CheckBox  chk       = new CheckBox();
            chk.ID = j + data.CourseElectiveCode;
            cellCheck.Controls.Add(chk);
            cellCheck.CssClass = "text-center";
            cellCheck.Width    = 50;
            tRowBody.Cells.Add(cellCheck);

            //Cell [1]
            TableCell cellCourseCode = new TableCell();
            string    urlShow        = "showCOURSE.aspx?token=" + data.CourseElectiveCode;
            HyperLink hypShow        = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            hypShow.Text        = data.CourseElectiveCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            //Cell [2]
            TableCell cellCourseThName = new TableCell();
            cellCourseThName.Text = data.CourseElectiveThName + "<BR>" + data.CourseElectiveEnName;
            tRowBody.Cells.Add(cellCourseThName);

            //Cell [3]
            TableCell cellNumCredit = new TableCell();
            cellNumCredit.Text  = data.Credit + " (x-x-x)";
            cellNumCredit.Width = 100;
            tRowBody.Cells.Add(cellNumCredit);

            //Cell [4]
            //ไม่แสดงผลออกทางหน้าจอ แต่ นำค่าไปใช้เก็บลงฐานข้อมูล
            TableCell cellCourseCodeHide = new TableCell();
            cellCourseCodeHide.Text    = data.Id;
            cellCourseCodeHide.Visible = false;
            tRowBody.Cells.Add(cellCourseCodeHide);

            tblCourse.Rows.Add(tRowBody);
        }
    }
Exemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.curriculum) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                // ======== Process ===========
                bool editable = false;
                code = Request.QueryString["token"];
                TQF.Course course = new TQF.Course().getCourse(code);

                //หลักสูตร
                if (autro_obj.CheckGroupUser(login_data, group_var.curriculum))
                {
                    editable = true;
                }
                // วิชาการคณะ
                else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                {
                    List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                    foreach (string fac in faculty_authorized)
                    {
                        if (fac == course.FacultyCode)
                        {
                            editable = true;
                            break;
                        }
                    }
                }
                // วิชาการภาค
                else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                {
                    List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                    foreach (string dep in department_authorized)
                    {
                        if (dep.Substring(0, 2) == course.FacultyCode)
                        {
                            editable = true;
                            break;
                        }
                    }
                }

                if (editable == true)
                {
                    if (!Page.IsPostBack)
                    {
                        rBtnOpen.Checked = true;

                        List <TQF.Levels> levels = new TQF.Levels().getLevels();
                        foreach (TQF.Levels row in levels)
                        {
                            ddlDegree.Items.Insert(ddlDegree.Items.Count, new ListItem(row.LevelName, row.LevelCode));
                        }
                        ddlDegree.Items.FindByValue(course.LevelCode).Selected = true;

                        List <CourseFlag> courseFlag = new CourseFlag().getCourseFlag();
                        foreach (CourseFlag row in courseFlag)
                        {
                            ddlCOURSE_Flag.Items.Insert(ddlCOURSE_Flag.Items.Count, new ListItem(row.CourseFlagName, row.CourseFlagCode));
                        }
                        ddlCOURSE_Flag.Items.FindByValue(course.CourseFlagCode).Selected = true;

                        List <TQF.CourseType> courseType = new TQF.CourseType().getCourseType();
                        foreach (TQF.CourseType row in courseType)
                        {
                            ddlCOURSE_TYPE.Items.Insert(ddlCOURSE_TYPE.Items.Count, new ListItem(row.CourseTypeThaiName, row.CourseTypeCode));
                        }
                        ddlCOURSE_TYPE.Items.FindByValue(course.CourseTypeCode).Selected = true;

                        List <SuFlage> suFlage = new SuFlage().getSuFlage();
                        foreach (SuFlage row in suFlage)
                        {
                            ddlSU_Flag.Items.Insert(ddlSU_Flag.Items.Count, new ListItem(row.SuFlageName, row.SuFlagCode));
                        }
                        ddlSU_Flag.Items.FindByValue(course.SuFlage).Selected = true;

                        List <ServiceStatus> serviceStatus = new ServiceStatus().getServiceStatus();
                        foreach (ServiceStatus row in serviceStatus)
                        {
                            ddl_SERVICESTATUS.Items.Insert(ddl_SERVICESTATUS.Items.Count, new ListItem(row.ServiceStatusName, row.ServiceStatusValue));
                        }
                        ddl_SERVICESTATUS.Items.FindByValue(course.ServiceStatus).Selected = true;

                        //หลักสูตร
                        if (autro_obj.CheckGroupUser(login_data, group_var.curriculum))
                        {
                            List <FacultyData> faculty = new Faculty().getFaculty();
                            foreach (FacultyData row in faculty)
                            {
                                ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(row.Faculty_Thai, row.Faculty_Code));
                            }
                        }
                        // วิชาการคณะ
                        else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string>      faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);
                            List <FacultyData> facultyData        = new List <FacultyData>();

                            // คณะ
                            facultyData = new Faculty().getFaculty(faculty_authorized);
                            foreach (FacultyData data in facultyData)
                            {
                                ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code));
                            }
                        }
                        // วิชาการภาค
                        else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                        {
                            List <DepartmentData> departmentData        = new List <DepartmentData>();
                            List <string>         department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                            //  คณะ
                            departmentData = new Department().getDepartment(department_authorized);
                            foreach (DepartmentData data in departmentData)
                            {
                                FacultyData faculty_data = new Faculty().getFaculty(data.Department_Code.Substring(0, 2));
                                ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code));
                            }
                        }

                        ddlCURR_FACULTY.Items.FindByValue(course.FacultyCode).Selected = true;

                        txtCOURSE_CODE.Text      = course.CourseCode;
                        txtSHORT_COURSENAME.Text = course.CourseEnShortName;
                        txtCOURSE_THAINAME.Text  = course.CourseThName;
                        txtCOURSE_ENGNAME.Text   = course.CourseEnName;
                        txtCOURSE_CREDIT.Text    = course.Credit;
                        txtTHEORY.Text           = course.TheoryHour;
                        txtPRACTICE.Text         = course.PracticeHour;
                        txtSELF_STUDY.Text       = course.SelfStudyHour;
                        txtCOURSE_DESC_TH.Text   = course.CourseThDesc;
                        txtCOURSE_DESC_EN.Text   = course.CourseEnDesc;
                        MIN_CREDITS.Text         = course.MinCredits;
                        txtdate.Text             = course.DateApprove;
                        if (course.CourseStatus == "Y")
                        {
                            rBtnOpen.Checked = true;
                        }
                        if (course.CourseStatus == "N")
                        {
                            rBtnClose.Checked = true;
                        }
                        COURSE_COMMENT.Text = course.Comments;
                    }
                }
                else
                {
                    HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                    HttpContext.Current.Response.Redirect("err_response.aspx");
                }

                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Exemplo n.º 11
0
    protected void htmlGenerateTab4(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode)
    {
        //string sqlCreditCount = "Select COUNT(COURSECODE) As CREDITCOUNT From TQF2SEC3SEMESTERPLAN Where CURRCODE='707012555' And YEARVERSION='2555' And CURRFORMATCODE='008' And CURRTYPECODE='004' And MAJORCODE='0701' And COURSECODE='070115800'";



        string html = "";

        html += "<div class=\"row\" style=\"margin: 0 10px\">";
        html += "    <div class=\"col col-10\">";
        html += "        <h3 class=\"txt-title-blue\">";
        html += "            <i class=\"fa fa-file-text-o\"></i> ";
        Label lblPlanTitle = new Label();

        lblPlanTitle.Font.Bold = true;
        lblPlanTitle.Text      = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")";
        html += lblPlanTitle.Text;
        html += "        </h3>";
        html += "    </div>";
        html += "</div>";

        string sqlYear = "Select Distinct EDUCATIONYEAR From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' Order By EDUCATIONYEAR";
        List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Year = new TQF2Sec3SemesterPlan().getYear(sqlYear);

        foreach (TQF2Sec3SemesterPlan rowYear in tqf2Sec3SemesterPlan_Year)
        {
            string sqlSemester = "Select Distinct EDUCATIONSEMESTER From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' Order By EDUCATIONYEAR";
            List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Semester = new TQF2Sec3SemesterPlan().getSemester(sqlSemester);
            foreach (TQF2Sec3SemesterPlan rowSemester in tqf2Sec3SemesterPlan_Semester)
            {
                html += "<div class=\"row\" style=\"margin: 0 10px\">";
                html += "    <div class=\"col col-10\">";
                html += "        <p class=\"text-center\">";
                Label label0 = new Label();
                label0.Text = "ปีที่ " + rowYear.EducationYear + " ภาคการศึกษาที่ " + rowSemester.EducationSemester;
                html       += "<span id=\"Label11\" class=\"label bg-color-teal\" style=\"font-weight: bold; font-size: 16px\">" + label0.Text + "</span>";
                html       += "        </p>";
                html       += "    </div>";
                html       += "</div>";

                html += "<div class=\"row\" style=\"margin: 0 10px; padding-bottom: 20px\">";
                html += "    <div class=\"col col-10\">";

                Table tblGroupCategory = new Table();
                // Head Table
                string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต" };
                tblGroupCategory.Attributes.Add("class", "table table-striped tb-curr-plan");
                TableHeaderRow tRowHead = new TableHeaderRow();
                tRowHead.CssClass     = "danger";
                tRowHead.TableSection = TableRowSection.TableHeader;
                for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                {
                    TableHeaderCell cellHead = new TableHeaderCell();
                    cellHead.Text = ar[cellCtr - 1];

                    if (cellCtr == 1 || cellCtr == 3)
                    {
                        cellHead.Width = 100;
                    }

                    tRowHead.Cells.Add(cellHead);
                }
                tblGroupCategory.Rows.Add(tRowHead);
                //Body Table
                string sqlCourse = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' And EDUCATIONSEMESTER='" + rowSemester.EducationSemester + "' Order By COURSECODE";
                List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Course = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sqlCourse);
                foreach (TQF2Sec3SemesterPlan row in tqf2Sec3SemesterPlan_Course)
                {
                    TQF.Course     course         = new TQF.Course().getCourse(row.CourseCode);
                    CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode);

                    TableRow tRowBody = new TableRow();
                    tRowBody.TableSection = TableRowSection.TableBody;

                    TableCell cellCourseCode = new TableCell();
                    string    urlShow        = "showCOURSE.aspx?token=" + row.CourseCode;
                    HyperLink hypShow        = new HyperLink();
                    hypShow.Attributes.Add("data-target", "#course_desModal");
                    hypShow.Attributes.Add("data-toggle", "modal");
                    hypShow.Text        = course.CourseCode + courseElective.CourseElectiveCode;
                    hypShow.NavigateUrl = urlShow;
                    hypShow.ToolTip     = "Course details";
                    cellCourseCode.Controls.Add(hypShow);
                    cellCourseCode.CssClass = "text-center";
                    cellCourseCode.Width    = 80;
                    tRowBody.Cells.Add(cellCourseCode);

                    TableCell cellNCourseThName = new TableCell();
                    cellNCourseThName.Text  = course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
                    cellNCourseThName.Text += course.CourseEnName + courseElective.CourseElectiveEnName;
                    tRowBody.Cells.Add(cellNCourseThName);

                    TableCell cellNumCredit = new TableCell();
                    //หาจำนวนวิชาวิทยานิพนธ์ทั้งหมด
                    string creditCount = "";
                    int    creDit      = 0;
                    //ค่าที่เช็คเงื่อนไขว่าเป็นวิชาวิทยานิพนธ์ มาจากตาราง COURSETYPE
                    //7	วิทยานิพนธ์ (ป.เอก)	Dissertation
                    //4	วิทยานิพนธ์	Thesis
                    //5	สารนิพนธ์	Master Project
                    if (course.CourseTypeCode == "4" || course.CourseTypeCode == "5" || course.CourseTypeCode == "7")
                    {
                        string sqlCreditCount = "Select COUNT(COURSECODE) As CREDITCOUNT From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSECODE='" + row.CourseCode + "'";
                        //คำนวนหน่วยกิตโดยการหารด้วยจำนวนเทอมที่เรียน
                        creditCount = new TQF2Sec3SemesterPlan().getCountCreditTQF2Sec3SemesterPlanManual(sqlCreditCount).CreditCount;
                        try
                        {
                            creDit = int.Parse(course.Credit) / int.Parse(creditCount);
                        }
                        catch
                        {
                            creDit = 0;
                        }

                        //แสดงผลลงในตาราง
                        cellNumCredit.Text  = creDit.ToString() + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                        cellNumCredit.Width = 100;
                        tRowBody.Cells.Add(cellNumCredit);
                    }
                    else
                    {
                        //แสดงผลลงในตาราง
                        cellNumCredit.Text  = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                        cellNumCredit.Width = 100;
                        tRowBody.Cells.Add(cellNumCredit);
                    }



                    tblGroupCategory.Rows.Add(tRowBody);
                }

                StringWriter htmlString = new StringWriter();
                tblGroupCategory.RenderControl(new HtmlTextWriter(htmlString));
                string htmlTableBody = htmlString.ToString();
                html += htmlTableBody;
                html += "    </div>";
                html += "</div>";
            }
        }

        Label lblHTML4 = new Label();

        lblHTML4.Text = html;
        placeHTML4.Controls.Add(lblHTML4);
    }
Exemplo n.º 12
0
    protected void tableBody(Table tblName, string CurrFormatCode, string CurrTypeCode, string MajorCode, string EducationYear, string EducationSemester)
    {
        string sql = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + EducationYear + "' And EDUCATIONSEMESTER='" + EducationSemester + "' Order By COURSECODE";
        List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sql);

        foreach (TQF2Sec3SemesterPlan row in tqf2Sec3SemesterPlan)
        {
            TQF.Course     course         = new TQF.Course().getCourse(row.CourseCode);
            CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode);

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            TableCell cellCourseCode = new TableCell();
            //string urlShow = "showCOURSE.aspx?token=" + row.CourseCode;
            string    urlShow = "showCOURSE.aspx?token=" + row.CourseCode + "&CurrCode=" + CurrCode + "&YearVersion=" + YearVersion;
            HyperLink hypShow = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            //แสดงรหัสวิชาระหว่างตาราง COURSE กับ COURSEELECTIVE
            hypShow.Text        = course.CourseCode + courseElective.CourseElectiveCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            TableCell cellNCourseThName = new TableCell();
            cellNCourseThName.Text  = course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
            cellNCourseThName.Text += course.CourseEnName + courseElective.CourseElectiveEnName;
            tRowBody.Cells.Add(cellNCourseThName);

            //TableCell cellNumCredit = new TableCell();
            //cellNumCredit.Text = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
            //cellNumCredit.Width = 100;
            //tRowBody.Cells.Add(cellNumCredit);

            TableCell cellNumCredit = new TableCell();
            //หาจำนวนวิชาวิทยานิพนธ์ทั้งหมด
            string creditCount = "";
            int    creDit      = 0;
            //ค่าที่เช็คเงื่อนไขว่าเป็นวิชาวิทยานิพนธ์ มาจากตาราง COURSETYPE
            //7	วิทยานิพนธ์ (ป.เอก)	Dissertation
            //4	วิทยานิพนธ์	Thesis
            //5	สารนิพนธ์	Master Project
            if (course.CourseTypeCode == "4" || course.CourseTypeCode == "5" || course.CourseTypeCode == "7")
            {
                string sqlCreditCount = "Select COUNT(COURSECODE) As CREDITCOUNT From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSECODE='" + row.CourseCode + "'";
                //คำนวนหน่วยกิตโดยการหารด้วยจำนวนเทอมที่เรียน
                creditCount = new TQF2Sec3SemesterPlan().getCountCreditTQF2Sec3SemesterPlanManual(sqlCreditCount).CreditCount;
                try
                {
                    creDit = int.Parse(course.Credit) / int.Parse(creditCount);
                }
                catch
                {
                    creDit = 0;
                }
                //แสดงผลลงในตาราง
                cellNumCredit.Text  = creDit.ToString() + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                cellNumCredit.Width = 100;
                tRowBody.Cells.Add(cellNumCredit);
            }
            else
            {
                //แสดงผลลงในตาราง
                cellNumCredit.Text  = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                cellNumCredit.Width = 100;
                tRowBody.Cells.Add(cellNumCredit);
            }

            //&CourseCode=" + course.CourseCode + courseElective.CourseElectiveCode --> รหัสวิชา หรือ รหัสวิชาเลือก(xxx)
            TableCell cellDel = new TableCell();
            string    urlDel  = "delete_CURR8_2.aspx?CurrCode=" + CurrCode + "&YearVersion=" + YearVersion + "&CurrFormatCode=" + CurrFormatCode + "&CurrTypeCode=" + CurrTypeCode + "&MajorCode=" + MajorCode + "&Year=" + row.EducationYear + "&Semester=" + row.EducationSemester + "&CourseCode=" + course.CourseCode + courseElective.Id + "";
            HyperLink hypDel  = new HyperLink();
            hypDel.Attributes.Add("data-target", "#deleteCourse");
            hypDel.Attributes.Add("data-toggle", "modal");
            hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
            hypDel.NavigateUrl = urlDel;
            hypDel.ToolTip     = "Delete";
            cellDel.Controls.Add(hypDel);
            cellDel.CssClass = "text-center";
            cellDel.Width    = 60;
            tRowBody.Cells.Add(cellDel);

            tblName.Rows.Add(tRowBody);
        }
    }
Exemplo n.º 13
0
    protected void btnSEARCH_Click(object sender, EventArgs e)
    {
        // Head Table
        string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "คณะ", "สถานะเปิด/ปิด", "แก้ไข", "ลบ" };
        tblCourse.Attributes.Add("class", "table table-bordered table-striped table-hover");
        tblCourse.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            // Create a new cell and add it to the row.
            TableHeaderCell cellHead = new TableHeaderCell();
            cellHead.Text = ar[cellCtr - 1];
            tRowHead.Cells.Add(cellHead);

            switch (cellCtr)
            {
            case 1:
                cellHead.Width = 80;
                break;

            case 2:
                break;

            case 3:
                cellHead.Width = 80;
                break;

            case 4:
                break;

            case 5:
                cellHead.Width = 80;
                break;

            case 6:
                cellHead.Width = 50;
                break;

            case 7:
                cellHead.Width = 50;
                break;
            }
        }
        tblCourse.Rows.Add(tRowHead);


        List <TQF.Course> course = new List <TQF.Course>();


        if (ddlCURR_FACULTY.SelectedValue == "00")
        {
            course = new TQF.Course().getCourse();
        }
        else
        {
            string sql = "Select * From COURSE Where FACULTYCODE='" + ddlCURR_FACULTY.SelectedValue + "'";
            course = new TQF.Course().getCourseManual(sql);
        }

        foreach (TQF.Course data in course)
        {
            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            TableCell cellCourseCode = new TableCell();

            string    urlShow = "showCOURSE.aspx?token=" + data.CourseCode;
            HyperLink hypShow = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            hypShow.Text        = data.CourseCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            TableCell cellCourseEnName = new TableCell();
            cellCourseEnName.Text = data.CourseThName + "<br>" + data.CourseEnName;
            tRowBody.Cells.Add(cellCourseEnName);

            TableCell cellCredit = new TableCell();
            cellCredit.Text = data.Credit + "(" + data.TheoryHour + "-" + data.PracticeHour + "-" + data.SelfStudyHour + ")";
            tRowBody.Cells.Add(cellCredit);

            TableCell cellFacultyCode = new TableCell();
            cellFacultyCode.Text  = new Faculty().getFaculty(data.FacultyCode).Faculty_Thai;
            cellFacultyCode.Width = 200;
            tRowBody.Cells.Add(cellFacultyCode);

            TableCell cellCourseStatus = new TableCell();
            if (data.CourseStatus == "Y")
            {
                cellCourseStatus.Text = "<h4 class='txt-color-green'><i class='fa fa-check'></i></h4>";                          // +data.CourseStatus;
            }
            if (data.CourseStatus == "N")
            {
                cellCourseStatus.Text = "<h4 class='txt-color-red'><i class='fa fa-times'></i></h4>";                          // +data.CourseStatus;
            }
            cellCourseStatus.Width    = 50;
            cellCourseStatus.CssClass = "text-center";
            tRowBody.Cells.Add(cellCourseStatus);

            TableCell cellEdit = new TableCell();

            // งานหลักสูตร
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
            {
                string    urlEdit = "editCOURSE.aspx?token=" + data.CourseCode;
                HyperLink hypEdit = new HyperLink();
                //hypEdit.Attributes.Add("data-target", "#editModal");
                //hypEdit.Attributes.Add("data-toggle", "modal");
                hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                hypEdit.NavigateUrl = urlEdit;
                hypEdit.ToolTip     = "Edit";
                cellEdit.Controls.Add(hypEdit);
            }
            // วิชาการคณะ
            //else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
            //{
            //    bool editable = false;
            //    List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

            //    foreach (string fac in faculty_authorized)
            //    {
            //        if (fac == data.FacultyCode)
            //        {
            //            editable = true;
            //            break;
            //        }
            //    }

            //    if (editable == true)
            //    {
            //        string urlEdit = "editCOURSE.aspx?token=" + data.CourseCode;
            //        HyperLink hypEdit = new HyperLink();
            //        //hypEdit.Attributes.Add("data-target", "#editModal");
            //        //hypEdit.Attributes.Add("data-toggle", "modal");
            //        hypEdit.Text = "<h4><i class='fa fa-edit'></i></h4>";
            //        hypEdit.NavigateUrl = urlEdit;
            //        hypEdit.ToolTip = "Edit";
            //        cellEdit.Controls.Add(hypEdit);
            //    }
            //    else
            //    {
            //        string urlEdit = "#";
            //        HyperLink hypEdit = new HyperLink();
            //        hypEdit.Text = "<h4><i class='fa fa-lock'></i></h4>";
            //        hypEdit.NavigateUrl = urlEdit;
            //        hypEdit.ToolTip = "ไม่สามารถแก้ไขได้";
            //        cellEdit.Controls.Add(hypEdit);
            //    }

            //}
            // วิชาการภาค
            else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                bool          editable = false;
                List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                foreach (string dep in department_authorized)
                {
                    if (dep.Substring(0, 2) == data.FacultyCode)
                    {
                        editable = true;
                        break;
                    }
                }
                if (editable == true)
                {
                    string    urlEdit = "editCOURSE.aspx?token=" + data.CourseCode;
                    HyperLink hypEdit = new HyperLink();
                    //hypEdit.Attributes.Add("data-target", "#editModal");
                    //hypEdit.Attributes.Add("data-toggle", "modal");
                    hypEdit.Text        = "<h4><i class='fa fa-edit'></i></h4>";
                    hypEdit.NavigateUrl = urlEdit;
                    hypEdit.ToolTip     = "Edit";
                    cellEdit.Controls.Add(hypEdit);
                }
                else
                {
                    string    urlEdit = "#";
                    HyperLink hypEdit = new HyperLink();
                    hypEdit.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                    hypEdit.NavigateUrl = urlEdit;
                    hypEdit.ToolTip     = "ไม่สามารถแก้ไขได้";
                    cellEdit.Controls.Add(hypEdit);
                }
            }
            // ทุกกลุ่มผู้ใช้
            else
            {
                string    urlEdit = "#";
                HyperLink hypEdit = new HyperLink();
                hypEdit.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                hypEdit.NavigateUrl = urlEdit;
                hypEdit.ToolTip     = "ไม่สามารถแก้ไขได้";
                cellEdit.Controls.Add(hypEdit);
            }

            cellEdit.CssClass = "text-center";
            cellEdit.Width    = 50;
            tRowBody.Cells.Add(cellEdit);

            TableCell cellDel = new TableCell();

            //เช็คว่ารายวิชามีการนำไปใช้แล้วหรือยัง ถ้ามีแล้วจะไม่สามารถลบข้อมูลได้
            bool chkExistCourse = new TQF2Sec3SemesterPlan().existCourse(data.CourseCode);

            // งานหลักสูตร
            if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) && chkExistCourse == false)
            {
                string    urlDel = "deleteCOURSE.aspx?token=" + data.CourseCode;
                HyperLink hypDel = new HyperLink();
                hypDel.Attributes.Add("data-target", "#deleteModal");
                hypDel.Attributes.Add("data-toggle", "modal");
                hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
                hypDel.NavigateUrl = urlDel;
                hypDel.ToolTip     = "Delete";
                cellDel.Controls.Add(hypDel);
            }
            // วิชาการคณะ
            //else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
            //{
            //    bool editable = false;
            //    List<string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

            //    foreach (string fac in faculty_authorized)
            //    {
            //        if (fac == data.FacultyCode)
            //        {
            //            editable = true;
            //            break;
            //        }
            //    }

            //    if (editable == true && chkExistCourse == false)
            //    {
            //        string urlDel = "deleteCOURSE.aspx?token=" + data.CourseCode;
            //        HyperLink hypDel = new HyperLink();
            //        hypDel.Attributes.Add("data-target", "#deleteModal");
            //        hypDel.Attributes.Add("data-toggle", "modal");
            //        hypDel.Text = "<h4><i class='fa fa-trash-o'></i></h4>";
            //        hypDel.NavigateUrl = urlDel;
            //        hypDel.ToolTip = "Delete";
            //        cellDel.Controls.Add(hypDel);
            //    }
            //    else
            //    {
            //        string urlDel = "#";
            //        HyperLink hypDel = new HyperLink();
            //        hypDel.Text = "<h4><i class='fa fa-lock'></i></h4>";
            //        hypDel.NavigateUrl = urlDel;
            //        hypDel.ToolTip = "ไม่สามารถลบได้";
            //        cellDel.Controls.Add(hypDel);
            //    }

            //}
            // วิชาการภาค
            else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                bool          editable = false;
                List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                foreach (string dep in department_authorized)
                {
                    if (dep.Substring(0, 2) == data.FacultyCode)
                    {
                        editable = true;
                        break;
                    }
                }
                if (editable == true && chkExistCourse == false)
                {
                    string    urlDel = "deleteCOURSE.aspx?token=" + data.CourseCode;
                    HyperLink hypDel = new HyperLink();
                    hypDel.Attributes.Add("data-target", "#deleteModal");
                    hypDel.Attributes.Add("data-toggle", "modal");
                    hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
                    hypDel.NavigateUrl = urlDel;
                    hypDel.ToolTip     = "Delete";
                    cellDel.Controls.Add(hypDel);
                }
                else
                {
                    string    urlDel = "#";
                    HyperLink hypDel = new HyperLink();
                    hypDel.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                    hypDel.NavigateUrl = urlDel;
                    hypDel.ToolTip     = "ไม่สามารถลบได้";
                    cellDel.Controls.Add(hypDel);
                }
            }
            // ทุกกลุ่มผู้ใช้
            else
            {
                string    urlDel = "#";
                HyperLink hypDel = new HyperLink();
                hypDel.Text        = "<h4><i class='fa fa-lock'></i></h4>";
                hypDel.NavigateUrl = urlDel;
                hypDel.ToolTip     = "ไม่สามารถลบได้";
                cellDel.Controls.Add(hypDel);
            }

            cellDel.CssClass = "text-center";
            cellDel.Width    = 50;
            tRowBody.Cells.Add(cellDel);

            tblCourse.Rows.Add(tRowBody);
        }
    }
Exemplo n.º 14
0
    protected void htmlGenerateTab3(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode)
    {
        string html = "";

        html += "<div class=\"row\" style=\"margin: 0 10px\">";
        html += "    <div class=\"col col-10\">";
        html += "        <h3 class=\"txt-title-blue\">";
        html += "            <i class=\"fa fa-file-text-o\"></i> ";
        Label lblPlanTitle = new Label();

        lblPlanTitle.Font.Bold = true;
        lblPlanTitle.Text      = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + " (แขนงวิชา " + new TQF.Major().getMajor(MajorCode).MajorThName + ")";
        html += lblPlanTitle.Text;
        html += "        </h3>";
        html += "    </div>";
        html += "</div>";

        string sql = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'";
        List <TQF2Sec3StructureCategory> tqf2s3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sql);

        foreach (TQF2Sec3StructureCategory data in tqf2s3StructureCategory)
        {
            html += "<div class=\"row\" style=\"margin: 0 10px\">";
            html += "    <div class=\"col col-10\">";
            html += "        <p class=\"text-center\">";
            Label label0 = new Label();
            label0.Text = new Category().getCategory(data.CategoryCode).CategoryThName;
            html       += "<span id=\"Label11\" class=\"label bg-color-teal\" style=\"font-weight: bold; font-size: 16px\">" + label0.Text + "</span>";
            html       += "        </p>";
            html       += "    </div>";
            html       += "</div>";

            string sql2 = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + data.CurrCode + "' And YEARVERSION='" + data.YearVersion + "' And CURRFORMATCODE='" + data.CurrFormatCode + "' And CURRTYPECODE='" + data.CurrTypeCode + "' And MAJORCODE='" + data.MajorCode + "' And CATEGORYCODE='" + data.CategoryCode + "'";
            List <TQF2Sec3StructureGroup> tqf2s3StructureCategory2 = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sql2);

            foreach (TQF2Sec3StructureGroup rowGroup in tqf2s3StructureCategory2)
            {
                html += "<div class=\"row\" style=\"margin: 0 10px\">";
                html += "    <div class=\"col col-10\">";
                html += "        <p>";
                Label label2 = new Label();
                label2.Font.Bold = true;
                label2.Text      = new CourseGroup().getCourseGroup(rowGroup.CourseGroupCode).CourseGroupThName;
                html            += "<span id=\"Label9\" style=\"font-weight: bold;\">" + label2.Text + "</span>";
                html            += "        </p>";
                html            += "    </div>";
                html            += "</div>";

                string sql3 = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + rowGroup.CurrFormatCode + "' And CURRTYPECODE='" + rowGroup.CurrTypeCode + "' And MAJORCODE='" + rowGroup.MajorCode + "' And CATEGORYCODE='" + rowGroup.CategoryCode + "' And COURSEGROUPCODE='" + rowGroup.CourseGroupCode + "'";
                List <Tqf2Sec3StructureType> tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sql3);

                foreach (Tqf2Sec3StructureType rowType in tqf2Sec3StructureType)
                {
                    html += "<div class=\"row\" style=\"margin: 0 10px\">";
                    html += "    <div class=\"col col-10\">";
                    html += "        <p>";
                    Label label3 = new Label();
                    label3.Font.Bold = true;
                    label3.Text      = new CourseSubjectType().getCourseSubjectType(rowType.CourseTypeCode).CourseTypeThaiName;
                    html            += label3.Text;
                    html            += "        </p>";
                    html            += "    </div>";
                    html            += "</div>";

                    html += "<div class=\"row\" style=\"margin: 0 10px; padding-bottom: 20px\">";
                    html += "    <div class=\"col col-10\">";

                    Table tblGroupCategory = new Table();
                    // Head Table
                    string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต" };
                    tblGroupCategory.Attributes.Add("class", "table table-striped tb-curr-plan");
                    TableHeaderRow tRowHead = new TableHeaderRow();
                    tRowHead.CssClass     = "success";
                    tRowHead.TableSection = TableRowSection.TableHeader;
                    for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                    {
                        TableHeaderCell cellHead = new TableHeaderCell();
                        cellHead.Text = ar[cellCtr - 1];

                        if (cellCtr == 1 || cellCtr == 3)
                        {
                            cellHead.Width = 100;
                        }

                        tRowHead.Cells.Add(cellHead);
                    }

                    tblGroupCategory.Rows.Add(tRowHead);

                    //Body Table
                    string sqlPlan = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + rowType.CourseGroupCode + "' And CATEGORYCODE='" + rowType.CategoryCode + "' And COURSETYPECODE='" + rowType.CourseTypeCode + "' Order By COURSECODE";
                    List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sqlPlan);

                    foreach (TQF2Sec3PlanDetail row in tqf2Sec3PlanDetail)
                    {
                        TQF.Course     course         = new TQF.Course().getCourse(row.CourseCode);
                        CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode);

                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

                        TableCell cellCourseCode = new TableCell();
                        //string urlShow = "showCOURSE.aspx?token=" + row.CourseCode;
                        string    urlShow = "showCOURSE.aspx?token=" + row.CourseCode + "&CurrCode=" + CurrCode + "&YearVersion=" + YearVersion;
                        HyperLink hypShow = new HyperLink();
                        hypShow.Attributes.Add("data-target", "#course_desModal");
                        hypShow.Attributes.Add("data-toggle", "modal");
                        hypShow.Text        = course.CourseCode + courseElective.CourseElectiveCode; //row.CourseCode;
                        hypShow.NavigateUrl = urlShow;
                        hypShow.ToolTip     = "Course details";
                        cellCourseCode.Controls.Add(hypShow);
                        cellCourseCode.CssClass = "text-center";
                        cellCourseCode.Width    = 80;
                        tRowBody.Cells.Add(cellCourseCode);

                        TableCell cellNCourseThName = new TableCell();
                        cellNCourseThName.Text  = course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
                        cellNCourseThName.Text += course.CourseEnName + courseElective.CourseElectiveEnName;
                        tRowBody.Cells.Add(cellNCourseThName);

                        TableCell cellNumCredit = new TableCell();
                        cellNumCredit.Text  = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                        cellNumCredit.Width = 100;
                        tRowBody.Cells.Add(cellNumCredit);

                        tblGroupCategory.Rows.Add(tRowBody);
                    }

                    StringWriter htmlString = new StringWriter();
                    tblGroupCategory.RenderControl(new HtmlTextWriter(htmlString));
                    string htmlTableBody = htmlString.ToString();
                    html += htmlTableBody;
                    html += "</div>";
                    html += "</div>";
                }
            }
        }

        Label lblHTML3 = new Label();

        lblHTML3.Text = html;
        placeHTML3.Controls.Add(lblHTML3);
    }
Exemplo n.º 15
0
    protected void htmlGenerateTab5(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode)
    {
        string html = "";

        html += "<div class=\"box-group-data\">";
        html += "<table class=\"table-course\">";

        //Body Table

        List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetail(CurrCode, YearVersion);

        foreach (TQF2Sec3PlanDetail row in tqf2Sec3PlanDetail)
        {
            TQF.Course course = new TQF.Course().getCourse(row.CourseCode);

            html += "<tr>";
            html += "<td><strong>" + course.CourseCode + "</strong></td>";
            html += "<td><strong>";
            html += course.CourseThName + "<BR>";
            html += course.CourseEnName;
            html += "</strong></td>";
            html += "<td><strong>";
            html += course.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
            html += "</strong></td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td colspan=\"2\">";

            html += "<table class=\"table-description\">";
            html += "<tr>";
            html += "<td>วิชาบังคับก่อน: &nbsp;&nbsp;</td>";
            html += "<td>";

            string sqlPreRequisite           = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And COURSECODE='" + course.CourseCode + "'";
            List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sqlPreRequisite);
            foreach (PreRequisite data in preRequisite)
            {
                html += data.PreRequisiteCourseCode + "   " + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseThName + "<br>";
            }

            html += "</td>";
            html += "</tr>";
            html += "</table>";

            html += "</td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td colspan=\"2\">";

            html += "<table class=\"table-description\">";
            html += "<tr>";
            html += "<td>PreRequisite: &nbsp;&nbsp;";
            html += "<td>";

            foreach (PreRequisite data in preRequisite)
            {
                html += data.PreRequisiteCourseCode + "   " + new TQF.Course().getCourse(data.PreRequisiteCourseCode).CourseEnName + "<br>";
            }

            html += "</td>";
            html += "</tr>";
            html += "</table>";

            html += "</td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td colspan=\"2\" class=\"course-description\">" + course.CourseThDesc + "</td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td colspan=\"2\" class=\"course-description\">" + course.CourseEnDesc + "</td>";
            html += "</tr>";

            html += "<tr>";
            html += "<td>&nbsp;</td>";
            html += "<td>&nbsp;</td>";
            html += "<td>&nbsp;</td>";
            html += "</tr>";
        }

        html += "</table>";

        html += "</div>";

        Label lblHTML5 = new Label();

        lblHTML5.Text = html;
        placeHTML5.Controls.Add(lblHTML5);
    }
Exemplo n.º 16
0
    protected void tableBody(Table tblName)
    {
        List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getDistinctCourseCodeTQF2Sec3PlanDetail(CurrCode, YearVersion);

        foreach (TQF2Sec3PlanDetail row in tqf2Sec3PlanDetail)
        {
            TQF.Course     course         = new TQF.Course().getCourse(row.CourseCode);
            CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode);

            TQF2Sec3PlanDetail rowCourseCode = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailCourseCode(row.CourseCode);

            string sql = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='999999999' And COURSECODE='" + row.CourseCode + "'";
            List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail2 = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql);

            //ถ้าเป็นรายวิชาในหลักสูตรบริการให้ข้าม
            if (tqf2Sec3PlanDetail2.Count > 0 && rowCourseCode.CurrCode != "999999999")
            {
                continue;
            }
            //ถ้าเป็นรายวิชาเลือก (วิชา xxx) ให้ข้าม
            else if (row.CourseCode == courseElective.Id)
            {
                continue;
            }

            else
            {
                TableRow tRowBody = new TableRow();
                tRowBody.TableSection = TableRowSection.TableBody;

                //Cell [0]
                TableCell cellCourseCode = new TableCell();
                //string urlShow = "showCOURSE.aspx?token=" + course.CourseCode;
                string    urlShow = "showCOURSE.aspx?token=" + course.CourseCode + "&CurrCode=" + CurrCode + "&YearVersion=" + YearVersion;
                HyperLink hypShow = new HyperLink();
                hypShow.Attributes.Add("data-target", "#showModal");
                hypShow.Attributes.Add("data-toggle", "modal");
                hypShow.Text        = course.CourseCode + " " + course.CourseThName + "<BR>" + course.CourseEnName;
                hypShow.Text        = course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
                hypShow.Text       += course.CourseEnName + courseElective.CourseElectiveEnName;
                hypShow.NavigateUrl = urlShow;
                hypShow.ToolTip     = "Course details";
                cellCourseCode.Controls.Add(hypShow);
                //cellCourseCode.CssClass = "text-center";
                cellCourseCode.Width = 200;
                tRowBody.Cells.Add(cellCourseCode);

                TableCell cellDomain1 = new TableCell();
                string    urlDomain1  = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=1&YearVersion=" + rowCourseCode.YearVersion + "";
                HyperLink hypDomain1  = new HyperLink();
                hypDomain1.Attributes.Add("data-target", "#editDomain_Modal");
                hypDomain1.Attributes.Add("data-toggle", "modal");

                List <TQF2Sec4CurriculumMapping> chk1 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "1", rowCourseCode.YearVersion);
                if (chk1.Count == 0)
                {
                    hypDomain1.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> ";
                }
                else
                {
                    hypDomain1.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> ";
                }

                hypDomain1.NavigateUrl = urlDomain1;
                hypDomain1.ToolTip     = "Click to edit";
                cellDomain1.Controls.Add(hypDomain1);
                cellDomain1.CssClass = "text-center";
                cellDomain1.Width    = 100;
                tRowBody.Cells.Add(cellDomain1);

                //Cell [1]
                TableCell cellDomain2 = new TableCell();
                string    urlDomain2  = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=2&YearVersion=" + rowCourseCode.YearVersion + "";
                HyperLink hypDomain2  = new HyperLink();
                hypDomain2.Attributes.Add("data-target", "#editDomain_Modal");
                hypDomain2.Attributes.Add("data-toggle", "modal");

                List <TQF2Sec4CurriculumMapping> chk2 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "2", rowCourseCode.YearVersion);
                if (chk2.Count == 0)
                {
                    hypDomain2.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> ";
                }
                else
                {
                    hypDomain2.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> ";
                }

                hypDomain2.NavigateUrl = urlDomain2;
                hypDomain2.ToolTip     = "Click to edit";
                cellDomain2.Controls.Add(hypDomain2);
                cellDomain2.CssClass = "text-center";
                cellDomain2.Width    = 100;
                tRowBody.Cells.Add(cellDomain2);

                //Cell [2]
                TableCell cellDomain3 = new TableCell();
                string    urlDomain3  = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=3&YearVersion=" + rowCourseCode.YearVersion + "";
                HyperLink hypDomain3  = new HyperLink();
                hypDomain3.Attributes.Add("data-target", "#editDomain_Modal");
                hypDomain3.Attributes.Add("data-toggle", "modal");

                List <TQF2Sec4CurriculumMapping> chk3 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "3", rowCourseCode.YearVersion);
                if (chk3.Count == 0)
                {
                    hypDomain3.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> ";
                }
                else
                {
                    hypDomain3.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> ";
                }

                hypDomain3.NavigateUrl = urlDomain3;
                hypDomain3.ToolTip     = "Click to edit";
                cellDomain3.Controls.Add(hypDomain3);
                cellDomain3.CssClass = "text-center";
                cellDomain3.Width    = 100;
                tRowBody.Cells.Add(cellDomain3);

                //Cell [3]
                TableCell cellDomain4 = new TableCell();
                string    urlDomain4  = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + rowCourseCode.CourseCode + "&DomainTypeCode=4&YearVersion=" + rowCourseCode.YearVersion + "";
                HyperLink hypDomain4  = new HyperLink();
                hypDomain4.Attributes.Add("data-target", "#editDomain_Modal");
                hypDomain4.Attributes.Add("data-toggle", "modal");

                List <TQF2Sec4CurriculumMapping> chk4 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "4", rowCourseCode.YearVersion);
                if (chk4.Count == 0)
                {
                    hypDomain4.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> ";
                }
                else
                {
                    hypDomain4.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> ";
                }

                hypDomain4.NavigateUrl = urlDomain4;
                hypDomain4.ToolTip     = "Click to edit";
                cellDomain4.Controls.Add(hypDomain4);
                cellDomain4.CssClass = "text-center";
                cellDomain4.Width    = 100;
                tRowBody.Cells.Add(cellDomain4);

                //Cell [4]
                TableCell cellDomain5 = new TableCell();
                string    urlDomain5  = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=5&YearVersion=" + rowCourseCode.YearVersion + "";
                HyperLink hypDomain5  = new HyperLink();
                hypDomain5.Attributes.Add("data-target", "#editDomain_Modal");
                hypDomain5.Attributes.Add("data-toggle", "modal");

                List <TQF2Sec4CurriculumMapping> chk5 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "5", rowCourseCode.YearVersion);
                if (chk5.Count == 0)
                {
                    hypDomain5.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> ";
                }
                else
                {
                    hypDomain5.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> ";
                }

                hypDomain5.NavigateUrl = urlDomain5;
                hypDomain5.ToolTip     = "Click to edit";
                cellDomain5.Controls.Add(hypDomain5);
                cellDomain5.CssClass = "text-center";
                cellDomain5.Width    = 100;
                tRowBody.Cells.Add(cellDomain5);

                //Cell [5]
                TableCell cellDomain6 = new TableCell();
                string    urlDomain6  = "edit_Curri_Mapping.aspx?CurrCode=" + rowCourseCode.CurrCode + "&CourseCode=" + row.CourseCode + "&DomainTypeCode=6&YearVersion=" + rowCourseCode.YearVersion + "";
                HyperLink hypDomain6  = new HyperLink();
                hypDomain6.Attributes.Add("data-target", "#editDomain_Modal");
                hypDomain6.Attributes.Add("data-toggle", "modal");

                List <TQF2Sec4CurriculumMapping> chk6 = new TQF2Sec4CurriculumMapping().getTQF2Sec4CurriculumMapping(rowCourseCode.CurrCode, row.CourseCode, "6", rowCourseCode.YearVersion);
                if (chk6.Count == 0)
                {
                    hypDomain6.Text = "<div class=\"btn btn-primary padding-5\"><i class=\"fa fa-edit\"></i> Edit</div> ";
                }
                else
                {
                    hypDomain6.Text = "<div class=\"btn btn-success padding-5\"><i class=\"fa fa-check-square-o\"></i> Edited</div> ";
                }

                hypDomain6.NavigateUrl = urlDomain6;
                hypDomain6.ToolTip     = "Click to edit";
                cellDomain6.Controls.Add(hypDomain6);
                cellDomain6.CssClass = "text-center";
                cellDomain6.Width    = 100;
                tRowBody.Cells.Add(cellDomain6);

                tblName.Rows.Add(tRowBody);
            }
        }
    }
Exemplo n.º 17
0
    protected void htmlGenerateTab3(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode)
    {
        string html = "";

        html += "<table class=\"table-curr\">";
        html += "<tr>";
        Label lblPlanTitle = new Label();

        lblPlanTitle.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName + " แขนงวิชา" + new TQF.Major().getMajor(MajorCode).MajorThName;
        html += "<th>หลักสูตร " + lblPlanTitle.Text + "</th>";
        html += "<th></th>";
        html += "<th></th>";
        html += "</tr>";
        Label label7 = new Label();

        label7.Text = new StructurePlan().getTotalCreditsStructurePlan(CurrCode, YearVersion, CurrFormatCode, CurrTypeCode, MajorCode).TotalCredits;
        html       += "</table>";

        html += "<div class=\"box-group-data\">";
        html += "<table class=\"table-curr\">";
        //<!-- 1. หมวดวิชาศึกษาทั่วไป -->
        string sqlTQF2Sec3StructureCategory = "Select * From TQF2SEC3STRUCTURECATEGORY Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "'";
        List <TQF2Sec3StructureCategory> TQF2Sec3StructureCategory = new TQF2Sec3StructureCategory().getTQF2Sec3StructureCategoryManual(sqlTQF2Sec3StructureCategory);

        int i = 0;

        foreach (TQF2Sec3StructureCategory data in TQF2Sec3StructureCategory)
        {
            i++;

            Label label1 = new Label();
            Label label2 = new Label();
            label1.Text = new Category().getCategory(data.CategoryCode).CategoryThName;
            label2.Text = data.CategoryCredits;
            html       += "<tr>";
            html       += "<th><span class=\"report-indent-1em\">" + i + ") " + label1.Text + "</span></th>";
            html       += "<th>" + label2.Text + "</th>";
            html       += "<th>หน่วยกิต</th>";
            html       += "</tr>";

            //กลุ่มวิชาสังคมศาสตร์
            string sqlTQF2Sec3StructureGroup = "Select * From TQF2SEC3STRUCTUREGROUP Where CURRCODE='" + data.CurrCode + "' And YEARVERSION='" + data.YearVersion + "' And CURRFORMATCODE='" + data.CurrFormatCode + "' And CURRTYPECODE='" + data.CurrTypeCode + "' And MAJORCODE='" + data.MajorCode + "' And CATEGORYCODE='" + data.CategoryCode + "'";
            List <TQF2Sec3StructureGroup> TQF2Sec3StructureGroup = new TQF2Sec3StructureGroup().getTQF2Sec3StructureGroupManual(sqlTQF2Sec3StructureGroup);

            foreach (TQF2Sec3StructureGroup row in TQF2Sec3StructureGroup)
            {
                Label label3 = new Label();
                Label label4 = new Label();
                label3.Text = new CourseGroup().getCourseGroup(row.CourseGroupCode).CourseGroupThName;
                label4.Text = row.GroupCredits;
                html       += "<tr>";
                html       += "<th><span class=\"report-indent-2em\">" + label3.Text + "</span></th>";
                html       += "<th>" + label4.Text + "</th>";
                html       += "<th>หน่วยกิต</th>";
                html       += "</tr>";

                //วิชาเลือก
                string sqlTqf2Sec3StructureType = "Select * From TQF2SEC3STRUCTURETYPE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And CATEGORYCODE='" + row.CategoryCode + "' And COURSEGROUPCODE='" + row.CourseGroupCode + "'";
                List <Tqf2Sec3StructureType> Tqf2Sec3StructureType = new Tqf2Sec3StructureType().getTqf2Sec3StructureTypeManual(sqlTqf2Sec3StructureType);

                foreach (Tqf2Sec3StructureType row2 in Tqf2Sec3StructureType)
                {
                    Label label5 = new Label();
                    Label label6 = new Label();
                    label5.Text = new CourseSubjectType().getCourseSubjectType(row2.CourseTypeCode).CourseTypeThaiName;
                    label6.Text = row2.TypeCredits;

                    html += "<tr>";
                    html += "<th><span class=\"report-indent-3em\">" + label5.Text + "</span></th>";
                    html += "<th>" + label6.Text + "</th>";
                    html += "<th>หน่วยกิต</th>";
                    html += "</tr>";

                    html += "<tr><td colspan=3>";
                    html += "<table width=100%>";

                    Table tblGroupCategory = new Table();
                    tblGroupCategory.Attributes.Add("class", "table-course");
                    //Body Table
                    string sqlPlan = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + row2.CourseGroupCode + "' And CATEGORYCODE='" + row2.CategoryCode + "' And COURSETYPECODE='" + row2.CourseTypeCode + "' Order By COURSECODE";
                    List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sqlPlan);

                    foreach (TQF2Sec3PlanDetail row3 in tqf2Sec3PlanDetail)
                    {
                        TQF.Course     course         = new TQF.Course().getCourse(row3.CourseCode);
                        CourseElective courseElective = new CourseElective().getCourseElective(row3.CourseCode);

                        html += "<tr>";
                        html += "<td class=\"text-align-left\" width=10%>" + row3.CourseCode + "</td>";
                        html += "<td class=\"text-align-left\" width=80%>" + course.CourseThName + courseElective.CourseElectiveThName + "<br>" + course.CourseEnName + courseElective.CourseElectiveEnName + "</td>";
                        html += "<td width=10%>" + course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")" + "</td>";
                        html += "</tr>";
                    }
                    html += "</table>";
                    html += "</td></tr>";
                }
            }
        }

        html += "</table>";
        html += "</div>";

        Label lblHTML3 = new Label();

        lblHTML3.Text = html;
        placeHTML3.Controls.Add(lblHTML3);
    }
Exemplo n.º 18
0
    protected void htmlGenerateTab4(string MajorCode, string CurrFormatCode, string TotalCredits, string YearVersion, string CurrTypeCode)
    {
        string html = "";

        html += "<div class=\"box-group-data\">";
        html += "<p class=\"text-center\">";
        html += "<span class=\"report-bold\">";
        Label lblPlanTitle = new Label();

        lblPlanTitle.Text = new CurrType().getCurrType(CurrTypeCode).CurrTypeName;
        html += lblPlanTitle.Text;
        html += "</span>";
        html += "<br />";
        html += "<span class=\"report-bold\">";
        Label lblPlanTitle2 = new Label();

        lblPlanTitle2.Text = " แขนงวิชา" + new TQF.Major().getMajor(MajorCode).MajorThName;
        html += lblPlanTitle2.Text;
        html += "</span>";
        html += "</p>";

        string sqlYear = "Select Distinct EDUCATIONYEAR From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' Order By EDUCATIONYEAR";
        List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Year = new TQF2Sec3SemesterPlan().getYear(sqlYear);

        foreach (TQF2Sec3SemesterPlan rowYear in tqf2Sec3SemesterPlan_Year)
        {
            string sqlSemester = "Select Distinct EDUCATIONSEMESTER From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' Order By EDUCATIONYEAR";
            List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Semester = new TQF2Sec3SemesterPlan().getSemester(sqlSemester);
            foreach (TQF2Sec3SemesterPlan rowSemester in tqf2Sec3SemesterPlan_Semester)
            {
                html += "<p class=\"text-center\">";
                Label label0 = new Label();
                label0.Text = "ปีที่ " + rowYear.EducationYear + " ภาคการศึกษาที่ " + rowSemester.EducationSemester;
                html       += "<span class=\"report-bold\">" + label0.Text + "</span>";
                html       += "</p>";

                html += "<table class=\"table-course\">";

                //Body Table
                string sqlCourse = "Select * From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And EDUCATIONYEAR='" + rowYear.EducationYear + "' And EDUCATIONSEMESTER='" + rowSemester.EducationSemester + "' Order By COURSECODE";
                List <TQF2Sec3SemesterPlan> tqf2Sec3SemesterPlan_Course = new TQF2Sec3SemesterPlan().getTQF2Sec3SemesterPlanManual(sqlCourse);
                foreach (TQF2Sec3SemesterPlan row in tqf2Sec3SemesterPlan_Course)
                {
                    TQF.Course     course         = new TQF.Course().getCourse(row.CourseCode);
                    CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode);

                    html += "<tr>";

                    html += "<td>" + course.CourseCode + courseElective.CourseElectiveCode + "</td>";
                    html += "<td>";
                    html += course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
                    html += course.CourseEnName + courseElective.CourseElectiveEnName;
                    html += "</td>";

                    //หาจำนวนวิชาวิทยานิพนธ์ทั้งหมด
                    string creditCount = "";
                    int    creDit      = 0;
                    //ค่าที่เช็คเงื่อนไขว่าเป็นวิชาวิทยานิพนธ์ มาจากตาราง COURSETYPE
                    //7	วิทยานิพนธ์ (ป.เอก)	Dissertation
                    //4	วิทยานิพนธ์	Thesis
                    //5	สารนิพนธ์	Master Project
                    if (course.CourseTypeCode == "4" || course.CourseTypeCode == "5" || course.CourseTypeCode == "7")
                    {
                        string sqlCreditCount = "Select COUNT(COURSECODE) As CREDITCOUNT From TQF2SEC3SEMESTERPLAN Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSECODE='" + row.CourseCode + "'";
                        //คำนวนหน่วยกิตโดยการหารด้วยจำนวนเทอมที่เรียน
                        creditCount = new TQF2Sec3SemesterPlan().getCountCreditTQF2Sec3SemesterPlanManual(sqlCreditCount).CreditCount;
                        try
                        {
                            creDit = int.Parse(course.Credit) / int.Parse(creditCount);
                        }
                        catch
                        {
                            creDit = 0;
                        }

                        //แสดงผลลงในตาราง
                        html += "<td>";
                        html += creDit.ToString() + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                        html += "</td>";
                    }
                    else
                    {
                        //แสดงผลลงในตาราง
                        html += "<td>";
                        html += course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                        html += "</td>";
                    }

                    html += "</tr>";
                }

                html += "</table>";
            }
        }

        html += "</div>";

        Label lblHTML4 = new Label();

        lblHTML4.Text = html;
        placeHTML4.Controls.Add(lblHTML4);
    }
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        foreach (TableRow row in tblCourse.Rows)
        {
            var cell = row.Cells[0];
            foreach (Control control in cell.Controls)
            {
                var checkBox = control as CheckBox;
                if (checkBox != null)
                {
                    if (checkBox.Checked == true)
                    {
                        CourseElectiveMember courseElectiveMember = new CourseElectiveMember();

                        courseElectiveMember.CourseElectiveMemberCode = new TQF.TQFUtility().getMaxID("COURSEELECTIVEMEMBERCODE", "COURSEELECTIVEMEMBER");
                        courseElectiveMember.CourseCode         = row.Cells[5].Text;
                        courseElectiveMember.CourseElectiveCode = code;
                        courseElectiveMember.FacultyCode        = facCreated;
                        courseElectiveMember.FacultyOwner       = ddlCURR_FACULTY.Items.FindByText(row.Cells[4].Text).Value;

                        string courseElectiveMemberSave = new CourseElectiveMember().insertCourseElectiveMember(courseElectiveMember);

                        if (courseElectiveMemberSave == "Success")
                        {
                            TableRow tRowBody = new TableRow();
                            tRowBody.TableSection = TableRowSection.TableBody;

                            TableCell cellCourseCode = new TableCell();
                            string    urlShow        = "showCOURSE.aspx?token=" + courseElectiveMember.CourseCode;
                            HyperLink hypShow        = new HyperLink();
                            hypShow.Attributes.Add("data-target", "#showModal");
                            hypShow.Attributes.Add("data-toggle", "modal");
                            hypShow.Text        = courseElectiveMember.CourseCode;
                            hypShow.NavigateUrl = urlShow;
                            hypShow.ToolTip     = "Course details";
                            cellCourseCode.Controls.Add(hypShow);
                            cellCourseCode.CssClass = "text-center";
                            cellCourseCode.Width    = 80;
                            tRowBody.Cells.Add(cellCourseCode);

                            TQF.Course course           = new TQF.Course().getCourse(code);
                            TableCell  cellCourseEnName = new TableCell();
                            cellCourseEnName.Text = course.CourseThName + "<br>" + course.CourseEnName;
                            tRowBody.Cells.Add(cellCourseEnName);

                            TableCell cellCredit = new TableCell();
                            cellCredit.Text = course.Credit + "(" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                            tRowBody.Cells.Add(cellCredit);

                            TableCell cellFacultyCode = new TableCell();
                            cellFacultyCode.Text  = row.Cells[4].Text;
                            cellFacultyCode.Width = 200;
                            tRowBody.Cells.Add(cellFacultyCode);

                            TableCell cellDel = new TableCell();
                            string    urlDel  = "deleteCOURSE.aspx?token=" + courseElectiveMember.CourseCode;
                            HyperLink hypDel  = new HyperLink();
                            hypDel.Attributes.Add("data-target", "#deleteModal");
                            hypDel.Attributes.Add("data-toggle", "modal");
                            hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
                            hypDel.NavigateUrl = urlDel;
                            hypDel.ToolTip     = "Delete";
                            cellDel.Controls.Add(hypDel);
                            cellDel.CssClass = "text-center";
                            cellDel.Width    = 50;
                            tRowBody.Cells.Add(cellDel);

                            dummyRow.Add(tRowBody);
                            //tblCourse.Rows.Add(tRowBody);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
            }
        }


        //Session["tblElectiveCourse"] = (List<TableRow>)dummyRow;
        //Response.Redirect("listCOURSEXXX.aspx");
        Response.Redirect("editElective_COURSE.aspx?token=" + code + "&facultyId=" + facId + "&FacultyCreated=" + facCreated);
    }
Exemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.curriculum) || autro_obj.CheckGroupUser(login_data, group_var.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                // ======== Process ===========
                bool editable = false;
                code = Request.QueryString["token"];
                TQF.Course course = new TQF.Course().getCourse(code);

                //หลักสูตร
                if (autro_obj.CheckGroupUser(login_data, group_var.curriculum))
                {
                    editable = true;
                }
                // วิชาการคณะ
                else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                {
                    List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                    foreach (string fac in faculty_authorized)
                    {
                        if (fac == course.FacultyCode)
                        {
                            editable = true;
                            break;
                        }
                    }
                }
                // วิชาการภาค
                else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                {
                    List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                    foreach (string dep in department_authorized)
                    {
                        if (dep.Substring(0, 2) == course.FacultyCode)
                        {
                            editable = true;
                            break;
                        }
                    }
                }

                if (editable == true)
                {
                    lblTextConfirm.Text = course.CourseCode + ": " + course.CourseThName;
                }
                else
                {
                    HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                    HttpContext.Current.Response.Redirect("err_response.aspx");
                }

                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Exemplo n.º 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        code  = Session["CourseElectiveCode"].ToString();
        facId = Session["FacultyCode"].ToString();

        if (!Page.IsPostBack)
        {
            lbl1.Text = "รหัสวิชา (" + code + ")";
            lbl2.Text = new Faculty().getFaculty(facId).Faculty_Thai;

            // Head Table
            string[] ar = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "คณะ", "ลบ" };
            tblElective.Attributes.Add("class", "table table-bordered table-striped table-hover");
            tblElective.Attributes.Add("id", "dt_basic");
            TableHeaderRow tRowHead = new TableHeaderRow();
            tRowHead.TableSection = TableRowSection.TableHeader;
            for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
            {
                // Create a new cell and add it to the row.
                TableHeaderCell cellHead = new TableHeaderCell();
                cellHead.Text = ar[cellCtr - 1];
                tRowHead.Cells.Add(cellHead);
            }
            tblElective.Rows.Add(tRowHead);

            List <CourseElectiveMember> courseElectiveMember = new List <CourseElectiveMember>();

            string sql = "Select * From COURSEELECTIVEMEMBER Where COURSECODE='" + code + "' And FACULTYCODE='" + facId + "'";
            courseElectiveMember = new CourseElectiveMember().getCourseElectiveMemberManual(sql);

            foreach (CourseElectiveMember data in courseElectiveMember)
            {
                TableRow tRowBody = new TableRow();
                tRowBody.TableSection = TableRowSection.TableBody;

                TableCell cellCourseCode = new TableCell();
                string    urlShow        = "showCOURSE.aspx?token=" + data.CourseCode;
                HyperLink hypShow        = new HyperLink();
                hypShow.Attributes.Add("data-target", "#showModal");
                hypShow.Attributes.Add("data-toggle", "modal");
                hypShow.Text        = data.CourseCode;
                hypShow.NavigateUrl = urlShow;
                hypShow.ToolTip     = "Course details";
                cellCourseCode.Controls.Add(hypShow);
                cellCourseCode.CssClass = "text-center";
                cellCourseCode.Width    = 80;
                tRowBody.Cells.Add(cellCourseCode);

                TQF.Course course           = new TQF.Course().getCourse(data.CourseCode);
                TableCell  cellCourseEnName = new TableCell();
                cellCourseEnName.Text = course.CourseThName + "<br>" + course.CourseEnName;
                tRowBody.Cells.Add(cellCourseEnName);

                TableCell cellCredit = new TableCell();
                cellCredit.Text = course.Credit + "(" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
                tRowBody.Cells.Add(cellCredit);

                TableCell cellFacultyCode = new TableCell();
                cellFacultyCode.Text  = new Faculty().getFaculty(data.FacultyCode).Faculty_Thai;
                cellFacultyCode.Width = 200;
                tRowBody.Cells.Add(cellFacultyCode);

                TableCell cellDel = new TableCell();
                string    urlDel  = "deleteCOURSE.aspx?token=" + data.CourseCode;
                HyperLink hypDel  = new HyperLink();
                hypDel.Attributes.Add("data-target", "#deleteModal");
                hypDel.Attributes.Add("data-toggle", "modal");
                hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
                hypDel.NavigateUrl = urlDel;
                hypDel.ToolTip     = "Delete";
                cellDel.Controls.Add(hypDel);
                cellDel.CssClass = "text-center";
                cellDel.Width    = 50;
                tRowBody.Cells.Add(cellDel);

                tblElective.Rows.Add(tRowBody);
            }
        }
    }
Exemplo n.º 22
0
    protected void tableBody(Table tblName, string CurrFormatCode, string CurrTypeCode, string MajorCode, string CourseGroupCode, string CategoryCode, string CourseTypeCode)
    {
        string sql = "Select * From TQF2SEC3PLANDETAIL Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' Order By COURSECODE";
        List <TQF2Sec3PlanDetail> tqf2Sec3PlanDetail = new TQF2Sec3PlanDetail().getTQF2Sec3PlanDetailManual(sql);

        foreach (TQF2Sec3PlanDetail row in tqf2Sec3PlanDetail)
        {
            TQF.Course     course         = new TQF.Course().getCourse(row.CourseCode);
            CourseElective courseElective = new CourseElective().getCourseElectiveId(row.CourseCode);

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            TableCell cellCourseCode = new TableCell();
            string    urlShow        = "showCOURSE.aspx?token=" + row.CourseCode + "&CurrCode=" + row.CurrCode + "&YearVersion=" + row.YearVersion;
            HyperLink hypShow        = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            hypShow.Text        = course.CourseCode + courseElective.CourseElectiveCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);


            TableCell cellNCourseThName = new TableCell();
            cellNCourseThName.Text  = course.CourseThName + courseElective.CourseElectiveThName + "<BR>";
            cellNCourseThName.Text += course.CourseEnName + courseElective.CourseElectiveEnName;
            tRowBody.Cells.Add(cellNCourseThName);

            TableCell cellNumCredit = new TableCell();
            cellNumCredit.Text  = course.Credit + courseElective.Credit + " (" + course.TheoryHour + "-" + course.PracticeHour + "-" + course.SelfStudyHour + ")";
            cellNumCredit.Width = 100;
            tRowBody.Cells.Add(cellNumCredit);

            TableCell cellPreReq   = new TableCell();
            string    urlAddCourse = "addCOURSE_to_PREREQ.aspx?CurrCode=" + row.CurrCode + "&YearVersion=" + row.YearVersion + "&CurrFormatCode=" + row.CurrFormatCode + "&CurrTypeCode=" + row.CurrTypeCode + "&MajorCode=" + row.MajorCode + "&CategoryCode=" + row.CategoryCode + "&CourseGroupCode=" + row.CourseGroupCode + "&CourseTypeCode=" + row.CourseTypeCode + "&CourseCode=" + row.CourseCode;
            HyperLink hypPreReq    = new HyperLink();
            //hypPreReq.Attributes.Add("data-target", "#deleteCURR4");
            //hypPreReq.Attributes.Add("data-toggle", "modal");
            hypPreReq.Text        = "<h4><i class=\"fa fa-clipboard\"></i></h4>";
            hypPreReq.NavigateUrl = urlAddCourse;
            hypPreReq.ToolTip     = "กำหนด Prerequisite";
            cellPreReq.Controls.Add(hypPreReq);
            cellPreReq.CssClass = "text-center";
            cellPreReq.Width    = 60;
            tRowBody.Cells.Add(cellPreReq);

            TableCell cellDel = new TableCell();
            string    urlDel  = "delete_CURR6.aspx?T2S3No=" + row.T2S3No + "&CurrCode=" + row.CurrCode + "&YearVersion=" + row.YearVersion + "&CurrFormatCode=" + row.CurrFormatCode + "&CurrTypeCode=" + row.CurrTypeCode + "&MajorCode=" + row.MajorCode + "&CategoryCode=" + row.CategoryCode + "&CourseGroupCode=" + row.CourseGroupCode + "&CourseTypeCode=" + row.CourseTypeCode + "&CourseCode=" + row.CourseCode;
            HyperLink hypDel  = new HyperLink();
            hypDel.Attributes.Add("data-target", "#deleteCURR6");
            hypDel.Attributes.Add("data-toggle", "modal");
            hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
            hypDel.NavigateUrl = urlDel;
            hypDel.ToolTip     = "Delete";
            cellDel.Controls.Add(hypDel);
            cellDel.CssClass = "text-center";
            cellDel.Width    = 60;
            tRowBody.Cells.Add(cellDel);

            tblName.Rows.Add(tRowBody);
        }
    }
Exemplo n.º 23
0
    //private string FacultyId;

    protected void Page_Load(object sender, EventArgs e)
    {
        CurrCode        = Request.QueryString["CurrCode"];
        YearVersion     = Request.QueryString["YearVersion"];
        CurrFormatCode  = Request.QueryString["CurrFormatCode"];
        CurrTypeCode    = Request.QueryString["CurrTypeCode"];
        MajorCode       = Request.QueryString["MajorCode"];
        CourseGroupCode = Request.QueryString["CourseGroupCode"];
        CategoryCode    = Request.QueryString["CategoryCode"];
        CourseTypeCode  = Request.QueryString["CourseTypeCode"];
        CourseCode      = Request.QueryString["CourseCode"];

        TQF.Curriculum currTitle = new TQF.Curriculum().getCurriculum(CurrCode, YearVersion);
        lblHeader1.Text = currTitle.CurrCode + " หลักสูตร" + currTitle.CurrThName;
        lblHeader2.Text = currTitle.CurrEnName;

        string currStatus;

        if (currTitle.CurrStatus == "1")
        {
            currStatus      = "หลักสูตรใหม่";
            lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
        }
        if (currTitle.CurrStatus == "2")
        {
            currStatus      = "หลักปรับปรุง";
            lblHeader3.Text = "(" + currStatus + " พ.ศ. " + currTitle.YearVersion + ")";
        }

        lblCurrFormatTitle.Text = new CurrFormat().getCurrFormat(CurrFormatCode).CurrFormatName + " (" + new TQF.Major().getMajor(MajorCode).MajorThName + ")";

        TQF.Course course = new TQF.Course().getCourse(CourseCode);
        lblCourseTitle.Text = course.CourseCode + " " + course.CourseThName + "<br> (" + course.CourseEnName + ")";

        // Head Table
        string[] ar = { "ลำดับเงื่อนไข", "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "เรียนก่อน/ร่วม", "ลบ" };
        tblCourse.Attributes.Add("class", "table table-striped table-bordered table-hover");
        tblCourse.Attributes.Add("id", "dt_basic");
        TableHeaderRow tRowHead = new TableHeaderRow();

        tRowHead.TableSection = TableRowSection.TableHeader;
        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
        {
            TableHeaderCell cellHead = new TableHeaderCell();
            if (cellCtr == 1)
            {
                cellHead.Width = 50;
            }
            if (cellCtr == 2 || cellCtr == 4)
            {
                cellHead.Width = 80;
            }
            if (cellCtr == 5)
            {
                cellHead.Width = 120;
            }
            if (cellCtr == 6)
            {
                cellHead.Width = 60;
            }

            cellHead.Text = ar[cellCtr - 1];
            tRowHead.Cells.Add(cellHead);
        }
        tblCourse.Rows.Add(tRowHead);

        string sqlPreRequisite           = "Select * From PREREQUISITE Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And CURRFORMATCODE='" + CurrFormatCode + "' And CURRTYPECODE='" + CurrTypeCode + "' And MAJORCODE='" + MajorCode + "' And COURSEGROUPCODE='" + CourseGroupCode + "' And CATEGORYCODE='" + CategoryCode + "' And COURSETYPECODE='" + CourseTypeCode + "' And COURSECODE='" + CourseCode + "' Order by PREREQUISITERULE";
        List <PreRequisite> preRequisite = new PreRequisite().getPreRequisiteManual(sqlPreRequisite);

        foreach (PreRequisite data in preRequisite)
        {
            TQF.Course courseData = new TQF.Course().getCourse(data.PreRequisiteCourseCode);

            TableRow tRowBody = new TableRow();
            tRowBody.TableSection = TableRowSection.TableBody;

            //Cell [0]
            TableCell cellPreRequisiteRule = new TableCell();
            cellPreRequisiteRule.Text     = data.PreRequisiteRule;
            cellPreRequisiteRule.CssClass = "text-center";
            cellPreRequisiteRule.Width    = 50;
            tRowBody.Cells.Add(cellPreRequisiteRule);

            //Cell [1]
            TableCell cellCourseCode = new TableCell();
            //string urlShow = "showCOURSE.aspx?token=" + data.PreRequisiteCourseCode;
            string    urlShow = "showCOURSE.aspx?token=" + data.PreRequisiteCourseCode + "&CurrCode=" + data.CurrCode + "&YearVersion=" + data.YearVersion;
            HyperLink hypShow = new HyperLink();
            hypShow.Attributes.Add("data-target", "#showModal");
            hypShow.Attributes.Add("data-toggle", "modal");
            hypShow.Text        = data.PreRequisiteCourseCode;
            hypShow.NavigateUrl = urlShow;
            hypShow.ToolTip     = "Course details";
            cellCourseCode.Controls.Add(hypShow);
            cellCourseCode.CssClass = "text-center";
            cellCourseCode.Width    = 80;
            tRowBody.Cells.Add(cellCourseCode);

            //Cell [2]
            TableCell cellCourseThName = new TableCell();
            cellCourseThName.Text = courseData.CourseThName + "<BR>" + courseData.CourseEnName;
            tRowBody.Cells.Add(cellCourseThName);

            //Cell [3]
            TableCell cellNumCredit = new TableCell();
            cellNumCredit.Text  = courseData.Credit + "(" + courseData.TheoryHour + "-" + courseData.PracticeHour + "-" + courseData.SelfStudyHour + ")";
            cellNumCredit.Width = 80;
            tRowBody.Cells.Add(cellNumCredit);

            //Cell [4]
            TableCell cellPreRequisiteFormat = new TableCell();
            if (data.PreRequisiteFormat == "B")
            {
                cellPreRequisiteFormat.Text = "บังคับเรียนก่อน";
            }
            if (data.PreRequisiteFormat == "C")
            {
                cellPreRequisiteFormat.Text = "บังคับเรียนร่วมกัน";
            }
            if (data.PreRequisiteFormat == "D")
            {
                cellPreRequisiteFormat.Text = "บังคับเรียนก่อน/บังคับเรียนร่วมกัน";
            }
            //cellPreRequisiteFormat.Text = data.PreRequisiteFormat;
            cellPreRequisiteFormat.Width = 120;
            tRowBody.Cells.Add(cellPreRequisiteFormat);

            //Cell [5]
            TableCell cellDel = new TableCell();
            string    urlDel  = "deletePREREQ.aspx?CurrCode=" + data.CurrCode + "&YearVersion=" + data.YearVersion + "&CurrFormatCode=" + data.CurrFormatCode + "&CurrTypeCode=" + data.CurrTypeCode + "&MajorCode=" + data.MajorCode + "&CategoryCode=" + data.CategoryCode + "&CourseGroupCode=" + data.CourseGroupCode + "&CourseTypeCode=" + data.CourseTypeCode + "&CourseCode=" + data.CourseCode + "&PreRequisiteCourseCode=" + data.PreRequisiteCourseCode + "&PreRequisiteRule=" + data.PreRequisiteRule;
            HyperLink hypDel  = new HyperLink();
            hypDel.Attributes.Add("data-target", "#deletePREREQ");
            hypDel.Attributes.Add("data-toggle", "modal");
            hypDel.Text        = "<h4><i class='fa fa-trash-o'></i></h4>";
            hypDel.NavigateUrl = urlDel;
            hypDel.ToolTip     = "Delete";
            cellDel.Controls.Add(hypDel);
            cellDel.CssClass = "text-center";
            cellDel.Width    = 60;
            tRowBody.Cells.Add(cellDel);
            tblCourse.Rows.Add(tRowBody);
        }
    }