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

            if (rowsCount > 0)
            {
                Hownet.Model.Mesg model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Mesg();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["FillManID"] != null && dt.Rows[n]["FillManID"].ToString() != "")
                    {
                        model.FillManID = int.Parse(dt.Rows[n]["FillManID"].ToString());
                    }
                    model.FillMan = dt.Rows[n]["FillMan"].ToString();
                    if (dt.Rows[n]["FillDate"] != null && dt.Rows[n]["FillDate"].ToString() != "")
                    {
                        model.FillDate = DateTime.Parse(dt.Rows[n]["FillDate"].ToString());
                    }
                    if (dt.Rows[n]["LastDate"] != null && dt.Rows[n]["LastDate"].ToString() != "")
                    {
                        model.LastDate = DateTime.Parse(dt.Rows[n]["LastDate"].ToString());
                    }
                    model.Title       = dt.Rows[n]["Title"].ToString();
                    model.TextContent = dt.Rows[n]["TextContent"].ToString();
                    if (dt.Rows[n]["IsEnd"] != null && dt.Rows[n]["IsEnd"].ToString() != "")
                    {
                        model.IsEnd = int.Parse(dt.Rows[n]["IsEnd"].ToString());
                    }
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hownet.Model.Mesg model)
 {
     return(dal.Update(model));
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.Mesg model)
 {
     return(dal.Add(model));
 }