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); }
public static void CopyClients(this IServiceCollection services, ClientCollection source, ref ClientCollection destination) { foreach (IdentityServer4.Models.Client client in source) { destination.Add(client); } }
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); }
private async Task ProcessClientConnect(Uri uri, HeloMessage helo) { Client client; // TODO : Move into IHostProtocol // Check if we're registering another protocol if (helo.ClientId.HasValue) { if (!_clientCollection.TryGet(helo.ClientId.Value, out client)) { // Something weird is going on // Ignore the message return; } // Register the protocol client.Uris.Add(uri.ProtocolType(), uri); // Update the client _clientCollection.Add(client); } else if (_clientCollection.TryGet(uri, out client)) { if (client.ClientId.Equals(helo.ClientId)) { // Ignore } else { // TODO: Renegotiate security } return; } else { // No matching client client = new Client(uri, helo); _clientCollection.Add(client); } // Acknowledge the request var ack = new HeloAckMessage(client); await _messageCenter.SendMessage(uri, ack); }
private static void AddClient(ClientCollection clients, CsvData data) { ClientObject client = new ClientObject(data.ClientId) { Email = data.Email, PreferredName = data.PreferredName }; clients.Add(client); }
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); }
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 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); }
private void AddClient() { // SelectedClient.Insert(); Client client = new Client(); ClientCollection.Add(client); SelectedClient = client; IsEnabledAddress = false; IsEnabledNewjob = false; IsEnabledAdd = false; IsEnabledSave = true; IsEnabledDelete = false; MessageBox.Show("Click Save button after entering the new Client details.", "Client", MessageBoxButton.OK, MessageBoxImage.Warning); }
public void Add(LynexWebSocketHandler webSocketHandler) { if (webSocketHandler is PiWebSocketHandler) { if (PiCollection.Any()) { var tempCollection = PiCollection.ToList(); foreach (var socketHandler in tempCollection) { socketHandler.Close(); } PiCollection.Clear(); } PiCollection.Add(webSocketHandler); } else if (webSocketHandler is ClientWebSocketHandler) { ClientCollection.Add(webSocketHandler); } }
void Listener_OnAccept(object sender) { Client C = new Client((TcpClient)sender); C.OnRecv += new Client.PacketReceivedEventHandler(C_OnRecv); Clients.Add(C); string n = "Unregistered"; int x = 0; string Name = n; while (Clients.HasName(Name)) { x++; Name = n + x; } C.Name = Name; TryChat("[Server] Accepted client " + C.Name + "(" + C.IP + ")"); C.Send(new Packet("msg", new string[] { Vars.GetS("Servername"), "You have connected successfully.\n" + Vars.GetS("motd") })); }
public ClientManagementViewModel() { //1. Its going to connect to DAL and bring in the results of all Instructors //2. we Create objects of type instructor and then add that object to our collection DAL dal = new DAL(); 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)"); foreach (DataRow dr in dt.Rows) { Client client = new Client(dr); ClientCollection.Add(client); } LoadFieldNameCombo(); IsEnabledAddress = true; IsEnabledNewjob = true; IsEnabledAdd = true; IsEnabledSave = true; IsEnabledDelete = true; }
/// <summary> /// Select clients from SQL repository /// </summary> /// <returns>Returns ClientCollection</returns> public static ClientCollection GetClients() { ClientCollection clients; using (SqlConnection conn = new SqlConnection(connString)) { string query = $@"SELECT ClientCode, CompanyName, Address1, Address2, City, Province, PostalCode, YTDSales, CreditHold, Notes FROM {clientTableName}"; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Connection = conn; conn.Open(); clients = new ClientCollection(); using (SqlDataReader reader = cmd.ExecuteReader()) { string clientCode, companyName, address1, address2 = null, city = null, province, postalCode = null, notes = null; decimal ytdSales; bool isCreditHold = false; while (reader.Read()) { clientCode = reader["ClientCode"] as string; companyName = reader["CompanyName"] as string; address1 = reader["Address1"] as string; if (!reader.IsDBNull(3)) { address2 = reader["Address2"] as string; } if (!reader.IsDBNull(4)) { city = reader["City"] as string; } province = reader["Province"] as string; if (!reader.IsDBNull(6)) { postalCode = reader["PostalCode"] as string; } ytdSales = (decimal)reader["YTDSales"]; isCreditHold = (bool)reader["CreditHold"]; if (!reader.IsDBNull(9)) { notes = reader["Notes"] as string; } clients.Add( new Client { ClientCode = clientCode, CompanyName = companyName, Address1 = address1, Address2 = address2, City = city, Province = province, PostalCode = postalCode, YTDSales = ytdSales, IsCreditHold = isCreditHold, Notes = notes } ); address2 = null; city = null; postalCode = null; notes = null; } } return(clients); } } }
/// <summary> /// Method for retrieving clients list from Database /// </summary> /// <returns>the clients</returns> public static ClientCollection GetClients() { ClientCollection clients; using (SqlConnection conn = new SqlConnection(connString)) { string query = @"SELECT ClientCode, CompanyName, Address1, Address2, City, Province, PostalCode, YTDSales, CreditHold, Notes FROM Client973569 ORDER BY CompanyName"; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Connection = conn; conn.Open(); clients = new ClientCollection(); using (SqlDataReader reader = cmd.ExecuteReader()) { string clientCode; string companyName; string address1; string address2 = null; string city = null; string province; string postalCode = null; decimal ytdSales; bool creditHold; string notes = null; while (reader.Read()) { clientCode = reader["ClientCode"] as string; companyName = reader["CompanyName"] as string; address1 = reader["Address1"] as string; if (!reader.IsDBNull(3)) { address2 = reader["Address2"] as string; } if (!reader.IsDBNull(4)) { city = reader["City"] as string; } province = reader["Province"] as string; if (!reader.IsDBNull(6)) { postalCode = reader["PostalCode"] as string; } ytdSales = (decimal)reader["YTDSales"]; creditHold = reader["CreditHold"] as bool? ?? false; if (!reader.IsDBNull(9)) { notes = reader["Notes"] as string; } clients.Add(new Client(clientCode, companyName, address1, address2, city, province, postalCode, ytdSales, creditHold, notes)); address2 = null; city = null; postalCode = null; notes = null; } } } return(clients); } }
public static ClientCollection ReadClient() { using (SqlConnection connection = new SqlConnection(connectionString)) { string query = @"SELECT * FROM Client967008"; using (SqlCommand command = new SqlCommand()) { command.CommandType = CommandType.Text; command.CommandText = query; command.Connection = connection; connection.Open(); ClientCollection clientInfo = new ClientCollection(); using (SqlDataReader reader = command.ExecuteReader()) { string clientCode = null; string companyName = null; string address1 = null; string address2 = null; string city = null; string province = null; string postalCode = null; decimal ytdSales = 0.0m; bool creditHold = false; string notes = null; while (reader.Read()) { clientCode = reader["ClientCode"] as string; companyName = reader["CompanyName"] as string; address1 = reader["Address1"] as string; if (!reader.IsDBNull(3)) { address2 = reader["Address2"] as string; } if (!reader.IsDBNull(4)) { city = reader["city"] as string; } province = reader["Province"] as string; if (!reader.IsDBNull(6)) { postalCode = reader["PostalCode"] as string; } ytdSales = (decimal)reader["YTDSales"]; creditHold = (bool)reader["CreditHold"]; if (!reader.IsDBNull(9)) { notes = reader["Notes"] as string; } clientInfo.Add(new Customer(clientCode, companyName, address1, address2, city, province, postalCode, ytdSales, creditHold, notes)); clientCode = null; companyName = null; address1 = null; address2 = null; city = null; province = null; postalCode = null; ytdSales = 0.0m; creditHold = false; notes = null; } } return(clientInfo); } } }
/// <summary> /// Getting a collection of all the clients form the database /// </summary> /// <returns>All the clients in the database</returns> static public ClientCollection GetAllClients() { ClientCollection clients; //creating the connection using (SqlConnection conn = new SqlConnection(connString)) { //SQL query string query = string.Format("{0} {1} {2}" , "SELECT *" , "FROM Client" , "ORDER BY ClientCode"); using (SqlCommand cmd = new SqlCommand()) { //preparing the command cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Connection = conn; //opening SQL connection conn.Open(); clients = new ClientCollection(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { string clientCode = (string)reader["ClientCode"]; string companyName = (string)reader["CompanyName"]; string address1 = (string)reader["Address1"]; string address2 = null; if (!reader.IsDBNull(3)) { address2 = (string)reader["Address2"]; } string city = null; if (!reader.IsDBNull(4)) { city = (string)reader["City"]; } string province = (string)reader["Province"]; string postalCode = null; if (!reader.IsDBNull(6)) { postalCode = (string)reader["PostalCode"]; } decimal yTDSales = (decimal)reader["YTDSales"]; bool creditHold = ((byte)reader["CreditHold"] != 0); string notes = null; if (!reader.IsDBNull(9)) { notes = (string)reader["Notes"]; } clients.Add(new Client { ClientCode = clientCode , CompanyName = companyName , Address1 = address1 , Address2 = address2 , City = city , Province = province , PostalCode = postalCode , YTDSales = yTDSales , CreditHold = creditHold , Notes = notes }); } } return(clients); } } }
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 GetAllClients() { ClientCollection clients; using (SqlConnection conn = new SqlConnection(connString)) { string query; query = @"SELECT ClientCode, CompanyName, Address1, Address2, City, Province, PostalCode, YTDSales, CreditHold, Notes FROM Client913705 ORDER BY CompanyName"; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Connection = conn; conn.Open(); clients = new ClientCollection(); using (SqlDataReader reader = cmd.ExecuteReader()) { string clientCode; // not null 0 string companyName; // not null 1 string address1; // not null 2 string address2 = null; //null 3 string city = null; //null 4 string province; // not null 5 string postalCode = null; //null 6 decimal ytdSales; //not null 7 bool creditHold; //not null string notes = null; //null 9 while (reader.Read()) { clientCode = reader["ClientCode"] as string; // 0 companyName = reader["CompanyName"] as string; // 1 address1 = reader["Address1"] as string; // 2 if (!reader.IsDBNull(3)) { address2 = reader["Address2"] as string; } if (!reader.IsDBNull(4)) { city = reader["City"] as string; } province = reader["Province"] as string; //5 if (!reader.IsDBNull(6)) { postalCode = reader["PostalCode"] as string; } ytdSales = (decimal)reader["YTDSales"]; //7 creditHold = (bool)reader["CreditHold"]; //8 if (!reader.IsDBNull(9)) { notes = reader["Notes"] as string; } clients.Add(new Client(clientCode, companyName, address1, address2, city, province, postalCode, ytdSales, creditHold, notes)); //clientCode = null; //companyName = null; //address1 = null; //province = null; //ytdSales = 0; //creditHold = false; } } return(clients); } } }
public static ClientCollection GetClients() { ClientCollection clients; using (SqlConnection conn = new SqlConnection(connString)) { string query = $@"SELECT ClientCode, CompanyName, Address1, Address2, City, Province, PostalCode, YTDSales, CreditHold, Notes FROM {clientTableName}"; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Connection = conn; conn.Open(); clients = new ClientCollection(); using (SqlDataReader reader = cmd.ExecuteReader()) { string clientCode; // 0 string companyName; // 1 string addressOne; // 2 string addressTwo = null; // 3 string city = null; // 4 string province; // 5 string postalCode = null; // 6 decimal YTDSales; // 7 bool creditHold; // 8 string notes = null; // 9 while (reader.Read()) { clientCode = reader["ClientCode"] as string; companyName = reader["CompanyName"] as string; addressOne = reader["Address1"] as string; if (!reader.IsDBNull(3)) { addressTwo = reader["Address2"] as string; } if (!reader.IsDBNull(4)) { city = reader["City"] as string; } province = reader["Province"] as string; if (!reader.IsDBNull(6)) { postalCode = reader["PostalCode"] as string; } YTDSales = (decimal)reader["YTDSales"]; creditHold = (bool)reader["CreditHold"]; if (!reader.IsDBNull(9)) { notes = reader["Notes"] as string; } clients.Add(new Client { ClientCode = clientCode, CompanyName = companyName, AddressOne = addressOne, AddressTwo = addressTwo, City = city, Province = province, PostalCode = postalCode, YTDSales = YTDSales, CreditHold = creditHold, Notes = notes }); addressTwo = null; city = null; postalCode = null; notes = null; } } return(clients); } } }