Beispiel #1
0
 public bool WriteLog(DataBase db)
 {
     if (Popedoms.Trim() != "")
     {
         int num = 0;
         string[] strArray = Popedoms.Split(",".ToCharArray());
         for (int i = 0; i < strArray.Length; i++)
         {
             if (strArray[i].Trim() == this.FunctionId.Trim())
             {
                 num = 1;
                 break;
             }
         }
         if (num != 0)
         {
             string commandText = "insert into " + GetAccessType.DataBaseName + "Qx_syslog(webuser,type,nrstring,logip,nrstringdata,logtable,logtablekey,logtableid,logdelyy,webusername) values('" + this.UserId + "','" + this.FunctionId + "','" + this.FunctionName + "','" + this.LogIp + "',";
             ParameterCollection commandParameters = new ParameterCollection(1);
             commandText = commandText + ":nrstringdata,";
             commandParameters.Add(":nrstringdata", this.functiondata, MyDataType.UInt16, ParameterDirection.Input);
             commandText = commandText + "'" + this.LogTable + "','" + this.LogTableKey + "','" + this.LogTableId + "','" + this.LogCause + "','" + this.UserName + "')";
             try
             {
                 db.ExecuteNonQuery(CommandType.Text, commandText, commandParameters);
             }
             catch (Exception)
             {
                 throw new LogException("写入日志失败!");
             }
         }
     }
     return true;
 }