Example #1
0
    // V1.0.0
    public List <ConfigNewStudentRegData> getConfigNewStudentReg(string degree_char)
    {
        List <ConfigNewStudentRegData> configData = new List <ConfigNewStudentRegData>();
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();
        string        sql       = "";

        sql = "Select * From CONFIG_NEWSTD_REG Where DEGREE_CHAR='" + degree_char + "'  Order By ACADEMIC_YEAR DESC, SEMESTER DESC, FACULTY_CODE";

        try
        {
            oracleObj.SelectCommand = sql;
            DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView rowData in allData)
            {
                ConfigNewStudentRegData config_data = new ConfigNewStudentRegData();
                config_data.academic_year = rowData["ACADEMIC_YEAR"].ToString();
                config_data.semester      = rowData["SEMESTER"].ToString();
                config_data.degree_char   = rowData["DEGREE_CHAR"].ToString();
                config_data.faculty_code  = rowData["FACULTY_CODE"].ToString();
                config_data.start_date    = rowData["START_DATE"].ToString();
                config_data.end_date      = rowData["END_DATE"].ToString();
                configData.Add(config_data);
            }
        }
        catch
        {
            HttpContext.Current.Session["response"] = "Unit Test:ConfigNewStudentReg:getConfigNewStudentReg" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }


        return(configData);
    }
Example #2
0
    // V1.0.0
    public string updateConfigNewStudentReg(ConfigNewStudentRegData dataInsert)
    {
        string response = "";


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

        string sql = "";

        sql = "Update CONFIG_NEWSTD_REG Set START_DATE='" + dataInsert.start_date + "',END_DATE='" + dataInsert.end_date + "' Where ACADEMIC_YEAR='" + dataInsert.academic_year + "' And SEMESTER='" + dataInsert.semester + "' And FACULTY_CODE='" + dataInsert.faculty_code + "' AND DEGREE_CHAR='" + dataInsert.degree_char + "' ";

        try
        {
            oracleObj.UpdateCommand = sql;

            if (oracleObj.Update() == 1)
            {
                response = "OK";
            }
        }
        catch
        {
            HttpContext.Current.Session["response"] = "Unit Test:ConfigNewStudentReg:updateConfigNewStudentReg" + " ไม่สามารถดำเนินการได้";
            HttpContext.Current.Response.Redirect("err_response.aspx");
        }



        return(response);
    }