Beispiel #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Model.tbChapter> DataTableToList(DataTable dt)
        {
            List <Model.tbChapter> modelList = new List <Model.tbChapter>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Model.tbChapter model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.tbChapter();
                    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]["chapterno"].ToString() != "")
                    {
                        model.chapterno = int.Parse(dt.Rows[n]["chapterno"].ToString());
                    }
                    model.chaptername = dt.Rows[n]["chaptername"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindSubject();
         if (Request.QueryString["id"] != null)
         {
             int id = Convert.ToInt32(Request.QueryString["id"]);
             chapter = chapterBLL.GetModel(id);
             txtChapterName.Text = chapter.chaptername;
             ddlSubject.Items.FindByValue(chapter.subjectid.ToString()).Selected = true;
             ddlChapterNO.Items.FindByValue(chapter.chapterno.ToString()).Selected = true;
         }
     }
 }
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<Model.tbChapter> DataTableToList(DataTable dt)
		{
			List<Model.tbChapter> modelList = new List<Model.tbChapter>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				Model.tbChapter model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new Model.tbChapter();					
													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]["chapterno"].ToString()!="")
				{
					model.chapterno=int.Parse(dt.Rows[n]["chapterno"].ToString());
				}
																																				model.chaptername= dt.Rows[n]["chaptername"].ToString();
																						
				
					modelList.Add(model);
				}
			}
			return modelList;
		}
Beispiel #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.tbChapter model)
 {
     return(dal.Update(model));
 }
Beispiel #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Model.tbChapter model)
 {
     return(dal.Add(model));
 }