Пример #1
0
        /// <summary>
        /// 显示所有
        /// </summary>
        /// <param name="Type">类型(单选/多选/不定项选/判断)</param>
        /// <param name="PapersID">试卷ID</param>
        /// <returns></returns>
        public List <Model.PapersTitleList> GetList(string Type, int PapersID)
        {
            string strSql = "";

            strSql = "Select * FROM [PapersTitleList] Where [Type]='" + Type + "' AND [PapersID]='" + PapersID + "' order by newid()";
            List <Model.PapersTitleList> List = new List <Model.PapersTitleList>();

            SqlParameter[] parameters =
            {
            };
            SqlDataReader DR;

            DR = ExamSys.ExecuteReader(strSql.ToString(), parameters);
            using (DR)
            {
                while (DR.Read())
                {
                    Model.PapersTitleList model = new Model.PapersTitleList();
                    model.Title = DR["Title"].ToString();
                    model.T_F   = DR["T_F"].ToString();
                    model.ID    = int.Parse(DR["ID"].ToString());
                    model.Score = int.Parse(DR["Score"].ToString());
                    List.Add(model);
                }
                DR.Close();
                DR.Dispose();
            }
            return(List);
        }
Пример #2
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(Model.PapersTitleList model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@ReturnValue", SqlDbType.Int),
                new SqlParameter("@CourseID",    SqlDbType.Int),
                new SqlParameter("@Type",        SqlDbType.NVarChar,  50),
                new SqlParameter("@Title",       SqlDbType.NVarChar, 500),
                new SqlParameter("@T_F",         SqlDbType.NVarChar,  50),
                new SqlParameter("@Analysis",    SqlDbType.Text),
                new SqlParameter("@ID",          SqlDbType.Int),
                new SqlParameter("@Score",       SqlDbType.Int),
                new SqlParameter("@PapersID",    SqlDbType.Int),
                new SqlParameter("@Status_id",   SqlDbType.Int)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.CourseID;
            parameters[2].Value     = model.Type;
            parameters[3].Value     = model.Title;
            parameters[4].Value     = model.T_F;
            parameters[5].Value     = model.Analysis;
            parameters[6].Value     = model.ID;
            parameters[7].Value     = model.Score;
            parameters[8].Value     = model.PapersID;
            parameters[9].Value     = model.Status_id;
            ExamSys.RunProcedure("PapersTitleList_Add", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
Пример #3
0
        /// <summary>
        /// 添加试卷题目
        /// </summary>
        /// <param name="Type">类型</param>
        /// <param name="gv">GridView</param>
        /// <param name="PapersID">PapersID</param>
        private void AddgvPapersTitleList(string Type, GridView gv, int PapersID)
        {
            BLL.PapersTitleList   bll   = new BLL.PapersTitleList();
            Model.PapersTitleList model = new Model.PapersTitleList();
            int Count = gv.Rows.Count;

            for (int i = 0; i < Count; i++)
            {
                HtmlInputCheckBox cbx = (HtmlInputCheckBox)gv.Rows[i].FindControl("checkbox");
                if (cbx.Checked == true)
                {
                    model.Title    = ((Label)gv.Rows[i].FindControl("lb_Title")).Text;
                    model.T_F      = ((Label)gv.Rows[i].FindControl("lb_T_F")).Text;
                    model.Analysis = ((Label)gv.Rows[i].FindControl("lb_Analysis")).Text;
                    model.ID       = int.Parse(((Label)gv.Rows[i].FindControl("lb_ID")).Text);

                    string score = ((HtmlInputText)gv.Rows[i].FindControl("textfield")).Value;
                    if (score == "")
                    {
                        model.Score = 0;
                    }
                    else
                    {
                        model.Score = int.Parse(score);
                    }
                    model.CourseID = int.Parse(lb_CourseID.Text);
                    model.Type     = Type;
                    model.PapersID = PapersID;
                    if (bll.Add(model) > 0)
                    {
                        AddgvPapersOptionsList(model.ID, PapersID, gv);
                    }
                    else
                    {
                        //如果题目添加不成功
                    }
                }
                else
                {
                    //如果题用户没有勾选
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 统计分值
        /// </summary>
        /// <param name="Type">类型(单选/多选/不定项选/判断)</param>
        /// <param name="PapersID">试卷ID</param>
        /// <returns></returns>
        private List <Model.PapersTitleList> nSumScore(string Type, int PapersID)
        {
            string strSql = "";

            if (Type != "")
            {
                strSql = "SELECT SUM([Score]) as sumscore FROM [ExaminationSystem].[Exam].[PapersTitleList] where PapersID='" + PapersID + "' and Type='" + Type + "'";
            }
            else
            {
                strSql = "SELECT SUM([Score]) as sumscore FROM [ExaminationSystem].[Exam].[PapersTitleList] where PapersID='" + PapersID + "'";
            }
            List <Model.PapersTitleList> List = new List <Model.PapersTitleList>();

            SqlParameter[] parameters =
            {
            };
            SqlDataReader DR;

            DR = ExamSys.ExecuteReader(strSql.ToString(), parameters);
            using (DR)
            {
                while (DR.Read())
                {
                    Model.PapersTitleList model = new Model.PapersTitleList();
                    if (DR["sumscore"].ToString() == "")
                    {
                        model.Score = 0;
                    }
                    else
                    {
                        model.Score = int.Parse(DR["sumscore"].ToString());
                    }
                    List.Add(model);
                }
                DR.Close();
                DR.Dispose();
            }
            return(List);
        }
        /// <summary>
        /// 添加试卷题目
        /// </summary>
        /// <param name="Type">类型</param>
        /// <param name="gv">GridView</param>
        /// <param name="PapersID">PapersID</param>
        private void AddgvPapersTitleList(string Type, int PapersID, string[] arrayTitle, string[] arrayScore, int CourseID)
        {
            try
            {
                BLL.PapersTitleList   bll   = new BLL.PapersTitleList();
                Model.PapersTitleList model = new Model.PapersTitleList();

                int count = 0;
                foreach (var item in arrayTitle)
                {
                    BLL.TitleList          Tbll = new BLL.TitleList();
                    List <Model.TitleList> list = Tbll.Details(int.Parse(item));

                    model.Title     = list[0].Title;
                    model.T_F       = list[0].T_F;
                    model.Analysis  = list[0].Analysis;
                    model.ID        = list[0].ID;
                    model.Score     = int.Parse(arrayScore[count]);
                    model.CourseID  = CourseID;
                    model.Type      = Type;
                    model.PapersID  = PapersID;
                    model.Status_id = int.Parse(list[0].Status_id.ToString());

                    count++;
                    if (bll.Add(model) > 0)
                    {
                        AddgvPapersOptionsList(model.ID, PapersID);
                    }
                    else
                    {
                        //如果题目添加不成功
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #6
0
        /// <summary>
        /// 添加试卷题目
        /// </summary>
        /// <param name="Type">类型</param>
        /// <param name="PapersID">PapersID</param>
        /// <param name="Score">分数</param>
        /// <param name="md">TitleList</param>
        private void AddPapersTitleList(string Type, int PapersID, int Score, Model.TitleList md)
        {
            BLL.PapersTitleList   bll   = new BLL.PapersTitleList();
            Model.PapersTitleList model = new Model.PapersTitleList();

            model.Title    = md.Title;
            model.T_F      = md.T_F;
            model.Analysis = md.Analysis;
            model.ID       = md.ID;
            model.CourseID = md.CourseID;

            model.Score    = Score;
            model.Type     = Type;
            model.PapersID = PapersID;
            if (bll.Add(model) > 0)
            {
                AddPapersOptionsList(PapersID, model.ID, model.Score, model.Type);
            }
            else
            {
                //如果题目添加不成功
            }
        }
 /// <summary>
 /// 添加
 /// </summary>
 public int Add(Model.PapersTitleList model)
 {
     return(dal.Add(model));
 }