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

            if (rowsCount > 0)
            {
                ROYcms.Sys.Model.ROYcms_Log model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Sys.Model.ROYcms_Log();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["User_id"] != null && dt.Rows[n]["User_id"].ToString() != "")
                    {
                        model.User_id = int.Parse(dt.Rows[n]["User_id"].ToString());
                    }
                    if (dt.Rows[n]["Admin_id"] != null && dt.Rows[n]["Admin_id"].ToString() != "")
                    {
                        model.Admin_id = int.Parse(dt.Rows[n]["Admin_id"].ToString());
                    }
                    if (dt.Rows[n]["Err_id"] != null && dt.Rows[n]["Err_id"].ToString() != "")
                    {
                        model.Err_id = dt.Rows[n]["Err_id"].ToString();
                    }
                    if (dt.Rows[n]["Event"] != null && dt.Rows[n]["Event"].ToString() != "")
                    {
                        model.Event = dt.Rows[n]["Event"].ToString();
                    }
                    if (dt.Rows[n]["Content"] != null && dt.Rows[n]["Content"].ToString() != "")
                    {
                        model.Content = dt.Rows[n]["Content"].ToString();
                    }
                    if (dt.Rows[n]["Time"] != null && dt.Rows[n]["Time"].ToString() != "")
                    {
                        model.Time = DateTime.Parse(dt.Rows[n]["Time"].ToString());
                    }
                    if (dt.Rows[n]["Ip"] != null && dt.Rows[n]["Ip"].ToString() != "")
                    {
                        model.Ip = dt.Rows[n]["Ip"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ROYcms.Sys.Model.ROYcms_Log model)
 {
     return(dal.Update(model));
 }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(ROYcms.Sys.Model.ROYcms_Log model)
 {
     return(dal.Add(model));
 }