public Driver(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Product ID"), Workcenter = row.Field <string>("Work Center") } into grp //orderby grp.Key select new { Product = grp.Key.ID, workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("UNIT TIME (MIN)"))) }).ToList(); using (var db = new TimeContext()) { foreach (var row in newSort) { ProdTB.AddInstance(row.Product, row.workcenter); OptionTB.AddInstance(optionName, row.Sum); ProdTB.AddOption(row.Product, row.workcenter, optionName, row.Sum); } } }
public static void AddOption(string product, string workcenter, string optionName, double prodTime, int?SectionLength = null) { using (var db = new TimeContext()) { var prod = db.Prod.Where(item => item.ProdCode == product && item.WorkCenter == workcenter).FirstOrDefault(); OptionTB optionindex = new OptionTB(); if (SectionLength == null) { optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime).FirstOrDefault(); } else { optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime && item.sectionLength == SectionLength).FirstOrDefault(); } if (!prod.Options.Contains(optionindex)) { prod.Options.Add(optionindex); } db.SaveChanges(); } }
public static List <TestUser> GetUsers() { if (users == null) { users = new List <TestUser>(); using (TimeContext context = new TimeContext()) { foreach (var user in context.Users) { users.Add(new TestUser { SubjectId = user.Id.ToString(), Username = user.Username, Password = "******", Claims = new List <Claim> { new Claim("name", user.Name), new Claim("role", user.Role) } }); } } } return(users); }
private void FixedUpdate() { _timeContext = TimeContext.FixedUpdate; TransmitInputToSubscribers(Time.fixedUnscaledTime, Time.fixedUnscaledDeltaTime); _keyboard.CleanKeyboardRecord(); }
public DistributedProgressTracker(InternalComputation internalComputation) { var processes = internalComputation.Controller.Configuration.Processes; var processid = internalComputation.Controller.Configuration.ProcessID; var context = new TimeContext <Empty>(internalComputation.ContextManager.MakeRawContextForScope <Empty>("progress context")); // construct aggregator stage with unconnected output var aggregatorPlacement = new Placement.SingleVertexPerProcess(processes, 0); var aggregator = new Stage <ProgressUpdateAggregator, Empty>(aggregatorPlacement, context, Stage.OperatorType.Default, (i, v) => new ProgressUpdateAggregator(i, v), "Aggregator"); var stream = aggregator.NewOutput(vertex => vertex.Output); aggregator.Materialize(); this.aggregator = aggregator.GetVertex(processid); // construct consumer stage with unconnected input var consumerPlacement = new Placement.SingleVertexPerProcess(processes, 0); var consumer = new Stage <ProgressUpdateConsumer, Empty>(consumerPlacement, context, Stage.OperatorType.Default, (i, v) => new ProgressUpdateConsumer(i, v, this.aggregator), "Consumer"); var recvPort = consumer.NewUnconnectedInput(vertex => vertex.Input, null); consumer.Materialize(); this.consumer = consumer.GetVertex(processid); // connect aggregators to consumers with special progress channel this.progressChannel = new ProgressChannel(aggregatorPlacement.Count, this.consumer, stream.StageOutput, recvPort, internalComputation.Controller, internalComputation.AllocateNewGraphIdentifier()); stream.StageOutput.AttachBundleToSender(this.progressChannel); Logging.Progress("Distributed progress tracker enabled"); }
public Nightlight(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Fixture Type"), Workcenter = row.Field <string>("Work Center") } into grp //orderby grp.Key select new { Fixture = grp.Key.ID, workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time(min)"))) }).ToList(); using (var db = new TimeContext()) { foreach (var row in newSort) { FixtureTB.AddInstance(row.Fixture, row.workcenter); OptionTB.AddInstance(optionName, row.Sum); FixtureTB.AddOption(row.Fixture, row.workcenter, optionName, row.Sum); } } }
static void saveToDB(TimeContext db, Time time) { Console.WriteLine(time.Output); db.Times.Add(time); db.SaveChanges(); Console.WriteLine("Data was successfully saved!"); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, TimeContext db) { db.Database.EnsureCreated(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //app.UseCors("Default"); app.UseResponseCompression(); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Projeto Rússia - API - v1"); }); app.UseMvc(); app.UseSignalR(routes => { routes.MapHub <GoalNotification>("/GoalNotification"); }); }
public PowerCord(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { wiresQty = row.Field <string>("Wires Qty"), Workcenter = row.Field <string>("Work Center") } into grp select new { workcenter = grp.Key.Workcenter, wires = grp.Key.wiresQty, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time (min)"))) }).ToList(); foreach (var row in newSort) { ParametersTB.AddInstance("WiresQty", row.wires); OptionTB.AddInstance(optionName, row.Sum); OptionTB.AddParam(optionName, row.Sum, "WiresQty", row.wires); using (var db = new TimeContext()) { foreach (var fixture in db.Fixtures) { FixtureTB.AddOption(fixture.FxCode, row.workcenter, optionName, row.Sum); } } } }
public static void AddOption(string fixtureID, string workcenter, string optionName, double prodTime, int?SectionLength = null) { using (var db = new TimeContext()) { var fixture = db.Fixtures.Where(item => item.FxCode == fixtureID && item.WorkCenter == workcenter).FirstOrDefault(); if (fixture == null) { FixtureTB.AddInstance(fixtureID, workcenter); } fixture = db.Fixtures.Where(item => item.FxCode == fixtureID && item.WorkCenter == workcenter).FirstOrDefault(); OptionTB optionindex = new OptionTB(); if (SectionLength == null) { optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime).FirstOrDefault(); } else { optionindex = db.Options.Where(item => item.OptionName == optionName && item.ProdTime == prodTime && item.sectionLength == SectionLength).FirstOrDefault(); } if (!fixture.Options.Contains(optionindex)) { fixture.Options.Add(optionindex); } db.SaveChanges(); } }
public static async Task Collect(ExcelWorksheet rawData, TimeContext ctx) { for (int row = 2; row <= rawData.Dimension.Rows; row++) { ctx.People.Add(new Employee { FirstName = rawData.ReadString(row, 2), LastName = rawData.ReadString(row, 3), Image = rawData.ReadString(row, 4), Email = rawData.ReadString(row, 6), Phone = rawData.ReadString(row, 7), BirthDay = rawData.ReadDate(row, 8), BeginDate = rawData.ReadDate(row, 9), EndDate = rawData.ReadDate(row, 10), Status = (EmployeeStatus)rawData.ReadInteger(row, 11), Position = rawData.ReadString(row, 12) }); ctx.Users.Add(new User { Name = rawData.ReadString(row, 2) + " " + rawData.ReadString(row, 3), Role = rawData.ReadString(row, 14), Username = rawData.ReadString(row, 4), Password = "******" }); } await ctx.SaveChangesAsync(); }
public static async Task Setup() { fileLocation = @"C:\TimeKeeper\TimeTest.xlsx"; Context = new TimeContext("PGS", "User ID=postgres; Password=osmanaga; Server=localhost; Port=5432; Database=testera; Integrated Security=true; Pooling=true;"); Context.Database.EnsureDeleted(); Context.Database.EnsureCreated(); FileInfo file = new FileInfo(fileLocation); using (ExcelPackage package = new ExcelPackage(file)) { var sheets = package.Workbook.Worksheets; await Teams.Collect(sheets["Teams"], Context); await Roles.Collect(sheets["Roles"], Context); await Customers.Collect(sheets["Customers"], Context); await Projects.Collect(sheets["Projects"], Context); await People.Collect(sheets["Employees"], Context); await Members.Collect(sheets["Engagement"], Context); } roles = new Repository <Role>(Context); teams = new Repository <Team>(Context); Assert.Pass(); }
public DustCover(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { Length = row.Field <string>("Length"), Workcenter = row.Field <string>("Work Center") } into grp //orderby grp.Key select new { length = Int32.Parse(grp.Key.Length), workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time (min)"))) }).ToList(); foreach (var row in newSort) { OptionTB.AddInstance(optionName, row.Sum, row.length); using (var db = new TimeContext()) { foreach (var fixture in db.Fixtures) { FixtureTB.AddOption(fixture.FxCode, row.workcenter, optionName, row.Sum, row.length); } } } }
private void ProvideLocalValuesAcrossThreads() { var expectedA = DateTime.MinValue; var expectedB = DateTime.MaxValue; var actualA = DateTime.Today; var actualB = DateTime.Today; var threadA = new Thread(() => { TimeContext.Init(() => expectedA); actualA = TimeContext.Now; }); var threadB = new Thread(() => { TimeContext.Init(() => expectedB); actualB = TimeContext.Now; }); threadA.Start(); threadB.Start(); threadA.Join(); threadB.Join(); Assert.Equal(expectedA, actualA); Assert.Equal(expectedB, actualB); }
public Remo(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { Workcenter = row.Field <string>("Work Center") } into grp select new { workcenter = grp.Key.Workcenter, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time(min)"))) }).ToList(); foreach (var row in newSort) { using (var db = new TimeContext()) { foreach (var fixture in db.Fixtures.Where(r => r.WorkCenter == row.workcenter)) { FixtureTB.AddOption(fixture.FxCode, row.workcenter, optionName, row.Sum); } } } }
public ReplaySystem(Contexts contexts) : base(contexts.time) { _LogicContext = contexts.logic; _timeContext = contexts.time; _inputContext = contexts.input; _inputSources = _inputContext.GetGroup(InputMatcher.ControllerInput); }
public ArbiterService() { gameProperties = new GameProperties(new MembershipManagerClient(), new TimingManagerClient(), new NotificationManagerClient(new InstanceContext(this)), new LogManagerClient()); timeContext = new TimeContext(gameProperties.Timing.GetGameTimings().TimeCount); gameContext = new GameContext(timeContext); }
public ShowFutureSystem(Contexts contexts) : base(contexts.time) { _LogicContext = contexts.logic; _timeContext = contexts.time; _inputContext = contexts.input; _movers = _LogicContext.GetGroup(LogicMatcher.Movable); _inputSources = _inputContext.GetGroup(InputMatcher.ControllerInput); }
public bool HasContext(InputContext context, TimeContext timeContext) { List <IInputSubscriber>[] subscriberArray; if (_subscribers.TryGetValue(context, out subscriberArray)) { return(subscriberArray[(int)timeContext].Count > 0); } return(false); }
// Use this for initialization void Start() { _timeContext = Contexts.sharedInstance.time; _timeContext.CreateEntity() .AddPausedListener(this); //_context.isPaused = true; }
private void AllowInitialization() { var expected = new DateTime(2000, 1, 1); TimeContext.Init(() => expected); var actual = TimeContext.Now; Assert.Equal(expected, actual); }
private void AllowReturningUtcTime() { var fakeTime = new DateTime(2000, 1, 1); TimeContext.Init(() => fakeTime); var actual = TimeContext.UtcNow; Assert.Equal(fakeTime.ToUniversalTime(), actual); }
public TokenAuthenticationHandler( IOptionsMonitor <AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, TimeContext context) : base(options, logger, encoder, clock) { _unit = new UnitOfWork(context); _access = new AccessHandler(_unit); }
static void getLastItems(TimeContext db) { var times = db.Times.ToList().Reverse <Time>().Take(5).Reverse(); Console.WriteLine("Last items in data base: "); foreach (Time u in times) { Console.WriteLine("{0}. {1}", u.Id, u.Output); } }
public Pack(string paramFilePath) { string optionName = this.GetType().Name; var dt = ConvertCSVtoDataTable(paramFilePath); var newSort = (from row in dt.AsEnumerable() group row by new { ID = row.Field <string>("Product ID"), mounting = row.Field <string>("Description"), Workcenter = row.Field <string>("Work Center"), Length = row.Field <string>("Length") } into grp //orderby grp.Key select new { Product = grp.Key.ID, workcenter = grp.Key.Workcenter, mounting = grp.Key.mounting, Length = grp.Key.Length, Sum = grp.Sum(r => Double.Parse(r.Field <string>("Time (min)"))) }).ToList(); using (var db = new TimeContext()) { foreach (var row in newSort) { int length = Int32.Parse(row.Length); string mounting = row.mounting; switch (mounting) { case "Spackle Flange": mounting = "DS"; break; case "Flangeless": mounting = "D"; break; default: mounting = "-"; break; } ProdTB.AddInstance(row.Product, row.workcenter); OptionTB.AddInstance(optionName, row.Sum, length); ParametersTB.AddInstance("Mounting", mounting); ProdTB.AddOption(row.Product, row.workcenter, optionName, row.Sum); OptionTB.AddParam(optionName, row.Sum, "Mounting", mounting, length); } } }
// Use this for initialization void Start() { //get the time context _timeContext = Contexts.sharedInstance.time; //creating an entity to represent this Contexts.sharedInstance.time.CreateEntity().AddPausedListener(this); button = GetComponent <Button> (); button.enabled = false; }
public static async Task Collect(ExcelWorksheet rawData, TimeContext ctx) { for (int row = 2; row <= rawData.Dimension.Rows; row++) { ctx.Teams.Add(new Team { Name = rawData.ReadString(row, 2), Description = rawData.ReadString(row, 3) }); } await ctx.SaveChangesAsync(); }
// Use this for initialization void Start() { playhead = GetComponent <Slider> (); _timeContext = Contexts.sharedInstance.time; TimeEntity e = _timeContext.CreateEntity(); e.AddTickListener(this); e.AddPausedListener(this); playhead.enabled = false; }
private void AllowResettingInitalization() { var fakeTime = new DateTime(1900, 1, 1); TimeContext.Init(() => fakeTime); var fakeTimeResult = TimeContext.Now; TimeContext.Reset(); var resetTimeResult = TimeContext.Now; Assert.NotEqual(fakeTimeResult.Year, resetTimeResult.Year); }
public static async Task Collect(ExcelWorksheet rawData, TimeContext ctx) { for (int row = 2; row <= rawData.Dimension.Rows; row++) { ctx.Roles.Add(new Role { Name = rawData.ReadString(row, 2), HourlyRate = rawData.ReadDecimal(row, 3), MonthlyRate = rawData.ReadDecimal(row, 4) }); } await ctx.SaveChangesAsync(); }
public TimeContext time() { TimeContext _localctx = new TimeContext(Context, State); EnterRule(_localctx, 300, RULE_time); int _la; try { EnterOuterAlt(_localctx, 1); { State = 2413; time_hour(); State = 2414; time_minute(); State = 2415; time_second(); State = 2417; _la = TokenStream.La(1); if (_la==Z) { { State = 2416; Match(Z); } } } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { ExitRule(); } return _localctx; }