/// <summary> /// Start the server /// </summary> public void StartServer() { Clients = new ClientCollection(); // Server basic configuration var config = new NetPeerConfiguration(GameConfiguration.NetworkAppIdentifier) { MaximumConnections = ServerSettings.MaxConnection, Port = ServerSettings.Port, #if DEBUG //PingInterval = 1f, // send ping every 1 second //SimulatedLoss = 0.5f, // half packets lost //SimulatedMinimumLatency = 0.05f, // latency of 50 ms #endif }; // To send ping to each player frequently config.SetMessageTypeEnabled(NetIncomingMessageType.ConnectionLatencyUpdated, true); try { _server = new NetServer(config); _server.Start(); _hostStarted = true; GameManager.Initialize(); Program.Log.Info("[START]Game server has started"); Program.Log.Info("[PORT]: " + config.Port); } catch (NetException ex) { Program.Log.Fatal(ex.Message); throw; } }
public static void CopyClients(this IServiceCollection services, ClientCollection source, ref ClientCollection destination) { foreach (IdentityServer4.Models.Client client in source) { destination.Add(client); } }
/// <summary> /// 获得数据列表 /// </summary> /// <returns></returns> public static List <ClientInfo> GetList() { string cacheKey = GetCacheKey(); //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取 if (CachedEntityCommander.IsTypeRegistered(typeof(ClientInfo)) && CachedEntityCommander.GetCache(cacheKey) != null) { return(CachedEntityCommander.GetCache(cacheKey) as List <ClientInfo>); } else { List <ClientInfo> list = new List <ClientInfo>(); ClientCollection collection = new ClientCollection(); Query qry = new Query(Client.Schema); collection.LoadAndCloseReader(qry.ExecuteReader()); foreach (Client client in collection) { ClientInfo clientInfo = new ClientInfo(); LoadFromDAL(clientInfo, client); list.Add(clientInfo); } //生成缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(ClientInfo))) { CachedEntityCommander.SetCache(cacheKey, list); } return(list); } }
private void GetInformation() { ClientCollection clients = Repository.ReadClient(); labelTotalYtdSales.Text = "Total YTD Sales: $" + clients.TotalYTDSales(); labelCreditHoldCount.Text = "Credit Hold Count: " + clients.CreditHoldCount(); labelRecordCount.Text = "Record Count: " + clients.Count(); }
DataSet IReadParser.UnparseContent(string content) { ClientCollection clients = new ClientCollection(); MatterCollection matters = new MatterCollection(); DocumentCollection documents = new DocumentCollection(); bool isHeaderLine = true; foreach (string line in content.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) { if (isHeaderLine) { isHeaderLine = false; continue; } CsvData data = new CsvData(line); AddClient(clients, data); AddMatter(matters, data); AddDocument(documents, data); } return(new DataSet() { Clients = clients, Matters = matters, Documents = documents }); }
public virtual async Task <TClient> RegisterClientAsync(string ownerUserName, string name, OAuthGrantType grantType) { Contract.Requires(!string.IsNullOrEmpty(name)); TClient client = new TClient(); client.GrantType = grantType; using (RijndaelManaged cryptoManager = new RijndaelManaged()) { cryptoManager.GenerateKey(); client.Id = BitConverter.ToString(cryptoManager.Key).Replace("-", string.Empty).ToLowerInvariant(); cryptoManager.GenerateKey(); client.Secret = BitConverter.ToString(cryptoManager.Key).Replace("-", string.Empty).ToLowerInvariant(); } client.OwnerUserName = ownerUserName; client.Name = name; client.SecretHash = new PasswordHasher().HashPassword(client.Secret); client.DateAdded = DateTimeOffset.Now; await ClientCollection.InsertOneAsync(client); return(client); }
/// <summary> /// Method to generate YTDSales and CreditHoldCount Totals /// </summary> private void Totals() { ClientCollection totals = ClientValidation.GetClients(); textBoxTotalYTDSales.Text = totals.TotalYTDSales.ToString(); textBoxCreditHoldCount.Text = totals.CreditHoldCount.ToString(); }
private void SearchClient() { DAL dal = new DAL(); ClientCollection.Clear(); DataTable dt = dal.Read("Select * from bit_client , bit_user_logon where bit_user_logon.account_Type='CLIENT' AND bit_user_logon.account_Ref= bit_client.client_Id and (STATUS='ACTIVE' OR STATUS IS NULL) and " + SelectedClientCols + " like '%" + ClientSearchString + "%'"); int i = 0; int index = 0; Client clientFirstRecord = new Client(); foreach (DataRow dr in dt.Rows) { index = i; if (index == 0) { clientFirstRecord = new Client(dr); } Client client = new Client(dr); ClientCollection.Add(client); i++; } SelectedClient = clientFirstRecord; // MessageBox.Show(SelectedClientCols + ClientSearchString); }
public static void Onload() { // Add On Process Stage change Page.Data.Process.AddOnStageChange(delegate(ExecutionContext context){ Script.Literal("debugger"); }); // Add On Process Stage change Page.Data.Process.AddOnStageSelected(delegate(ExecutionContext context) { Script.Literal("debugger"); }); Script.Literal("debugger"); // Get Current Process Process process = Page.Data.Process.GetActiveProcess(); Stage stage = Page.Data.Process.GetActiveStage(); // Get Stages ClientCollection <Stage> stages = process.GetStages(); if (stages.GetLength() > 0) { // Get Steps Stage stage0 = stages.Get(0); ClientCollection <Step> steps = stage0.GetSteps(); } // Show/Hide Process Page.Ui.Process.SetVisible(true); }
public async Task <bool> ModifyClientAsync(int id, Client newClientData) { try { ClientCollection clientCollection = await LoadClientsAsync(); Client selectedClient = clientCollection.clients.Where(x => x.Id == id).First(); // Wat je wilt veranderen selectedClient.Name = newClientData.Name; bool saved = await JsonHandler.SaveObject("clientData.json", clientCollection); if (saved) { return(true); } else { return(false); } } catch { return(false); } }
/// <summary> /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据 /// </summary> /// <param name="pPageIndex">页数</param> /// <param name="pPageSize">每页列表</param> /// <param name="pOrderBy">排序</param> /// <param name="pSortExpression">排序字段</param> /// <param name="pRecordCount">列表行数</param> /// <returns>数据分页</returns> public static List <ClientInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount) { if (pPageIndex <= 1) { pPageIndex = 1; } List <ClientInfo> list = new List <ClientInfo>(); Query q = Client.CreateQuery(); q.PageIndex = pPageIndex; q.PageSize = pPageSize; q.ORDER_BY(pSortExpression, pOrderBy.ToString()); ClientCollection collection = new ClientCollection(); collection.LoadAndCloseReader(q.ExecuteReader()); foreach (Client client in collection) { ClientInfo clientInfo = new ClientInfo(); LoadFromDAL(clientInfo, client); list.Add(clientInfo); } pRecordCount = q.GetRecordCount(); return(list); }
public IActionResult Client() { ClientGateway clientGateway = new ClientGateway(); ClientCollection clients = clientGateway.GetClients(); return(View("Client", clients)); }
public ClientCollection FetchAll() { ClientCollection coll = new ClientCollection(); Query qry = new Query(Client.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
/// <summary> /// Method to generate ClientCount, CreditHoldCount YTDSales Totals /// </summary> private void totals() { ClientCollection totals = ClientValidation.GetClients(); labelDisplayClientCount.Text = totals.ClientCount.ToString(); labelDisplayCreditHoldCount.Text = totals.CreditHoldCount.ToString(); labelDisplayYTDSalesTotal.Text = totals.TotalYTDSales.ToString(); }
private static void ConfigureClients(ClientCollection clients, IConfiguration configuration) { foreach (var client in clients) { client.AllowOfflineAccess = true; client.AccessTokenLifetime = (int)TimeSpan.FromHours(8).TotalSeconds; } }
private static void AddClient(ClientCollection clients, CsvData data) { ClientObject client = new ClientObject(data.ClientId) { Email = data.Email, PreferredName = data.PreferredName }; clients.Add(client); }
public HostStateHandler( ClientCollection clientCollection, ILogger logger, IServiceProvider services) { _clientCollection = clientCollection; _logger = logger.ForContext <HostStateHandler>(); _services = services; }
/// <summary> /// 批量装载 /// </summary> internal static void LoadFromDALPatch(List <ClientInfo> pList, ClientCollection pCollection) { foreach (Client client in pCollection) { ClientInfo clientInfo = new ClientInfo(); LoadFromDAL(clientInfo, client); pList.Add(clientInfo); } }
public IActionResult Index() { ViewData["CompanyName"] = "Document Doctors Ltd."; ClientGateway clientGateway = new ClientGateway(); ClientCollection clients = clientGateway.GetClients(); return(View("Index", clients)); }
void BindClients() { ClientCollection clientCollection = new ClientCollection(); //coll.Where(DocCat.Columns.Active, 1); clientCollection.Load(); grdClients.DataSource = clientCollection; grdClients.DataBind(); //pnlMain.UpdateAfterCallBack = true; }
public void Remove(LynexWebSocketHandler webSocketHandler) { if (webSocketHandler is PiWebSocketHandler) { PiCollection.Remove(webSocketHandler); } else if (webSocketHandler is ClientWebSocketHandler) { ClientCollection.Remove(webSocketHandler); } }
/// <summary> /// Getting results from the background running thread; /// Hadling selected row possioning (vScrolling) after data reload (preserving vertical possition and currect cell possition) /// </summary> /// <param name="sender"></param> /// <param name="e">results of the background runnig thread</param> private void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { resource = (ClientCollection)e.Result; clientVM = new ClientViewModel(ClientValidation.GetClients()); setupBindings(); refreshStatsPanel(); toolStripStatusLabelInfo.Text = "Loaded"; dataGridViewClients.ClearSelection(); dataGridViewClients.CurrentRow.Selected = false; dataGridViewClients.Rows[currentIndex].Selected = true; dataGridViewClients.CurrentCell = dataGridViewClients[0, currentIndex]; }
private void MainForm_Load(object sender, EventArgs e) { //bool configured = false; // configured = true; // uncomment to configure DataGridView clientList = DataAccessObject.SelectAll(); //Fetch records from DB clientVM = new ClientViewModel(clientList); //Connect VM with fetched DB clientDialog = new Dialog(this); //Create Edit Record Dialog createDialog = new CreateForm(); //Create Add Record Dialog dataGridViewClients.AutoGenerateColumns = false; //DO NOT autogenerate columns dataGridViewClients.DataSource = clientVM.Clients; //Datasource from VM setupDataGridView(); }
public static IServiceCollection ConfigureIdentityServer(this IServiceCollection services) { ClientCollection clientColl = services.GetClientCollection(); services.AddIdentityServer() .AddApiAuthorization <ApplicationUser, ApplicationDbContext>(options => { services.CopyClients(options.Clients, ref clientColl); }) .AddInMemoryClients(clientColl); return(services); }
public async Task <int> ProvideNewClientId() { try { ClientCollection clientCollection = await LoadClientsAsync(); return(clientCollection.clients.Last().Id + 1); } catch { return(-1); } }
public static ClientCollection GetClientCollection(this IServiceCollection services) { IConfigurationSection section = SharedConfiguration.GetSection("OidcClients"); IEnumerable <IConfigurationSection> clients = section.GetChildren(); ClientCollection clientColl = new ClientCollection(); bool isSpa = false; foreach (IConfigurationSection clientSection in clients) { isSpa = clientSection.GetValue <bool>("Spa"); if (isSpa) { clientColl.AddSPA(clientSection.Key, spa => spa.WithLogoutRedirectUri(clientSection.GetValue <string>("LogoutUris"))); var scopes = clientSection.GetValue <string>("Scopes"); if (scopes != null && scopes.Length > 0) { clientColl[clientSection.Key].AllowedScopes = SharedConfiguration.GetStringCollection(clientSection, "Scopes"); } var origins = clientSection.GetValue <string>("CorsOrigins"); if (origins != null && origins.Length > 0) { clientColl[clientSection.Key].AllowedCorsOrigins = SharedConfiguration.GetStringCollection(clientSection, "CorsOrigins"); } clientColl[clientSection.Key].RedirectUris = SharedConfiguration.GetStringCollection(clientSection, "RedirectUris"); } else { clientColl.Add(new IdentityServer4.Models.Client { ClientId = clientSection.Key, AllowedGrantTypes = SharedConfiguration.GetStringCollection(clientSection, "GrantTypes"), AllowedScopes = SharedConfiguration.GetStringCollection(clientSection, "Scopes"), ClientSecrets = GetSecretCollection(clientSection), RequireConsent = clientSection.GetValue <bool>("Consent"), RequirePkce = clientSection.GetValue <bool>("Pkce"), RedirectUris = SharedConfiguration.GetStringCollection(clientSection, "RedirectUris"), PostLogoutRedirectUris = SharedConfiguration.GetStringCollection(clientSection, "LogoutUris"), AllowedCorsOrigins = SharedConfiguration.GetStringCollection(clientSection, "CorsOrigins"), }); } } return(clientColl); }
public PreviewObject() { Confidence = "0.00 %"; Lines = new List <TextLine>(); //path Lang = "Not Specificed"; ListOfKeyPossitions = new List <PossitionOfWord>(); ListOfKeyColumn = new List <Column>(); Evidence = new Evidence(); Clients = new ClientCollection() { Capacity = 5 }; }
public ActionResult Save(Bam.Net.CoreServices.ApplicationRegistration.Data.Dao.Client[] values) { try { ClientCollection saver = new ClientCollection(); saver.AddRange(values); saver.Save(); return(Json(new { Success = true, Message = "", Dao = "" })); } catch (Exception ex) { return(GetErrorResult(ex)); } }
private static ClientObject GetOrAddClient(ClientCollection clients, CsvData data) { ClientObject client = clients.Where(c => c.ClientID == data.ClientId).FirstOrDefault(); if (client == null) { client = new ClientObject(data.ClientId) { Email = data.Email, PreferredName = data.PreferredName }; clients.Add(client); } return(client); }
public ClientCollection GetClients() { ClientCollection clients = new ClientCollection(); clients.Add(new Client() { ClientId = 1, Name = "Glenn Ltd" }); clients.Add(new Client() { ClientId = 2, Name = "Dan PLC" }); return(clients); }
}//end validate method /// <summary> /// Verifies if a string is already present in database as a ClientCode /// </summary> /// <param name="clientCodeToCheck">the client code to check</param> /// <returns>wether the client code already exists in the database</returns> public static bool existingClientCode(string clientCodeToCheck) { bool existing = false; ClientCollection allClients = ClientRepository.GetAllClients(); var match = allClients.Where(x => x.ClientCode.Contains(clientCodeToCheck)); if (match.Any()) { existing = true; } return(existing); }
public Host(IServiceProvider serviceProvider, MessageCenter messageCenter, ClientCollection clientCollection, IEnumerable <IMiddleware> middleware, HostOptions hostOptions, ILogger logger) { ServiceProvider = serviceProvider; _messageCenter = messageCenter; _clientCollection = clientCollection; _middleware = middleware; _messageCenter.OnMessage += OnMessage; _messageCenter.OnClosed += OnClosed; LocalEndPoint = hostOptions.LocalEndPoint; _logger = logger.ForContext <Host>(); }
public static ClientCollection GetClients() { ClientCollection clients; using (SqlConnection sqlConn = new SqlConnection(Helper.GetConnectionString())) { var query = @"Select ClientCode, CompanyName, Address1, City, Province, PostalCode, YTDSales, CreditHold, Notes from dbo.Client013054" ; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Connection = sqlConn; sqlConn.Open(); clients = new ClientCollection(); using (SqlDataReader dr = cmd.ExecuteReader()) { string ClientCode, CompanyName, Address1, City, Province, PostalCode, Notes = String.Empty; decimal YTDSale; bool CreditHold = false; while (dr.Read()) { ClientCode = dr["ClientCode"] as string; CompanyName = dr["CompanyName"] as string; Address1 = dr["Address1"] as string; City = dr["City"] as string; Province = dr["Province"] as string; PostalCode = dr["PostalCode"] as string; YTDSale = (decimal)dr["YTDSales"]; CreditHold = (bool)dr["CreditHold"]; Notes = dr["Notes"] as string; clients.Add(new Client(ClientCode, CompanyName, Address1, City, Province, PostalCode, YTDSale, CreditHold, Notes)); } } } } return(clients); }
/// <summary> /// 获得数据列表 /// </summary> /// <returns></returns> public static List<ClientInfo> GetList() { string cacheKey = GetCacheKey(); //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取 if (CachedEntityCommander.IsTypeRegistered(typeof(ClientInfo)) && CachedEntityCommander.GetCache(cacheKey) != null) { return CachedEntityCommander.GetCache(cacheKey) as List< ClientInfo>; } else { List< ClientInfo> list =new List< ClientInfo>(); ClientCollection collection=new ClientCollection(); Query qry = new Query(Client.Schema); collection.LoadAndCloseReader(qry.ExecuteReader()); foreach(Client client in collection) { ClientInfo clientInfo= new ClientInfo(); LoadFromDAL(clientInfo,client); list.Add(clientInfo); } //生成缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(ClientInfo))) { CachedEntityCommander.SetCache(cacheKey, list); } return list; } }
/// <summary> /// 批量装载 /// </summary> internal static void LoadFromDALPatch(List< ClientInfo> pList, ClientCollection pCollection) { foreach (Client client in pCollection) { ClientInfo clientInfo = new ClientInfo(); LoadFromDAL(clientInfo, client ); pList.Add(clientInfo); } }
public static ClientCollection GetClientsForPaymentInfoByPaymentInfoGuid(Guid paymentInfoGuid) { SP.ClientSvc.Client[] clients = _clientClient.GetClientsForPaymentInfoByPaymentInfoGuid(paymentInfoGuid); ClientCollection result = new ClientCollection(); foreach (SP.ClientSvc.Client client in clients) { ClientViewModel viewModel = new ClientViewModel(client.ClientGuid, client.ClientID, client.ClientName, client.PhoneNumber, client.Email, client.Address, client.CityStateZipGuid, client.PaymentInfoGuid, client.FederatedID, client.FederatedKey, client.FederatedIDProvider, client.Username, client.HashedPassword); result.Add(viewModel); } return result; }
public static ClientCollection GetClients() { // Call the service for data. SP.ClientSvc.Client[] clients = _clientClient.GetAllClient(); // Convert the service proxy object to a View Model object. ClientCollection result = new ClientCollection(clients.ToViewModels()); return result; }
public ClientCollection FetchByID(object ClientId) { ClientCollection coll = new ClientCollection().Where("clientId", ClientId).Load(); return coll; }
public ClientCollection FetchByQuery(Query qry) { ClientCollection coll = new ClientCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return coll; }
private GameServer() { Clients = new ClientCollection(); Maps = new Dictionary<string, string>(); SelectedMapMd5 = ""; }
/// <summary> /// set the client collection /// </summary> /// <param name="clientCollection">client collection</param> public void SetClientCollection(ClientCollection clientCollection) { this.clients = clientCollection; }
/// <summary> /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据 /// </summary> /// <param name="pPageIndex">页数</param> /// <param name="pPageSize">每页列表</param> /// <param name="pOrderBy">排序</param> /// <param name="pSortExpression">排序字段</param> /// <param name="pRecordCount">列表行数</param> /// <returns>数据分页</returns> public static List<ClientInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount) { if(pPageIndex<=1) pPageIndex=1; List< ClientInfo> list = new List< ClientInfo>(); Query q = Client .CreateQuery(); q.PageIndex = pPageIndex; q.PageSize = pPageSize; q.ORDER_BY(pSortExpression,pOrderBy.ToString()); ClientCollection collection=new ClientCollection(); collection.LoadAndCloseReader(q.ExecuteReader()); foreach (Client client in collection) { ClientInfo clientInfo = new ClientInfo(); LoadFromDAL(clientInfo, client); list.Add(clientInfo); } pRecordCount=q.GetRecordCount(); return list; }