Esempio n. 1
0
    /// <summary>
    /// แก้ไขข้อมูลจากตาราง SUFLAGE
    /// </summary>
    /// <param name="updateData">SuFlage Object</param>
    /// <returns>Success</returns>
    public string updateSuFlage(SuFlage updateData)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle_tqf2();

        string sql = "Update SUFLAGE Set SUFLAGNAME = '" + updateData.SuFlageName + "', SUFLAGEENNAME = '" + updateData.SuFlageEnName + "' Where SUFLAGCODE = '" + updateData.SuFlagCode + "'";

        oracleObj.UpdateCommand = sql;

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

        return(response);
    }
Esempio n. 2
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง SUFLAGE
    /// </summary>
    /// <param name="dataInsert">SuFlage Object</param>
    /// <returns>Success</returns>
    public string insertSuFlage(SuFlage dataInsert)
    {
        string response = "";

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

        string sql = "Insert into SUFLAGE (SUFLAGCODE, SUFLAGNAME, SUFLAGEENNAME) values ('" + dataInsert.SuFlagCode + "','" + dataInsert.SuFlageName + "','" + dataInsert.SuFlageEnName + "')";

        oracleObj.InsertCommand = sql;

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

        return(response);
    }
Esempio n. 3
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง SUFLAGE
    /// </summary>
    /// <param name="SuFlagCode">รหัสลักษณะของการคิดหน่วยกิต</param>
    /// <returns>ข้อมูลจากตาราง SUFLAGE</returns>
    public SuFlage getSuFlage(string SuFlagCode)
    {
        SuFlage SuFlageData = new SuFlage();

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

        oracleObj.SelectCommand = "Select * From SUFLAGE Where SUFLAGCODE='" + SuFlagCode + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            SuFlageData.SuFlagCode    = rowData["SUFLAGCODE"].ToString();
            SuFlageData.SuFlageName   = rowData["SUFLAGNAME"].ToString();
            SuFlageData.SuFlageEnName = rowData["SUFLAGEENNAME"].ToString();
        }

        return(SuFlageData);
    }
Esempio n. 4
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง SUFLAGE
    /// </summary>
    /// <returns>ข้อมูลจากตาราง SUFLAGE</returns>
    public List <SuFlage> getSuFlage()
    {
        List <SuFlage> SuFlageData = new List <SuFlage>();

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

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

        foreach (DataRowView rowData in allData)
        {
            SuFlage SuFlageRow = new SuFlage();

            SuFlageRow.SuFlagCode    = rowData["SUFLAGCODE"].ToString();
            SuFlageRow.SuFlageName   = rowData["SUFLAGNAME"].ToString();
            SuFlageRow.SuFlageEnName = rowData["SUFLAGEENNAME"].ToString();

            SuFlageData.Add(SuFlageRow);
        }

        return(SuFlageData);
    }
Esempio n. 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");
            }
        }
    }
Esempio n. 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");
            }
        }
    }