public void MapToBo(SystemWorkPlace bo, ApplicationInformation appInfo) { bo.Name = this.Name; bo.Description = this.Description; bo.SortCode = this.SortCode; bo.AppInfo = appInfo; }
/// <summary> /// Create ApplicationInformation instance /// </summary> /// <param name="longName"></param> /// <param name="pid"></param> /// <returns></returns> private ApplicationInformation CreateAppInfoInstance(string longName, int pid) { //fetch process using GetProcessById method var fetchedProcess = System.Diagnostics.Process.GetProcessById(pid); //if process is null, set start time to current time DateTime processStarted = _dateTime.Now; if (fetchedProcess is null) { processStarted = fetchedProcess.StartTime.ToUniversalTime(); } var appInstance = new ApplicationInformation { ApplicationName = GetBasicApplicationTitle(longName, fetchedProcess?.ProcessName ?? string.Empty), StartTime = processStarted, Session = _sessionService.SessionInformation.SessionId, FetchTime = _dateTime.Now }; _logger.LogInfo("data {@appInstance}", appInstance); return(appInstance); }
public ActionResult SaveApplicationInformation(ApplicationInformation appInfo) { using (new PerformanceMonitor()) { if (null == appInfo) { return(this.Json(WebResponse.Bind((int)Fault.DataNotSpecified, "Application Information not specified."), JsonRequestBehavior.AllowGet)); } else { try { var userApplication = new ApplicationInformation() { Identifier = Settings.ApplicationIdentifier, }; var updated = appCore.Save(appInfo, User.Identity.Editor(), userApplication); return(this.Json(updated, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { logger.Log(ex, EventTypes.Error, (int)Fault.Unknown); return(this.Json(WebResponse.Bind((int)Fault.Unknown, ex.Message), JsonRequestBehavior.AllowGet)); } } } }
private void Form1_Load(object sender, EventArgs e) { m_applicationInformation = new ApplicationInformation(); propertyGrid1.SelectedObject = m_applicationInformation; InitListViewInfo(); DoLA(); }
public void ApplicationInfoRoundTrip() { var table = new AzureTable <UserData>(CloudStorageAccount.DevelopmentStorageAccount); var user = new UserData(string.Format("{0}@temp.com", Guid.NewGuid()), "na", Guid.NewGuid().ToString()); table.AddEntity(user); var core = new ApplicationCore(); var data = this.Information(); data.Identifier = Abc.Underpinning.Application.Identifier; var u = new User() { Identifier = user.Id, }; var app = new Application() { Identifier = Guid.NewGuid(), }; var editor = new UserApplication() { User = u, Application = app, }; var userApp = new ApplicationInformation() { Identifier = Application.Default.Identifier, }; var saved = core.Save(data, editor, userApp); Assert.IsNotNull(saved); Assert.AreEqual <string>(data.Description, saved.Description); Assert.AreEqual <string>(data.Name, saved.Name); Assert.AreEqual <Guid>(data.Identifier, saved.Identifier); }
public void ConvertWithUser() { var owner = new User() { Identifier = Guid.NewGuid(), }; var appInfo = new ApplicationInformation() { Active = true, Identifier = Guid.NewGuid(), Deleted = true, Description = StringHelper.ValidString(), Environment = StringHelper.ValidString(), IsValid = true, Name = StringHelper.ValidString(), ValidUntil = DateTime.UtcNow, IsNew = true, OwnerId = owner.Identifier, }; var model = appInfo.Convert(owner); Assert.AreEqual <bool>(model.Active, appInfo.Active); Assert.AreEqual <bool>(model.Deleted, appInfo.Deleted); Assert.AreEqual <bool>(model.IsValid, appInfo.IsValid); Assert.AreEqual <bool>(model.New, appInfo.IsNew); Assert.IsTrue(model.IsOwner); Assert.AreEqual <Guid>(model.ApplicationId, appInfo.Identifier); Assert.AreEqual <string>(model.Description, appInfo.Description); Assert.AreEqual <string>(model.Environment, appInfo.Environment); Assert.AreEqual <string>(model.Name, appInfo.Name); Assert.AreEqual <DateTime>(model.ValidUntil, appInfo.ValidUntil); }
public void SaveApplicationInformationEmptyInfoAppId() { var core = new ApplicationCore(); var u = new User() { Identifier = Guid.NewGuid(), }; var app = new Application() { Identifier = Guid.NewGuid(), }; var editor = new UserApplication() { User = u, Application = app, }; var userApp = new ApplicationInformation() { Identifier = Guid.NewGuid(), }; var info = this.Information(); info.Identifier = Guid.Empty; core.Save(info, editor, userApp); }
public void RuntimeName() { this.SkipTestOnLinux(); var e = new ApplicationInformation(); #if NETCOREAPP2_1 Assert.AreEqual("2.1.13", e.RuntimeName); Assert.AreEqual(new Version("4.6.28008.1"), e.RuntimeVersion); #elif NETCOREAPP2_2 if (Environment.GetEnvironmentVariable("NetCoreSdk") == "2.2.401") { Assert.AreEqual("2.2.6", e.RuntimeName); Assert.AreEqual(new Version("4.6.27817.3"), e.RuntimeVersion); } else { Assert.AreEqual("2.2.7", e.RuntimeName); Assert.AreEqual(new Version("4.6.28008.2"), e.RuntimeVersion); } #elif NETCOREAPP3_1 Assert.AreEqual("3.1.21", e.RuntimeName); Assert.AreEqual(new Version("3.1.21"), e.RuntimeVersion); #else Assert.Fail("Unexpected"); #endif }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationHeader"/> class /// with a custom title text. /// </summary> public ApplicationHeader(string title) { applicationInformation = new ApplicationInformation(); Title = title ?? applicationInformation.GetProductName(); Margin = "0 0 0 1"; }
public void Description() { var description = StringHelper.ValidString(); var appInfo = new ApplicationInformation(); appInfo.Description = description; Assert.AreEqual <string>(description, appInfo.Description); }
public void ApplicationId() { var appId = Guid.NewGuid(); var appInfo = new ApplicationInformation(); appInfo.Identifier = appId; Assert.AreEqual <Guid>(appId, appInfo.Identifier); }
public AboutWindowViewModel(AboutWindow view) { this.view = view; applicationInformation = new ApplicationInformation(); versionChecker = new VersionChecker(view, true); versionChecker.TaskFinished += VersionCheckerTaskFinished; CreateCommands(); }
public void OwnerId() { var appId = Guid.NewGuid(); var appInfo = new ApplicationInformation(); appInfo.OwnerId = appId; Assert.AreEqual <Guid>(appId, appInfo.OwnerId); }
public void ValidUntil() { var now = DateTime.UtcNow; var appInfo = new ApplicationInformation(); appInfo.ValidUntil = now; Assert.AreEqual <DateTime>(now, appInfo.ValidUntil); }
public void PublicKey() { var name = StringHelper.ValidString(); var appInfo = new ApplicationInformation(); appInfo.PublicKey = name; Assert.AreEqual <string>(name, appInfo.PublicKey); }
public void Environment() { var environment = StringHelper.ValidString(); var appInfo = new ApplicationInformation(); appInfo.Environment = environment; Assert.AreEqual <string>(environment, appInfo.Environment); }
public void Deleted() { var appInfo = new ApplicationInformation(); appInfo.Deleted = true; Assert.IsTrue(appInfo.Deleted); appInfo.Deleted = false; Assert.IsFalse(appInfo.Deleted); }
public void IsValid() { var appInfo = new ApplicationInformation(); appInfo.IsValid = true; Assert.IsTrue(appInfo.IsValid); appInfo.IsValid = false; Assert.IsFalse(appInfo.IsValid); }
public void IsNew() { var appInfo = new ApplicationInformation(); appInfo.IsNew = true; Assert.IsTrue(appInfo.IsNew); appInfo.IsNew = false; Assert.IsFalse(appInfo.IsNew); }
public void Initialize(ITelemetry telemetry) { IApplicationInformation appInfo = new ApplicationInformation(); // Component.Version maps to application_Version telemetry.Context.Component.Version = appInfo.ProductVersion; // Environment will be mapped to customDimensions telemetry.Context.Properties.Add("Environment", ConfigurationManager.AppSettings["SiteEnvironment"]); }
public void Active() { var appInfo = new ApplicationInformation(); appInfo.Active = true; Assert.IsTrue(appInfo.Active); appInfo.Active = false; Assert.IsFalse(appInfo.Active); }
public ActionResult Create(ApplicationInformation appInfo) { if (!ModelState.IsValid) { ModelState.AddModelError("", "Unable to save ApplicationInformation."); return(View(appInfo)); } _repository.Save(appInfo); return(RedirectToAction("List")); }
public IActionResult Get() { var model = new ApplicationInformation() { Name = "Dashboard Api", Version = "V1" }; return(Ok(model)); }
private void ShowNextRegion(string username) { if (CurrentMode == Mode.LOGIN) { new UserServiceClient().Using(client => { ApplicationInformation info = client.GetApplicationInformation(); ReturnObject ro = client.GetUserQuestions(username); var questions = (UserQuestion[])ro.ReturnValue; if ((bool)client.GetMustChangePasswordFlag(username).ReturnValue) { //must change password now before getting access to the site //show MustChangePassword screen //if change successful, give auth ticket ShowRegion(phChangePassword); } //you don't have to do any explicit checks to see if the current application uses //the password expiration feature. if that's the case, IsPasswordExpired and //ShouldShowPasswordExpirationWarning will always return false else if ((bool)client.IsPasswordExpired(username).ReturnValue) { //must change password now before getting access to the site //show password expired screen //if change successful, give auth ticket ShowRegion(phChangePassword); } else if ((bool)client.ShouldShowPasswordExpirationWarning(username).ReturnValue) { //show warning screen, give opportunity to change password immediately SetAuthCookie(username); ShowRegion(phExpirationWarning); } else if (info.NumberOfPasswordResetQuestions > 0 && questions.Count() < info.NumberOfPasswordResetQuestions) { //The user needs to provide password reset questions SetAuthCookie(username); ShowRegion(phSetQuestions); } else { //All clear, send them in SetAuthCookie(username); if (Session["NCIPL_LOGINREFERRER"] != null && Session["NCIPL_LOGINREFERRER"].ToString().Length > 0) { Response.Redirect(Session["NCIPL_LOGINREFERRER"].ToString()); } else { FormsAuthentication.RedirectFromLoginPage(username, chkPersistent.Checked); } } }); } }
/// <summary> /// Initializes a new instance of the <see cref="ResponseLog" /> class. /// </summary> /// <param name="options">The configured <see cref="SqlServerLoggingOptions" />.</param> /// <param name="locations">The configured <see cref="LocationStore" />.</param> /// <param name="environment">The environment context.</param> public ResponseLog(SqlServerLoggingOptions options, ILocationStore locations, ApplicationInformation environment) : base(options.BatchSize, options.Period) { Argument.NotNull(options, nameof(options)); Argument.NotNull(locations, nameof(locations)); Argument.NotNull(environment, nameof(environment)); _options = options; _locations = locations; _environment = environment; _eventsTable = this.CreateTable(); }
public ActionResult Save(SystemWorkPlaceVM boVM) { if (ModelState.IsValid) { var bo = _Service.GetSingle(boVM.ID); if (bo == null) { bo = new SystemWorkPlace(); bo.ID = boVM.ID; } var appID = Assembly.GetExecutingAssembly().ManifestModule.ModuleVersionId; var appInfo = _Service.GetSingleRelevance <ApplicationInformation>(appID); if (appInfo == null) { appInfo = new ApplicationInformation(); appInfo.ID = appID; appInfo.AppID = appID; appInfo.Name = ""; appInfo.Description = ""; appInfo.SortCode = "001"; _Service.AddRelevance <ApplicationInformation>(appInfo); _Service.Save(); } boVM.MapToBo(bo, appInfo); _Service.AddOrEditAndSave(bo); return(Json(PageComponentRepository <SystemWorkPlaceVM> .SaveOK(true, "1", ""))); } else { var vItems = new List <ValidatorResult>(); foreach (var item in ModelState) { if (item.Value.Errors != null) { foreach (var vItem in item.Value.Errors) { var errItem = new ValidatorResult(); errItem.Name = item.Key; errItem.ErrorMessage = vItem.ErrorMessage; vItems.Add(errItem); } } } var editor = PageComponentRepository <SystemWorkPlaceVM> .UpdateCreateOrEditDialog(boVM, false, vItems).InnerHtmlContent; return(Json(editor)); } }
public ApplicationInformation AppInfo() { var currentProcess = System.Diagnostics.Process.GetCurrentProcess(); var data = new ApplicationInformation { IsAdministrator = Sitecore.Context.User.IsAdministrator, MemoryUsage = string.Format("{0} MB", currentProcess.WorkingSet64 / (1024 * 1024)), CpuTime = String.Format("{0:0.0}", HardwareUtil.GetCpuLoadAsync(1000) * 100) }; return(data); }
/// <summary> /// Initializes a new instance of <see cref="EventEmitter"/> /// </summary> /// <param name="applicationInformation"></param> /// <param name="eventEnvelopeProducer"></param> /// <param name="eventPublisher"></param> /// <param name="eventStore"></param> /// <param name="eventProcessors"></param> public EventEmitter( ApplicationInformation applicationInformation, IEventEnvelopeProducer eventEnvelopeProducer, IEventPublisher eventPublisher, IEventStore eventStore, IEventProcessors eventProcessors) { _applicationInformation = applicationInformation; _eventPublisher = eventPublisher; _eventProcessors = eventProcessors; _eventEnvelopeProducer = eventEnvelopeProducer; _eventStore = eventStore; }
public ApplicationInformation Receive() { var result = new ApplicationInformation(); var request = Server.Receive(); var proposeCreate = Soap.ToData<ProposeCreateApplicationTransactionType>( request); proposeCreate.Application.RunCommonTests(); proposeCreate.Application.RunStatusTests(); result.ApplicationNumber = proposeCreate.Application.ApplicationNumber.Value; proposeCreate.StandardBusinessMessageHeader.RunCommonTests(); proposeCreate.StandardBusinessMessageHeader.RunFullPartnerTests(); proposeCreate.Specialisation.Should().NotBeNull(); proposeCreate.Specialisation.Count().Should().Be(2); proposeCreate.Specialisation[0].Jurisdiction.Should().NotBeNull(); proposeCreate.Specialisation[0].Version.Should().NotBeNull(); proposeCreate.Specialisation[0].Extension.Should().NotBeNull(); proposeCreate.Specialisation[0].Extension.Length.Should().Be(1); proposeCreate.Specialisation[0].Extension[0].Name.Should().Be("Application"); var applicationExtension = proposeCreate.Specialisation[0].Extension[0].ConvertNode<Application1>(); applicationExtension.Type.Should().NotBeNull(); applicationExtension.DevelopmentCode.Should().NotBeNull(); applicationExtension.DevelopmentCode.Length.Should().BeGreaterThan(0); applicationExtension.BCAClass.Should().NotBeNull(); applicationExtension.RefNumber.Should().NotBeNull(); proposeCreate.Specialisation[1].Jurisdiction.Should().NotBeNull(); proposeCreate.Specialisation[1].Version.Should().NotBeNull(); proposeCreate.Specialisation[1].Extension.Should().NotBeNull(); proposeCreate.Specialisation[1].Extension.Length.Should().Be(1); proposeCreate.Specialisation[1].Extension[0].Name.Should().Be("SubjectLand"); var subjectLandExtension = proposeCreate.Specialisation[1].Extension[0].ConvertNode<SubjectLand1>(); subjectLandExtension.Should().NotBeNull(); subjectLandExtension.ABS_Statistics.Should().NotBeNull(); subjectLandExtension.ABS_Statistics.Floor.Should().NotBeNull(); subjectLandExtension.ABS_Statistics.Floor.Length.Should().Be(1); subjectLandExtension.ABS_Statistics.Floor[0].Value.Should().NotBeNullOrEmpty(); subjectLandExtension.ABS_Statistics.Frame.Should().NotBeNull(); subjectLandExtension.ABS_Statistics.Frame.Length.Should().Be(1); subjectLandExtension.ABS_Statistics.Frame[0].Value.Should().NotBeNullOrEmpty(); subjectLandExtension.ABS_Statistics.Roof.Should().NotBeNull(); subjectLandExtension.ABS_Statistics.Roof.Length.Should().Be(1); subjectLandExtension.ABS_Statistics.Roof[0].Value.Should().NotBeNullOrEmpty(); subjectLandExtension.ABS_Statistics.Walls.Should().NotBeNull(); subjectLandExtension.ABS_Statistics.Walls.Length.Should().Be(1); subjectLandExtension.ABS_Statistics.Walls[0].Value.Should().NotBeNullOrEmpty(); Server.Respond("ProposeCreate", ReceiptAcknowledgementSignalType, request); return result; }
public static async Task <int> Main(string[] args) { _args = args; Title = ApplicationInformation.DefaultTitle; AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit); SerilogExtensions.SetupSerilog(null); ApplicationInformation.LogAssemblyInformation(); try { using (PluginManager = new PluginManager(Log.Logger)) { Setup(); using (var dnsServer = ServiceProvider.GetService <DnsServer>()) { return(await WaitForEndAsync().ConfigureAwait(false)); } return(0); } } #pragma warning disable CA1031 // Do not catch general exception types // Last Global Exception Handler!!! catch (System.Net.Sockets.SocketException socex) { if (socex.ErrorCode == 10048) { Log.Fatal(socex, "The Port for the DNS-Proxy-Server is in use. Stop the application that use the same Port or change the ListenerPort!"); } else { Log.Fatal(socex, "Host terminated unexpectedly {DefaultTitle}", ApplicationInformation.DefaultTitle); } await Task.Delay(100).ConfigureAwait(false); return(await Task.FromResult(1).ConfigureAwait(false)); } catch (Exception ex) #pragma warning restore CA1031 // Do not catch general exception types { Log.Fatal(ex, "Host terminated unexpectedly {DefaultTitle}", ApplicationInformation.DefaultTitle); await Task.Delay(100).ConfigureAwait(false); return(await Task.FromResult(1).ConfigureAwait(false)); } finally { } }
public void SaveApplicationInformationEmptyUserId() { var core = new ApplicationCore(); var editor = this.UserApplication(Guid.NewGuid()); editor.User.Identifier = Guid.Empty; var userApp = new ApplicationInformation() { Identifier = Guid.NewGuid(), }; var info = this.Information(); core.Save(info, editor, userApp); }
public TwilloSmsEventHandler(ApplicationInformation appInfo) : base(new SmsMessageFormatter(appInfo)) { }