示例#1
0
        private void AddTrainCourseCourseware(TreeViewNodeCollection tvNodes)
        {
            ArrayList objList = GetCourseWareList();

            foreach (TreeViewNode node in tvNodes)
            {
                if (node.ShowCheckBox == true)
                {
                    if (node.Checked == true)
                    {
                        if (objList.IndexOf(node.Value) == -1)
                        {
                            TrainCourseCoursewareBLL obj = new TrainCourseCoursewareBLL();
                            TrainCourseCourseware    objTrainCourseCourseware = new TrainCourseCourseware();

                            objTrainCourseCourseware.CourseID     = Convert.ToInt32(ViewState["CourseID"].ToString());
                            objTrainCourseCourseware.CoursewareID = Convert.ToInt32(node.Value);

                            obj.AddTrainCourseCourseware(objTrainCourseCourseware);
                        }
                    }
                }

                if (node.Nodes.Count > 0)
                {
                    AddTrainCourseCourseware(node.Nodes);
                }
            }
        }
        /// <summary>
        /// 根据课程ID和课件类型ID取得在该课程的所有课件中与该课程类型相关的课件信息
        /// </summary>
        /// <param name="courseID"></param>
        /// <param name="typeID"></param>
        /// <returns></returns>
        public IList <TrainCourseCourseware> GetTrainCourseCoursewareByTypeID(int courseID, int typeID)
        {
            IList <TrainCourseCourseware> objCourseCoursewareList = new List <TrainCourseCourseware>();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_TRAIN_COURSE_WARE_G";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_train_course_courseware_id", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "p_course_id", DbType.Int32, courseID);
            db.AddInParameter(dbCommand, "p_courseware_type_id", DbType.Int32, typeID);
            db.AddInParameter(dbCommand, "p_courseware_id", DbType.Int32, 0);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    TrainCourseCourseware obj = CreateModelObject(dataReader);

                    objCourseCoursewareList.Add(obj);
                }
            }
            return(objCourseCoursewareList);
        }
        /// <summary>
        /// 更新培训课程的课件信息
        /// </summary>
        /// <param name="obj"></param>
        public void UpdateTrainCourseCourseware(TrainCourseCourseware obj)
        {
            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_TRAIN_COURSE_WARE_U";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_train_course_courseware_id", DbType.Int32, obj.TrainCourseCoursewareID);
            db.AddInParameter(dbCommand, "p_course_id", DbType.Int32, obj.CourseID);
            db.AddInParameter(dbCommand, "p_courseware_id", DbType.Int32, obj.CoursewareID);
            db.AddInParameter(dbCommand, "p_study_demand", DbType.String, obj.StudyDemand);
            db.AddInParameter(dbCommand, "p_study_hours", DbType.VarNumeric, obj.StudyHours);
            db.AddInParameter(dbCommand, "p_memo", DbType.String, obj.Memo);

            db.ExecuteNonQuery(dbCommand);
        }
        public IList <TrainCourseCourseware> GetTrainCourseCoursewareInfo(int trainCourseCoursewareID,
                                                                          int courseID,
                                                                          int coursewareID,
                                                                          string studyDemand,
                                                                          decimal studyHours,
                                                                          string memo,
                                                                          int startRowIndex,
                                                                          int maximumRows,
                                                                          string orderBy)
        {
            IList <TrainCourseCourseware> objCourseCoursewareList = new List <TrainCourseCourseware>();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_TRAIN_COURSE_WARE_S";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_start_row_index", DbType.Int32, startRowIndex);
            db.AddInParameter(dbCommand, "p_page_size", DbType.Int32, maximumRows);
            db.AddInParameter(dbCommand, "p_order_by", DbType.String, GetMappingOrderBy(orderBy));
            db.AddOutParameter(dbCommand, "p_count", DbType.Int32, 4);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    TrainCourseCourseware obj = CreateModelObject(dataReader);

                    objCourseCoursewareList.Add(obj);
                }
            }

            _recordCount = Convert.ToInt32(db.GetParameterValue(dbCommand, "p_count"));

            return(objCourseCoursewareList);
        }
示例#5
0
 /// <summary>
 /// 更新培训课程的课件信息
 /// </summary>
 /// <param name="trainCourseCourseware"></param>
 public void UpdateTrainCourseCourseware(TrainCourseCourseware trainCourseCourseware)
 {
     dal.UpdateTrainCourseCourseware(trainCourseCourseware);
 }
示例#6
0
 public void DeleteTrainCourseCourseware(TrainCourseCourseware trainCourseCourseware)
 {
     dal.DeleteTrainCourseCourseware(trainCourseCourseware.CoursewareID);
 }
示例#7
0
 /// <summary>
 /// 新增培训课程的课件信息
 /// </summary>
 /// <param name="trainCourseCourseware"></param>
 public void AddTrainCourseCourseware(TrainCourseCourseware trainCourseCourseware)
 {
     dal.AddTrainCourseCourseware(trainCourseCourseware);
 }