public static List <PrepareTMOrderLog> QueryLog(DateTime BeginTime, DateTime EndTime, string TMJiaoluGUID, string LogText)
        {
            List <PrepareTMOrderLog> result = new List <PrepareTMOrderLog>();

            string strSql = @"select * from Tab_Nameplate_TrainmanJiaolu_PrepareOrderLog  where LogTime >=@BeginTime and LogTime <=@EndTime and TMJiaoluGUID=@TMJiaoluGUID  ";

            if (LogText.Trim().Length > 0)
            {
                strSql += " and LogText like @LogText";
            }
            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("BeginTime", BeginTime),
                new SqlParameter("EndTime", EndTime),
                new SqlParameter("TMJiaoluGUID", TMJiaoluGUID),
                new SqlParameter("LogText", "%" + LogText + "%")
            };
            strSql += " order by LogTime ";
            DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PrepareTMOrderLog logItem = new PrepareTMOrderLog();
                logItem.LogTime      = Convert.ToDateTime(dt.Rows[i]["LogTime"]);
                logItem.TMJiaoluGUID = dt.Rows[i]["TMJiaoluGUID"].ToString();
                logItem.TMJiaoluName = dt.Rows[i]["TMJiaoluName"].ToString();
                logItem.UserNumber   = dt.Rows[i]["UserNumber"].ToString();
                logItem.UserName     = dt.Rows[i]["UserName"].ToString();
                logItem.LogText      = dt.Rows[i]["LogText"].ToString();
                logItem.ChangeType   = Convert.ToInt32(dt.Rows[i]["ChangeType"]);
                result.Add(logItem);
            }
            return(result);
        }
        public static void AddLog(PrepareTMOrderLog Log)
        {
            string strSql = @"insert Tab_Nameplate_TrainmanJiaolu_PrepareOrderLog  (LogTime,UserNumber,UserName,TMJiaoluGUID,TMJiaoluName,ChangeType,LogText) 
                values (@LogTime,@UserNumber,@UserName,@TMJiaoluGUID,@TMJiaoluName,@ChangeType,@LogText)  ";

            SqlParameter[] sqlParams = new SqlParameter[] {
                new SqlParameter("LogTime", Log.LogTime),
                new SqlParameter("UserNumber", Log.UserNumber),
                new SqlParameter("UserName", Log.UserName),
                new SqlParameter("TMJiaoluGUID", Log.TMJiaoluGUID),
                new SqlParameter("TMJiaoluName", Log.TMJiaoluName),
                new SqlParameter("ChangeType", Log.ChangeType),
                new SqlParameter("LogText", Log.LogText)
            };
            SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams);
        }
示例#3
0
 public static void AddLog(PrepareTMOrderLog Log)
 {
     DBPrepareTMOrder.AddLog(Log);
 }