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

            if (rowsCount > 0)
            {
                Maticsoft.Model.MessageInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Maticsoft.Model.MessageInfo();
                    if (dt.Rows[n]["MessID"].ToString() != "")
                    {
                        model.MessID = int.Parse(dt.Rows[n]["MessID"].ToString());
                    }
                    model.MessTitle = dt.Rows[n]["MessTitle"].ToString();
                    model.Username  = dt.Rows[n]["Username"].ToString();
                    if (dt.Rows[n]["Sex"].ToString() != "")
                    {
                        model.Sex = int.Parse(dt.Rows[n]["Sex"].ToString());
                    }
                    if (dt.Rows[n]["DateTime"].ToString() != "")
                    {
                        model.DateTime = DateTime.Parse(dt.Rows[n]["DateTime"].ToString());
                    }
                    model.Address     = dt.Rows[n]["Address"].ToString();
                    model.Linkphoto   = dt.Rows[n]["Linkphoto"].ToString();
                    model.Email       = dt.Rows[n]["Email"].ToString();
                    model.Messcontent = dt.Rows[n]["Messcontent"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.MessageInfo model)
 {
     return(dal.Update(model));
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Maticsoft.Model.MessageInfo model)
 {
     return(dal.Add(model));
 }