예제 #1
0
 public static STD_QuestionChapter GetSTD_QuestionChapterByQuestion_ChapterID(int Question_ChapterID)
 {
     STD_QuestionChapter sTD_QuestionChapter = new STD_QuestionChapter();
     SqlSTD_QuestionChapterProvider sqlSTD_QuestionChapterProvider = new SqlSTD_QuestionChapterProvider();
     sTD_QuestionChapter = sqlSTD_QuestionChapterProvider.GetSTD_QuestionChapterByQuestion_ChapterID(Question_ChapterID);
     return sTD_QuestionChapter;
 }
예제 #2
0
    public bool UpdateSTD_QuestionChapter(STD_QuestionChapter sTD_QuestionChapter)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("UpdateSTD_QuestionChapter", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Question_ChapterID", SqlDbType.Int).Value = sTD_QuestionChapter.Question_ChapterID;
            cmd.Parameters.Add("@QuestionID", SqlDbType.Int).Value = sTD_QuestionChapter.QuestionID;
            cmd.Parameters.Add("@ChapterID", SqlDbType.Int).Value = sTD_QuestionChapter.ChapterID;
            //cmd.Parameters.Add("@ChapterID", SqlDbType.Int).Value = sTD_QuestionChapter.ChapterID;
            //cmd.Parameters.Add("@ChapterID", SqlDbType.Int).Value = sTD_QuestionChapter.ChapterID;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_QuestionChapter.UpdatedBy;
            cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_QuestionChapter.UpdateDate;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
예제 #3
0
    public int InsertSTD_QuestionChapter(STD_QuestionChapter sTD_QuestionChapter)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("InsertSTD_QuestionChapter", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Question_ChapterID", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@QuestionID", SqlDbType.Int).Value = sTD_QuestionChapter.QuestionID;
            cmd.Parameters.Add("@ChapterID", SqlDbType.Int).Value = sTD_QuestionChapter.ChapterID;
            cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = sTD_QuestionChapter.AddedBy;
            cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = sTD_QuestionChapter.AddedDate;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_QuestionChapter.UpdatedBy;
            cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_QuestionChapter.UpdateDate;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return (int)cmd.Parameters["@Question_ChapterID"].Value;
        }
    }
예제 #4
0
    public STD_QuestionChapter GetSTD_QuestionChapterFromReader(IDataReader reader)
    {
        try
        {
            STD_QuestionChapter sTD_QuestionChapter = new STD_QuestionChapter
                (

                     DataAccessObject.IsNULL<int>(reader["Question_ChapterID"]),
                     DataAccessObject.IsNULL<int>(reader["QuestionID"]),
                     DataAccessObject.IsNULL<int>(reader["ChapterID"]),
                     DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]),
                     DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"])
                );
             return sTD_QuestionChapter;
        }
        catch(Exception ex)
        {
            return null;
        }
    }
예제 #5
0
 public static int InsertSTD_QuestionChapter(STD_QuestionChapter sTD_QuestionChapter)
 {
     SqlSTD_QuestionChapterProvider sqlSTD_QuestionChapterProvider = new SqlSTD_QuestionChapterProvider();
     return sqlSTD_QuestionChapterProvider.InsertSTD_QuestionChapter(sTD_QuestionChapter);
 }
예제 #6
0
 public static bool UpdateSTD_QuestionChapter(STD_QuestionChapter sTD_QuestionChapter)
 {
     SqlSTD_QuestionChapterProvider sqlSTD_QuestionChapterProvider = new SqlSTD_QuestionChapterProvider();
     return sqlSTD_QuestionChapterProvider.UpdateSTD_QuestionChapter(sTD_QuestionChapter);
 }