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; }
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; } }
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; } }
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; } }
public static int InsertSTD_QuestionChapter(STD_QuestionChapter sTD_QuestionChapter) { SqlSTD_QuestionChapterProvider sqlSTD_QuestionChapterProvider = new SqlSTD_QuestionChapterProvider(); return sqlSTD_QuestionChapterProvider.InsertSTD_QuestionChapter(sTD_QuestionChapter); }
public static bool UpdateSTD_QuestionChapter(STD_QuestionChapter sTD_QuestionChapter) { SqlSTD_QuestionChapterProvider sqlSTD_QuestionChapterProvider = new SqlSTD_QuestionChapterProvider(); return sqlSTD_QuestionChapterProvider.UpdateSTD_QuestionChapter(sTD_QuestionChapter); }