public void AddCredentialToCustomer(Credential cred, Int32 customerID) { repo.AddCredentialToCustomer(cred, customerID); repo.SaveChanges(); this.Clients.Group("credentials").refreshCredentials(repo.GetCredentials()); this.Clients.Group("credentials.CustomerID:" + customerID).refreshCredentials(repo.GetCustomerCredentials(customerID)); }
public void UpdateCredential(Credential credential) { repo.UpdateCredential(credential); repo.SaveChanges(); this.Clients.Group("credentials").refreshCredentials(); if (credential.NodeID.HasValue) this.Clients.Group("credentials.NodeID:" + credential.NodeID).returnUpdateCredential(credential); else this.Clients.Group("credentials.CustomerID:" + credential.CustomerID.Value).returnUpdateCredential(credential); }
public static IEnumerable<Customer> CreateTestCustomer_Mem() { // Preparation var customer = new Customer(); var contact1 = new Contact(); var contact2 = new Contact(); var node1 = new Node(); var node2 = new Node(); var node3 = new Node(); var credential1 = new Credential(); var credential2 = new Credential(); var credential3 = new Credential(); // Build customer customer.Name = "Test Customer"; customer.Symbol = "ASA"; // Build contact1 contact1.FirstName = "Anita"; contact1.LastName = "Neal"; contact1.Email = "*****@*****.**"; contact1.MyCustomer = customer; // Build contact2 contact2.FirstName = "Monster"; contact2.LastName = "Energy"; contact2.Email = "*****@*****.**"; contact2.MyCustomer = customer; // build node1 node1.Address = "node1.billmcg.com"; node1.Name = "Node1 is best node!"; node1.Comment = "No comment here"; node1.MyCustomer = customer; // build node2 node2.Address = "node2.billmcg.com"; node2.Name = "Node2 FTW!"; node2.Comment = "Worst Connection US"; node2.MyCustomer = customer; // build node3 node2.Address = "node3.billmcg.com"; node2.Name = "Test Server"; node3.Comment = "Use RDP fool"; node3.MyCustomer = customer; // build credential1 credential1.Domain = "SPLITH"; credential1.UserName = "******"; credential1.Password = "******"; // build credential2 credential2.Domain = "AURORA_NT"; credential2.UserName = "******"; credential2.Password = "******"; // build credential3 credential3.Domain = "AURORA_NT"; credential3.UserName = "******"; credential3.Password = "******"; // assembly customer.Contacts.Add(contact1); customer.Contacts.Add(contact2); customer.Credentials.Add(credential2); customer.Credentials.Add(credential3); customer.Nodes.Add(node1); customer.Nodes.Add(node2); customer.Nodes.Add(node3); node1.Credentials.Add(credential1); return new List<Customer>(new Customer[] { customer }); }