public UserAccountFundSyncService() { InitializeComponent(); try { this._LocalLogger = new Common.General(Common.General.BindLocalLogInfo()); this._DBLogger = new Common.General(Common.General.BindDbLogInfo()); this._ServiceName = ConfigurationSettings.AppSettings["ServiceName"]; if (string.IsNullOrEmpty(this._ServiceName)) { this._ServiceName = "ServAccountSync"; } this._ServiceName.PadRight(20, ' ').Substring(0, 20).Trim(); this._IPreConsumeRecordBL = MasterBLLFactory.GetBLL<IPreConsumeRecordBL>(MasterBLLFactory.PreConsumeRecord); this._IConsumeRecordBL = MasterBLLFactory.GetBLL<IConsumeRecordBL>(MasterBLLFactory.ConsumeRecord); this._ICodeMasterBL = BLL.Factory.SysMaster.MasterBLLFactory.GetBLL<ICodeMasterBL>(BLL.Factory.SysMaster.MasterBLLFactory.CodeMaster_cmt); this._IConsumeMachineBL = MasterBLLFactory.GetBLL<IConsumeMachineBL>(MasterBLLFactory.ConsumeMachine); this._ICardUserAccountBL = MasterBLLFactory.GetBLL<ICardUserAccountBL>(MasterBLLFactory.CardUserAccount); this._tmrMain = new System.Timers.Timer(); this._tmrMain.Interval = 60000; this._tmrMain.Elapsed += new System.Timers.ElapsedEventHandler(_tmrMain_Elapsed); this._LocalLogger.WriteLog("服务初始化完毕。 " + DateTime.Now.ToString(), string.Empty, SystemLog.SystemLog.LogType.Trace); } catch (Exception ex) { this._LocalLogger.WriteLog("服务初始化失败。" + ex.Message + " " + DateTime.Now.ToString(), string.Empty, SystemLog.SystemLog.LogType.Error); } }
public frmCardRecharge(string strPwd) : base(strPwd) { InitializeComponent(); this._strPwd = strPwd; localLog = new General(Common.General.BindLocalLogInfo()); }
public bool AccountSync() { if (_LocalLogger == null) { _LocalLogger = new Common.General(Common.General.BindLocalLogInfo()); } try { cosumeRecordAnalysis(); } catch (Exception ex) { Console.WriteLine(getCWStyle(ex.Message, SystemLog.SystemLog.LogType.Error)); return false; } return true; }
/// <summary> /// Ask the user to select a data-stream file, de-serialized this to the appropriate object type and then display the data using the appropriate /// <c>FormDataStreamPlot</c> derived class. /// </summary> /// <param name="title">The title that is to appear on the <c>OpenFileDialog</c> form.</param> /// <param name="defaultExtension">The default extension associated with the type of log.</param> /// <param name="filterText">The filter text. Used to filter the list of available files.</param> /// <param name="initialDirectory">The initial directory that will be show.</param> /// <returns>A flag to indicate whether a valid watch file was selected. True, indicates that the selected file was valid; otherwise, false.</returns> public virtual bool ShowDataStreamFile(string title, string defaultExtension, string filterText, string initialDirectory) { // Default to the selected file being invalid. bool selectedFileIsValid = false; MainWindow.CloseChildForms(); MainWindow.Cursor = Cursors.WaitCursor; string fullFilename = General.FileDialogOpenFile(title, defaultExtension, filterText, initialDirectory); // Skip, if the user didn't select a simulated fault log file. if (fullFilename == string.Empty) { MainWindow.Cursor = Cursors.Default; return(selectedFileIsValid); } // Update the appropriate InitialDirectory property with the path of the specified data stream file. switch (defaultExtension) { case CommonConstants.ExtensionFaultLog: InitialDirectory.FaultLogsRead = Path.GetDirectoryName(fullFilename); break; case CommonConstants.ExtensionSimulatedFaultLog: InitialDirectory.SimulatedFaultLogsRead = Path.GetDirectoryName(fullFilename); break; case CommonConstants.ExtensionWatchFile: InitialDirectory.WatchFilesRead = Path.GetDirectoryName(fullFilename); break; default: break; } // De-serialize the selected file. m_WatchFile = FileHandling.Load <WatchFile_t>(fullFilename, FileHandling.FormatType.Binary); // Ensure that the de-serialized file contains data. if (m_WatchFile.DataStream.WatchFrameList == null) { // File format is not recognised, report message. MessageBox.Show(Resources.MBTInvalidFormat, Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error); MainWindow.Cursor = Cursors.Default; return(selectedFileIsValid); } // Ensure that the selected log file is associated with the current project. if (m_WatchFile.Header.ProjectInformation.ProjectIdentifier != Parameter.ProjectInformation.ProjectIdentifier) { MessageBox.Show(Resources.MBTProjectIdMismatch, Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error); MainWindow.Cursor = Cursors.Default; return(selectedFileIsValid); } FileInfo fileInfo = new FileInfo(fullFilename); m_WatchFile.Filename = fileInfo.Name; m_WatchFile.FullFilename = fileInfo.FullName; selectedFileIsValid = true; MainWindow.Cursor = Cursors.Default; return(selectedFileIsValid); }