Ejemplo n.º 1
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.board_reg_sta) || autro_obj.CheckGroupUser(login_data, group_var.officer_reg_sta) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                //========== Process ============
                if (!Page.IsPostBack)
                {
                    success.Visible = false;
                    fail.Visible    = false;
                    config_data     = new TeachExamConfig().getTeachExamConfig();

                    txtStartDate.Text = config_data.Date_Start;
                    txtStopDate.Text  = config_data.Date_Stop;
                }
                //===============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 2
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        utility  utlObj = new utility();
        DateTime dt;

        if (ddlDepartment.SelectedItem.Value == "0")
        {
            MsgValidate("โปรดระบุ ภาควิชา");
        }
        else if (!DateTime.TryParseExact(txtStartDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
        {
            MsgValidate("รูปแบบวันเริ่มต้นการจัดตาราสอน/ตาราสอบ วัน/เดือน/ปี เช่น 01/10/2015");
        }
        else if (!DateTime.TryParseExact(txtStopDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
        {
            MsgValidate("รูปแบบวันสุดท้ายการจัดตาราสอน/ตาราสอบ วัน/เดือน/ปี เช่น 01/10/2015");
        }
        else if (utlObj.getDiffDate(txtStartDate.Text, txtStopDate.Text) > 0)
        {
            MsgValidate("วันเริ่มแรกและวันสุดท้ายของการขึ้นทะเบียน ไม่สอดคล้องกัน");
        }
        else
        {
            string result = "";
            config_data.Faculty_Code    = ddlFACULTY.SelectedItem.Value;
            config_data.Department_Code = ddlDepartment.SelectedItem.Value;
            config_data.Date_Start      = txtStartDate.Text;
            config_data.Date_Stop       = txtStopDate.Text;

            configData = new TeachExamConfig().getExtendTeachExamConfig(ddlDepartment.SelectedItem.Value);

            if (configData.Department_Code == null)
            {
                result          = new TeachExamConfig().extendDateConfig(config_data);
                lblSuccess.Text = "เพิ่มข้อมูลสำเร็จ";
            }
            else
            {
                config_data.Department_Code = configData.Department_Code;
                result          = new TeachExamConfig().updateExtendDateConfig(config_data);
                lblSuccess.Text = "แก้ไขข้อมูลสำเร็จ";
            }

            if (result == "OK")
            {
                success.Visible = true;
                fail.Visible    = false;
            }
            else
            {
                success.Visible = false;
                fail.Visible    = true;
            }
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        divFail.Visible = false;
        divShow.Visible = false;

        if (!Page.IsPostBack)
        {
            config_data           = new TeachExamConfig().getTeachExamConfig();
            txtACADEMIC_YEAR.Text = config_data.AcademicYear;
            academic_year         = config_data.AcademicYear;
            ddlSEMESTER.Items.FindByValue(config_data.Semester).Selected = true;

            degreeLevel = new Degree().getDegreeChar();

            // ระดับการศึกษา
            foreach (DegreeData data in degreeLevel)
            {
                ddlDegreeLevel.Items.Insert(ddlDegreeLevel.Items.Count, new ListItem(data.Degree_Thai, data.Degree_Char));
            }

            try
            {
                if ((Request.QueryString["view_course"] != null) || (Request.QueryString["view_degree"] != null))
                {
                    txtCOURSE_CODE.Text = Request.QueryString["view_course"];

                    for (int i = 0; i < ddlDegreeLevel.Items.Count; i++)
                    {
                        if (ddlDegreeLevel.Items[i].Value == Request.QueryString["view_degree"])
                        {
                            ddlDegreeLevel.Items[i].Selected = true;
                        }
                    }

                    btnSEARCH_Click(null, null);
                }
            }
            catch
            {
                divFail.Visible = true;
                divShow.Visible = false;
            }
        }


        academic_year        = txtACADEMIC_YEAR.Text;
        lblAcademicYear.Text = ddlSEMESTER.SelectedValue + "/" + academic_year;
    }
Ejemplo n.º 4
0
    public TeachExamConfigData getExtendTeachExamConfig(string department_code)
    {
        TeachExamConfigData config_data = new TeachExamConfigData();
        string        sql       = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        sql = "Select * From TEACH_EXAM_EXTEND_CONFIG Where DEPARTMENT_CODE='" + department_code + "'";

        oracleObj.SelectCommand = sql;
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            config_data.Faculty_Code    = rowData["FACULTY_CODE"].ToString();
            config_data.Department_Code = rowData["DEPARTMENT_CODE"].ToString();
            config_data.Date_Start      = rowData["EX_DATE_START"].ToString();
            config_data.Date_Stop       = rowData["EX_DATE_STOP"].ToString();
        }

        return(config_data);
    }
Ejemplo n.º 5
0
    public TeachExamConfigData getTeachExamConfig()
    {
        TeachExamConfigData config_data = new TeachExamConfigData();
        string        sql       = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        sql = "Select * From TEACH_EXAM_CONFIG";

        oracleObj.SelectCommand = sql;
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            config_data.AcademicYear = rowData["ACADEMIC_YEAR"].ToString();
            config_data.Semester     = rowData["SEMESTER"].ToString();
            config_data.Date_Start   = rowData["DATE_START"].ToString();
            config_data.Date_Stop    = rowData["DATE_STOP"].ToString();
        }

        return(config_data);
    }
Ejemplo n.º 6
0
    public string updateDateConfig(TeachExamConfigData config_data)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "Update TEACH_EXAM_CONFIG Set DATE_START='" + config_data.Date_Start + "',DATE_STOP='" + config_data.Date_Stop + "' ";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString() + " ";
        }

        return(response);
    }
Ejemplo n.º 7
0
    public string updateYearSemesterConfig(TeachExamConfigData config_data)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "Update TEACH_EXAM_CONFIG Set ACADEMIC_YEAR='" + config_data.AcademicYear + "',SEMESTER='" + config_data.Semester + "' ";

        oracleObj.UpdateCommand = sql;

        try
        {
            if (oracleObj.Update() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString() + " ";
        }

        return(response);
    }
Ejemplo n.º 8
0
    public string extendDateConfig(TeachExamConfigData config_data)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "Insert Into TEACH_EXAM_EXTEND_CONFIG(FACULTY_CODE,DEPARTMENT_CODE,EX_DATE_START,EX_DATE_STOP) Values('" + config_data.Faculty_Code + "','" + config_data.Department_Code + "','" + config_data.Date_Start + "','" + config_data.Date_Stop + "')";

        oracleObj.InsertCommand = sql;

        try
        {
            if (oracleObj.Insert() == 1)
            {
                response = "OK";
            }
        }
        catch (Exception e)
        {
            response = e.Message.ToString() + " ";
        }

        return(response);
    }
Ejemplo n.º 9
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.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                divFail.Visible = false;

                if ((Session["save_data"] != null) && (Session["service_course"] != null))
                {
                    ConnectDB     db        = new ConnectDB();
                    SqlDataSource oracleObj = db.ConnectionOracle_tqf2();


                    available_data = (AvailableCourseData)Session["save_data"];
                    service_code   = (bool)Session["service_course"];



                    if (service_code == true)
                    {
                        // ตรวจสอบกำหนดการ

                        int diffDate = -1;


                        config_data1 = new TeachExamConfig().getTeachExamConfig();

                        if (config_data1.Date_Stop != null)
                        {
                            diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday());
                        }



                        string sql = "";
                        curr_year       = available_data.Curr_Code.Substring(0, 4);
                        curr_code       = available_data.Curr_Code.Substring(4);
                        lblFaculty.Text = "วิชาบริการศึกษา";
                        //available_data.Faculty_Code = "xx";
                        //available_data.Department_Code = "xxxx";
                        available_data.Major_Code = "xxxxxx";
                        lblCurri.Text             = new Curriculum().getCurriculum(available_data.Curr_Code).Curr_ThaiName + " (" + curr_year + ")";


                        //วิชาการคณะ
                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string fac in faculty_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + fac + "%'";

                                if (faculty_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                            // lblCurri.Text = sql;
                        }

                        //วิชาการภาค
                        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);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string dep in department_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + dep + "%'";

                                if (department_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                        }

                        oracleObj.SelectCommand = sql;
                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        all_course.Clear();
                        foreach (DataRowView rowData in allData)
                        {
                            int diffExtDate = -1;
                            config_data2 = new TeachExamConfig().getExtendTeachExamConfig(rowData["COURSECODE"].ToString().Substring(0, 4));
                            if (config_data2.Date_Stop != null)
                            {
                                diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                            }

                            if (diffDate >= 0)
                            {
                                if (course.checkStatus(rowData["COURSECODE"].ToString()))
                                {
                                    all_course.Add(rowData["COURSECODE"].ToString());
                                }
                            }
                            else if (diffExtDate >= 0)
                            {
                                if (course.checkStatus(rowData["COURSECODE"].ToString()))
                                {
                                    all_course.Add(rowData["COURSECODE"].ToString());
                                }
                            }
                        }
                    }
                    else if (service_code == false)
                    {
                        curr_year = available_data.Curr_Code.Substring(0, 4);
                        curr_code = available_data.Curr_Code.Substring(4);

                        lblFaculty.Text = new Faculty().getFaculty(available_data.Faculty_Code).Faculty_Thai;
                        lblCurri.Text   = curr_code + " " + new Curriculum().getCurriculum(available_data.Curr_Code).Curr_ThaiName + " (" + curr_year + ")";

                        string sql = "";

                        //วิชาการคณะ
                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string fac in faculty_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + fac + "%'";

                                if (faculty_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                        }

                        //วิชาการภาค
                        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);

                            sql = "Select DISTINCT COURSECODE From TQF2SEC3PLANDETAIL Where CURRCODE='" + curr_code + "' AND YEARVERSION='" + curr_year + "' AND  COURSECODE NOT Like '%x' AND (";

                            int ii = 0;
                            foreach (string dep in department_authorized)
                            {
                                ii++;
                                sql += "COURSECODE Like '" + dep + "%'";

                                if (department_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") Order By COURSECODE";
                        }

                        oracleObj.SelectCommand = sql;

                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        all_course.Clear();
                        foreach (DataRowView rowData in allData)
                        {
                            if (course.checkStatus(rowData["COURSECODE"].ToString()))
                            {
                                all_course.Add(rowData["COURSECODE"].ToString());
                            }
                        }
                    }


                    RadioButton[] radio = new RadioButton[all_course.Count];
                    int           i     = 0;

                    // Head Table
                    string[] ar  = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "เลือก" };
                    Table    tb1 = new Table();
                    tb1.Attributes.Add("class", "table table-bordered table-hover");
                    tb1.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.Attributes.Add("class", "text-center");
                        cellHead.Text = ar[cellCtr - 1];
                        tRowHead.Cells.Add(cellHead);
                    }

                    tb1.Rows.Add(tRowHead);

                    foreach (string course_code in all_course)
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

                        course_data = course.getCourse(course_code);


                        TableCell cellCourse_Code = new TableCell();
                        cellCourse_Code.Text = course_data.Course_Code;
                        tRowBody.Cells.Add(cellCourse_Code);

                        TableCell cellCourse_Name = new TableCell();
                        cellCourse_Name.Text = course_data.Course_Thainame + "<br/>" + course_data.Course_Engname;
                        tRowBody.Cells.Add(cellCourse_Name);

                        TableCell cellCourse_Credit = new TableCell();
                        cellCourse_Credit.Text = Convert.ToString(course_data.Credit) + "(" + Convert.ToString(course_data.Theory) + "-" + Convert.ToString(course_data.Practice) + "-" + course_data.Self_Study.ToString() + ")";
                        cellCourse_Credit.Attributes.Add("class", "text-center");
                        tRowBody.Cells.Add(cellCourse_Credit);

                        TableCell cellCourse_Radio = new TableCell();

                        radio[i]    = new RadioButton();
                        radio[i].ID = course_data.Course_Code;
                        cellCourse_Radio.Attributes.Add("class", "text-center");
                        radio[i].AutoPostBack    = true;
                        radio[i].GroupName       = "course_group";
                        radio[i].CheckedChanged += new EventHandler(radioButtons_CheckedChanged);
                        cellCourse_Radio.Controls.Add(radio[i]);


                        tRowBody.Cells.Add(cellCourse_Radio);

                        tb1.Rows.Add(tRowBody);

                        i++;
                    }

                    TableRow  row  = new TableRow();
                    TableCell cell = new TableCell();
                    cell.Controls.Add(tb1);
                    row.Cells.Add(cell);
                    tblCourse.Rows.Add(row);

                    //Disable Next button when page load
                    btnNext.Disabled = true;
                }
                else
                {
                    divShow.Visible = false;
                    divFail.Visible = true;
                }
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo 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.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department) || autro_obj.CheckGroupUser(login_data, group_var.board_reg_sta) || autro_obj.CheckGroupUser(login_data, group_var.officer_reg_sta))
            {
                divShow.Visible    = false;
                divSuccess.Visible = false;
                divFail.Visible    = false;
                divFail2.Visible   = false;

                try
                {
                    divShow.Visible = true;

                    academic_year = Request.QueryString["year"];
                    semester      = Request.QueryString["sem"];
                    course_code   = Request.QueryString["course"];
                    curr_code     = Request.QueryString["curr_code"];
                    fac_code      = Request.QueryString["fac_code"];
                    dep_code      = Request.QueryString["dep_code"];
                    degree_char   = Request.QueryString["degree_char"];

                    //course_type = "";

                    //if (Request.QueryString["type"] == "S")
                    //{
                    //    course_type = "1";
                    //}
                    //else if (Request.QueryString["type"] == "L")
                    //{
                    //    course_type = "2";
                    //}
                    //else if (Request.QueryString["type"] == "T")
                    //{
                    //    course_type = "4";
                    //}
                    //else if (Request.QueryString["type"] == "M")
                    //{
                    //    course_type = "5";
                    //}
                    //else if (Request.QueryString["type"] == "SP")
                    //{
                    //    course_type = "6";
                    //}
                    //else if (Request.QueryString["type"] == "D")
                    //{
                    //    course_type = "7";
                    //}

                    //sec_num = Convert.ToInt16(Request.QueryString["sec"]);
                    //subsec_num = Convert.ToInt16(Request.QueryString["subsec"]);
                    //getAvailableCourse(string academic_year, string semester, string faculty_code, string department_code, string curr_code, string course_code, string degree_char)

                    available_data = new AvailableCourse().getAvailableCourse(academic_year, semester, fac_code, dep_code, curr_code, course_code, degree_char);

                    // ตรวจสอบกำหนดการ
                    config_data1 = new TeachExamConfig().getTeachExamConfig();
                    config_data2 = new TeachExamConfig().getExtendTeachExamConfig(available_data[0].Department_Code);
                    int diffDate    = -1;
                    int diffExtDate = -1;

                    if (config_data1.Date_Stop != null)
                    {
                        diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday());
                    }

                    if (config_data2.Date_Stop != null)
                    {
                        diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                    }

                    // งานทะเบียน บัญฑิต
                    if (autro_obj.CheckGroupUser(login_data, group_var.board_reg_sta) || autro_obj.CheckGroupUser(login_data, group_var.officer_reg_sta))
                    {
                    }
                    // วิชาการ คณะ
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    {
                        int           i = 0;
                        List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);
                        foreach (string fac in faculty_authorized)
                        {
                            if (available_data[0].Faculty_Code == fac)
                            {
                                i++;
                                break;
                            }
                        }

                        if (i == 0)
                        {
                            MsgValidate("ไม่มีสิทธิ์ในการแก้ไขข้อมูล");
                            btnSAVE.Enabled = false;
                        }
                        else if (diffDate < 0 && diffExtDate < 0)
                        {
                            MsgValidate("เกินกำหนดระยะเวลาแก้ไขข้อมูล");
                            btnSAVE.Enabled = false;
                        }
                    }
                    // วิชาการภาค
                    else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                    {
                        int           i = 0;
                        List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);
                        foreach (string dep in department_authorized)
                        {
                            if (available_data[0].Department_Code == dep)
                            {
                                i++;
                                break;
                            }
                        }

                        if (i == 0)
                        {
                            MsgValidate("ไม่มีสิทธิ์ในการแก้ไขข้อมูล");
                            btnSAVE.Enabled = false;
                        }
                        else if (diffDate < 0 && diffExtDate < 0)
                        {
                            MsgValidate("เกินกำหนดระยะเวลาแก้ไขข้อมูล");
                            btnSAVE.Enabled = false;
                        }
                    }



                    exam_data = examObj.getExamTable(available_data[0].AcademicYear, available_data[0].Semester, available_data[0].Course_Code, available_data[0].Faculty_Code, available_data[0].Department_Code, available_data[0].Curr_Code, degree_char);

                    if (exam_data.Course_Code != null)
                    {
                        if (!IsPostBack)
                        {
                            txtMIDEXAM_DAY.Text        = exam_data.ExamMid_Day;
                            txtMIDTERM_START_TIME.Text = exam_data.ExamMid_StartTime;
                            txtMIDTERM_END_TIME.Text   = exam_data.ExamMid_EndTime;
                            txtFINALEXAM_DAY.Text      = exam_data.ExamFinal_Day;
                            txtFINAL_START_TIME.Text   = exam_data.ExamFinal_StartTime;
                            txtFINAL_END_TIME.Text     = exam_data.ExamFinal_EndTime;
                        }

                        save         = false;
                        btnSAVE.Text = "Update";
                    }
                    else
                    {
                        save         = true;
                        btnSAVE.Text = "Save";
                    }

                    lblSemesterYear.Text = semester + "/" + academic_year;
                    CourseData course_data = new CourseData();
                    course_data    = new Course().getCourse(available_data[0].Course_Code);
                    lblCourse.Text = available_data[0].Course_Code + ":" + course_data.Course_Engname + ", " + course_data.Credit + "(" + course_data.Theory + "-" + course_data.Practice + "-" + course_data.Self_Study + ")";

                    //if (course_type == "1")
                    //{
                    //    lblSec.Text = "S." + sec_num;
                    //}
                    //else if (course_type == "2")
                    //{
                    //    if (subsec_num != 0)
                    //    {
                    //        lblSec.Text = "L." + subsec_num;
                    //    }
                    //    else
                    //    {
                    //        lblSec.Text = "L." + sec_num;
                    //    }
                    //}
                    //else if (course_type == "4")
                    //{
                    //    lblSec.Text = "T." + sec_num;
                    //}
                    //else if (course_type == "5")
                    //{
                    //    lblSec.Text = "M." + sec_num;
                    //}
                    //else if (course_type == "6")
                    //{
                    //    lblSec.Text = "SP." + sec_num;
                    //}
                    //else if (course_type == "7")
                    //{
                    //    lblSec.Text = "D." + sec_num;
                    //}
                }
                catch
                {
                    divFail.Visible = true;
                }
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 11
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.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                divFail.Visible = false;

                if ((Session["save_data"] != null) && (Session["service_course"] != null))
                {
                    ConnectDB     db        = new ConnectDB();
                    SqlDataSource oracleObj = db.ConnectionOracle();

                    available_data = (AvailableCourseData)Session["save_data"];
                    service_code   = (bool)Session["service_course"];

                    CurriculumGeneralData curr = new Curriculum().getCurriculum(available_data.Curr_Code);
                    degree_char = curr.Degree_Char;


                    CourseData course_data = new CourseData();
                    Course     course      = new Course();

                    List <string> all_course = new List <string>();
                    string        TableName  = new AvailableCourse().getTableName(degree_char);

                    string sql = "";

                    if (service_code == true)
                    {
                        lblFaculty.Text = "วิชาบริการศึกษา";
                        lblCurri.Text   = curr.Curr_ThaiName + " (ปีหลักสูตร " + curr.Curr_Year + ")";

                        // ตรวจสอบกำหนดการ

                        int diffDate = -1;


                        config_data1 = new TeachExamConfig().getTeachExamConfig();

                        if (config_data1.Date_Stop != null)
                        {
                            diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday());
                        }

                        //วิชาการคณะ
                        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                        {
                            List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                            sql = "Select COURSE_CODE From " + TableName + " Where ACADEMIC_YEAR='" + available_data.AcademicYear + "' And SEMESTER='" + available_data.Semester + "' And CURR_CODE='" + available_data.Curr_Code + "' And (";

                            int ii = 0;
                            foreach (string fac in faculty_authorized)
                            {
                                ii++;
                                sql += "FACULTY_CODE= '" + fac + "'";

                                if (faculty_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") GROUP By COURSE_CODE Order By COURSE_CODE";
                        }
                        //วิชาการภาค
                        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);

                            sql = "Select COURSE_CODE From " + TableName + " Where ACADEMIC_YEAR='" + available_data.AcademicYear + "' And SEMESTER='" + available_data.Semester + "' And CURR_CODE='" + available_data.Curr_Code + "' And (";

                            int ii = 0;
                            foreach (string dep in department_authorized)
                            {
                                ii++;
                                sql += "DEPARTMENT_CODE= '" + dep + "'";

                                if (department_authorized.Count != ii)
                                {
                                    sql += " OR ";
                                }
                            }

                            sql += ") GROUP By COURSE_CODE Order By COURSE_CODE";
                        }

                        oracleObj.SelectCommand = sql;
                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        all_course.Clear();
                        foreach (DataRowView rowData in allData)
                        {
                            int diffExtDate = -1;
                            config_data2 = new TeachExamConfig().getExtendTeachExamConfig(rowData["COURSE_CODE"].ToString().Substring(0, 4));
                            if (config_data2.Date_Stop != null)
                            {
                                diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                            }

                            if (diffDate >= 0)
                            {
                                all_course.Add(rowData["COURSE_CODE"].ToString());
                            }
                            else if (diffExtDate >= 0)
                            {
                                all_course.Add(rowData["COURSE_CODE"].ToString());
                            }
                        }
                    }
                    else if (service_code == false)
                    {
                        lblFaculty.Text = new Faculty().getFaculty(available_data.Faculty_Code).Faculty_Thai;
                        lblCurri.Text   = curr.Curr_Code + " " + curr.Curr_ThaiName;

                        sql = "Select COURSE_CODE From " + TableName + " Where ACADEMIC_YEAR='" + available_data.AcademicYear + "' And SEMESTER='" + available_data.Semester + "' And FACULTY_CODE='" + available_data.Faculty_Code + "' And DEPARTMENT_CODE='" + available_data.Department_Code + "' And CURR_CODE='" + available_data.Curr_Code + "' GROUP By COURSE_CODE Order By COURSE_CODE";

                        oracleObj.SelectCommand = sql;
                        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
                        foreach (DataRowView rowData in allData)
                        {
                            all_course.Add(rowData["COURSE_CODE"].ToString());
                        }
                    }



                    RadioButton[] radio = new RadioButton[all_course.Count];
                    int           i     = 0;

                    // Head Table
                    string[] ar  = { "รหัสวิชา", "ชื่อวิชา", "หน่วยกิต", "เลือก" };
                    Table    tb1 = new Table();
                    tb1.Attributes.Add("class", "table table-bordered table-hover");
                    tb1.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.Attributes.Add("class", "text-center");
                        cellHead.Text = ar[cellCtr - 1];
                        tRowHead.Cells.Add(cellHead);
                    }

                    tb1.Rows.Add(tRowHead);

                    foreach (string course_code in all_course)
                    {
                        TableRow tRowBody = new TableRow();
                        tRowBody.TableSection = TableRowSection.TableBody;

                        course_data = course.getCourse(course_code);

                        if (course_data.Practice != 0 && course_data.Theory != 0)
                        {
                            TableCell cellCourse_Code = new TableCell();
                            cellCourse_Code.Text = course_data.Course_Code;
                            tRowBody.Cells.Add(cellCourse_Code);

                            TableCell cellCourse_Name = new TableCell();
                            cellCourse_Name.Text = course_data.Course_Thainame + "<br/>" + course_data.Course_Engname;
                            tRowBody.Cells.Add(cellCourse_Name);

                            TableCell cellCourse_Credit = new TableCell();
                            cellCourse_Credit.Attributes.Add("class", "text-center");
                            cellCourse_Credit.Text = Convert.ToString(course_data.Credit) + "(" + Convert.ToString(course_data.Theory) + "-" + Convert.ToString(course_data.Practice) + "-" + course_data.Self_Study.ToString() + ")";
                            tRowBody.Cells.Add(cellCourse_Credit);

                            TableCell cellCourse_Radio = new TableCell();
                            cellCourse_Radio.Attributes.Add("class", "text-center");
                            radio[i]              = new RadioButton();
                            radio[i].ID           = course_data.Course_Code;
                            radio[i].AutoPostBack = true;
                            radio[i].GroupName    = "course_group";
                            if (Session["selected_course"] != null)
                            {
                                if (radio[i].ID == (string)Session["selected_course"])
                                {
                                    radio[i].Checked = true;
                                }
                            }
                            radio[i].CheckedChanged += new EventHandler(radioButtons_CheckedChanged);
                            cellCourse_Radio.Controls.Add(radio[i]);
                            tRowBody.Cells.Add(cellCourse_Radio);

                            tb1.Rows.Add(tRowBody);

                            i++;
                        }
                    }

                    if (!Page.IsPostBack)
                    {
                        //A1.Disabled = true;
                    }

                    TableRow  row  = new TableRow();
                    TableCell cell = new TableCell();
                    cell.Controls.Add(tb1);
                    row.Cells.Add(cell);
                    tblCourse.Rows.Add(row);
                }
                else
                {
                    divShow.Visible = false;
                    divFail.Visible = true;
                }
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 12
0
    protected void ddlFACULTY_SelectedIndexChanged(object sender, EventArgs e)
    {
        string Curr_LevelCode = "";

        if (ddlDEGREE.SelectedValue == "U")
        {
            Curr_LevelCode = "01";
        }
        else if (ddlDEGREE.SelectedValue == "B")
        {
            Curr_LevelCode = "02";
        }
        else if (ddlDEGREE.SelectedValue == "P")
        {
            Curr_LevelCode = "05";
        }
        else if (ddlDEGREE.SelectedValue == "M")
        {
            Curr_LevelCode = "03";
        }
        else if (ddlDEGREE.SelectedValue == "D")
        {
            Curr_LevelCode = "04";
        }

        //วิชาการคณะ
        if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
        {
            // ตรวจสอบกำหนดการ
            config_data1 = new TeachExamConfig().getTeachExamConfig();

            int diffDate = -1;
            if (config_data1.Date_Stop != null)
            {
                diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday());
            }

            string faculty_code    = ddlFACULTY.SelectedValue;
            string department_code = "";

            departmentData = new Department().getDepartmentWithFaculty(faculty_code);
            ddlDepartment.Items.Clear();
            foreach (DepartmentData data in departmentData)
            {
                int diffExtDate = -1;
                config_data2 = new TeachExamConfig().getExtendTeachExamConfig(data.Department_Code);

                if (config_data2.Date_Stop != null)
                {
                    diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                }

                if (diffDate >= 0)
                {
                    ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code));
                }
                else if (diffExtDate >= 0)
                {
                    ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code));
                }
                else
                {
                    ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem("<เกินกำหนด> " + data.Department_Thai, data.Department_Code.Substring(0, 2) + "xx"));
                    //ddlDepartment.Items[ddlDepartment.Items.Count-1].Attributes.Add("style", "color:red;");
                }
            }

            department_code = ddlDepartment.SelectedValue;

            string curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE='" + department_code + "' AND CURRCODE!='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'";
            currData = new Curriculum().getManualCurriculum(curr_sql);

            ddlCURRICULUM.Items.Clear();
            if (currData.Count.Equals(0))
            {
                ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0"));
            }
            else
            {
                foreach (CurriculumGeneralData data in currData)
                {
                    ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName + " (" + data.Curr_Year + ")", data.Curr_Year + data.Curr_Code));
                }
            }
        }
    }
Ejemplo n.º 13
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.officer_faculty) || autro_obj.CheckGroupUser(login_data, group_var.officer_department))
            {
                divFail.Visible = false;
                if (rbt1.Checked == true)
                {
                    ddlServiceCURRICULUM.Enabled   = false;
                    ddlServiceCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");

                    ddlFACULTY.Enabled      = true;
                    ddlDepartment.Enabled   = true;
                    ddlCURRICULUM.Enabled   = true;
                    ddlFACULTY.BackColor    = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
                    ddlDepartment.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
                    ddlCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
                }
                else if (rbt2.Checked == true)
                {
                    ddlFACULTY.Enabled      = false;
                    ddlDepartment.Enabled   = false;
                    ddlCURRICULUM.Enabled   = false;
                    ddlFACULTY.BackColor    = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
                    ddlDepartment.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
                    ddlCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");

                    ddlServiceCURRICULUM.Enabled   = true;
                    ddlServiceCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
                }

                if (!Page.IsPostBack)
                {
                    Session.Remove("save_data");
                    Session.Remove("save_student");
                    Session.Remove("save_teaching");
                    Session.Remove("save_p_teaching");
                    Session.Remove("save_lecturer");
                    Session.Remove("selected_course");
                    Session.Remove("selected_t_course");
                    Session.Remove("Sec");
                    Session.Remove("number_student");
                    Session.Remove("service_course");

                    config_data           = new TeachExamConfig().getTeachExamConfig();
                    txtACADEMIC_YEAR.Text = config_data.AcademicYear;
                    academic_year         = config_data.AcademicYear;
                    ddlSEMESTER.Items.FindByValue(config_data.Semester).Selected = true;

                    string faculty_code    = "";
                    string department_code = "";

                    // ระดับการศึกษา
                    degreeLevel = new Degree().getDegreeChar();
                    foreach (DegreeData data in degreeLevel)
                    {
                        ddlDEGREE.Items.Insert(ddlDEGREE.Items.Count, new ListItem(data.Degree_Thai, data.Degree_Char));
                    }

                    string Curr_LevelCode = "";
                    if (ddlDEGREE.SelectedValue == "U")
                    {
                        Curr_LevelCode = "01";
                    }
                    else if (ddlDEGREE.SelectedValue == "B")
                    {
                        Curr_LevelCode = "02";
                    }
                    else if (ddlDEGREE.SelectedValue == "M")
                    {
                        Curr_LevelCode = "03";
                    }
                    else if (ddlDEGREE.SelectedValue == "P")
                    {
                        Curr_LevelCode = "05";
                    }
                    else if (ddlDEGREE.SelectedValue == "D")
                    {
                        Curr_LevelCode = "04";
                    }

                    // ตรวจสอบกำหนดการ
                    config_data1 = new TeachExamConfig().getTeachExamConfig();

                    int diffDate = -1;
                    if (config_data1.Date_Stop != null)
                    {
                        diffDate = utlObj.getDiffDate(config_data1.Date_Stop, utlObj.getToday());
                    }



                    //วิชาการคณะ
                    if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    {
                        List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                        facultyData = new Faculty().getFaculty(faculty_authorized);
                        foreach (FacultyData data in facultyData)
                        {
                            ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code));
                        }

                        faculty_code = ddlFACULTY.SelectedValue;

                        departmentData = new Department().getDepartmentWithFaculty(faculty_code);
                        foreach (DepartmentData data in departmentData)
                        {
                            int diffExtDate = -1;
                            config_data2 = new TeachExamConfig().getExtendTeachExamConfig(data.Department_Code);

                            if (config_data2.Date_Stop != null)
                            {
                                diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                            }

                            if (diffDate >= 0)
                            {
                                ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code));
                            }
                            else if (diffExtDate >= 0)
                            {
                                ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code));
                            }
                            else
                            {
                                ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem("<เกินกำหนด> " + data.Department_Thai, data.Department_Code.Substring(0, 2) + "xx"));
                                //ddlDepartment.Items[ddlDepartment.Items.Count - 1].Attributes.Add("style", "color:red;");
                            }
                        }

                        department_code = ddlDepartment.SelectedValue;

                        string curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND DEPARTMENTCODE='" + department_code + "' AND CURRCODE!='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'";
                        currData = new Curriculum().getManualCurriculum(curr_sql);

                        ddlCURRICULUM.Items.Clear();
                        if (currData.Count.Equals(0))
                        {
                            ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0"));
                        }
                        else
                        {
                            foreach (CurriculumGeneralData data in currData)
                            {
                                ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName + " (" + data.Curr_Year + ")", data.Curr_Year + data.Curr_Code));
                            }
                        }
                    }


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

                        // ตรวจสอบกำหนดการ
                        // config_data1 = new TeachExamConfig().getTeachExamConfig();



                        departmentData = new Department().getDepartment(department_authorized);
                        foreach (DepartmentData data in departmentData)
                        {
                            int diffExtDate = -1;
                            config_data2 = new TeachExamConfig().getExtendTeachExamConfig(data.Department_Code);

                            if (config_data2.Date_Stop != null)
                            {
                                diffExtDate = utlObj.getDiffDate(config_data2.Date_Stop, utlObj.getToday());
                            }

                            if (diffDate >= 0)
                            {
                                ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code));
                            }
                            else if (diffExtDate >= 0)
                            {
                                ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_Thai, data.Department_Code));
                            }
                            else
                            {
                                ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem("<เกินกำหนด> " + data.Department_Thai, data.Department_Code.Substring(0, 2) + "xx"));
                                //ddlDepartment.Items[ddlDepartment.Items.Count - 1].Attributes.Add("style", "color:red;");
                            }
                        }

                        department_code = ddlDepartment.SelectedValue;

                        faculty_data = new Faculty().getFaculty(department_code.Substring(0, 2));
                        ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code));

                        faculty_code = ddlFACULTY.SelectedValue;



                        string curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND  DEPARTMENTCODE='" + department_code + "' AND CURRCODE!='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'";
                        currData = new Curriculum().getManualCurriculum(curr_sql);

                        ddlCURRICULUM.Items.Clear();
                        if (currData.Count.Equals(0))
                        {
                            ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0"));
                        }
                        else
                        {
                            foreach (CurriculumGeneralData data in currData)
                            {
                                ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName, data.Curr_Year + data.Curr_Code));
                            }
                        }
                    }


                    // วิชาบริการ
                    string curr_sql2 = "Select * From CURRICULUM Where CURRCODE='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'";
                    currData2 = new Curriculum().getManualCurriculum(curr_sql2);
                    ddlServiceCURRICULUM.Items.Clear();
                    if (currData2.Count.Equals(0))
                    {
                        ddlServiceCURRICULUM.Items.Insert(ddlServiceCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0"));
                    }
                    else
                    {
                        foreach (CurriculumGeneralData data in currData2)
                        {
                            ddlServiceCURRICULUM.Items.Insert(ddlServiceCURRICULUM.Items.Count, new ListItem(data.Curr_ThaiName + " ( ปีหลักสูตร " + data.Curr_Year + " )", data.Curr_Year + data.Curr_Code));
                        }
                    }
                }

                academic_year = txtACADEMIC_YEAR.Text;
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        divFail.Visible = false;
        divShow.Visible = false;

        if (rbt1.Checked == true)
        {
            ddlServiceCURRICULUM.Enabled   = false;
            ddlServiceCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");

            ddlFACULTY.Enabled      = true;
            ddlCURRICULUM.Enabled   = true;
            ddlFACULTY.BackColor    = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
            ddlCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
        }
        else if (rbt2.Checked == true)
        {
            ddlFACULTY.Enabled      = false;
            ddlCURRICULUM.Enabled   = false;
            ddlFACULTY.BackColor    = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
            ddlCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");

            ddlServiceCURRICULUM.Enabled   = true;
            ddlServiceCURRICULUM.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
        }

        if (!Page.IsPostBack)
        {
            config_data           = new TeachExamConfig().getTeachExamConfig();
            txtACADEMIC_YEAR.Text = config_data.AcademicYear;
            academic_year         = config_data.AcademicYear;
            ddlSEMESTER.Items.FindByValue(config_data.Semester).Selected = true;

            facultyData = new Faculty().getFaculty();
            foreach (FacultyData data in facultyData)
            {
                ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code));
                if (data.Faculty_Code == "11")
                {
                    ddlFACULTY.Items.FindByValue(data.Faculty_Code).Selected = true;
                }
            }
            string faculty_code = ddlFACULTY.SelectedValue;

            string Curr_LevelCode = "";
            if (ddlDEGREE.SelectedValue == "U")
            {
                Curr_LevelCode = "01";
            }
            else if (ddlDEGREE.SelectedValue == "B")
            {
                Curr_LevelCode = "02";
            }
            else if (ddlDEGREE.SelectedValue == "M")
            {
                Curr_LevelCode = "03";
            }
            else if (ddlDEGREE.SelectedValue == "D")
            {
                Curr_LevelCode = "04";
            }


            //string curr_sql = "Select * From CURRICULUM Where FACULTYCODE=" + faculty_code;
            string curr_sql = "Select * From CURRICULUM Where FACULTYCODE='" + faculty_code + "' AND CURRCODE!='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'";
            currData = new Curriculum().getManualCurriculum(curr_sql);


            ddlCURRICULUM.Items.Clear();
            if (currData.Count.Equals(0))
            {
                ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0"));
            }
            else
            {
                foreach (CurriculumGeneralData data in currData)
                {
                    ddlCURRICULUM.Items.Insert(ddlCURRICULUM.Items.Count, new ListItem(data.Curr_Code + " " + data.Curr_ThaiName, data.Curr_Year + data.Curr_Code));
                }
            }

            string curr_sql2 = "Select * From CURRICULUM Where CURRCODE='999999999' AND LEVELCODE='" + Curr_LevelCode + "' AND APPROVESTATUS='Y'";
            currData2 = new Curriculum().getManualCurriculum(curr_sql2);
            ddlServiceCURRICULUM.Items.Clear();
            if (currData2.Count.Equals(0))
            {
                ddlServiceCURRICULUM.Items.Insert(ddlServiceCURRICULUM.Items.Count, new ListItem("--- เลือกหลักสูตร ---", "0"));
            }
            else
            {
                foreach (CurriculumGeneralData data in currData2)
                {
                    ddlServiceCURRICULUM.Items.Insert(ddlServiceCURRICULUM.Items.Count, new ListItem(data.Curr_ThaiName + " ( ปีหลักสูตร " + data.Curr_Year + " )", data.Curr_Year + data.Curr_Code));
                }
            }
        }

        academic_year = txtACADEMIC_YEAR.Text;

        lblFaculty.Text      = ddlFACULTY.SelectedItem.Text;
        lblSemesterYear.Text = ddlSEMESTER.SelectedItem.Text + "/" + academic_year;

        if (ddlCURRICULUM.SelectedValue != "0")
        {
            lblcurri.Text = ddlCURRICULUM.SelectedItem.Text;
        }
        else
        {
            lblcurri.Text = "";
        }
    }
Ejemplo n.º 15
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.board_reg_sta) || autro_obj.CheckGroupUser(login_data, group_var.officer_reg_sta) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                //========== Process ============
                if (!Page.IsPostBack)
                {
                    config_data     = new TeachExamConfig().getTeachExamConfig();
                    divShow.Visible = false;
                    fail.Visible    = false;
                    success.Visible = false;

                    txtStartDate.Text = config_data.Date_Start;
                    txtStopDate.Text  = config_data.Date_Stop;

                    if (autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
                    {
                        List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.admin_faculty);

                        facultyData = new Faculty().getFaculty(faculty_authorized);
                        foreach (FacultyData data in facultyData)
                        {
                            ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code));
                        }
                    }
                    else
                    {
                        facultyData = new Faculty().getFaculty();
                        ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem("--- เลือกภาควิชา ---", "0"));
                        foreach (FacultyData data in facultyData)
                        {
                            ddlFACULTY.Items.Insert(ddlFACULTY.Items.Count, new ListItem(data.Faculty_Thai, data.Faculty_Code));
                        }
                    }


                    string faculty_code = ddlFACULTY.SelectedValue;
                    departmentData = new Department().getDepartmentWithFaculty(faculty_code);

                    foreach (DepartmentData data in departmentData)
                    {
                        ddlDepartment.Items.Insert(ddlDepartment.Items.Count, new ListItem(data.Department_ShortName + " " + data.Department_Thai, data.Department_Code));
                    }
                }
                //===============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
Ejemplo n.º 16
0
    private void loadTable()
    {
        configData = new TeachExamConfig().getExtendTeachExamConfig(ddlDepartment.SelectedItem.Value);

        if (configData.Department_Code != null)
        {
            txtStartDate.Text = configData.Date_Start;
            txtStopDate.Text  = configData.Date_Stop;

            btnSAVE.Text = "Edit";
        }
        else
        {
            txtStartDate.Text = config_data.Date_Start;
            txtStopDate.Text  = config_data.Date_Stop;

            btnSAVE.Text = "Save";
        }

        // Head Table
        string[] ar  = { "คณะ", "ภาควิชา", "วันเริ่มต้น", "วันสุดท้าย", "ลบ" };
        Table    tb1 = new Table();

        tb1.Attributes.Add("class", "table table-bordered table-striped table-hover smart-form");
        tb1.Attributes.Add("id", "dt_section");
        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);
        }

        tb1.Rows.Add(tRowHead);


        // foreach (TeachExamConfigData data in configData)
        // {
        TableRow tRowBody = new TableRow();

        tRowBody.TableSection = TableRowSection.TableBody;


        TableCell cellFaculty = new TableCell();

        cellFaculty.Text = new Faculty().getFaculty(configData.Faculty_Code).Faculty_Thai;
        tRowBody.Cells.Add(cellFaculty);

        TableCell cellDepartment = new TableCell();

        cellDepartment.Text = new Department().getDepartment(configData.Department_Code).Department_Thai;
        tRowBody.Cells.Add(cellDepartment);

        TableCell cellStart = new TableCell();

        cellStart.Text = configData.Date_Start;
        tRowBody.Cells.Add(cellStart);

        TableCell cellStop = new TableCell();

        cellStop.Text = configData.Date_Stop;
        tRowBody.Cells.Add(cellStop);

        TableCell cellDel = new TableCell();
        string    urlDel  = "delete_extend_Schedule.aspx?dep=" + configData.Department_Code;
        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     = "ลบ";
        cellDel.Controls.Add(hypDel);
        cellDel.Attributes.Add("class", "text-center");
        tRowBody.Cells.Add(cellDel);

        tb1.Rows.Add(tRowBody);
        // }

        TableRow  row  = new TableRow();
        TableCell cell = new TableCell();

        cell.Controls.Add(tb1);
        row.Cells.Add(cell);
        tblExam.Rows.Add(row);
    }