Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Model.tbArrange> DataTableToList(DataTable dt)
        {
            List <Model.tbArrange> modelList = new List <Model.tbArrange>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Model.tbArrange model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.tbArrange();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["subjectid"].ToString() != "")
                    {
                        model.subjectid = int.Parse(dt.Rows[n]["subjectid"].ToString());
                    }
                    if (dt.Rows[n]["paperid"].ToString() != "")
                    {
                        model.paperid = int.Parse(dt.Rows[n]["paperid"].ToString());
                    }
                    if (dt.Rows[n]["userid"].ToString() != "")
                    {
                        model.userid = int.Parse(dt.Rows[n]["userid"].ToString());
                    }
                    model.arrangetitle = dt.Rows[n]["arrangetitle"].ToString();
                    if (dt.Rows[n]["starttime"].ToString() != "")
                    {
                        model.starttime = DateTime.Parse(dt.Rows[n]["starttime"].ToString());
                    }
                    if (dt.Rows[n]["endtime"].ToString() != "")
                    {
                        model.endtime = DateTime.Parse(dt.Rows[n]["endtime"].ToString());
                    }
                    if (dt.Rows[n]["arrangetype"].ToString() != "")
                    {
                        model.arrangetype = int.Parse(dt.Rows[n]["arrangetype"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindSubject();
            if (Request.QueryString["id"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["id"]);
                arrange = arrangeBLL.GetModel(id);
                txtArrangeName.Text = arrange.arrangetitle;
                txtStartTime.Text = arrange.starttime.ToString("yyyy-MM-dd HH:mm");
                txtEndTime.Text = arrange.endtime.ToString("yyyy-MM-dd HH:mm");

                ddlSubject.Items.FindByValue(arrange.subjectid.ToString()).Selected = true;
                ddlSubject.Enabled = false;
                BindPaper();
                ddlPaper.Items.FindByValue(arrange.paperid.ToString()).Selected = true;
                ddlPaper.Enabled = false;
            }
        }
    }
Пример #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.tbArrange model)
 {
     return(dal.Update(model));
 }
Пример #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Model.tbArrange model)
 {
     return(dal.Add(model));
 }
Пример #5
0
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<Model.tbArrange> DataTableToList(DataTable dt)
		{
			List<Model.tbArrange> modelList = new List<Model.tbArrange>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				Model.tbArrange model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new Model.tbArrange();					
													if(dt.Rows[n]["id"].ToString()!="")
				{
					model.id=int.Parse(dt.Rows[n]["id"].ToString());
				}
																																if(dt.Rows[n]["subjectid"].ToString()!="")
				{
					model.subjectid=int.Parse(dt.Rows[n]["subjectid"].ToString());
				}
																																if(dt.Rows[n]["paperid"].ToString()!="")
				{
					model.paperid=int.Parse(dt.Rows[n]["paperid"].ToString());
				}
																																if(dt.Rows[n]["userid"].ToString()!="")
				{
					model.userid=int.Parse(dt.Rows[n]["userid"].ToString());
				}
																																				model.arrangetitle= dt.Rows[n]["arrangetitle"].ToString();
																												if(dt.Rows[n]["starttime"].ToString()!="")
				{
					model.starttime=DateTime.Parse(dt.Rows[n]["starttime"].ToString());
				}
																																if(dt.Rows[n]["endtime"].ToString()!="")
				{
					model.endtime=DateTime.Parse(dt.Rows[n]["endtime"].ToString());
				}
																																if(dt.Rows[n]["arrangetype"].ToString()!="")
				{
					model.arrangetype=int.Parse(dt.Rows[n]["arrangetype"].ToString());
				}
																										
				
					modelList.Add(model);
				}
			}
			return modelList;
		}
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        arrangeid = Convert.ToInt32(Request.QueryString["id"]);
        arrange = arrangeBLL.GetModel(arrangeid);
        paper = paperBLL.GetModel(arrange.paperid);
        subject = subjectBLL.GetModel(arrange.subjectid);

        if (!IsPostBack)
        {
            //取得数据库连接
            SqlConnection conn = SQLHelper.GetConnection();
            //打开数据库连接
            conn.Open();
            //创建事务
            SqlTransaction SqlTransaction = conn.BeginTransaction();

            try
            {
                PaperGenerateDAL pgd = new PaperGenerateDAL(paper, SqlTransaction);
                pc = pgd.GetPaperContent();
                SqlTransaction.Commit();
            }
            catch (Exception)
            {
                try
                {
                    SqlTransaction.Rollback();
                }
                catch (Exception)
                {
                    //事务回滚出错
                }
            }
            finally
            {
                //关闭各种资源
                SqlTransaction.Dispose();
                conn.Close();
            }
            if (arrange.arrangetype == 2)
            {
                //考试,记录考试时间,成绩状态
                tbUser user = (tbUser)Session[Constant.User];
                tbScore score = this.GetScore(arrangeid, user.id);
                score.starttime = DateTime.Now;
                score.scorestatus = 2;//正在考试
                scoreBLL.Update(score);

                //把scoreid存放在ViewState
                ViewState[Constant.ScoreID] = score.id;
            }
            if (pc.SRContent.Count != 0)
            {
                rptSR.DataSource = pc.SRContent;
                rptSR.DataBind();
            }

            if (pc.CBContent.Count != 0)
            {
                rptCB.DataSource = pc.CBContent;
                rptCB.DataBind();
            }

            if (pc.JDContent.Count != 0)
            {
                rptJD.DataSource = pc.JDContent;
                rptJD.DataBind();
            }

            if (pc.BFContent.Count != 0)
            {
                rptBF.DataSource = pc.BFContent;
                rptBF.DataBind();
            }

            if (pc.SAContent.Count != 0)
            {
                rptSA.DataSource = pc.SAContent;
                rptSA.DataBind();
            }
        }
    }