Пример #1
0
        public int Insert(LectureDetailItem item)
        {
            string        query = "Insert into LectureDetail(accountId,lectureCategoryId,lectureTypeId,sectionId,name,credit,score) VALUES(@AccountId,@LectureCategoryId,@LectureTypeId,@SectionId,@Name,@Credit,@Score)";
            IDbParameters param = CreateDbParameters();

            param.AddWithValue("LectureCategoryId", item.LectureCategoryId).DbType = DbType.Int32;
            param.AddWithValue("LectureTypeId", item.LectureTypeId).DbType         = DbType.Int32;
            param.AddWithValue("Name", item.Name).DbType           = DbType.String;
            param.AddWithValue("Score", item.Score).DbType         = DbType.String;
            param.AddWithValue("SectionId", item.SectionId).DbType = DbType.Int32;
            param.AddWithValue("AccountId", item.AccountId).DbType = DbType.Int32;
            param.AddWithValue("Credit", item.Credit).DbType       = DbType.Int32;
            return(AdoTemplate.ExecuteNonQuery(CommandType.Text, query, param));
        }
Пример #2
0
        public int Update(LectureDetailItem item)
        {
            string        query = "UPDATE LectureDetail SET accountId = @AccountId, lectureCategoryId = @LectureCategoryId, lectureTypeId = @LectureTypeId, name = @Name, score = @Score, sectionId=@SectionId, credit = @Credit where id = @Id";
            IDbParameters param = CreateDbParameters();

            param.AddWithValue("Id", item.Id).DbType = DbType.Int32;
            param.AddWithValue("LectureCategoryId", item.LectureCategoryId).DbType = DbType.Int32;
            param.AddWithValue("LectureTypeId", item.LectureTypeId).DbType         = DbType.Int32;
            param.AddWithValue("Name", item.Name).DbType           = DbType.String;
            param.AddWithValue("Score", item.Score).DbType         = DbType.String;
            param.AddWithValue("SectionId", item.SectionId).DbType = DbType.Int32;
            param.AddWithValue("AccountId", item.AccountId).DbType = DbType.Int32;
            param.AddWithValue("Credit", item.Credit).DbType       = DbType.Int32;
            return(AdoTemplate.ExecuteNonQuery(CommandType.Text, query, param));
        }