//public void AssertBootstrapTokenIsAvailable() //{ // var identity = GetClaimsIdentity(); // var token = identity.BootstrapContext as BootstrapContext; // if (EnsureBootstrapSecurityToken(token) == null) // throw new ApplicationException("Cannot get boostrap context from current identity."); // if (token == null) // throw new ApplicationException("Bootstrap token cannot be null"); //} //private static SecurityToken EnsureBootstrapSecurityToken(BootstrapContext bootstrapContext) //{ // if (bootstrapContext.SecurityToken != null) // return bootstrapContext.SecurityToken; // if (string.IsNullOrWhiteSpace(bootstrapContext.Token)) // return null; // var handlers = FederatedAuthentication.FederationConfiguration.IdentityConfiguration.SecurityTokenHandlers; // return handlers.ReadToken(new XmlTextReader(new StringReader(bootstrapContext.Token))); //} public Datasets GetDatasets() { var datasets = new Datasets(); var rep = new DB1Repository(); datasets.PythagorasValues = rep.GetDataSets(); return(datasets); }
public CompanyInfo GetCompanyByCvrNumber(int cvrNumber) { // AssertBootstrapTokenIsAvailable(); var identity = GetClaimsIdentity(); var rep = new DB1Repository(); var cInfo = rep.GetCompanyInfo(cvrNumber); return(cInfo); }
public string SetDataset(int?valueA, int?valueB, int?valueC) { //isInRole etc. var rep = new DB1Repository(); if (valueA < 0 || valueB < 0 || valueC < 0) { var _error = new ErrorLog() { Timestamp = DateTime.UtcNow, UserName = "******", Email = "unKnown", Action = "Saving dataset", ErrorMessage = "This physical world does not support negative distances" }; rep.logError(_error); return(_error.ErrorMessage); } if ((valueA == null && valueB == null) || (valueB == null && valueC == null) || (valueA == null && valueC == null)) { var _error = new ErrorLog() { Timestamp = DateTime.UtcNow, UserName = "******", Email = "unKnown", Action = "Saving dataset", ErrorMessage = "More than one null in dataset" }; rep.logError(_error); return(_error.ErrorMessage); } if (valueA != null && valueB != null && valueC != null) { var _error = new ErrorLog() { Timestamp = DateTime.UtcNow, UserName = "******", Email = "unKnown", Action = "Saving dataset", ErrorMessage = "No empty data to fill in dataset" }; rep.logError(_error); return(_error.ErrorMessage); } var pythagorasValue = new Models.PythagorasValue() { ValueA = valueA, ValueB = valueB, ValueC = valueC }; if (rep.SavedataSet(pythagorasValue)) { return("Ok"); } return("Ukendt fejl: kontakt en relevant ansvarlig"); }