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

            if (rowsCount > 0)
            {
                lgk.Model.tb_userLog model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new lgk.Model.tb_userLog();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["UserName"] != null && dt.Rows[n]["UserName"].ToString() != "")
                    {
                        model.UserName = dt.Rows[n]["UserName"].ToString();
                    }
                    if (dt.Rows[n]["LogTime"] != null && dt.Rows[n]["LogTime"].ToString() != "")
                    {
                        model.LogTime = DateTime.Parse(dt.Rows[n]["LogTime"].ToString());
                    }
                    if (dt.Rows[n]["LogContent"] != null && dt.Rows[n]["LogContent"].ToString() != "")
                    {
                        model.LogContent = dt.Rows[n]["LogContent"].ToString();
                    }
                    if (dt.Rows[n]["LogIP"] != null && dt.Rows[n]["LogIP"].ToString() != "")
                    {
                        model.LogIP = dt.Rows[n]["LogIP"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_userLog model)
 {
     return(dal.Update(model));
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(lgk.Model.tb_userLog model)
 {
     return(dal.Add(model));
 }