public static async Task Main() { var dbContext = new BulkInsertContext(); var paymentRepositories = new List <IPaymentRepository>() { new EFDummyAddRepository(dbContext), new EFAddRepository(dbContext), new EFAddRangeRepository(dbContext), new SqlBulkCopyRepository(dbContext), new AutoDetectChangesDisabledPaymentRepositoryDecorator(new EFDummyAddRepository(dbContext)), new AutoDetectChangesDisabledPaymentRepositoryDecorator(new EFAddRepository(dbContext)), new AutoDetectChangesDisabledPaymentRepositoryDecorator(new EFAddRangeRepository(dbContext)), new AutoDetectChangesDisabledPaymentRepositoryDecorator(new SqlBulkCopyRepository(dbContext)), // new BulkInsertRepository(dbContext) }; IPerformanceService performanceService = new PerformanceService(); var result = await performanceService.CompareAsync(paymentRepositories); var serializedResult = JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }); Console.WriteLine(serializedResult); Console.Read(); }
private void DGV_Binding() { PerformanceService service = new PerformanceService(); perList = service.GetPerList(); dgvPerformance.DataSource = perList; }
private void btnSearch_Click(object sender, EventArgs e) { string pid = ""; string process = ""; if (cboProduct.SelectedIndex > 0) { pid = cboProduct.SelectedValue.ToString(); } if (cboProcess.SelectedIndex > 0) { process = cboProcess.Text; } try { PerformanceService service = new PerformanceService(); perList = service.SearchPerList(pid, process); string FromDate = periodSearchControl.dtFrom; string ToDate = periodSearchControl.dtTo; List <PerformanceVO> PerformanceList = (from per in perList where Convert.ToDateTime(FromDate) <= Convert.ToDateTime(per.production_sdate) && Convert.ToDateTime(per.production_sdate) <= Convert.ToDateTime(ToDate) select per).ToList(); dgvPerformance.DataSource = PerformanceList; } catch (Exception err) { MessageBox.Show(err.Message); } }
public void GetEvaluatedProfilesTest() { PerformanceService service = new PerformanceService(); var profiles = service.GetEvaluatedProfiles(); Assert.IsTrue(profiles != null); }
public static void BuildDocumentMap(FileData file) { lock (file.DocumentMap) { PerformanceService.StartEvent($"{PerformanceService.CONST_BuildDocumentMap}{file.Path}"); try { #region LazyLoad if (file.IsCached_Lazy_DocumentMap) { Log.Write("Pulling DocumentMap from Cache", typeof(DocumentMapService).FullName, MethodBase.GetCurrentMethod().Name, LogEntryType.Warning); return; } #endregion file.DocumentMap.Clear(); List <iLineMatch> events = new List <iLineMatch>(); var performanceResults = new List <EventPerformanceResult>(); var results = new List <DocumentEntry>(); int totalEvents; events = GetLines(file, performanceResults, out totalEvents); file.DocumentMap = ProcessLines(file, events); BuildDocumentMapValues(file); file.DocumentMap.AddRange(new BuildDocumentMapGapService().Execute(file)); file.DocumentMap = BuildDocumentMapGapService.PostProcess(file.DocumentMap.OrderBy(n => n.iLine).ThenBy(n => n.Sort).ToList()); } finally { file.IsCached_Lazy_DocumentMap = true; } PerformanceService.StopEvent($"{PerformanceService.CONST_BuildDocumentMap}{file.Path}"); } }
public void GetParticipantProfileScorecardByEvaluateeTest() { PerformanceService service = new PerformanceService(); List <IpsQuestionInfo> questions = service.GetParticipantProfileScorecardByEvaluatee(72, 229, 217); Assert.IsFalse(questions != null); }
public void GetParticipantEvaluatorsTest() { PerformanceService service = new PerformanceService(); List <IpsParticipantInfo> evaluators = service.GetParticipantEvaluators(77, 246); Assert.IsFalse(evaluators != null); }
public InfoModule(DiscordSocketClient discord, LoggingService logger, PerformanceService perf, BotInfoService botInfo, DocumentationCacheService cache) { this.discord = discord; this.logger = logger; this.perf = perf; this.botInfo = botInfo; this.cache = cache; }
public void GetProfileScoreCardsTest() { PerformanceService service = new PerformanceService(); DateTime date = new DateTime(2015, 06, 19); // PeriodDate = {6/19/2015 10:06:00 AM} 236 IpsProfileScorecard scorecard = service.GetProfileScoreCards(60, 228, null, date); Assert.IsTrue(scorecard != null); }
public void GetPeriods() { PerformanceService service = new PerformanceService(); //List<IpsScorecardPeriod> periods = service.GetProfileEvaluationPeriods(41, 216); List <IpsScorecardPeriod> periods = service.GetProfileEvaluationPeriods(60, 236); Assert.IsFalse(periods.Count > 0); }
public void Main() { var uow = new MyUnitOfWork("connection string"); var positionQueryRepo = new PositionQueryRepository("connection string"); // Inject dependencies into services and go have fun var positionService = new PositionService(uow, positionQueryRepo); var performanceService = new PerformanceService(positionQueryRepo); }
public void Render(string model) { _renderComplete.Reset(); var r = new ReleaseUI($"Render ReleaseUI for {ViewModel.Model.File.Path}", true); ViewModel.RenderStarted(); SuspendLayout(); try { if (model == null) { Log.WriteError("Model is NULL, this should not happen!", typeof(DocumentWindow).FullName, MethodBase.GetCurrentMethod().Name); return; } if (InvokeRequired) { Invoke(new Action <string>(Render), model); return; } PerformanceService.StartEvent($"{PerformanceService.CONST_RenderDocument}{ViewModel.Model.File.Path}"); OutputService.Log($"Document Render for {ViewModel.Model.File.Path}"); Log.WriteEnter(typeof(DocumentWindow).FullName, MethodBase.GetCurrentMethod().Name); // Setting SelectionChangedDelayedEnabled for the first time if (!fctbDocument.SelectionChangedDelayedEnabled) { fctbDocument.SelectionChangedDelayedEnabled = true; } scBase.Panel1Collapsed = !XmlDal.DataModel.Options.DocumentSourceInfo; PreCachePropertyLineData(); r.DoEvents(); sourceInfo.Render(ViewModel.Model.File); fctbDocument.ClearCache(); r.DoEvents(); fctbDocument.Text = model; r.DoEvents(); ApplyFolding(); // Force the control to paint itself now fctbDocument.Invalidate(); StatusUpdate(StatusModel.Completed); Log.WriteTrace("Document Render Complete...", typeof(DocumentWindow).FullName, MethodBase.GetCurrentMethod().Name); PerformanceService.StopEvent($"Rebuild Active Document for {ViewModel.Model.File.Path}", true); PerformanceService.StopEvent($"{PerformanceService.CONST_RenderDocument}{ViewModel.Model.File.Path}", true); r.Stop(); } finally { ResumeLayout(); ViewModel.DocumentRenderComplete(); _renderComplete.Set(); } }
public void GetUserScorecardTest() { PerformanceService service = new PerformanceService(); List <int> ids = new List <int>() { 246 }; List <IpsQuestionInfo> questions = service.GetParticipantProfileScorecard(77, ids); Assert.IsFalse(questions != null); }
private void MainForm_Shown(object sender, EventArgs e) { DataPath.ExecutablePath = Application.ExecutablePath; mainMenu.Enabled = false; mainMenu.Visible = false; Text = string.Format("Sara.LogReader {0}", Application.ProductVersion); PerformanceService.StartEvent(PerformanceService.CONST_Startup); MainViewModel.StartUp(this, _openFileOnStartupPath); PerformanceService.StopEvent(PerformanceService.CONST_Startup); }
private void RenderCallback(TreeNodeCollection nodes) { var r = new ReleaseUI("DocumentMap.RenderCallback", true); if (IsDisposed) { return; } if (InvokeRequired) { Invoke(new Action <TreeNodeCollection>(RenderCallback), nodes); return; } #region Clear // Note: We are on the MainUI Thread. We want to limit our activity to 50ms or less before we call Application.DoEvents (r.DoEvents) r.DoEvents("starting"); var n = 0; for (int i = tvMapEntries.Nodes.Count - 1; i >= 0; i--) { n++; tvMapEntries.Nodes.RemoveAt(i); if (n % @break == 0) { r.DoEvents("RemoveAt break"); } } r.DoEvents("RemoveAt done"); #endregion #region Add n = 0; foreach (TreeNode node in nodes) { n++; tvMapEntries.Nodes.Add(node); if (n % @break == 0) { r.DoEvents("Node.Add break"); } } r.DoEvents("Node.Add done"); #endregion tvMapEntriesSplit.Clone(tvMapEntries); _isRendering = false; r.DoEvents("Clone"); StatusPanel.StatusUpdate(StatusModel.Completed); ViewModel.RenderComplete(); PerformanceService.StopEvent($"{PerformanceService.CONST_RenderDocumentMap}{ViewModel.LastPath}"); r.Stop(); }
public PerformanceServer(Arguments args) { var credentials = args.GetServerCredentials(); server = new Server { Services = { PerformanceService.BindService(new PerformanceServiceImpl()) }, Ports = { new ServerPort("localhost", args.ServerPort, credentials) }, }; server.Start(); Console.WriteLine($"C# Performance Server running in port {args.ServerPort}"); Console.WriteLine($" - TLS: {credentials != ServerCredentials.Insecure}"); }
public void GetUserProfiles() { PerformanceService service = new PerformanceService(); //IpsUserProfiles profiles = service.GetUserProfiles(1122); DateTime todayDate = DateTime.Today; List <IpsUserProfile> activeProfiles = new List <IpsUserProfile>(); List <IpsUserProfile> completedProfiles = new List <IpsUserProfile>(); List <IpsUserProfile> historyProfiles = new List <IpsUserProfile>(); var _ipsDataContext = service._ipsDataContext; //IpsUserProfiles profiles = service.GetUserProfiles(1073); //Assert.IsFalse(profiles != null); }
public static async Task Main(string[] args) { var service = new PerformanceService(null); if (args.Length < 1) { Console.WriteLine("url is required"); return; } var url = args[0]; var size = 100000; if (args.Length > 1) { size = int.Parse(args[1]); } var degree = 10; if (args.Length > 2) { degree = int.Parse(args[2]); } var handler = new HttpPerformanceDelegatingHandler(new HttpClientHandler()); var client = new HttpClient(handler); var block = new ActionBlock <int>(async i => await client.GetAsync(string.Format(url, i)), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = degree }); foreach (var i in Enumerable.Range(0, size)) { block.Post(i); } block.Complete(); await block.Completion; }
/// <summary> /// Used to quickly rebuild the active documents cache. Used to speed up development and exercise code /// </summary> public static void RebuildActiveDocument() { ThreadPool.QueueUserWorkItem(delegate { OutputService.ClearOutputWindow?.Invoke(); PerformanceService.StartEvent($"Rebuild Active Document for {Current.Model.File.Path}"); Thread.CurrentThread.Name = "Rebuild.Active.Document"; var file = Current.Model.File; file.Clear(); FileService.Build(file, true); file.IsCached_Lazy_NetworkMessages = false; NetworkService.CheckNetworkMessages(file, View.StatusUpdate, "Source"); // Invalidate will force dependent Components to Render file.DataController.Invalidate(); }); }
public void Render(List <DocumentEntry> model) { var r = new ReleaseUI("DocumentMap.Render"); PerformanceService.StartEvent($"{PerformanceService.CONST_RenderDocumentMap}{ViewModel.LastPath}"); // Note: Invoke is handled through ViewModelbase - Sara if (_isRendering) { return; } if (!MainViewModel.StartupComplete) { StatusPanel.StatusUpdate(StatusModel.Completed); return; } if (model == null) { ShowWarning(); StatusPanel.StatusUpdate(StatusModel.Completed); return; } _isRendering = true; wpOpen.Visible = false; panel3.Visible = true; StatusPanel.StatusUpdate(StatusModel.StartStopWatch); StatusPanel.StatusUpdate(StatusModel.Update("Loading", "")); r.Stop(); ThreadPool.QueueUserWorkItem(delegate { var sw = new Stopwatch("DocumentMap.Render.BuildTreeView"); Thread.CurrentThread.Name = "Building.DocumentMap.TreeView"; ViewModel.BuildTreeView(model, RenderCallback); sw.Stop(0); }); }
static void Main(string[] args) { ExcelExportFileService excelExportFileService = new ExcelExportFileService(); IList <PerformanceInfo> performanceInfos = new List <PerformanceInfo>(); HashSet1 hashSet1 = new HashSet1(); HashSet2 hashSet2 = new HashSet2(); Task task1 = new Task(() => hashSet1.Method()); Task task2 = new Task(() => hashSet2.Method()); performanceInfos.Add(PerformanceService.MeasurePerformance(task1)); performanceInfos.Add(PerformanceService.MeasurePerformance(task2)); if (File.Exists(excelExportFileService.ExcelFilePath)) { File.Delete(excelExportFileService.ExcelFilePath); } using (var excelPackage = new ExcelPackage(new System.IO.FileInfo(excelExportFileService.ExcelFilePath))) { ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.Add(excelExportFileService.PopulateWorkSheetName(null)); excelExportFileService.ExportPerformanceInfoToExcel(performanceInfos, worksheet); excelPackage.Save(); } }
public List <RmsReportMonitoringRaw> Monitoring(string mType, ClientResult clientResult) { try { var ret = new List <RmsReportMonitoringRaw>(); if (string.IsNullOrEmpty(mType)) { return(ret); } if (clientResult == null) { return(ret); } if (mType.ToLower() == "performance") { var ps = new PerformanceService(); return(ps.Monitoring(clientResult)); } else if (mType.ToLower() == "device") { ret = CheckDevice(clientResult); } else { throw new Exception("Monitoring Type Not Match. mType=" + mType); } return(ret); } catch (Exception ex) { throw new RMSAppException(this, "0500", "Monitoring failed. " + ex.Message, ex, false); } }
public static void StartUp(MainForm view, string fileOnStartupPath) { StopWatchOutput.Log = OutputService.Log; ReleaseOutput.Log = OutputService.Log; View = view; Log.WriteTrace("Starting Sara.LogReader", typeof(MainViewModel).Name, MethodBase.GetCurrentMethod().Name); #region Loading Data PerformanceService.StartEvent(PerformanceService.CONST_LoadingDataFile); View.StatusUpdate(StatusModel.StartCountdown(PerformanceService.GetLastDuration("Loading DataFile"))); View.StatusUpdate(StatusModel.Update("Starting Sara.LogReader", "Loading Cache")); try { MainService.LoadDataFile(); } catch (Exception ex) { View.ShowError(ex.Message); } PerformanceService.StopEvent(PerformanceService.CONST_LoadingDataFile); View.StatusUpdate(StatusModel.StopCountdown); #endregion #region Loading Layout PerformanceService.StartEvent(PerformanceService.CONST_LoadingLayout); View.StatusUpdate(StatusModel.Update("Starting Sara.LogReader", "Initializing Controls")); StartupCreateWindows(); View.StatusUpdate(StatusModel.StartStopWatch); View.StatusUpdate(StatusModel.Update(null, "Loading Layout")); _mDeserializeDockContent = StartupGetContentFromPersistString; var configFile = DataPath.GetConfigFilePath(); try { if (File.Exists(configFile)) { View.LoadLayout(configFile, _mDeserializeDockContent); } } catch (Exception) { var msg = $"\"{configFile}\" has become corrupted. \nTo resolve the system will automatically reset the file to default settings."; Log.WriteTrace(msg, typeof(MainForm).FullName, MethodBase.GetCurrentMethod().Name); MessageBox.Show(msg, "System Error"); File.Delete(configFile); } Log.WriteTrace($"Main UI Thread Id: {MainUIThreadId}", typeof(MainForm).FullName, MethodBase.GetCurrentMethod().Name); View.StatusUpdate(StatusModel.StartStopWatch); PerformanceService.StopEvent(PerformanceService.CONST_LoadingLayout); #endregion PerformanceService.StartEvent(PerformanceService.CONST_LoadingOther); View.StatusUpdate(StatusModel.Update(null, "Rendering...")); CurrentLineChangedEvent += View.ActiveDocumentLineChanged; view.Render(null); #region Options View.SetOptions(Options); ApplyHideOptions(false); #endregion Options Application.DoEvents(); StartupOpenFile(fileOnStartupPath); // Note: The majority of the cpu cycles will occur on the MainUI thread. // This is why we are not running this in Parallel or on it's own Thread. // This means that if you have 10 documents to open and each takes 2 seconds your will be waiting for 10+ seconds. - Sara if (Options.RestoreOpenDocuments) { View.StatusUpdate(StatusModel.Update("Restoring Open Documents...")); var i = 0; var count = Options.RestoreOpenDocumentsList.Count; foreach (var path in Options.RestoreOpenDocumentsList) { i++; OpenDocument(path); View.StatusUpdate(StatusModel.UpdateDetail($"{i} of {count}")); } } ReadyViews(); // Render the Filter window any time a Category changes - Sara XmlDal.DataModel.CategoryCacheDataController.InvalidateNotificationEvent += _mFilterViewModel.RenderDocument; StartupComplete = true; // Render Focused Document var _current = Documents.FirstOrDefault(model => model.View.DockHandler.IsActiveContentHandler); if (_current != null) { SetCurrent(_current); } DocumentFont = ColorService.ColorScheme.Current.GeneralFontObject; View.StatusUpdate(StatusModel.Completed); PerformanceService.StopEvent(PerformanceService.CONST_LoadingOther); }
public PerformanceController() { _perforamnce = new PerformanceService(); _admissionService = new AddmissionService(); }
public ReportController() { _report = new PerformanceReportService(); _admissionService = new AddmissionService(); _perforamnce = new PerformanceService(); }
public void GetPreviousEvaluationScoresTest() { PerformanceService service = new PerformanceService(); service.GetPreviousEvaluationScores(5, 135); }
public void GetEvaluationAggregatedScoresTest() { PerformanceService service = new PerformanceService(); service.GetEvaluationAggregatedScores(72, 217); }
/// <summary> /// STARTING POINT for Open Document /// /// Order of Operations /// 1.) MainViewModel.OnOpenDocument /// 2.) DocumentWindow.OpenFile /// 3.) MainViewModel.AddDocument /// </summary> public static void OpenDocument(string path, Action callback = null) { #region InvokeRequired if (View.InvokeRequired) { View.Invoke(new Action <string, Action>(OpenDocument), path, callback); return; } #endregion PerformanceService.StartEvent($"{PerformanceService.CONST_OpenDocument}{path}"); Log.WriteEnter(typeof(MainViewModel).FullName, MethodBase.GetCurrentMethod().Name); lock (_syncOpenDocument) { #region Check if already open if (!File.Exists(path)) { MessageBox.Show(string.Format("They system cannot find the file specified: \"{0}\"", path)); return; } var doc = FindDocument(path) as DocumentWindow; if (doc != null) { doc.DockHandler.Show(); var model = doc as DocumentWindow; if (model != null) { SetCurrent(model.ViewModel); } callback?.Invoke(); return; } #endregion #region Create DocumentWindow doc = new DocumentWindow { Text = Path.GetFileName(path) }; try { var model = new DocumentModel { Control = doc.PrepareDocument(path), File = XmlDal.CacheModel.GetFile(path) }; doc.ViewModel.View.StatusUpdate(StatusModel.Update("Loading")); doc.ViewModel.Model = model; model.File.Options = Options; model.File.DocumentModel = model; Documents.Add(doc.ViewModel); DocumentService.BuildDocument(model); } catch (Exception exception) { doc.Close(); MessageBox.Show(exception.Message); } #endregion #region Show if (View.DockPanel.DocumentStyle == DocumentStyle.SystemMdi) { doc.MdiParent = View as Form; doc.Show(); } else { doc.Show(View.DockPanel); } #endregion if (StartupComplete) { SetCurrent(doc.ViewModel); } callback?.Invoke(); PerformanceService.StopEvent($"{PerformanceService.CONST_OpenDocument}{path}"); Log.WriteExit(typeof(MainViewModel).FullName, MethodBase.GetCurrentMethod().Name); } }