/// <summary> /// Initializes a new instance of the <see cref="DamperUc"/> class. /// </summary> public DamperUc() { InitializeComponent(); Totals.SetMaterial(MaterialP1); ТолщинаВнешней.ItemsSource = Totals.SheetMetalThikness; ТолщинаВнешней.SelectedIndex = 2; }
/// <summary> /// Terminate the stopwatch, add the average/max to the collection of timers, /// and log if the job took longer than the expected threshold. /// </summary> public void Stop() { end = Environment.TickCount; long time = end - start; Logging.LogTrace("Time taken for {0}: {1}ms", timername, time); if (taskThresholdMS > 0 && time > taskThresholdMS) { Logging.LogVerbose($"Stopwatch: task {timername} took {time}ms (threshold {taskThresholdMS}ms)."); } Totals total; if (!averages.TryGetValue(timername, out total)) { total = new Totals { count = 1, totalTime = time }; averages[timername] = total; } else { total.count++; total.totalTime += time; } if (!maximums.ContainsKey(timername) || maximums[timername] < time) { maximums[timername] = time; } }
public DexoColorFlakeMaterialViewModel(Totals metalTotals, Totals slopeTotals, JobSetup Js) : base(metalTotals, slopeTotals, Js) { materialNames = new Dictionary<string, string>(); FillMaterialList(); FetchMaterialValuesAsync(false); }
/// <inheritdoc/> public void RemoveChild(Base child) { if (child is DataConnectionBase) { Connections.Remove(child as DataConnectionBase); } else if (child is DataSourceBase) { DataSources.Remove(child as DataSourceBase); } else if (child is Relation) { Relations.Remove(child as Relation); } else if (child is Parameter) { Parameters.Remove(child as Parameter); } else if (child is Total) { Totals.Remove(child as Total); } else if (child is CubeSourceBase) { CubeSources.Remove(child as CubeSourceBase); } }
/// <summary> /// Initializes a new instance of the <see cref="Panel50Uc"/> class. /// </summary> public Panel50Uc() { InitializeComponent(); _backgroundWorker.DoWork += BackgroundWorkerOnDoWork; ТолщинаВнешней.ItemsSource = Totals.SheetMetalThikness; ТолщинаВнешней.SelectedIndex = 2; ТолщинаВннутренней.ItemsSource = Totals.SheetMetalThikness; ТолщинаВннутренней.SelectedIndex = 2; Totals.SetPanelType(TypeOfPanel50); Totals.SetMaterial(MaterialP1); Totals.SetMaterial(MaterialP2); #region Paint Totals.SetRal(Ral1); Totals.SetRal(Ral2); Ral1.Visibility = Visibility.Hidden; Ral2.Visibility = Visibility.Hidden; Totals.SetCoatingType(CoatingType1); Totals.SetCoatingType(CoatingType2); Totals.SetCoatingClass(CoatingClass1); Totals.SetCoatingClass(CoatingClass2); #endregion }
public void Totales(float end) { double total = 0; long personId = long.Parse(GridView1.SelectedRow.Cells[1].Text); long stuModId = proxySM.GetStudentModuleId((long)Session["TeachModID"], personId); double res = TotalParcial(stuModId); double notaFinal = end; total = (res * 0.6) + (notaFinal * 0.4); //lbl_mensaje.Text = "" + total; string v = total + ""; long t = long.Parse(v); entityTotal = new Totals(); entityTotal.Code = stuModId; entityTotal.TotalPartial = res; entityTotal.TotalFinal = notaFinal; entityTotal.Total = t; proxyQ.InsertQualificationTotals(entityTotal); lbl_mensaje.Text = "ÉXITO. La nota se ha registrado."; }
private void RefreshStats(Expression <Func <GameResult, bool> > filter = null) { var expr = filter ?? GetFilterExpression(); Task.Run(() => CurrentStats.RefreshFrom(dbContext, expr)); Task.Run(() => Totals.Update(dbContext, expr)); }
//readonly SqlBaseData _sqlBaseData = new SqlBaseData(); // readonly SetMaterials _setMaterials = new SetMaterials(); // readonly ToSQL _toSql = new ToSQL(); /// <summary> /// Initializes a new instance of the <see cref="MontageFrameUc"/> class. /// </summary> public MontageFrameUc() { InitializeComponent(); MaterialMontageFrame.ItemsSource = ((IListSource)SqlBaseData.MaterialsForMontageFrame()).GetList(); MaterialMontageFrame.DisplayMemberPath = "MaterialsName"; MaterialMontageFrame.SelectedValuePath = "LevelID"; //"CodeMaterial"; MaterialMontageFrame.SelectedIndex = 0; #region MontageFrame50 Initialize FrameOffset.MaxLength = 5; FrameOffset.IsReadOnly = true; LenghtBaseFrame.MaxLength = 5; WidthBaseFrame.MaxLength = 5; #endregion //ToSQL.Conn = Settings.Default.ConnectionToSQL; Totals.SetRal(Ral1); Ral1.Visibility = Visibility.Hidden; Totals.SetCoatingType(CoatingType1); Totals.SetCoatingClass(CoatingClass1); }
public async Task <ActionResult <Totals> > Counts(string author = null) { try { var effectiveAuthor = author == null ? null :_data.Authors.Single(x => x.AppUserName == author); var posts = _data.BlogPosts.All(); var effectivePosts = effectiveAuthor == null ? posts.ToArray() : posts.Where(x => x.AuthorId == effectiveAuthor.Id).ToArray(); Totals totals = new Totals { PostCount = effectivePosts.Count(), ViewsCount = effectivePosts.Select(v => v.PostViews).Sum(), DraftCount = effectivePosts.Count(p => p.Published == DateTime.MinValue), SubsriberCount = _data.Newsletters.All().Count() }; return(Ok(await Task.FromResult(totals))); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Database Failure")); } }
//Constructor for ProjectReportViewModel public ProjectReportViewModel(ProjectReport projectReport, EmployeeNameViewModel projectManager, List <EmployeeNameViewModel> engineers, List <WorkPackageReportSnapshot> lowWpStatus, List <WorkPackageReportSnapshot> highWpStatus) { ProjectReportId = projectReport.ProjectReportId; ProjectId = projectReport.ProjectId; ProjectCode = projectReport.ProjectCode; ProjectName = projectReport.ProjectName; ReportDate = DateTime.Now; StartDate = projectReport.StartDate; EndDate = projectReport.EndDate; ProjectManager = projectManager; Engineers = engineers; LowWpStatus = new List <LowWorkPackage>(); HighWpStatus = new List <HighWorkPackage>(); foreach (WorkPackageReportSnapshot wp in lowWpStatus) { LowWpStatus.Add(new LowWorkPackage(wp)); } foreach (WorkPackageReportSnapshot wp in highWpStatus) { HighWpStatus.Add(new HighWorkPackage(wp)); } //Inner class totals totals = new Totals(LowWpStatus); }
private void ReadTotals() { gridData = CsvFileReader.ReadAll(csvPath + csvTotalsFile, System.Text.Encoding.GetEncoding("gbk")); for (int i = 0; i < gridData.Count; i++) { for (int j = 0; j < gridData[i].Count; j++) { var value = gridData[i][j]; if (i == 0) { columnIds.Add(value); } if (j % gridData.Count == 0) { rowIds.Add(value); } if (IsNumeric(value)) { Totals.Add(int.Parse(value)); } } } }
public JsonResult OnPostTotals() { try { var totals = new Totals { total = 0, totalCredits = 0, totalDebits = 0, totalMovements = 0 }; var ofx = ofxManager.GetOfxFile(); if (ofx == null || ofx.Transactions.Count < 1) { return(new JsonResult(totals)); } totals.total = ofx.Transactions.Sum(x => x.TransactionValue).ToString("#0.00"); totals.totalDebits = ofx.Transactions.Where(x => x.Type == Library.Model.OfxTransaction.TransactionType.DEBIT).Sum(x => x.TransactionValue).ToString("#0.00"); totals.totalCredits = ofx.Transactions.Where(x => x.Type == Library.Model.OfxTransaction.TransactionType.CREDIT).Sum(x => x.TransactionValue).ToString("#0.00"); totals.totalMovements = ofx.Transactions.Count().ToString(); return(new JsonResult(totals)); } catch (Exception ex) { throw new Exception(ex.Message); } }
void BackupDatabaseObjects(string database, string type) { DateTime startTime = DateTime.Now; sourceCmd.ChangeDatabase(backupDatabase = database); string process = "Backup Database"; string[] schemas = sourceCmd.RetrieveUsers(); Memo("Start", string.Format("/*\r\n**\t{0}\r\n**\t{1} {2} {3} - {4:n0} Schema{5}\r\n*/\r\n", BackupTimeStamp, process, backupServerDatabase, type, schemas.Length, schemas.Length > 0 ? "s" : "")); try { zipFile.InitializeSchemaNames(schemas); foreach (string schema in schemas) { zipFile.DeflateSchema(schema, type); if (type == "Tables") { BackupTables(schema); } else { BackupStoredObjects(type, schema); } zipFile.FinalizeSchema(); if (abort) { break; } } zipFile.FinalizeDatabase(); foreach (Totals tTotals in zipFile.SchemaTotals) { Memo("Totals", string.Format("{0} {1}: {2, 13:n0} Bytes ({3,10:n0} Compressed) - {4,7:n0} Schema {5}", process, type, tTotals.size, tTotals.deflated, tTotals.count, tTotals.Name)); } Totals totals = zipFile.DatabaseTotal; Memo(Abort ? "Error" : "Totals", string.Format("{0} {1}: {2, 13:n0} Bytes ({3,10:n0} Compressed) - {4,7:n0} *** Total Database {5} {6}\r\n" + "Backup Database {0}: {6, 31:n1}% {7, 24} {8}\r\n", process, type, totals.size, totals.deflated, totals.count, database, totals.size > 0 ? 100.0 * totals.deflated / totals.size : 0.0, "***", abort ? "ABORTED" : VETimeStamp.ElapsedTime(startTime))); } catch (Exception e) { Error(string.Format("VEDataAdmin.BackupDatabaseObjects {0} - All Schema {1}", backupServerDatabase, type), e); } }
public void Get_Totals() { using var scope = _factory.Services.CreateScope(); var database = scope.ServiceProvider.GetService <IDatabaseEngine>(); DateTime now = DateTime.UtcNow; Area area = new Area("Totals2", "province", "city", "Totals2"); Location location = new Location(9999, 9999, now, area, true); database.Insert_Location(location); Location location2 = new Location(8888, 8888, now, area, true); database.Insert_Location(location2); Location location3 = new Location(7777, 7777, now, area, true); database.Insert_Location(location3); database.Set_Totals(area); var count = 0; Totals list = database.Get_Totals(area); foreach (Carriers carrier in list.TotalCarriers) { count += carrier.TotalCarriers; } Assert.True(true); }
void BackupServerObjects(string type) { DateTime startTime = DateTime.Now; string[] databases = sourceCmd.ApplicationDatabases; Memo("Start", string.Format("/***\r\n****\t{0}\r\n****\tBackup Server [{1}] {2} - {3:n0} Databases\r\n***/\r\n", BackupTimeStamp, sourceObject.ServerID, type, databases.Length)); try { ZipFile.InitializeServer(databases, type); foreach (string database in databases) { if (!abort && database.ToLower().IndexOf("northwind") < 0) // Can't handle Northwind images { ZipFile.DeflateDatabase(database); BackupDatabaseObjects(SourceDatabase = database, type); } } zipFile.FinalizeServer(); foreach (Totals tTotals in zipFile.DatabaseTotals) { Memo("Totals", string.Format("Backup Server {0}: {1, 13:n0} Bytes ({2,10:n0} Compressed) - {3,7:n0} Schema {4}", type, tTotals.size, tTotals.deflated, tTotals.count, tTotals.Name)); } Totals totals = zipFile.ServerTotal; string fmt = string.Format("{{0,{0}}} ", 14 + type.Length); Memo("Totals", string.Format("{0} {1, 13:n0} Bytes ({2,10:n0} Compressed) - {3,7:n0} Server [{4}] {5}\r\n", string.Format(fmt, "****"), totals.size, totals.deflated, totals.count, sourceObject.ServerID, type)); } catch (Exception e) { Error(string.Format("VEDataAdmin.BackupServerObjects: [{0}] {1}", sourceObject.ServerID, type), e); } finally { SourceDatabase = null; zipFile.Close(); string text = string.Format("/***\r\n****\t{0}\r\n****\tBackup Server [{1}] {2}\r\n****\t{3}\r\n***/\r\n", BackupTimeStamp, sourceObject.ServerID, type, abort ? "*** ABORTED ***" : "Completed: " + VETimeStamp.ElapsedTime(startTime)); if (!abort) { Memo("End", text); } else { Error(text); } } }
public MulticoatMaterialViewModel(Totals metalTotals, Totals slopeTotals, JobSetup Js) : base(metalTotals, slopeTotals, Js) { materialNames = new Dictionary <string, string>(); linearFootageCoping = Js.LinearCopingFootage; FillMaterialList(); FetchMaterialValuesAsync(false); }
public DesertbrandMaterialViewModel(Totals metalTotals, Totals slopeTotals, JobSetup Js) : base(metalTotals, slopeTotals, Js) { materialNames = new Dictionary <string, string>(); IsJobSpecifiedByArchitect = Js.IsJobSpecifiedByArchitect; FillMaterialList(); FetchMaterialValuesAsync(false); }
public DexoMaterialViewModel(Totals metalTotals, Totals slopeTotals, JobSetup Js) : base(metalTotals, slopeTotals, Js) { materialNames = new Dictionary <string, string>(); FillMaterialList(); FetchMaterialValuesAsync(false); //set resititeLiquid QTY resistiteQty(); }
public _201MaterialViewModel(Totals metalTotals, Totals slopeTotals, JobSetup js) : base(metalTotals, slopeTotals, js) { materialNames = new Dictionary <string, string>(); isIndependent = js.IsProjectIndependent; FillMaterialList(); FetchMaterialValuesAsync(false); }
public ParasealMaterialViewModel(Totals metalTotals, Totals slopeTotals, JobSetup Js) : base(metalTotals, slopeTotals, Js) { materialNames = new Dictionary <string, string>(); FillMaterialList(); FetchMaterialValuesAsync(false); pinsCoverage = SystemMaterials.Where(x => x.Name == "PINS & LOADS").FirstOrDefault().Coverage; }
public void InsertQualificationTotals(Totals entity) { using (var context = new QualificationsDBEntities()) { context.Totals.Attach(entity); context.ObjectStateManager.ChangeObjectState(entity, System.Data.EntityState.Added); context.SaveChanges(); } }
public TufflexMaterialViewModel(Totals metalTotals, Totals slopeTotals, JobSetup Js) : base(metalTotals, slopeTotals, Js) { materialNames = new Dictionary <string, string>(); TotalSqftPlywood = Js.TotalSqftPlywood; IsNewPlaywood = Js.IsNewPlywood; FillMaterialList(); FetchMaterialValuesAsync(false); }
public SlopeBaseViewModel() { Slopes = new ObservableCollection <Slope>(); SlopeTotals = new Totals { TabName = "Slope" }; IsOverrridable = true; UrethaneText = "Slope Sand and Urethane Fill"; SlopeHeaderText = "Slope Sand Cement Scrim"; }
/** * Called from a different thread as testStarted() but using the same instance. * So synch is needed to fetch the accumulator, and the myName field will already be set up. * <p> * {@inheritDoc} */ public void TestEnded(String host) { List <KeyValuePair <String, Totals> > totals = new List <KeyValuePair <String, Totals> >(); Monitor.Enter(LOCK); try { instanceCount--; if (instanceCount <= 0) { totals = accumulators.ToList(); } } finally { Monitor.Exit(LOCK); } // We're not done yet if (totals.Count == 0) { return; } foreach (KeyValuePair <String, Totals> pair in totals) { String str = ""; String name = pair.Key; Totals total = pair.Value; // Only print final delta if there were some samples in the delta // and there has been at least one sample reported previously if (total.delta.getNumSamples() > 0 && total.total.getNumSamples() > 0) { str = Format(name, total.delta, "+"); if (TOLOG) { log.Info(str); } if (TOCONSOLE) { System.Console.WriteLine(str); } } total.MoveDelta(); str = Format(name, total.total, "="); if (TOLOG) { log.Info(str); } if (TOCONSOLE) { System.Console.WriteLine(str); } } }
public ParkingMaterialViewModel(Totals metalTotals, Totals slopeTotals, JobSetup Js) : base(metalTotals, slopeTotals, Js) { MaterialNames = new Dictionary <string, string>(); TotalSqftPlywood = Js.TotalSqftPlywood; IsReseal = Js.IsReseal; IsNewPlaywood = Js.IsNewPlywood; RequireFlashing = Js.IsFlashingRequired; FillMaterialList(); SystemMaterial.OnUnitChanged += (s, e) => { setUnitChangeValues(); }; FetchMaterialValuesAsync(false); }
private void PopulatTotals(Totals totals) { FlashReportTotalModel.Charges = totals.Charges; FlashReportTotalModel.InvoiceDiscount = totals.InvoiceDiscount; FlashReportTotalModel.LineDiscounts = totals.LineDiscount; FlashReportTotalModel.ProductSales = totals.ProductSales; FlashReportTotalModel.Refunded = totals.Refunded; FlashReportTotalModel.SalesAfterDiscount = totals.SalesAfterDiscount; FlashReportTotalModel.Taxes = totals.Taxes; FlashReportTotalModel.TotalsReceipts = totals.TotalsReceipts; }
private static GenerationOutput CalculateGenerationData(GenerationReport generationReport, ReferenceData referenceData) { Totals totals = new Totals(); List <ActualHeatRates> actualHeatRates = new List <ActualHeatRates>(); MaxEmissionGenerators maxEmissionGenerators = new MaxEmissionGenerators(); foreach (var windGenerator in generationReport.Wind.WindGenerator) { var generator = new Generator { Name = windGenerator.Name, Total = CalculateTotalGenerationValue(windGenerator.Generation, windGenerator.Name, referenceData, null) }; totals.Generator.Add(generator); } foreach (var coalGenerator in generationReport.Coal.CoalGenerator) { var generator = new Generator { Name = coalGenerator.Name, Total = CalculateTotalGenerationValue(coalGenerator.Generation, coalGenerator.Name, referenceData, coalGenerator.EmissionsRating) }; var actualHeatRate = new ActualHeatRates { Name = coalGenerator.Name, HeatRate = coalGenerator.TotalHeatInput / coalGenerator.ActualNetGeneration }; totals.Generator.Add(generator); actualHeatRates.Add(actualHeatRate); } foreach (var gasGenerator in generationReport.Gas.GasGenerator) { var generator = new Generator { Name = gasGenerator.Name, Total = CalculateTotalGenerationValue(gasGenerator.Generation, gasGenerator.Name, referenceData, gasGenerator.EmissionsRating) }; totals.Generator.Add(generator); } maxEmissionGenerators.Day = MaxEmissionsDays.OrderByDescending(x => x.Emission).GroupBy(x => x.Date).Select(b => b.First()).ToList(); return(new GenerationOutput() { Totals = totals, ActualHeatRates = actualHeatRates, MaxEmissionGenerators = maxEmissionGenerators }); }
public GenerationReport(InputGenerationReport input) { _config = new ConfigurationBuilder().AddJsonFile("specflow.json").Build(); _xmlDataSourceProcessor = new XmlDataSourceProcessor(); _input = input; _generationOutput = new GenerationOutput(); _referenceData = new ReferenceData(); _calculatedTotalValue = new Totals(); _energyCalculator = new EnergyCalculator(); _maxEmissionGeneratorsDays = new List <DTOs.OutputGeneration.Day>(); _heatRates = new List <ActualHeatRates>(); _generationOutput = _xmlDataSourceProcessor.GetGenerationOutput(); }
public void EvaluateSubTotals() { Months.Clear(); Totals.Clear(); for (var index = 0; index <= _diffMonths; index++) { var period = _from.AddMonths(index); var ordersInMonth = _orders.Where(IsInMonth(period.Month)); Months.Add(period.ToString(MonthFormat)); SubTotals.Add(ordersInMonth.Sum(order => order.SubTotal)); } }
void BackupSchema(string schema) { string process = "Backup Schema Objects"; try { DateTime startTime = DateTime.Now; ActiveSchema = schema; Memo("Start", string.Format("/*\r\n**\t{0}\r\n**\t{1}: From {2}\r\n**\t{1}: [{3}]\r\n**\t{1}:\r\n**\t{1}: To {4}\r\n**\t{1}: [{5}]\r\n*/\r\n", BackupTimeStamp, process, sourceObject.DatabaseSchema, sourceObject.Server, zipFile.Filename, zipFile.Path)); zipFile.DeflateSchema(schema); BackupStoredObjects("Functions", schema); if (!abort) { BackupStoredObjects("Procedures", schema); } if (!abort) { BackupTables(schema); } zipFile.FinalizeSchema(); foreach (Totals sTotals in zipFile.SchemaTypeTotals) { Memo("Totals", string.Format("{0}: {1, 10:n0} Bytes ({2,10:n0} Compressed) - {3,7:n0} {4}", process, sTotals.size, sTotals.deflated, sTotals.count, sTotals.Name)); } Totals totals = zipFile.SchemaTotal; Memo("Totals", string.Format("{0}: {1, 10:n0} Bytes ({2,10:n0} Compressed) - {3,7:n0} ** Total Schema {4} Objects\r\n" + "{0}: {5, 28:n1}% {6, 23} {7}\r\n", process, totals.size, totals.deflated, totals.count, schema, totals.size > 0 ? 100.0 * totals.deflated / totals.size : 0.0, "**", abort ? "ABORTED" : VETimeStamp.ElapsedTime(startTime))); } catch (Exception e) { Error(string.Format("VEDataAdmin.BackupSchema: {0}", schema), e); } }
/// <summary> /// Recalculates the specified order. /// </summary> /// <param name="order">The order.</param> /// <exception cref="ArgumentNullException"><paramref name="order"/> is <c>null</c>.</exception> /// <exception cref="InvalidOperationException"><c>InvalidOperationException</c>.</exception> public virtual void Recalculate(ref Order order) { if (order == null) { throw new ArgumentNullException(); } if (order.OrderLines == null || order.Totals == null) { throw new InvalidOperationException(); } var orderTotals = new Totals(); foreach (var orderLine in order.OrderLines) { var lineTotals = orderLine.Totals; if (lineTotals == null) { throw new InvalidOperationException(); } decimal quantity = orderLine.Quantity; lineTotals.TotalVat = lineTotals.PriceExVat * lineTotals.VAT * quantity; lineTotals.PriceIncVat = lineTotals.PriceExVat * (1 + lineTotals.VAT); lineTotals.TotalPriceExVat = lineTotals.PriceExVat * quantity; lineTotals.TotalPriceIncVat = lineTotals.PriceIncVat * quantity; lineTotals.ToList().ForEach(p => orderTotals[p.Key] += p.Value); } orderTotals.TotalPriceExVat += order.ShippingPrice; orderTotals.TotalPriceIncVat += order.ShippingPrice; order.Totals.TotalVat = orderTotals.TotalVat; order.Totals.VAT = orderTotals.VAT; order.Totals.PriceExVat = orderTotals.TotalPriceExVat; order.Totals.PriceIncVat = orderTotals.TotalPriceIncVat; // Reset redundant fields. order.Totals.TotalPriceExVat = 0; order.Totals.TotalPriceIncVat = 0; }
/** * Called once for each Summariser in the test plan. * There may be more than one summariser with the same name, * however they will all be called before the test proper starts. * <p> * However, note that this applies to a single test only. * When running in client-server mode, testStarted() may be * invoked after sampleOccurred(). * <p> * {@inheritDoc} */ public void TestStarted(String host) { Monitor.Enter(LOCK); try { myName = GetName(); if (!accumulators.TryGetValue(myName, out myTotals)) { myTotals = new Totals(); accumulators.TryAdd(myName, myTotals); } instanceCount++; } finally { Monitor.Exit(LOCK); } }