Esempio n. 1
0
        /// <summary>
        /// 根据DataTable转换成List对象数组
        /// </summary>
        public List <MultiColorPen.Model.sys_loginfo> DataTableToList(DataTable dt)
        {
            List <MultiColorPen.Model.sys_loginfo> modelList = new List <MultiColorPen.Model.sys_loginfo>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                MultiColorPen.Model.sys_loginfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new MultiColorPen.Model.sys_loginfo();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.logtype = dt.Rows[n]["logtype"].ToString();
                    if (dt.Rows[n]["createtime"].ToString() != "")
                    {
                        model.createtime = DateTime.Parse(dt.Rows[n]["createtime"].ToString());
                    }
                    model.usercode   = dt.Rows[n]["usercode"].ToString();
                    model.username   = dt.Rows[n]["username"].ToString();
                    model.ipaddress  = dt.Rows[n]["ipaddress"].ToString();
                    model.logcontent = dt.Rows[n]["logcontent"].ToString();
                    model.datatable  = dt.Rows[n]["datatable"].ToString();
                    model.dataid     = dt.Rows[n]["dataid"].ToString();
                    model.dataold    = dt.Rows[n]["dataold"].ToString();
                    model.datanew    = dt.Rows[n]["datanew"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(MultiColorPen.Model.sys_loginfo model)
 {
     return(dal.Update(model) ? 1 : 0);
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(MultiColorPen.Model.sys_loginfo model)
 {
     return(dal.Add(model) ? 1 : 0);
 }