public async Task <IActionResult> Create([Bind("ID,CCSD,Domain,CKT_Type,Source,SInt,SIP,Destination,DInt,DIP,CCO,Phone,Date,user")] Circuit circuit) { //if (ClaimsLoader.IsInGroup(User, _config.GetValue<string>("Admin"))) //{ if (ModelState.IsValid) { Circuit newCircuit = new Circuit { ID = circuit.ID, CCSD = circuit.CCSD, Domain = circuit.Domain, CKT_Type = circuit.CKT_Type, Source = circuit.Source, SInt = circuit.SInt, SIP = circuit.SIP, Destination = circuit.Destination, DInt = circuit.DInt, DIP = circuit.DIP, CCO = circuit.CCO, Phone = circuit.Phone, Date = DateTime.UtcNow, user = User.Identity.Name }; _context.Add(newCircuit); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(circuit)); //} //else { return NotFound(); } }
public static void AddActionsToScheduler( ReportJobConfiguration config, CoreBusinessLayerService service) { if (!config.get_Enabled()) { return; } ReportingActionContext reportingActionContext = new ReportingActionContext(); reportingActionContext.set_AccountID(config.get_AccountID()); reportingActionContext.set_UrlsGroupedByLeftPart(ReportJobInitializer.GroupUrls(config)); reportingActionContext.set_WebsiteID(config.get_WebsiteID()); ReportingActionContext reportingContext = reportingActionContext; MacroContext macroContext = ((ActionContextBase)reportingContext).get_MacroContext(); ReportingContext reportingContext1 = new ReportingContext(); reportingContext1.set_AccountID(config.get_AccountID()); reportingContext1.set_ScheduleName(config.get_Name()); reportingContext1.set_ScheduleDescription(config.get_Description()); reportingContext1.set_LastRun(config.get_LastRun()); reportingContext1.set_WebsiteID(config.get_WebsiteID()); macroContext.Add((ContextBase)reportingContext1); ((ActionContextBase)reportingContext).get_MacroContext().Add((ContextBase) new GenericContext()); int num = 0; if (config.get_Schedules() == null) { return; } using (List <ReportSchedule> .Enumerator enumerator1 = config.get_Schedules().GetEnumerator()) { while (enumerator1.MoveNext()) { ReportSchedule current = enumerator1.Current; DateTime dateTime = !current.get_EndTime().HasValue ? DateTime.MaxValue : current.get_EndTime().Value; Scheduler.get_Instance().Add(new ScheduledTask(string.Format("ReportJob-{0}_{1}", (object)config.get_ReportJobID(), (object)num), (TimerCallback)(o => { ReportJobInitializer.log.Info((object)"Starting action execution"); using (List <ActionDefinition> .Enumerator enumerator = config.get_Actions().GetEnumerator()) { while (enumerator.MoveNext()) { service.ExecuteAction(enumerator.Current, (ActionContextBase)reportingContext); } } config.set_LastRun(new DateTime?(DateTime.Now.ToUniversalTime())); ReportJobDAL.UpdateLastRun(config.get_ReportJobID(), config.get_LastRun()); }), (object)null, current.get_CronExpression(), current.get_StartTime(), dateTime, config.get_LastRun(), current.get_CronExpressionTimeZoneInfo()), true); ++num; } } }
public async Task <IActionResult> Create([Bind("ID,Manufacturer,SoftwareTitle,AssignedTo,PurchaseOrder,LicenseType,PurchaseDate,Supported,SupportExp,TotalKeys,UsedKeys,LicenseKey,added")] Software software) { if (ModelState.IsValid) { software.added = DateTime.UtcNow; _context.Add(software); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(software)); }