コード例 #1
0
        /// <summary>
        /// 删除试卷
        /// </summary>
        /// <param name="msg"></param>
        private void DeletePager(out string msg)
        {
            msg = "";
            CheckedDelPar(out msg);
            if (msg == "")
            {
                Entities.ExamPaper paperModel = BLL.ExamPaper.Instance.GetExamPaper(long.Parse(Epid));
                if (paperModel != null)
                {
                    Entities.QueryExamBigQuestion query = new Entities.QueryExamBigQuestion();
                    query.EPID = paperModel.EPID;

                    int       totalCount = 0;
                    DataTable dt         = BLL.ExamBigQuestion.Instance.GetExamBigQuestion(query, "", 1, 9999, out totalCount);

                    string        connectionstrings = ConfigurationUtil.GetAppSettingValue("ConnectionStrings_CC");
                    SqlConnection connection        = new SqlConnection(connectionstrings);
                    connection.Open();
                    SqlTransaction tran = connection.BeginTransaction("SampleTransaction");

                    try
                    {
                        int retVal = BLL.ExamPaper.Instance.Delete(tran, int.Parse(Epid));
                        if (retVal > 0)
                        {
                            if (dt != null && dt.Rows.Count > 0)
                            {
                                foreach (DataRow dr in dt.Rows)
                                {
                                    retVal = BLL.ExamBigQuestion.Instance.Delete(tran, long.Parse(dr["BQID"].ToString()));
                                }
                            }
                        }

                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                        msg = ex.Message.ToString();
                    }
                    finally
                    {
                        connection.Close();
                    }
                }
                else
                {
                    msg = "没找到对应试卷";
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 绑定大题信息
        /// </summary>
        private void BindBigQustion()
        {
            long epid = 0;

            if (long.TryParse(EPID, out epid))
            {
                Entities.QueryExamBigQuestion query = new Entities.QueryExamBigQuestion();
                query.EPID = epid;

                int       totalCount = 0;
                DataTable dt         = BLL.ExamBigQuestion.Instance.GetExamBigQuestion(query, "", 1, 99999, out totalCount);
                if (dt != null)
                {
                    RptBigQuestion.DataSource = dt;
                    RptBigQuestion.DataBind();
                }
            }
        }