Beispiel #1
0
    protected void ddlCURR_DEPARTMENT_SelectedIndexChanged(object sender, EventArgs e)
    {
        string sql = "Select * From DIVISION Where DEPARTMENTCODE='" + ddlCURR_DEPARTMENT.SelectedValue + "'";
        List <TQF.Division> division = new TQF.Division().getDivisionManual(sql);

        ddlCURR_MAJOR.Items.Clear();
        //ddlCURR_MAJOR.Items.Insert(ddlCURR_MAJOR.Items.Count, new ListItem("--- เลือกสาขาวิชา ---", "00"));
        if (division.Count == 0)
        {
            ddlCURR_MAJOR.Items.Clear();
            ddlCURR_MAJOR.Items.Insert(ddlCURR_MAJOR.Items.Count, new ListItem("ไม่มีสาขาวิชา", "00"));
        }
        else
        {
            foreach (TQF.Division row in division)
            {
                ddlCURR_MAJOR.Items.Insert(ddlCURR_MAJOR.Items.Count, new ListItem(row.DivisionThName + " ( " + row.DivisionEnShortName + " )", row.DivisionCode));
            }
        }
    }
    protected void ddlCURR_DEPARTMENT_SelectedIndexChanged(object sender, EventArgs e)
    {
        // วิชาการภาค
        if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
        {
            // คณะ
            FacultyData faculty_data = new Faculty().getFaculty(ddlCURR_DEPARTMENT.SelectedValue.Substring(0, 2));
            ddlCURR_FACULTY.Items.Clear();
            if (faculty_data.Faculty_Code != null)
            {
                ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(faculty_data.Faculty_Thai, faculty_data.Faculty_Code));
            }
            else
            {
                ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem("--- เลือกคณะ ---", "00"));
            }
        }

        string sql = "Select * From DIVISION Where DEPARTMENTCODE='" + ddlCURR_DEPARTMENT.SelectedValue + "'";
        List <TQF.Division> division = new TQF.Division().getDivisionManual(sql);

        ddlCURR_MAJOR.Items.Clear();
        //ddlCURR_MAJOR.Items.Insert(ddlCURR_MAJOR.Items.Count, new ListItem("--- เลือกสาขาวิชา ---", "00"));
        if (division.Count == 0)
        {
            ddlCURR_MAJOR.Items.Clear();
            ddlCURR_MAJOR.Items.Insert(ddlCURR_MAJOR.Items.Count, new ListItem("ไม่มีสาขาวิชา", "00"));
        }
        else
        {
            foreach (TQF.Division row in division)
            {
                ddlCURR_MAJOR.Items.Insert(ddlCURR_MAJOR.Items.Count, new ListItem(row.DivisionThName + " ( " + row.DivisionEnShortName + " )", row.DivisionCode));
            }
        }
    }
Beispiel #3
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))
            {
                // ======== Process ===========
                bool editable = false;
                CurrCode    = Request.QueryString["CurrCode"];
                YearVersion = Request.QueryString["YearVersion"];

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

                //หลักสูตร
                if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                {
                    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 == curriculumData.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 == curriculumData.DepartmentCode)
                        {
                            editable = true;
                            break;
                        }
                    }
                }

                if (!Page.IsPostBack)
                {
                    if (editable == true)
                    {
                        if (curriculumData.CurrStatus == "1")
                        {
                            //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง)
                            rBtnNEW_CURR.Checked = true;
                        }
                        else if (curriculumData.CurrStatus == "2")
                        {
                            //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง)
                            rBtnMINOR_MODI_CURR.Checked = true;
                        }
                        else
                        {
                            //สถานะของหลักสูตร(1=ใหม่, 2=ปรับปรุง)
                            rBtnNEW_CURR.Checked = true;
                        }

                        txtCURR_CODE.Text         = curriculumData.CurrCode;
                        txtCURR_YEAR_VERSION.Text = curriculumData.YearVersion;
                        try
                        {
                            ddlCURR_SEMESTER.Items.FindByValue(curriculumData.BeginSemester).Selected = true;
                        }
                        catch
                        { }

                        txtCURR_YEAR.Text = curriculumData.BeginYear;

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

                        txtCURR_THAINAME.Text = curriculumData.CurrThName;
                        txtCURR_ENGNAME.Text  = curriculumData.CurrEnName;
                        //txtCURR_SHORT_THAINAME.Text = curriculumData.CurrShortThName;
                        //txtCURR_SHORT_ENGNAME.Text = curriculumData.CurrShortEnName;
                        txtDIP_THAINAME.Text       = new Diploma().getDiploma(curriculumData.DiplomaCode).DomainThName;
                        txtDIP_ENGNAME.Text        = new Diploma().getDiploma(curriculumData.DiplomaCode).DomainEnName;
                        txtDIP_SHORT_THAINAME.Text = new Diploma().getDiploma(curriculumData.DiplomaCode).DomainThShortName;
                        txtDIP_SHORT_ENGNAME.Text  = new Diploma().getDiploma(curriculumData.DiplomaCode).DomainEnShortName;

                        List <FacultyData> faculty = new Faculty().getFaculty();
                        ddlCURR_FACULTY.Items.Clear();
                        foreach (FacultyData row in faculty)
                        {
                            ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(row.Faculty_Thai, row.Faculty_Code));
                        }
                        try
                        {
                            ddlCURR_FACULTY.Items.FindByValue(curriculumData.FacultyCode).Selected = true;
                        }
                        catch
                        { }

                        List <DepartmentData> department = new Department().getDepartment();
                        ddlCURR_DEPARTMENT.Items.Clear();
                        foreach (DepartmentData row in department)
                        {
                            ddlCURR_DEPARTMENT.Items.Insert(ddlCURR_DEPARTMENT.Items.Count, new ListItem(row.Department_Thai, row.Department_Code));
                        }
                        try
                        {
                            ddlCURR_DEPARTMENT.Items.FindByValue(curriculumData.DepartmentCode).Selected = true;
                        }
                        catch
                        { }

                        string sqlDivision           = "Select * From DIVISION Where DEPARTMENTCODE = " + curriculumData.DepartmentCode;
                        List <TQF.Division> division = new TQF.Division().getDivisionManual(sqlDivision);
                        ddlCURR_MAJOR.Items.Clear();
                        foreach (TQF.Division row in division)
                        {
                            ddlCURR_MAJOR.Items.Insert(ddlCURR_MAJOR.Items.Count, new ListItem(row.DivisionThName + " ( " + row.DivisionEnShortName + " )", row.DivisionCode));
                        }

                        string sqlDivisionExtension = "Select * From DIVISIONEXTENSION Where DIVISIONNO='" + curriculumData.DivisionCode + "'";
                        List <DivisionExtension> divisionExtension = new DivisionExtension().getDivisionExtensionManual(sqlDivisionExtension);
                        foreach (DivisionExtension row in divisionExtension)
                        {
                            try
                            {
                                ddlCURR_MAJOR.Items.FindByValue(row.DivisionCode).Selected = true;
                            }
                            catch
                            { }
                        }


                        txtSTUDY_YEAR.Text       = curriculumData.NumYear;
                        txtTOTAL_STUDY_YEAR.Text = curriculumData.MaxNumYear;

                        List <SysUser> sysUser = new SysUser().getSysUser();
                        ddlLECTURER.Items.Clear();
                        foreach (SysUser row in sysUser)
                        {
                            string sql = "Select * From ABOUTLECTURER Where LECTIDENTITY='" + row.IdCode + "'";
                            List <AboutLecturer> aboutLecturer = new AboutLecturer().getAboutLecturerManual(sql);
                            //เช็คว่าอาจารย์ประจำหลักสูตรไปแล้วหรือยัง
                            if (aboutLecturer.Count > 0)
                            {
                                string sql2 = "Select * From ABOUTLECTURER Where CURRCODE='" + CurrCode + "' And YEARVERSION='" + YearVersion + "' And LECTIDENTITY='" + row.IdCode + "' And LOADTYPECODE='1'";
                                List <AboutLecturer> aboutLecturer2 = new AboutLecturer().getAboutLecturerManual(sql2);
                                foreach (AboutLecturer li in aboutLecturer2)
                                {
                                    if (li.LectIdentity == row.IdCode)
                                    {
                                        ddlLECTURER.Items.Insert(ddlLECTURER.Items.Count, new ListItem(row.ThName + " " + row.ThSurName + " (" + row.ShortName + ")", row.IdCode));
                                        ddlLECTURER.Items.FindByValue(row.IdCode).Selected = true;
                                    }
                                }

                                continue;
                            }
                            else
                            {
                                ddlLECTURER.Items.Insert(ddlLECTURER.Items.Count, new ListItem(row.ThName + " " + row.ThSurName + " (" + row.ShortName + ")", row.IdCode));
                            }
                        }
                        try
                        {
                            ddlMAJORSTATUS.Items.FindByValue(curriculumData.MajorStatus).Selected = true;
                        }
                        catch
                        { }

                        List <TQF1> tqf1 = new TQF1().getTQF1();
                        ddlTQF1.Items.Clear();
                        foreach (TQF1 row in tqf1)
                        {
                            ddlTQF1.Items.Insert(ddlTQF1.Items.Count, new ListItem(row.TQF1Major, row.NumTQF1));

                            if (curriculumData.NumTQF1 == row.NumTQF1)
                            {
                                ddlTQF1.Items.FindByValue(curriculumData.NumTQF1).Selected = true;
                            }
                        }

                        //ddlTQF1.Items.FindByValue(curriculumData.NumTQF1).Selected = true;

                        txtDateApprove.Text = curriculumData.ApprovedDate;
                    }
                    else
                    {
                        HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                        HttpContext.Current.Response.Redirect("err_response.aspx");
                    }
                }
                //=========================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }