Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];

            if (id.IsGuid())
            {
                log = new FoWoSoft.Platform.Log().Get(id.ToGuid());
                if (log != null)
                {
                    this.Title1.Text    = log.Title;
                    this.Type.Text      = log.Type;
                    this.WriteTime.Text = log.WriteTime.ToDateTimeStringS();
                    this.UserName.Text  = log.UserName;
                    this.IPAddress.Text = log.IPAddress;
                    this.URL.Text       = log.URL;
                    this.Others.Text    = log.Others;
                    this.Contents.Text  = log.Contents.HtmlEncode();
                    this.OldXml.Text    = log.OldXml.HtmlEncode();
                    this.NewXml.Text    = log.NewXml.HtmlEncode();
                    if (log.Contents.IsNullOrEmpty())
                    {
                        this.contentstr.Visible = false;
                    }
                    if (log.OldXml.IsNullOrEmpty())
                    {
                        this.oldxmlstr.Visible = false;
                    }
                    if (log.NewXml.IsNullOrEmpty())
                    {
                        this.newxmlstr.Visible = false;
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// 将DataRedar转换为List
        /// </summary>
        private List <FoWoSoft.Data.Model.Log> DataReaderToList(SqlDataReader dataReader)
        {
            List <FoWoSoft.Data.Model.Log> List = new List <FoWoSoft.Data.Model.Log>();

            FoWoSoft.Data.Model.Log model = null;
            while (dataReader.Read())
            {
                model           = new FoWoSoft.Data.Model.Log();
                model.ID        = dataReader.GetGuid(0);
                model.Title     = dataReader.GetString(1);
                model.Type      = dataReader.GetString(2);
                model.WriteTime = dataReader.GetDateTime(3);
                if (!dataReader.IsDBNull(4))
                {
                    model.UserID = dataReader.GetGuid(4);
                }
                if (!dataReader.IsDBNull(5))
                {
                    model.UserName = dataReader.GetString(5);
                }
                if (!dataReader.IsDBNull(6))
                {
                    model.IPAddress = dataReader.GetString(6);
                }
                if (!dataReader.IsDBNull(7))
                {
                    model.URL = dataReader.GetString(7);
                }
                if (!dataReader.IsDBNull(8))
                {
                    model.Contents = dataReader.GetString(8);
                }
                if (!dataReader.IsDBNull(9))
                {
                    model.Others = dataReader.GetString(9);
                }
                if (!dataReader.IsDBNull(10))
                {
                    model.OldXml = dataReader.GetString(10);
                }
                if (!dataReader.IsDBNull(11))
                {
                    model.NewXml = dataReader.GetString(11);
                }
                List.Add(model);
            }
            return(List);
        }
Example #3
0
 /// <summary>
 /// 记录日志
 /// </summary>
 /// <param name="err"></param>
 public static void Add(string title, string contents, Types type = Types.其它分类, string oldXML = "", string newXML = "", FoWoSoft.Data.Model.Users user = null)
 {
     if (user == null)
     {
         user = Platform.Users.CurrentUser;
     }
     FoWoSoft.Data.Model.Log log = new FoWoSoft.Data.Model.Log();
     log.Contents  = contents;
     log.ID        = Guid.NewGuid();
     log.IPAddress = FoWoSoft.Utility.Tools.GetIPAddress();
     log.Others    = string.Format("操作系统:{0} 浏览器:{1}", FoWoSoft.Utility.Tools.GetOSName(), FoWoSoft.Utility.Tools.GetBrowse());
     log.Title     = title;
     log.OldXml    = oldXML.IsNullOrEmpty() ? null : oldXML;
     log.NewXml    = newXML.IsNullOrEmpty() ? null : newXML;
     log.Type      = type.ToString();
     log.URL       = System.Web.HttpContext.Current.Request.Url.ToString();
     if (user != null)
     {
         log.UserID   = user.ID;
         log.UserName = user.Name;
     }
     log.WriteTime = FoWoSoft.Utility.DateTimeNew.Now;
     Add(log);
 }
Example #4
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model">FoWoSoft.Data.Model.Log实体类</param>
        /// <returns>操作所影响的行数</returns>
        public int Add(FoWoSoft.Data.Model.Log model)
        {
            string sql = @"INSERT INTO Log
				(ID,Title,Type,WriteTime,UserID,UserName,IPAddress,URL,Contents,Others,OldXml,NewXml) 
				VALUES(@ID,@Title,@Type,@WriteTime,@UserID,@UserName,@IPAddress,@URL,@Contents,@Others,@OldXml,@NewXml)"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                },
                new SqlParameter("@Title", SqlDbType.NVarChar, -1)
                {
                    Value = model.Title
                },
                new SqlParameter("@Type", SqlDbType.NVarChar, 100)
                {
                    Value = model.Type
                },
                new SqlParameter("@WriteTime", SqlDbType.DateTime, 8)
                {
                    Value = model.WriteTime
                },
                model.UserID == null ? new SqlParameter("@UserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@UserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.UserID
                },
                model.UserName == null ? new SqlParameter("@UserName", SqlDbType.NVarChar, 100)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@UserName", SqlDbType.NVarChar, 100)
                {
                    Value = model.UserName
                },
                model.IPAddress == null ? new SqlParameter("@IPAddress", SqlDbType.VarChar, 50)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@IPAddress", SqlDbType.VarChar, 50)
                {
                    Value = model.IPAddress
                },
                model.URL == null ? new SqlParameter("@URL", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@URL", SqlDbType.VarChar, -1)
                {
                    Value = model.URL
                },
                model.Contents == null ? new SqlParameter("@Contents", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Contents", SqlDbType.VarChar, -1)
                {
                    Value = model.Contents
                },
                model.Others == null ? new SqlParameter("@Others", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Others", SqlDbType.VarChar, -1)
                {
                    Value = model.Others
                },
                model.OldXml == null ? new SqlParameter("@OldXml", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@OldXml", SqlDbType.VarChar, -1)
                {
                    Value = model.OldXml
                },
                model.NewXml == null ? new SqlParameter("@NewXml", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@NewXml", SqlDbType.VarChar, -1)
                {
                    Value = model.NewXml
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Example #5
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model">FoWoSoft.Data.Model.Log实体类</param>
        public int Update(FoWoSoft.Data.Model.Log model)
        {
            string sql = @"UPDATE Log SET 
				Title=@Title,Type=@Type,WriteTime=@WriteTime,UserID=@UserID,UserName=@UserName,IPAddress=@IPAddress,URL=@URL,Contents=@Contents,Others=@Others,OldXml=@OldXml,NewXml=@NewXml
				WHERE ID=@ID"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@Title", SqlDbType.NVarChar, -1)
                {
                    Value = model.Title
                },
                new SqlParameter("@Type", SqlDbType.NVarChar, 100)
                {
                    Value = model.Type
                },
                new SqlParameter("@WriteTime", SqlDbType.DateTime, 8)
                {
                    Value = model.WriteTime
                },
                model.UserID == null ? new SqlParameter("@UserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@UserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.UserID
                },
                model.UserName == null ? new SqlParameter("@UserName", SqlDbType.NVarChar, 100)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@UserName", SqlDbType.NVarChar, 100)
                {
                    Value = model.UserName
                },
                model.IPAddress == null ? new SqlParameter("@IPAddress", SqlDbType.VarChar, 50)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@IPAddress", SqlDbType.VarChar, 50)
                {
                    Value = model.IPAddress
                },
                model.URL == null ? new SqlParameter("@URL", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@URL", SqlDbType.VarChar, -1)
                {
                    Value = model.URL
                },
                model.Contents == null ? new SqlParameter("@Contents", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Contents", SqlDbType.VarChar, -1)
                {
                    Value = model.Contents
                },
                model.Others == null ? new SqlParameter("@Others", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Others", SqlDbType.VarChar, -1)
                {
                    Value = model.Others
                },
                model.OldXml == null ? new SqlParameter("@OldXml", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@OldXml", SqlDbType.VarChar, -1)
                {
                    Value = model.OldXml
                },
                model.NewXml == null ? new SqlParameter("@NewXml", SqlDbType.VarChar, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@NewXml", SqlDbType.VarChar, -1)
                {
                    Value = model.NewXml
                },
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Example #6
0
        /// <summary>
        /// 新增
        /// </summary>
        public static void Add(FoWoSoft.Data.Model.Log model)
        {
            dgWriteLog wl = new dgWriteLog(add);

            wl.BeginInvoke(model, null, null);
        }
Example #7
0
 /// <summary>
 /// 新增
 /// </summary>
 private static void add(FoWoSoft.Data.Model.Log model)
 {
     dataLog1.Add(model);
 }
Example #8
0
 /// <summary>
 /// 更新
 /// </summary>
 public int Update(FoWoSoft.Data.Model.Log model)
 {
     return(dataLog.Update(model));
 }