Exemplo n.º 1
0
        public void AddContactToCustomer(Contact cont, Int32 customerID)
        {
            repo.AddContactToCustomer(cont, customerID);
            repo.SaveChanges();

            this.Clients.Group("contacts").refreshContacts(repo.GetContacts());
            this.Clients.Group("contacts.CustomerID:" + customerID).refreshContacts(repo.GetCustomerContacts(customerID));
        }
Exemplo n.º 2
0
        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 });
        }
Exemplo n.º 3
0
        public void UpdateContact(Contact contact)
        {
            repo.UpdateContact(contact);
            repo.SaveChanges();

            this.Clients.Group("contacts").refreshContacts();
            this.Clients.Group("contacts.CustomerID:" + contact.CustomerID).returnUpdateContact(contact);
        }
Exemplo n.º 4
0
        public void Mem_Customer_AddItems()
        {
            var repo = new Left4Edit.Models.Repo.MemCustomerRepo();
            var customer = CreateTestCustomer_Mem().ElementAt(0);
            customer.ID = 0;

            repo.NewCustomer(customer);

            var contact = new Contact()
            {
                FirstName = "Test",
                LastName = "User",
                Email = "*****@*****.**",
                MyCustomer = customer,
                ID = 100
            };

            repo.AddContactToCustomer(contact, customer.ID);

            Assert.IsTrue(
                repo.GetCustomer(0)
                    .Contacts
                    .Where(c => c.ID == 100)
                    .First().FirstName == "Test"
            );
        }