Beispiel #1
0
        /// <summary>
        /// 根据时间按写日志
        /// </summary>
        /// <param name="span"></param>
        /// <param name="msg"></param>
        public static void WirteTimeSpanLog(TimeSpan span, LogType type)
        {
            try
            {
                if (span.TotalSeconds > 1)
                {
                    string msg = "";
                    switch (type)
                    {
                    case LogType.SP:    //合件
                        msg = "扫描合件";
                        break;

                    case LogType.SC:    //子件
                        msg = "扫描子件";
                        break;

                    case LogType.Y1:    //验证合件
                        msg = "验证合件";
                        break;

                    case LogType.Y2:    //验证子件
                        msg = "验证子件";
                        break;

                    case LogType.V0:    //声音Error
                        msg = "错误提示音";
                        break;

                    case LogType.V1:    //扫描OK
                        msg = "扫描提示音";
                        break;

                    case LogType.V2:    //声音OK
                        msg = "正确提示音";
                        break;

                    case LogType.RD:    //插入到数据库
                        msg = "更新到数据库";
                        break;

                    case LogType.DBOPEN:    //数据库连接OPEN
                        msg = "数据库连接OPEN";
                        break;

                    case LogType.DBEXECUTE:    //执行SQL语句
                        msg = "执行SQL语句";
                        break;

                    case LogType.REQUEST:    //执行SQL语句
                        msg = "Request请求";
                        break;
                    }
                    CLog.WriteStationLog("scan", msg + ":" + span);
                }
            }
            catch (Exception ex)
            {
                CLog.WriteErrLog("[FrmScan.WirteTimeSpanLog]" + ex.Message);
            }
        }