Ejemplo n.º 1
0
 public void AddContact(Customers firm, Customers agent)
 {
     if (!db.Contacts.Any(c => c.firmID == firm.customerID && c.agentID == agent.customerID))
     {
         Contacts newContact = new Contacts()
         {
             agentID = agent.customerID,
             firmID = firm.customerID
         };
         db.Contacts.Add(newContact);
         db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
        public TestDatabase()
        {
            Cities city01 = new Cities() { cityID = 1, city = "Dunaújváros", isDeleted = false, postalCode = "2400" };
            testCities.Add(city01);
            Cities city02 = new Cities() { cityID = 2, city = "Győr", isDeleted = false, postalCode = "1234" };
            testCities.Add(city02);
            Cities city03 = new Cities() { cityID = 3, city = "Balassagyarmat", isDeleted = false, postalCode = "5847" };
            testCities.Add(city03);

            Customers person01 = new Customers() { customerID = 1, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Teszt Béla Károly", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr" };
            testCustomers.Add(person01);
            Customers person02 = new Customers() { customerID = 2, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Gipsz Jakab", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr" };
            testCustomers.Add(person02);
            Customers person03 = new Customers() { customerID = 3, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Halocsekerentyű Leokádia", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr" };
            testCustomers.Add(person03);
            Customers person04 = new Customers() { customerID = 4, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Vaszlavics Ilona", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr" };
            testCustomers.Add(person04);
            Customers person05 = new Customers() { customerID = 5, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Kotyogó Júlia", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr" };
            testCustomers.Add(person05);

            Customers firm01 = new Customers() { customerID = 100, cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Óvárosi Csavarbolt", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = true,  serviceCounter = 0, rentCounter = 0 };
            testCustomers.Add(firm01);
            Customers firm02 = new Customers() { customerID = 101, cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "ISD Dunaferr", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = true, serviceCounter = 0, rentCounter = 0 };
            testCustomers.Add(firm02);
            Customers firm03 = new Customers() { customerID = 102, cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Hankook", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = true, serviceCounter = 0, rentCounter = 0 };
            testCustomers.Add(firm03);

            Contacts firm01contact01 = new Contacts() { contactID = 1, firmID = firm01.customerID, agentID = person02.customerID };
            testContacts.Add(firm01contact01);
            Contacts firm02contact01 = new Contacts() { contactID = 2, firmID = firm02.customerID, agentID = person01.customerID };
            testContacts.Add(firm02contact01);
            Contacts firm02contact02 = new Contacts() { contactID = 3, firmID = firm02.customerID, agentID = person04.customerID };
            testContacts.Add(firm02contact02);

            testDetailedCustomers.Add(new DetailedCustomers() { customerID = 5, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Kotyogó Júlia", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr", city = "Dunaújváros", cityDeleted = false, customerDeleted = false, postalCode = "2400" });

            testDetailedCustomers.Add(new DetailedCustomers() { customerID = 102, cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Hankook", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isFirm = true, serviceCounter = 0, rentCounter = 0, city = "Dunaújváros", cityDeleted = false, customerDeleted = false, postalCode = "2400" });
        }
Ejemplo n.º 3
0
        public TestDatabase()
        {
            Cities city01 = new Cities()
            {
                cityID = 1, city = "Dunaújváros", isDeleted = false, postalCode = "2400"
            };

            testCities.Add(city01);
            Cities city02 = new Cities()
            {
                cityID = 2, city = "Győr", isDeleted = false, postalCode = "1234"
            };

            testCities.Add(city02);
            Cities city03 = new Cities()
            {
                cityID = 3, city = "Balassagyarmat", isDeleted = false, postalCode = "5847"
            };

            testCities.Add(city03);

            Customers person01 = new Customers()
            {
                customerID = 1, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Teszt Béla Károly", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr"
            };

            testCustomers.Add(person01);
            Customers person02 = new Customers()
            {
                customerID = 2, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Gipsz Jakab", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr"
            };

            testCustomers.Add(person02);
            Customers person03 = new Customers()
            {
                customerID = 3, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Halocsekerentyű Leokádia", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr"
            };

            testCustomers.Add(person03);
            Customers person04 = new Customers()
            {
                customerID = 4, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Vaszlavics Ilona", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr"
            };

            testCustomers.Add(person04);
            Customers person05 = new Customers()
            {
                customerID = 5, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Kotyogó Júlia", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr"
            };

            testCustomers.Add(person05);

            Customers firm01 = new Customers()
            {
                customerID = 100, cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Óvárosi Csavarbolt", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = true, serviceCounter = 0, rentCounter = 0
            };

            testCustomers.Add(firm01);
            Customers firm02 = new Customers()
            {
                customerID = 101, cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "ISD Dunaferr", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = true, serviceCounter = 0, rentCounter = 0
            };

            testCustomers.Add(firm02);
            Customers firm03 = new Customers()
            {
                customerID = 102, cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Hankook", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isDeleted = false, isFirm = true, serviceCounter = 0, rentCounter = 0
            };

            testCustomers.Add(firm03);

            Contacts firm01contact01 = new Contacts()
            {
                contactID = 1, firmID = firm01.customerID, agentID = person02.customerID
            };

            testContacts.Add(firm01contact01);
            Contacts firm02contact01 = new Contacts()
            {
                contactID = 2, firmID = firm02.customerID, agentID = person01.customerID
            };

            testContacts.Add(firm02contact01);
            Contacts firm02contact02 = new Contacts()
            {
                contactID = 3, firmID = firm02.customerID, agentID = person04.customerID
            };

            testContacts.Add(firm02contact02);

            testDetailedCustomers.Add(new DetailedCustomers()
            {
                customerID = 5, birthDate = new DateTime(1980, 3, 2), cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Kotyogó Júlia", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isFirm = false, mothersName = "Kovács Laura", serviceCounter = 0, rentCounter = 0, workPlace = "ISD Dunaferr", city = "Dunaújváros", cityDeleted = false, customerDeleted = false, postalCode = "2400"
            });

            testDetailedCustomers.Add(new DetailedCustomers()
            {
                customerID = 102, cityID = city01.cityID, customerAddress = "Almafa utca 32.", customerName = "Hankook", customerPhone = "+36/30/517-6289", IDNumber = "JD245874", isFirm = true, serviceCounter = 0, rentCounter = 0, city = "Dunaújváros", cityDeleted = false, customerDeleted = false, postalCode = "2400"
            });
        }