private bool AddResourceProvider(Provider provider, Dictionary<string, List<string>> locationMap) { if (locationMap == null || provider == null) { return false; } var providersLocations = provider.ResourceTypes .CoalesceEnumerable() .SelectMany(type => type.Locations) .Distinct(StringComparer.InvariantCultureIgnoreCase); providersLocations.ForEach(location => { if (!locationMap.ContainsKey(location)) { locationMap[location] = new List<string>(); } if (!locationMap[location].Contains(provider.NamespaceProperty)) { locationMap[location].Add(provider.NamespaceProperty); } }); return true; }
/// <summary> /// 根据提供者信息,创建实现类 /// </summary> /// <param name="dataProvider"></param> /// <returns></returns> public static Object Instance(Provider dataProvider) { if (dataProvider == null) { throw new Exception("Provider不存在,请确认配置文件中的节点Provider中的信息"); } Type type = Type.GetType(dataProvider.Type); object newObject = null; if (type != null) { string connectionString = null; string databaseOwner = null; GetDataStoreParameters(dataProvider, out connectionString, out databaseOwner); newObject = Activator.CreateInstance(type, connectionString, databaseOwner); if (newObject == null) { throw new Exception("建立实例出错"); } } else { throw new Exception("加载类型出错"); } return newObject; }
public RunParameters(XmlElement e, Provider<IAgent, string> agentProvider) { exePath = e.SelectSingleNode("./cmd").InnerText; workingDirectory = e.SelectSingleNode("./dir").InnerText; parameters = e.SelectSingleNode("./args").InnerText; agent = agentProvider(e.SelectSingleNode("./agent").InnerText); }
public ViewModel() { Provider = new Provider(); Messages = new ObservableCollection<Core.Message>(); ActivateCommands(); SendRequests(); }
public GlobalSettings GetSettings(Provider? provider) { var key = string.Format("GlobalSettingsFor{0}", provider); var global = (GlobalSettings) MemoryCache.Default.Get(key); if (global != null) return global; using (var session = nhibernateSessionFactory.OpenSession()) { var settings = session.Query<Setting>().Where(x => x.Provider == provider || x.Provider == null).ToList(); ProviderSettings providerSettings = null; if (provider.HasValue) { providerSettings = session.Query<ProviderSettings>().FirstOrDefault(p => p.Provider == provider); } global = new GlobalSettings(settings, providerSettings); } MemoryCache.Default.Set(key, global, DateTimeOffset.Now.AddMinutes(5)); return global; }
/// <summary> /// Instantiates a new symmetric encryption object using the specified provider. /// </summary> //public Symmetric(Provider provider) //{ // this.Symmetric(provider,true); //} public Symmetric(Provider provider, bool useDefaultInitializationVector) { switch (provider) { case Provider.DES: _crypto = new DESCryptoServiceProvider(); break; case Provider.RC2: _crypto = new RC2CryptoServiceProvider(); break; case Provider.Rijndael: _crypto = new RijndaelManaged(); break; case Provider.TripleDES: _crypto = new TripleDESCryptoServiceProvider(); break; } //-- make sure key and IV are always set, no matter what Key = RandomKey(); if (useDefaultInitializationVector) { IntializationVector = new Data(_DefaultIntializationVector); } else { IntializationVector = RandomInitializationVector(); } }
public void FindCitiesWithRadius() { var providerCoventry = new Provider() { Name = "Coventry", Location = new Location() { Lat = 52.406822, Long = -1.519692999999961 }, Radius = 30 }; var rugby = new Location() { Lat = 52.370878, Long = -1.2650320000000193 }; var warwik = new Location() { Lat = 52.28231599999999, Long = -1.5849269999999933 }; var leicester = new Location(){Lat = 52.6368778,Long = -1.1397591999999577}; var london = new Location() { Lat = 51.5073509, Long = -0.12775829999998223 }; var calculator = new Calculator(); // Rugby and Warwik is closer than 30 km to Coventry var rugby_yes = calculator.IsWithin(rugby, providerCoventry.Location, providerCoventry.Radius); var warwik_yes = calculator.IsWithin(warwik, providerCoventry.Location, providerCoventry.Radius); // Leicester is further away than 30 km var leicester_no = calculator.IsWithin(leicester, providerCoventry.Location, providerCoventry.Radius); Assert.IsTrue(rugby_yes); Assert.IsTrue(warwik_yes); Assert.IsFalse(leicester_no); }
///<summary>Inserts one Provider into the database. Returns the new priKey.</summary> internal static long Insert(Provider provider) { if(DataConnection.DBtype==DatabaseType.Oracle) { provider.ProvNum=DbHelper.GetNextOracleKey("provider","ProvNum"); int loopcount=0; while(loopcount<100){ try { return Insert(provider,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ provider.ProvNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(provider,false); } }
public void AddProviderWithDefaultUser(Provider provider, User user) { using (TransactionScope scope = new TransactionScope()) { using (var dataContext = new HealthReunionEntities()) { if (CheckIfUserNameExists(user.UserName)) throw new Exception("User name already exist"); if(CheckIfProviderNameExists(provider.ProviderName)) throw new Exception("Provider name already exist"); // Add provider enity dataContext.Providers.Add(provider); // Save changes so that it will insert records into database. dataContext.SaveChanges(); user.ProviderId = provider.ProviderId; user.Password = EncryptDecrypt.EncryptData(user.Password, EncryptDecrypt.ReadCert()); // Add user entity dataContext.Users.Add(user); dataContext.SaveChanges(); // Complete the transaction if everything goes well. scope.Complete(); } } }
public void Delegate_Leak_RemoveOnlyDelegate() { freeAll(); var memBegin = Process.GetCurrentProcess().PrivateMemorySize64; Debug.WriteLine("Begin: " + (memBegin / 1000000)); var provider = new Provider(); var consumer = new Consumer(provider.Notify); freeAll(); var afterCreation = Process.GetCurrentProcess().PrivateMemorySize64 - memBegin; Debug.WriteLine("After creation (should be around 200MB): " + (afterCreation / 1000000)); provider = null; freeAll(); var afterDispose = Process.GetCurrentProcess().PrivateMemorySize64 - memBegin; Debug.WriteLine("After dispose (should be around 200MB): " + (afterDispose / 1000000)); consumer.RemoveDelegate(); freeAll(); var afterDispose2 = Process.GetCurrentProcess().PrivateMemorySize64 - memBegin; Debug.WriteLine("After consumer dispose (should be around 100MB): " + (afterDispose2 / 1000000)); }
protected void btnSave_Click(object sender, EventArgs e) { try { //1st save off the region _selectedRegion.Title = txtTitle.Text.Trim(); _selectedRegion.ProviderId = int.Parse(ddlProvider.SelectedValue); _selectedRegion.TemplateRegionId = int.Parse(ddlTemplateRegion.SelectedValue); int sortOrder = 1; int.TryParse(txtSortOrder.Text, out sortOrder); _selectedRegion.SortOrder = sortOrder; _selectedRegion.ShowTitle = chkShowTitle.Checked; _selectedRegion.Save(WebUtility.GetUserName()); //2nd join it up with the page int rowsAffected = new RegionController().JoinToPage(_selectedRegion.RegionId, pageId); Provider provider = new Provider(int.Parse(ddlProvider.SelectedValue)); Response.Redirect(string.Format("~/admin/provider.aspx?pageId={0}®ionId={1}&providerId={2}", pageId, _selectedRegion.RegionId, provider.ProviderId), true); } catch (System.Threading.ThreadAbortException) { throw; } catch(Exception ex) { Logger.Error(typeof(region).Name, ex); Master.MessageCenter.DisplayCriticalMessage(ex.Message); } }
private void ConvertProviders(Provider provider, Managed.Database.Provider newProvider) { newProvider.Name = provider.Name; newProvider.Description = provider.Description; newProvider.Web = provider.Web; newProvider.Pinned = provider.Pinned; foreach (var media in provider.Medias) { var stream = new Stream { Name = media.Name, Description = media.Description, Web = media.Web, ChatEmbed = media.ChatEmbed, StreamGuid = media.StreamGuid, StreamEmbed = media.StreamEmbed, Tags = media.Tags, Size = media.Size }; foreach (var newEmbedData in media.ChatEmbedData.Select(embedData => new StreamDeskProperty { Name = embedData.Name, Value = embedData.Value })) { stream.ChatEmbedData.Add(newEmbedData); } foreach (var newEmbedData in media.StreamEmbedData.Select(embedData => new StreamDeskProperty { Name = embedData.Name, Value = embedData.Value })) { stream.StreamEmbedData.Add(newEmbedData); } newProvider.Streams.Add(stream); } foreach (var subProvider in provider.SubProviders) { var newSubProvider = new Managed.Database.Provider(); ConvertProviders(subProvider, newSubProvider); newProvider.SubProviders.Add(newSubProvider); } }
/// <summary> /// Initializes a new instance of the <see cref="EditNodeForm"/> class. /// </summary> /// <param name="provider"> /// The provider. /// </param> /// <param name="oldVertexId"> /// The old vertex id. /// </param> public EditNodeForm(Provider.Provider provider, string oldVertexId) { this.InitializeComponent(); this.provider = provider; this.oldVertexId = oldVertexId; this.FillForm(); }
public Config() { CollectionPaths = null; DefinitionsCollection = new Definition[3]; ProvidersCollection = new Provider[2]; TrailerPath = ""; }
private static string GetProviderHost(Provider provider) { switch (provider) { default: return "cache-aws-us-east-1"; } }
/// <summary> /// Initializes a new instance of the <see cref="BatchProcess"/> class. /// </summary> /// <param name="provider"> /// The provider. /// </param> public BatchProcess(Provider.Provider provider) { this.InitializeComponent(); this.PrepareDialog(); this.InitializeEditBox(); this.provider = provider; this.IsAdd = false; }
/// <summary> /// Initializes a new instance of the <see cref="AddTree"/> class. /// </summary> /// <param name="provider"> /// The provider. /// </param> /// <param name="fromFile"> /// The from file. /// </param> public AddTree(Provider.Provider provider, bool fromFile) { this.InitializeComponent(); this.InitializeAdd(); this.provider = provider; this.fromFile = fromFile; this.FillTrees(); this.SetTitleLabel(); }
IDictionary<string, string> IExtensionResponse.Serialize(Provider.IRequest authenticationRequest) { var fields = new Dictionary<string, string> { { "mode", Succeeded ? SuccessMode : FailureMode }, }; if (!Succeeded && !string.IsNullOrEmpty(FailureReason)) fields.Add("error", FailureReason); return fields; }
/// <summary> /// Constianer to hold extra handler objects. /// </summary> //protected Handler[] handlers; /// <summary> /// Scene Holder container. /// </summary> //protected SceneHolder sceneHolder; public BaseApplication () { _provider = new Kinetic.Provide.OpenTKProvider(); _resourceManager = _provider.CreateResourceManager(); _displays = null; _renderers = null; //handlers = null; //sceneHolder = null; }
public void processEventFrame(Provider.FrameEventArgs e) { touchscreenMutex.WaitOne(); List<PointerTouchInfo> toFire = new List<PointerTouchInfo>(); foreach (WiiContact contact in e.Contacts) { if (Settings.Default.pointer_customCursor && (contact.Type == ContactType.Hover || contact.Type == ContactType.EndFromHover)) { //If we are using the custom cursor and it's more than 1 touchpoints, we skip the hovering because otherwise it's not working with edge guestures for example. } else { ContactType type = contact.Type; if (Settings.Default.pointer_customCursor && (contact.Type == ContactType.EndToHover)) { type = ContactType.End; } PointerTouchInfo touch = new PointerTouchInfo(); touch.PointerInfo.pointerType = PointerInputType.TOUCH; touch.TouchFlags = TouchFlags.NONE; //contact.Orientation = (uint)cur.getAngleDegrees();//this is only valid for TuioObjects touch.Pressure = 0; touch.TouchMasks = TouchMask.NONE; touch.PointerInfo.PtPixelLocation.X = (int)contact.Position.X; touch.PointerInfo.PtPixelLocation.Y = (int)contact.Position.Y; touch.PointerInfo.PointerId = (uint)contact.ID; touch.PointerInfo.PerformanceCount = e.Timestamp; if (type == ContactType.Start) touch.PointerInfo.PointerFlags = PointerFlags.DOWN | PointerFlags.INRANGE | PointerFlags.INCONTACT; else if (type == ContactType.Move) touch.PointerInfo.PointerFlags = PointerFlags.UPDATE | PointerFlags.INRANGE | PointerFlags.INCONTACT; else if (type == ContactType.End) touch.PointerInfo.PointerFlags = PointerFlags.UP; else if (type == ContactType.EndToHover) touch.PointerInfo.PointerFlags = PointerFlags.UP | PointerFlags.INRANGE; else if (type == ContactType.Hover) touch.PointerInfo.PointerFlags = PointerFlags.UPDATE | PointerFlags.INRANGE; else if (type == ContactType.EndFromHover) touch.PointerInfo.PointerFlags = PointerFlags.UPDATE; toFire.Add(touch); } } //fire the events if (toFire.Count > 0) { if (!TCD.System.TouchInjection.TouchInjector.InjectTouchInput(toFire.Count, toFire.ToArray())) { Console.WriteLine("Could not send touch input, count " + toFire.Count); } } touchscreenMutex.ReleaseMutex(); }
/// <summary> /// Get number of existing export files /// </summary> /// <param name="profile">Export profile</param> /// <param name="provider">Export provider</param> /// <returns>Number of export files</returns> public static int GetExportFileCount(this ExportProfile profile, Provider<IExportProvider> provider) { var result = profile.GetExportFiles(provider).Count(); if (File.Exists(profile.GetExportZipPath())) ++result; return result; }
public void OnGoogleLoginCheck() { targetProvider = Provider.GOOGLE; Text text = googleTextGameObject.GetComponent<Text>(); if (SoomlaProfile.IsLoggedIn(targetProvider)) text.text = "Google+ is logined"; else text.text = "Google+ is not logined"; }
public void OnFacebookLoginCheck() { targetProvider = Provider.FACEBOOK; Text text = facebookTextGameObject.GetComponent<Text>(); if (SoomlaProfile.IsLoggedIn(targetProvider)) text.text = "Facebook is logined"; else text.text = "Facebook is not logined"; }
public ActionResult Edit(Provider provider) { if (ModelState.IsValid) { db.Entry(provider).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(provider); }
private static string GetProviderHost(Provider provider) { switch (provider) { case Provider.Rackspace: return "mq-rackspace-dfw"; default: return "mq-aws-us-east-1"; } }
/// <summary> /// Static constructor /// </summary> /// <param name="connection">The connection which been proxified.</param> /// <param name="provider">The provider used</param> /// <returns>A proxy</returns> internal static IDbConnection NewInstance(IDbConnection connection, Provider provider) { object proxyConnection = null; IInterceptor handler = new IDbConnectionProxy(connection, provider); ProxyGenerator proxyGenerator = new ProxyGenerator(); proxyConnection = proxyGenerator.CreateProxy(typeof(IDbConnection), handler, connection); return (IDbConnection) proxyConnection; }
public ActionResult Create(Provider provider) { if (ModelState.IsValid) { db.Providers.Add(provider); db.SaveChanges(); return RedirectToAction("Index"); } return View(provider); }
protected object btnValidate_GetObject() { var provider = new Provider(); provider.FirstName = txtFirstName.Text; provider.LastName = txtLastName.Text; provider.MiddleInitial = txtMiddle.Text; provider.StartDate = Convert.ToDateTime(txtStartDate.Text); provider.Code = Convert.ToInt32(txtCode.Text); return provider; }
IDictionary<string, string> IExtensionResponse.Serialize(Provider.IRequest authenticationRequest) { var fields = new Dictionary<string, string> { { "mode", Mode }, }; if (UpdateUrlSupported) fields.Add("update_url", UpdateUrl.AbsoluteUri); SerializeAttributes(fields, attributesProvided); return fields; }
public bool AddEntry(string providerName,string fullPath, Predicate<string> checkIsLeaf) { // create provider if it doesn't exist: Provider provider; if (!Providers.TryGetValue(providerName,out provider)) { provider = new Provider(providerName); Providers[providerName] = provider; } return provider.UpdateEntry(fullPath, checkIsLeaf); }
private void Export(string colName) { ExportDirectory = Path.Combine(Path.GetDirectoryName(Provider.Filename), Path.GetFileNameWithoutExtension(Provider.Filename) + "_Export"); if (!Directory.Exists(ExportDirectory)) { Directory.CreateDirectory(ExportDirectory); } FeatureDataTable fdt = Provider.CreateNewTable(); IFeatureDataReader reader = Provider.GetReader(); while (reader.Read()) { string layerName = GenerateUniqueName(reader[colName].ToString()); using ( ShapeFileProvider export = ShapeFileProvider.Create(ExportDirectory, layerName, Provider.ShapeType, Provider.CreateNewTable(), Provider.GeometryFactory, _geometryServices.CoordinateSystemFactory)) { export.IsSpatiallyIndexed = false; export.Open(); FeatureDataRow <uint> fdr = (FeatureDataRow <uint>)fdt.NewRow(); object[] vals = new object[fdt.Columns.Count]; reader.GetValues(vals); fdr.ItemArray = vals; fdr.Geometry = reader.Geometry; export.Insert(fdr); export.Close(); } } }
public ActionResult UpdateHospital(IEnumerable <HospitalViewModel> models, IEnumerable <OptionsViewModel> options, int ProviderType) { var datasource = new DataSource <HospitalViewModel>(); var result = new List <Provider>(); datasource.Data = models; datasource.Total = models.Count(); bool updateOnly = true; if (ModelState.IsValid) { if (ServerValidationEnabled) { var errors = _hrUnitOfWork.CompanyRepository.Check(new CheckParm { CompanyId = CompanyId, ObjectName = "Providers", Columns = Models.Utils.GetModifiedRows(ModelState.Where(a => a.Key.Contains("models"))), Culture = Language }); if (errors.Count() > 0) { datasource.Errors = errors; return(Json(datasource)); } } var ids = models.Select(a => a.Id); var db_Provider = _hrUnitOfWork.Repository <Provider>().Where(a => ids.Contains(a.Id)).ToList(); var sequence = _hrUnitOfWork.Repository <Provider>().Select(a => a.Code).DefaultIfEmpty(0).Max(); var MaxCode = sequence == 0 ? 1 : sequence + 1; for (var i = 0; i < models.Count(); i++) { var ProviderRecord = db_Provider.FirstOrDefault(a => a.Id == models.ElementAtOrDefault(i).Id); if (ProviderRecord == null) { Provider Provider = new Provider(); AutoMapper(new AutoMapperParm() { ObjectName = "Providers", Destination = Provider, Source = models.ElementAtOrDefault(i), Version = 0, Options = options.ElementAtOrDefault(i), Transtype = TransType.Insert }); // Create updateOnly = false; Provider.CreatedUser = UserName; Provider.ProviderType = (short)ProviderType; Provider.CreatedTime = DateTime.Now; Provider.Code = MaxCode++; result.Add(Provider); _hrUnitOfWork.LookUpRepository.Add(Provider); } //Update else { AutoMapper(new AutoMapperParm() { ObjectName = "Providers", Destination = ProviderRecord, Source = models.ElementAtOrDefault(i), Version = 0, Options = options.ElementAtOrDefault(i), Transtype = TransType.Insert }); ProviderRecord.ModifiedUser = UserName; ProviderRecord.ModifiedTime = DateTime.Now; ProviderRecord.ProviderType = (short)ProviderType; _hrUnitOfWork.LookUpRepository.Attach(ProviderRecord); _hrUnitOfWork.LookUpRepository.Entry(ProviderRecord).State = EntityState.Modified; } } datasource.Errors = SaveChanges(Language); } else { datasource.Errors = Models.Utils.ParseErrors(ModelState.Values); } if (updateOnly) { datasource.Data = models; } else { datasource.Data = (from m in models join r in result on m.Name equals r.Name into g from r in g.DefaultIfEmpty() select new HospitalViewModel { Id = (r == null ? 0 : r.Id), Name = m.Name, Email = m.Email, Tel = m.Tel, Address = m.Address, Code = r.Code, Manager = m.Manager, AddressId = m.AddressId, CreatedTime = m.CreatedTime, ProviderType = m.ProviderType, CreatedUser = m.CreatedUser, ModifiedUser = m.ModifiedUser, ModifiedTime = m.ModifiedTime }).ToList(); } if (datasource.Errors.Count() > 0) { return(Json(datasource)); } else { return(Json(datasource.Data)); } }
public byte[] Control(SCardControlFunction function, byte[] send, int bufferSize, PcscExceptionHandler onException = null) { return(Control(Provider.SCardCtlCode(function), send, bufferSize, onException)); }
/// <summary> /// Saves the country item. /// </summary> /// <param name="countryItem">The country item.</param> /// <returns>CountryItem.</returns> public Country SaveCountryItem(Country countryItem) { return(Provider <Country> .Save(countryItem)); }
/// <summary> /// Gets the name of the country item by. /// </summary> /// <param name="name">The name.</param> /// <returns>CountryItem.</returns> /// <exception cref="System.NotImplementedException"></exception> public Country GetCountryItemByName(string name) { return(Provider <Country> .Where("DefaultName", name).FirstOrDefault()); }
public async Task <ActionResult> Edit(string id, FormCollection collection, HttpPostedFileBase headImageFile) { try { // TODO: Add update logic here var userManager = new UserManager <IdentityUser>(new UserStore <IdentityUser>(new IdentityDbContext(Platform.DAAS.OData.Security.ModuleConfiguration.DefaultIdentityStoreConnectionName))); var user = userManager.FindById(id); IdentityResult result = null; if (user != null) { //userManager.SetEmail(user.Id, collection["Email"]); user.Email = collection["Email"]; //user.Description = collection["Description"]; result = userManager.Update(user); } //if (result.Succeeded) //{ // var accountManager = Facade.Facade.GetAccountManager(); // var account = accountManager.GetAccount(id); // if (account == null) // { // account = new Core.DomainModel.Account() // { // ID = id, // Name = user.UserName, // FirstName = collection["FirstName"], // LastName = collection["LastName"], // NickName = collection["NickName"], // Organization = collection["Organization"], // Position = collection["Position"], // Gender = int.Parse(collection["Gender"]), // SID = collection["SID"], // Headline = collection["Headline"], // Email = collection["Email"], // Description = collection["Description"] // }; // if (headImageFile != null) // { // var ms = imageSize(headImageFile); // account.HeadImage = new Attachment() // { // Name = String.Format("HdImg-{0}-{1}-{2}", ControllerContext.HttpContext.User.Identity.Name, DateTime.Now.ToString("yyyy-MM-ddTHH-mm-ss"), headImageFile.FileName.Substring((headImageFile.FileName.LastIndexOf("\\") + 1))), //String.Format("HeadImg-{0}-{1}-{2}", ControllerContext.HttpContext.User.Identity.Name, ControllerContext.HttpContext.User.Identity.GetUserId(), Guid.NewGuid().ToString("N")), //Request.Files[0].FileName, // Bytes = new byte[ms.Length], // Size = ms.Length, // CreationTime = DateTime.Now // }; // using (headImageFile.InputStream) // { // account.HeadImage.Bytes = ms.ToArray(); // } // if (Facade.Global.Should("DoRemoteFileUpload")) // { // this.DoRemoteFileUpload(account.HeadImage); // } // else // { // accountManager.SetImage(account.HeadImage, account.HeadImage.Bytes); // } // } // accountManager.AddAccount(account); // } // else // { // account.Name = user.UserName; // account.FirstName = collection["FirstName"]; // account.LastName = collection["LastName"]; // account.NickName = collection["NickName"]; // account.Organization = collection["Organization"]; // account.Position = collection["Position"]; // account.Gender = int.Parse(collection["Gender"]); // account.SID = collection["SID"]; // account.Headline = collection["Headline"]; // account.Email = collection["Email"]; // account.Description = collection["Description"]; // if (headImageFile != null) // { // var ms = imageSize(headImageFile); // account.HeadImage = new Attachment() // { // Name = String.Format("HdImg-{0}-{1}-{2}", ControllerContext.HttpContext.User.Identity.Name, DateTime.Now.ToString("yyyy-MM-ddTHH-mm-ss"), headImageFile.FileName.Substring((headImageFile.FileName.LastIndexOf("\\") + 1))), //String.Format("HeadImg-{0}-{1}-{2}", ControllerContext.HttpContext.User.Identity.Name, ControllerContext.HttpContext.User.Identity.GetUserId(), Guid.NewGuid().ToString("N")), //Request.Files[0].FileName, // Bytes = new byte[ms.Length], // Size = ms.Length, // CreationTime = DateTime.Now // }; // using (headImageFile.InputStream) // { // account.HeadImage.Bytes = ms.ToArray(); // } // if (Facade.Global.Should("DoRemoteFileUpload")) // { // this.DoRemoteFileUpload(account.HeadImage); // } // else // { // accountManager.SetImage(account.HeadImage, account.HeadImage.Bytes); // } // } // accountManager.SetAccount(id, account); // } //return RedirectToAction("Index"); // return RedirectToAction("Details", new { id = id }); //} //return RedirectToAction("Index"); return(RedirectToAction("Details", new { id = id })); } catch (Exception ex) { Provider.ExceptionHandler().HandleException(ex); return(View()); } }
private async Task <bool> InvokeUserinfoEndpointAsync() { OpenIdConnectRequest request; if (string.Equals(Request.Method, "GET", StringComparison.OrdinalIgnoreCase)) { request = new OpenIdConnectRequest(Request.Query); } else if (string.Equals(Request.Method, "POST", StringComparison.OrdinalIgnoreCase)) { // Note: if no Content-Type header was specified, assume the userinfo request // doesn't contain any parameter and create an empty OpenIdConnectRequest. if (string.IsNullOrEmpty(Request.ContentType)) { request = new OpenIdConnectRequest(); } else { // May have media/type; charset=utf-8, allow partial match. if (!Request.ContentType.StartsWith("application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase)) { Logger.LogError("The userinfo request was rejected because an invalid 'Content-Type' " + "header was specified: {ContentType}.", Request.ContentType); return(await SendUserinfoResponseAsync(new OpenIdConnectResponse { Error = OpenIdConnectConstants.Errors.InvalidRequest, ErrorDescription = "The specified 'Content-Type' header is not valid." })); } request = new OpenIdConnectRequest(await Request.ReadFormAsync()); } } else { Logger.LogError("The userinfo request was rejected because an invalid " + "HTTP method was specified: {Method}.", Request.Method); return(await SendUserinfoResponseAsync(new OpenIdConnectResponse { Error = OpenIdConnectConstants.Errors.InvalidRequest, ErrorDescription = "The specified HTTP method is not valid." })); } // Note: set the message type before invoking the ExtractUserinfoRequest event. request.SetProperty(OpenIdConnectConstants.Properties.MessageType, OpenIdConnectConstants.MessageTypes.UserinfoRequest); // Insert the userinfo request in the ASP.NET context. Context.SetOpenIdConnectRequest(request); var @event = new ExtractUserinfoRequestContext(Context, Scheme, Options, request); await Provider.ExtractUserinfoRequest(@event); if (@event.Result != null) { if (@event.Result.Handled) { Logger.LogDebug("The userinfo request was handled in user code."); return(true); } else if (@event.Result.Skipped) { Logger.LogDebug("The default userinfo request handling was skipped from user code."); return(false); } } else if (@event.IsRejected) { Logger.LogError("The userinfo request was rejected with the following error: {Error} ; {Description}", /* Error: */ @event.Error ?? OpenIdConnectConstants.Errors.InvalidRequest, /* Description: */ @event.ErrorDescription); return(await SendUserinfoResponseAsync(new OpenIdConnectResponse { Error = @event.Error ?? OpenIdConnectConstants.Errors.InvalidRequest, ErrorDescription = @event.ErrorDescription, ErrorUri = @event.ErrorUri })); } Logger.LogInformation("The userinfo request was successfully extracted " + "from the HTTP request: {Request}.", request); string token = null; if (!string.IsNullOrEmpty(request.AccessToken)) { token = request.AccessToken; } else { string header = Request.Headers[HeaderNames.Authorization]; if (!string.IsNullOrEmpty(header)) { if (!header.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase)) { Logger.LogError("The userinfo request was rejected because the " + "'Authorization' header was invalid: {Header}.", header); return(await SendUserinfoResponseAsync(new OpenIdConnectResponse { Error = OpenIdConnectConstants.Errors.InvalidRequest, ErrorDescription = "The specified 'Authorization' header is invalid." })); } token = header.Substring("Bearer ".Length); } } if (string.IsNullOrEmpty(token)) { Logger.LogError("The userinfo request was rejected because the access token was missing."); return(await SendUserinfoResponseAsync(new OpenIdConnectResponse { Error = OpenIdConnectConstants.Errors.InvalidRequest, ErrorDescription = "The mandatory 'access_token' parameter is missing." })); } var context = new ValidateUserinfoRequestContext(Context, Scheme, Options, request); await Provider.ValidateUserinfoRequest(context); if (context.Result != null) { if (context.Result.Handled) { Logger.LogDebug("The userinfo request was handled in user code."); return(true); } else if (context.Result.Skipped) { Logger.LogDebug("The default userinfo request handling was skipped from user code."); return(false); } } else if (context.IsRejected) { Logger.LogError("The userinfo request was rejected with the following error: {Error} ; {Description}", /* Error: */ context.Error ?? OpenIdConnectConstants.Errors.InvalidRequest, /* Description: */ context.ErrorDescription); return(await SendUserinfoResponseAsync(new OpenIdConnectResponse { Error = context.Error ?? OpenIdConnectConstants.Errors.InvalidRequest, ErrorDescription = context.ErrorDescription, ErrorUri = context.ErrorUri })); } Logger.LogInformation("The userinfo request was successfully validated."); var ticket = await DeserializeAccessTokenAsync(token, request); if (ticket == null) { Logger.LogError("The userinfo request was rejected because the access token was invalid."); // Note: an invalid token should result in an unauthorized response // but returning a 401 status would invoke the previously registered // authentication middleware and potentially replace it by a 302 response. // To work around this limitation, a 400 error is returned instead. // See http://openid.net/specs/openid-connect-core-1_0.html#UserInfoError return(await SendUserinfoResponseAsync(new OpenIdConnectResponse { Error = OpenIdConnectConstants.Errors.InvalidGrant, ErrorDescription = "The specified access token is not valid." })); } if (ticket.Properties.ExpiresUtc.HasValue && ticket.Properties.ExpiresUtc < Options.SystemClock.UtcNow) { Logger.LogError("The userinfo request was rejected because the access token was expired."); // Note: an invalid token should result in an unauthorized response // but returning a 401 status would invoke the previously registered // authentication middleware and potentially replace it by a 302 response. // To work around this limitation, a 400 error is returned instead. // See http://openid.net/specs/openid-connect-core-1_0.html#UserInfoError return(await SendUserinfoResponseAsync(new OpenIdConnectResponse { Error = OpenIdConnectConstants.Errors.InvalidGrant, ErrorDescription = "The specified access token is no longer valid." })); } var notification = new HandleUserinfoRequestContext(Context, Scheme, Options, request, ticket) { Issuer = Context.GetIssuer(Options), Subject = ticket.Principal.GetClaim(OpenIdConnectConstants.Claims.Subject) }; // Note: when receiving an access token, its audiences list cannot be used for the "aud" claim // as the client application is not the intented audience but only an authorized presenter. // See http://openid.net/specs/openid-connect-core-1_0.html#UserInfoResponse notification.Audiences.UnionWith(ticket.GetPresenters()); // The following claims are all optional and should be excluded when // no corresponding value has been found in the authentication ticket. if (ticket.HasScope(OpenIdConnectConstants.Scopes.Profile)) { notification.FamilyName = ticket.Principal.GetClaim(OpenIdConnectConstants.Claims.FamilyName); notification.GivenName = ticket.Principal.GetClaim(OpenIdConnectConstants.Claims.GivenName); notification.BirthDate = ticket.Principal.GetClaim(OpenIdConnectConstants.Claims.Birthdate); } if (ticket.HasScope(OpenIdConnectConstants.Scopes.Email)) { notification.Email = ticket.Principal.GetClaim(OpenIdConnectConstants.Claims.Email); } if (ticket.HasScope(OpenIdConnectConstants.Scopes.Phone)) { notification.PhoneNumber = ticket.Principal.GetClaim(OpenIdConnectConstants.Claims.PhoneNumber); } await Provider.HandleUserinfoRequest(notification); if (notification.Result != null) { if (notification.Result.Handled) { Logger.LogDebug("The userinfo request was handled in user code."); return(true); } else if (notification.Result.Skipped) { Logger.LogDebug("The default userinfo request handling was skipped from user code."); return(false); } } else if (notification.IsRejected) { Logger.LogError("The userinfo request was rejected with the following error: {Error} ; {Description}", /* Error: */ notification.Error ?? OpenIdConnectConstants.Errors.InvalidRequest, /* Description: */ notification.ErrorDescription); return(await SendUserinfoResponseAsync(new OpenIdConnectResponse { Error = notification.Error ?? OpenIdConnectConstants.Errors.InvalidRequest, ErrorDescription = notification.ErrorDescription, ErrorUri = notification.ErrorUri })); } // Ensure the "sub" claim has been correctly populated. if (string.IsNullOrEmpty(notification.Subject)) { throw new InvalidOperationException("The subject claim cannot be null or empty."); } var response = new OpenIdConnectResponse { [OpenIdConnectConstants.Claims.Subject] = notification.Subject, [OpenIdConnectConstants.Claims.Address] = notification.Address, [OpenIdConnectConstants.Claims.Birthdate] = notification.BirthDate, [OpenIdConnectConstants.Claims.Email] = notification.Email, [OpenIdConnectConstants.Claims.EmailVerified] = notification.EmailVerified, [OpenIdConnectConstants.Claims.FamilyName] = notification.FamilyName, [OpenIdConnectConstants.Claims.GivenName] = notification.GivenName, [OpenIdConnectConstants.Claims.Issuer] = notification.Issuer, [OpenIdConnectConstants.Claims.PhoneNumber] = notification.PhoneNumber, [OpenIdConnectConstants.Claims.PhoneNumberVerified] = notification.PhoneNumberVerified, [OpenIdConnectConstants.Claims.PreferredUsername] = notification.PreferredUsername, [OpenIdConnectConstants.Claims.Profile] = notification.Profile, [OpenIdConnectConstants.Claims.Website] = notification.Website }; switch (notification.Audiences.Count) { case 0: break; case 1: response[OpenIdConnectConstants.Claims.Audience] = notification.Audiences.ElementAt(0); break; default: response[OpenIdConnectConstants.Claims.Audience] = new JArray(notification.Audiences); break; } foreach (var claim in notification.Claims) { response.SetParameter(claim.Key, claim.Value); } return(await SendUserinfoResponseAsync(response)); }
public void Dispose() { Provider.Dispose(); }
/// <summary> /// Sends HD44780 lcd interface command. /// </summary> /// <param name="data">The byte command to send.</param> public void SendCommand(byte data) { Provider.Send(data, false, _backlight); }
/// <summary> /// Sends one data byte to the display. /// </summary> /// <param name="data">The data byte to send.</param> public void WriteByte(byte data) { Provider.Send(data, true, _backlight); }
public void HandleIncomingTransport(ITransport transport) { Provider.HandleTransport(transport); }
public async Task <ActionResult <Provider> > UpdateProvider(Provider provider) { return(await this.repository.UpdatetProvider(provider.Mail, provider.Name, provider.Address, provider.Population, provider.Cp, provider.Tlf, provider.Pwd, provider.Description, provider.Img1, provider.Img2, provider.Img3)); }
///<summary>Uses a VB dll to launch.</summary> public static void SendData(Program ProgramCur, Patient pat) { if (pat == null) { MessageBox.Show("Please select a patient first."); return; } if (pat.Race == PatientRace.Unknown) { MessageBox.Show("Race must be entered first."); return; } //Make sure the program is running if (Process.GetProcessesByName("DrCeph").Length == 0) { try{ Process.Start(ProgramCur.Path); } catch { MsgBox.Show("DrCeph", "Program path not set properly."); return; } Thread.Sleep(TimeSpan.FromSeconds(4)); } ArrayList ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);; ProgramProperty PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");; string patID = ""; if (PPCur.PropertyValue == "0") { patID = pat.PatNum.ToString(); } else { patID = pat.ChartNumber; } try{ List <RefAttach> referalList = RefAttaches.Refresh(pat.PatNum); Provider prov = Providers.GetProv(Patients.GetProvNum(pat)); string provName = prov.FName + " " + prov.MI + " " + prov.LName + " " + prov.Suffix; Family fam = Patients.GetFamily(pat.PatNum); Patient guar = fam.ListPats[0]; string relat = ""; if (guar.PatNum == pat.PatNum) { relat = "Self"; } else if (guar.Gender == PatientGender.Male && pat.Position == PatientPosition.Child) { relat = "Father"; } else if (guar.Gender == PatientGender.Female && pat.Position == PatientPosition.Child) { relat = "Mother"; } else { relat = "Unknown"; } VBbridges.DrCephNew.Launch(patID, pat.FName, pat.MiddleI, pat.LName, pat.Address, pat.Address2, pat.City, pat.State, pat.Zip, pat.HmPhone, pat.SSN, pat.Gender.ToString(), pat.Race.ToString(), "", pat.Birthdate.ToString(), DateTime.Today.ToShortDateString(), RefAttachL.GetReferringDr(referalList), provName, guar.GetNameFL(), guar.Address, guar.Address2, guar.City, guar.State, guar.Zip, guar.HmPhone, relat); } catch { MessageBox.Show("DrCeph not responding. It might not be installed properly."); } }
public string registerProvider(Provider objProvider) { return(objProviderDAO.registerProvider(objProvider)); }
/// <summary> /// Gets the country items. /// </summary> /// <returns>CountryItem[][].</returns> /// <exception cref="System.NotImplementedException"></exception> public Country[] GetCountryItems() { return(Provider <Country> .GetAll()); }
public int Count() => Provider.Count(this);
public override void Connect() { // NOTE: RowHeaderItemsProperty Property NEVER changes. Provider.SetEvent(ProviderEventType.TableItemPatternColumnHeaderItemsProperty, new DataItemTableItemColumnHeaderItemsEvent(DataItemProvider)); }
protected Crawler(IDocumentFactory documentFactory, IKeyValueStore <string, Result> store, IKeyValueStore <string, FetchTarget> frontier) { _store = store; _frontier = frontier; var fetcherOptions = new FetcherOptions { UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36", }; var parserOptions = new ParserOptions { }; var scraperOptions = new ScraperOptions { }; var extractorOptions = new ExtractorOptions { }; //var storerOptions = new StorerOptions //{ //}; var builderOptions = new BuilderOptions { }; var providerOptions = new ProviderOptions { }; //var dispatcherOptions = new DispatcherOptions //{ //}; Fetcher = new Fetcher(fetcherOptions); Parser = new Parser(parserOptions, documentFactory); Scraper = new Scraper(scraperOptions); Extractor = new Extractor(extractorOptions); Storer = new Storer(store); Builder = new Builder(builderOptions); Provider = new Provider(providerOptions, store, frontier); Dispatcher = new Dispatcher(); Fetcher.SendTo(Parser, x => x.StatusCode == System.Net.HttpStatusCode.OK); Parser.SendTo(Scraper); Parser.SendTo(Extractor); Fetcher.SendTo(Builder, x => x.StatusCode == System.Net.HttpStatusCode.OK); Scraper.SendTo(Builder); Extractor.SendTo(Builder); Builder.SendTo(Storer); //Storer.LinkTo(new ActionBlock<Result>(x => //{ //})); Builder.SendTo(Provider); Provider.SendTo(Dispatcher, x => x != null); Dispatcher.SendTo(Fetcher); }
/// <summary> /// Gets the name of the country item by three letter iso region. /// </summary> /// <param name="threeLetterIsoRegionName">Name of the three letter iso region.</param> /// <returns>CountryItem.</returns> /// <exception cref="System.NotImplementedException"></exception> public Country GetCountryItemByThreeLetterIsoRegionName(string threeLetterIsoRegionName) { return(Provider <Country> .Where("ThreeLetterIsoRegionName", threeLetterIsoRegionName).FirstOrDefault()); }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return((Provider.Execute <System.Collections.IEnumerable>(Expression)).GetEnumerator()); }
/// <summary> /// Gets the country item. /// </summary> /// <param name="id">The identifier.</param> /// <returns>CountryItem.</returns> /// <exception cref="System.NotImplementedException"></exception> public Country GetCountryItem(string id) { return(Provider <Country> .GetById(id)); }
public IEnumerator <TData> GetEnumerator() { return((Provider.Execute <IEnumerable <TData> >(Expression)).GetEnumerator()); }
/// <summary> /// Deletes the country item. /// </summary> /// <param name="item">The item.</param> /// <returns>CountryItem.</returns> public Country DeleteCountryItem(Country item) { return(Provider <Country> .Delete(item)); }
public MediaId(Provider type, int idFromProvider) { IdFromProvider = idFromProvider; Type = type; }
/// <summary> /// Gets the country items for culture. /// </summary> /// <param name="cultureName">Name of the culture.</param> /// <returns>CountryItem[][].</returns> /// <exception cref="System.NotImplementedException"></exception> public Country[] GetCountryItemsForCulture(string cultureName) { return(Provider <Country> .Where("TwoLetterIsoRegionName", cultureName)); }
public void TestCanConstruct() { var p = new Provider("FileSystem"); Assert.AreEqual("FileSystem", p.Name); }
public byte[] Control(SCardControlFunction function, params byte[] send) { return(Control(Provider.SCardCtlCode(function), send, ControlBufferSize)); }
public string updateProvider(Provider objProvider) { return(objProviderDAO.updateProvider(objProvider)); }
public ActionResult UserRoles(string id, FormCollection roleItems) { try { if (roleItems != null) { Dictionary <string, object> roleItemValues = new Dictionary <string, object>(); List <string> userRoles = null; foreach (string key in roleItems.Keys) { if (key.ToLower() != "id") { roleItemValues.Add(key, roleItems.GetValues(key)); } } if (roleItemValues != null) { userRoles = new List <string>(); foreach (var key in roleItemValues.Keys) { if ((roleItemValues[key] != null) && (roleItemValues[key] as string[]).Length >= 1) { if ((roleItemValues[key] as string[])[0].ToLower() == "true") { userRoles.Add(key); } } } } var userManager = new UserManager <IdentityUser>(new UserStore <IdentityUser>(new IdentityDbContext(Platform.DAAS.OData.Security.ModuleConfiguration.DefaultIdentityStoreConnectionName))); IList <string> currentUserRoles = userManager.GetRoles(id); var securityManager = Provider.SecurityManager(); List <object> setRoleResults = new List <object>(); if ((currentUserRoles != null) && (currentUserRoles.Count > 0)) { IdentityResult identityResult = userManager.RemoveFromRoles(id, currentUserRoles.ToArray()); setRoleResults.Add(identityResult); } if (userRoles != null) { IdentityRole identityRole = null; var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(new IdentityDbContext(Platform.DAAS.OData.Security.ModuleConfiguration.DefaultIdentityStoreConnectionName))); foreach (var role in userRoles) { identityRole = roleManager.FindById(role); if (identityRole != null) { setRoleResults.Add(securityManager.AddActorToRole(id, identityRole.Name)); //Add the user to each of the roles selected. } } } } return(RedirectToAction("Details", new { id = id }));//return RedirectToAction("Index"); } catch (Exception ex) { Provider.ExceptionHandler().HandleException(ex); return(View()); } }
public IEntity FirstOrDefault() { TakeTop = 1; return((Provider.GetList(this)).FirstOrDefault()); }