Пример #1
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง STUDENT_JOURNAL
    /// </summary>
    /// <param name="sql">SQL Command</param>
    /// <returns>ข้อมูลจากตาราง STUDENT_JOURNAL</returns>
    public List <StudentJournalData> getStudentJournalManual(string sql)
    {
        List <StudentJournalData> data = new List <StudentJournalData>();

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

        oracleObj.SelectCommand = sql;

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

        foreach (DataRowView rowData in allData)
        {
            StudentJournalData row = new StudentJournalData();

            row.StudentJournalId    = rowData["STUDENT_JOURNAL_ID"].ToString();
            row.StudentId           = rowData["STUDENT_ID"].ToString();
            row.StudentJournalTitle = rowData["STUDENT_JOURNAL_TITLE"].ToString();
            row.JournalName         = rowData["JOURNAL_NAME"].ToString();
            row.JournalYear         = rowData["JOURNAL_YEAR"].ToString();
            row.JournalVolum        = rowData["JOURNAL_VOLUM"].ToString();
            row.JournalLevel        = rowData["JOURNAL_LEVEL"].ToString();
            row.ProceedingDbId      = rowData["PROCEEDING_DB_ID"].ToString();

            data.Add(row);
        }

        return(data);
    }
Пример #2
0
    /// <summary>
    /// แก้ไขข้อมูลจากตาราง STUDENT_JOURNAL
    /// เฉพาะข้อมูล STUDENT_JOURNAL_TITLE, JOURNAL_NAME, JOURNAL_YEAR,
    /// JOURNAL_VOLUM, JOURNAL_LEVEL, PROCEEDING_DB_ID
    /// </summary>
    /// <param name="updateData">StudentEnglishTest Object</param>
    /// <returns>OK</returns>
    public string updateStudentJournal(StudentJournalData updateData)
    {
        string        response  = "";
        ConnectDB     db        = new ConnectDB();
        SqlDataSource oracleObj = db.ConnectionOracle();

        string sql = "Update STUDENT_JOURNAL Set STUDENT_JOURNAL_TITLE = '" + updateData.StudentJournalTitle + "', JOURNAL_NAME = '" + updateData.JournalName + "', JOURNAL_YEAR = '" + updateData.JournalYear + "', JOURNAL_VOLUM = '" + updateData.JournalVolum + "', JOURNAL_LEVEL = '" + updateData.JournalLevel + "', PROCEEDING_DB_ID = '" + updateData.ProceedingDbId + "' Where STUDENT_JOURNAL_ID = '" + updateData.StudentJournalId + "'";

        oracleObj.UpdateCommand = sql;

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

        return(response);
    }
Пример #3
0
    /// <summary>
    /// เพิ่มข้อมูลลงตาราง STUDENT_JOURNAL
    /// </summary>
    /// <param name="dataInsert">StudentEnglishTest Object</param>
    /// <returns>OK</returns>
    public string insertStudentJournal(StudentJournalData dataInsert)
    {
        string response = "";

        int    sleepTime        = 5000;
        string StudentJournalId = dataInsert.StudentJournalId;

        for (int i = 0; i < 10; i++)
        {
            if (getStudentJournal(StudentJournalId).StudentJournalId != null)
            {
                Thread.Sleep(sleepTime);
                StudentJournalId = getMaxIdStudentJournal();
                sleepTime       += 5000;
            }
            else
            {
                dataInsert.StudentJournalId = StudentJournalId;
                break;
            }
        }

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

        string sql = "Insert into STUDENT_JOURNAL (STUDENT_JOURNAL_ID,STUDENT_ID,STUDENT_JOURNAL_TITLE,JOURNAL_NAME,JOURNAL_YEAR,JOURNAL_VOLUM,JOURNAL_LEVEL,PROCEEDING_DB_ID) values ('" + dataInsert.StudentJournalId + "','" + dataInsert.StudentId + "','" + dataInsert.StudentJournalTitle + "','" + dataInsert.JournalName + "','" + dataInsert.JournalYear + "','" + dataInsert.JournalVolum + "','" + dataInsert.JournalLevel + "','" + dataInsert.ProceedingDbId + "')";

        oracleObj.InsertCommand = sql;

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

        return(response);
    }
Пример #4
0
    /// <summary>
    /// เรียกดูข้อมูลจากตาราง STUDENT_JOURNAL
    /// </summary>
    /// <param name="StudentProceedingId">รหัสบทความวิจัยที่นำเสนอ</param>
    /// <returns>ข้อมูลจากตาราง STUDENT_JOURNAL</returns>
    public StudentJournalData getStudentJournal(string StudentJournalId)
    {
        StudentJournalData data = new StudentJournalData();

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

        oracleObj.SelectCommand = "Select * From STUDENT_JOURNAL Where STUDENT_JOURNAL_ID ='" + StudentJournalId + "'";
        DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView rowData in allData)
        {
            data.StudentJournalId    = rowData["STUDENT_JOURNAL_ID"].ToString();
            data.StudentId           = rowData["STUDENT_ID"].ToString();
            data.StudentJournalTitle = rowData["STUDENT_JOURNAL_TITLE"].ToString();
            data.JournalName         = rowData["JOURNAL_NAME"].ToString();
            data.JournalYear         = rowData["JOURNAL_YEAR"].ToString();
            data.JournalVolum        = rowData["JOURNAL_VOLUM"].ToString();
            data.JournalLevel        = rowData["JOURNAL_LEVEL"].ToString();
            data.ProceedingDbId      = rowData["PROCEEDING_DB_ID"].ToString();
        }

        return(data);
    }