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

            if (rowsCount > 0)
            {
                Dianda.Model.Term_Diary model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Dianda.Model.Term_Diary();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["DATETIME"].ToString() != "")
                    {
                        model.DATETIME = DateTime.Parse(dt.Rows[n]["DATETIME"].ToString());
                    }
                    model.CONTENTS = dt.Rows[n]["CONTENTS"].ToString();
                    if (dt.Rows[n]["FirstWeek"].ToString() != "")
                    {
                        model.FirstWeek = DateTime.Parse(dt.Rows[n]["FirstWeek"].ToString());
                    }
                    if (dt.Rows[n]["LastWeek"].ToString() != "")
                    {
                        model.LastWeek = DateTime.Parse(dt.Rows[n]["LastWeek"].ToString());
                    }
                    if (dt.Rows[n]["DELFLAG"].ToString() != "")
                    {
                        model.DELFLAG = int.Parse(dt.Rows[n]["DELFLAG"].ToString());
                    }
                    if (dt.Rows[n]["isWork"].ToString() != "")
                    {
                        model.isWork = int.Parse(dt.Rows[n]["isWork"].ToString());
                    }
                    model.UserID = dt.Rows[n]["UserID"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Dianda.Model.Term_Diary model)
 {
     dal.Update(model);
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Dianda.Model.Term_Diary model)
 {
     return(dal.Add(model));
 }