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

            if (rowsCount > 0)
            {
                Sys.Model.AdminLog model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Sys.Model.AdminLog();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    model.Username = dt.Rows[n]["Username"].ToString();
                    model.Flag     = dt.Rows[n]["Flag"].ToString();
                    model.Log      = dt.Rows[n]["Log"].ToString();
                    if (dt.Rows[n]["CreateTime"].ToString() != "")
                    {
                        model.CreateTime = DateTime.Parse(dt.Rows[n]["CreateTime"].ToString());
                    }
                    model.CreateIP = dt.Rows[n]["CreateIP"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int AddModel(Sys.Model.AdminLog model)
 {
     return(dal.Add(model));
 }