예제 #1
0
        private List <FBPaperItem> GetFBItem()
        {
            //List<TrainFBQuestion> question= _DalFBQues.GetFBQuestionByConditon(string.Empty, -1);
            FeedBackPaper paper = _IFeedBackPaper.GetFeedBackPaperById(_Course.CourseFeedBackPaper.FeedBackPaperId);

            if (paper == null || paper.FBQuestions == null)
            {
                return(new List <FBPaperItem>());
            }
            List <TrainFBQuestion> question   = paper.FBQuestions;
            List <FBPaperItem>     paperItems = new List <FBPaperItem>();

            foreach (TrainFBQuestion ques in question)
            {
                if (ques.FBItems.Count != 0 && ques.FBItems != null)
                {
                    FBPaperItem item = new FBPaperItem();
                    item.FBQuestion = ques.Description;
                    item.FBQueItems = GetItemString(ques.FBItems);
                    item.Worths     = GetItemWorth(ques.FBItems);
                    paperItems.Add(item);
                }
            }
            return(paperItems);
        }
예제 #2
0
        public List <FeedBackPaper> GetFeedBackPaperByPaperName(string paperName)
        {
            List <FeedBackPaper> papers = new List <FeedBackPaper>();
            SqlCommand           cmd    = new SqlCommand();

            cmd.Parameters.Add(_ParmPaperName, SqlDbType.NVarChar, 50).Value = paperName;
            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetFeedBackPaperByPaperName", cmd))
            {
                while (sdr.Read())
                {
                    FeedBackPaper paper = new FeedBackPaper();
                    paper.FeedBackPaperId   = Convert.ToInt32(sdr[_DbPKID]);
                    paper.FeedBackPaperName = sdr[_DbPaperName].ToString();
                    papers.Add(paper);
                }
                return(papers);
            }
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FeedBackPaper GetFeedBackPaperById(int id)
        {
            FeedBackPaper templatePaper = null;
            SqlCommand    cmd           = new SqlCommand();

            cmd.Parameters.Add(_ParmPKID, SqlDbType.Int).Value = id;

            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetFeedBackPaperByPaperId", cmd))
            {
                while (sdr.Read())
                {
                    templatePaper = new FeedBackPaper();
                    templatePaper.FeedBackPaperId   = Convert.ToInt32(sdr[_DbPKID]);
                    templatePaper.FeedBackPaperName = sdr[_DbPaperName].ToString();
                    templatePaper.FBQuestions       = GetFeedBackPaperItemsById(templatePaper.FeedBackPaperId);
                }
                return(templatePaper);
            }
        }
예제 #4
0
 public void UpdateFeedBackPaper(FeedBackPaper feedBackPaper)
 {
     try
     {
         SqlCommand cmd = new SqlCommand();
         cmd.Parameters.Add(_ParmCount, SqlDbType.Int).Direction          = ParameterDirection.Output;
         cmd.Parameters.Add(_ParmPKID, SqlDbType.Int).Value               = feedBackPaper.FeedBackPaperId;
         cmd.Parameters.Add(_ParmPaperName, SqlDbType.NVarChar, 50).Value = feedBackPaper.FeedBackPaperName;
         SqlHelper.ExecuteNonQuery("FeedBackPaperUpdate", cmd);
         DeleteAllItemsInPaper(feedBackPaper.FeedBackPaperId);
         if (feedBackPaper.FBQuestions != null)
         {
             foreach (TrainFBQuestion item in feedBackPaper.FBQuestions)
             {
                 ManagePaperItems(feedBackPaper.FeedBackPaperId, item.FBQuestioniD);
             }
         }
     }
     catch
     {
         throw new ApplicationException(_DbError);
     }
 }
예제 #5
0
 public int InsertFeedBackPaper(FeedBackPaper feedBackPaper)
 {
     try
     {
         int        pkid;
         SqlCommand cmd = new SqlCommand();
         cmd.Parameters.Add(_ParmPaperName, SqlDbType.NVarChar, 50).Value = feedBackPaper.FeedBackPaperName;
         cmd.Parameters.Add(_ParmPKID, SqlDbType.Int).Direction           = ParameterDirection.Output;
         SqlHelper.ExecuteNonQueryReturnPKID("FeedBackPaperInsert", cmd, out pkid);
         if (feedBackPaper.FBQuestions != null)
         {
             foreach (TrainFBQuestion item in feedBackPaper.FBQuestions)
             {
                 ManagePaperItems(pkid, item.FBQuestioniD);
             }
         }
         return(pkid);
     }
     catch
     {
         throw new ApplicationException(_DbError);
     }
 }
예제 #6
0
 ///<summary>
 ///</summary>
 ///<param name="iPaper"></param>
 ///<param name="paper"></param>
 public UpdateFeedBackPaper(IFeedBackPaper iPaper, FeedBackPaper paper)
 {
     _IFeedBackPaper = iPaper;
     _Paper          = paper;
 }
예제 #7
0
        /// <summary>
        /// 该事务执行后,会修改考评表的基本信息
        /// 异常情况:
        /// 1.当前要修改的考评表是否存在,如果不在则给出提示,事务中断
        /// 2.PaperName不可与已有Paper的PaperName重复,否则给出提示,事务中断
        /// 业务流程:
        /// 1.有效性判断
        /// 2.如果通过有效性判断,则调用IDal层方法进行考评表修改
        /// </summary>

        public UpdateFeedBackPaper(FeedBackPaper paper)
        {
            _Paper = paper;
        }
예제 #8
0
 ///<summary>
 ///</summary>
 public InsertFeedBackPaper(IFeedBackPaper iPaper, FeedBackPaper paper)
 {
     _IFeedBackPaper = iPaper;
     _Paper          = paper;
 }
예제 #9
0
 /// <summary>
 /// 该事务执行后,会增加一张没有考评项的考评表
 /// 异常情况:
 /// 1.Title不可与已有Paper的Title重复,否则给出提示,事务中断
 /// 业务流程:
 /// 1.有效性判断
 /// 2.如果通过有效性判断,则调用IDal层方法进行考评表新增
 /// </summary>
 public InsertFeedBackPaper(FeedBackPaper paper)
 {
     _Paper = paper;
 }
예제 #10
0
        public void UpdateFeedBackPaper(FeedBackPaper feedBackPaper)
        {
            UpdateFeedBackPaper _update = new UpdateFeedBackPaper(feedBackPaper);

            _update.Excute();
        }
예제 #11
0
        public void AddAFeedBackPaper(FeedBackPaper feedBackPaper)
        {
            InsertFeedBackPaper _insert = new InsertFeedBackPaper(feedBackPaper);

            _insert.Excute();
        }