Пример #1
0
        /// <summary>
        /// แก้ไขข้อมูลจากตาราง COURSETYPE
        /// </summary>
        /// <param name="updateData">CourseType Object</param>
        /// <returns>Success</returns>
        public string updateCourseType(CourseType updateData)
        {
            string        response  = "";
            ConnectDB     db        = new ConnectDB();
            SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

            string sql = "Update COURSETYPE Set COURSETYPETHAINAME = '" + updateData.CourseTypeThaiName + "', COURSETYPEENGNAME = '" + updateData.CourseTypeEngName + "' Where COURSETYPECODE = '" + updateData.CourseTypeCode + "'";

            oracleObj.UpdateCommand = sql;

            try
            {
                if (oracleObj.Update() == 1)
                {
                    response = "Success";
                }
            }
            catch (Exception e)
            {
                string exception = e.Message;
                HttpContext.Current.Session["response"] = "updateCourseType: " + exception;
                HttpContext.Current.Response.Redirect("../err_response.aspx");
            }

            return(response);
        }
Пример #2
0
        /// <summary>
        /// เพิ่มข้อมูลลงตาราง COURSETYPE
        /// </summary>
        /// <param name="dataInsert">CourseType Object</param>
        /// <returns>Success</returns>
        public string insertCourseType(CourseType dataInsert)
        {
            string response = "";

            ConnectDB     db        = new ConnectDB();
            SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

            string sql = "Insert into COURSETYPE (COURSETYPECODE, COURSETYPETHAINAME, COURSETYPEENGNAME) values ('" + dataInsert.CourseTypeCode + "','" + dataInsert.CourseTypeThaiName + "','" + dataInsert.CourseTypeEngName + "')";

            oracleObj.InsertCommand = sql;

            try
            {
                if (oracleObj.Insert() == 1)
                {
                    response = "Success";
                }
            }
            catch (Exception e)
            {
                string exception = e.Message;
                HttpContext.Current.Session["response"] = "insertCourseType: " + exception;
                HttpContext.Current.Response.Redirect("../err_response.aspx");
            }

            return(response);
        }
Пример #3
0
        /// <summary>
        /// เรียกดูข้อมูลจากตาราง COURSETYPE
        /// </summary>
        /// <param name="CourseTypeCode">รหัสประเภทวิชา</param>
        /// <returns>ข้อมูลจากตาราง COURSETYPE</returns>
        public CourseType getCourseType(string CourseTypeCode)
        {
            CourseType CourseTypeData = new CourseType();

            ConnectDB     db        = new ConnectDB();
            SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

            oracleObj.SelectCommand = "Select * From COURSETYPE Where COURSETYPECODE='" + CourseTypeCode + "'";
            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

            foreach (DataRowView rowData in allData)
            {
                CourseTypeData.CourseTypeCode     = rowData["COURSETYPECODE"].ToString();
                CourseTypeData.CourseTypeThaiName = rowData["COURSETYPETHAINAME"].ToString();
                CourseTypeData.CourseTypeEngName  = rowData["COURSETYPEENGNAME"].ToString();
            }

            return(CourseTypeData);
        }
Пример #4
0
        /// <summary>
        /// เรียกดูข้อมูลจากตาราง COURSETYPE
        /// </summary>
        /// <returns>ข้อมูลจากตาราง COURSETYPE</returns>
        public List <CourseType> getCourseType()
        {
            List <CourseType> CourseTypeData = new List <CourseType>();

            ConnectDB     db        = new ConnectDB();
            SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

            oracleObj.SelectCommand = "Select * From COURSETYPE Order By COURSETYPECODE";
            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

            foreach (DataRowView rowData in allData)
            {
                CourseType CourseTypeRow = new CourseType();

                CourseTypeRow.CourseTypeCode     = rowData["COURSETYPECODE"].ToString();
                CourseTypeRow.CourseTypeThaiName = rowData["COURSETYPETHAINAME"].ToString();
                CourseTypeRow.CourseTypeEngName  = rowData["COURSETYPEENGNAME"].ToString();

                CourseTypeData.Add(CourseTypeRow);
            }

            return(CourseTypeData);
        }
Пример #5
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");
            }
        }
    }
Пример #6
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 ===========
                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));
                    }

                    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));
                    }

                    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));
                    }

                    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));
                    }

                    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));
                    }

                    //หลักสูตร
                    if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                    {
                        List <FacultyData> faculty = new Faculty().getAllFaculty();
                        foreach (FacultyData row in faculty)
                        {
                            ddlCURR_FACULTY.Items.Insert(ddlCURR_FACULTY.Items.Count, new ListItem(row.Faculty_Thai, row.Faculty_Code));
                            if (row.Faculty_Code == "11")
                            {
                                ddlCURR_FACULTY.Items.FindByValue(row.Faculty_Code).Selected = 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);
                    //    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));
                        }
                    }
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }