Exemplo n.º 1
0
        private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblDetail1.Visible   = false;
            lblDetail2.Visible   = false;
            lblDetail3.Visible   = false;
            lblDetail4.Visible   = false;
            rchbxDetail1.Visible = false;
            rchbxDetail2.Visible = false;
            rchbxDetail3.Visible = false;
            rchbxDetail4.Visible = false;

            if (cmbbxTables.SelectedItem.ToString() == "Suppliers")
            {
                lblDetail1.Text    = "SupplierID";
                lblDetail2.Text    = "Company Name";
                lblDetail3.Text    = "Contact Name";
                lblDetail4.Text    = "Phone";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                lblDetail3.Visible = true;
                lblDetail4.Visible = true;
                Suppliers supp = (Suppliers)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = supp.SupplierID.ToString();
                rchbxDetail2.Text    = supp.CompanyName;
                rchbxDetail3.Text    = supp.ContactName;
                rchbxDetail4.Text    = supp.Phone;
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
                rchbxDetail3.Visible = true;
                rchbxDetail4.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Orders")
            {
                lblDetail1.Text    = "OrderID";
                lblDetail2.Text    = "CustomerID";
                lblDetail3.Text    = "EmployeeID";
                lblDetail4.Text    = "ShipName";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                lblDetail3.Visible = true;
                lblDetail4.Visible = true;
                Orders ord = (Orders)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = ord.OrderID.ToString();
                rchbxDetail2.Text    = ord.CustomerID;
                rchbxDetail3.Text    = ord.EmployeeID.ToString();
                rchbxDetail4.Text    = ord.ShipName;
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
                rchbxDetail3.Visible = true;
                rchbxDetail4.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Categories")
            {
                lblDetail1.Text    = "CategoryID";
                lblDetail2.Text    = "Category Name";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                Categories cat = (Categories)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = cat.CategoryID.ToString();
                rchbxDetail2.Text    = cat.CategoryName;
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Customers")
            {
                lblDetail1.Text    = "CustomerID";
                lblDetail2.Text    = "Company Name";
                lblDetail3.Text    = "Phone";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                lblDetail3.Visible = true;
                Customers cust = (Customers)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = cust.CustomerID;
                rchbxDetail2.Text    = cust.CompanyName;
                rchbxDetail3.Text    = cust.Phone;
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
                rchbxDetail3.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "CustomerCustomerDemo")
            {
                lblDetail1.Text    = "CustomerID";
                lblDetail2.Text    = "CustomerTypeID";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                CustomerCustomerDemo ccd = (CustomerCustomerDemo)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = ccd.CustomerID;
                rchbxDetail2.Text    = ccd.CustomerTypeID;
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "CustomerDemographics")
            {
                lblDetail1.Text    = "CustomerTypeID";
                lblDetail2.Text    = "Customer Desc";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                CustomerDemographics cd = (CustomerDemographics)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = cd.CustomerTypeID;
                rchbxDetail2.Text    = cd.CustomerDesc;
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Employees")
            {
                lblDetail1.Text    = "EmployeeID";
                lblDetail2.Text    = "First Name";
                lblDetail3.Text    = "Last Name";
                lblDetail4.Text    = "BirthDate";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                lblDetail3.Visible = true;
                lblDetail4.Visible = true;
                Employees emp = (Employees)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = emp.EmployeeID.ToString();
                rchbxDetail2.Text    = emp.FirstName;
                rchbxDetail3.Text    = emp.LastName;
                rchbxDetail4.Text    = emp.BirthDate.ToString();
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
                rchbxDetail3.Visible = true;
                rchbxDetail4.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "EmployeeTerritories")
            {
                lblDetail1.Text    = "EmployeeID";
                lblDetail2.Text    = "TerritoryID";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                EmployeeTerritories empt = (EmployeeTerritories)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = empt.EmployeeID.ToString();
                rchbxDetail2.Text    = empt.TerritoryID;
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "OrderDetails")
            {
                lblDetail1.Text    = "OrderID";
                lblDetail2.Text    = "ProductID";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                OrderDetails od = (OrderDetails)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = od.OrderID.ToString();
                rchbxDetail2.Text    = od.ProductID.ToString();
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Products")
            {
                lblDetail1.Text    = "ProductID";
                lblDetail2.Text    = "Product Name";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                Products pro = (Products)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = pro.ProductID.ToString();
                rchbxDetail2.Text    = pro.ProductName;
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Shippers")
            {
                lblDetail1.Text    = "ShipperID";
                lblDetail2.Text    = "Company Name";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                Shippers ship = (Shippers)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = ship.ShipperID.ToString();
                rchbxDetail2.Text    = ship.CompanyName;
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Territories")
            {
                lblDetail1.Text    = "TerritoryID";
                lblDetail2.Text    = "RegionID";
                lblDetail1.Visible = true;
                lblDetail2.Visible = true;
                Territories terr = (Territories)lstbxRows.SelectedItem;
                rchbxDetail1.Text    = terr.TerritoryID;
                rchbxDetail2.Text    = terr.RegionID.ToString();
                rchbxDetail1.Visible = true;
                rchbxDetail2.Visible = true;
            }
        }
Exemplo n.º 2
0
        private void ComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            lstbxRows.Items.Clear();
            lblDetail1.Visible   = false;
            lblDetail2.Visible   = false;
            lblDetail3.Visible   = false;
            lblDetail4.Visible   = false;
            rchbxDetail1.Visible = false;
            rchbxDetail2.Visible = false;
            rchbxDetail3.Visible = false;
            rchbxDetail4.Visible = false;

            SqlConnection cnn = new SqlConnection(@"server=.\MSSQLSERVER01;database=Northwnd;trusted_connection=true");

            cnn.Open();

            if (cmbbxTables.SelectedItem.ToString() == "Suppliers")
            {
                SqlCommand cmd = new SqlCommand("select SupplierID,CompanyName,ContactName,Phone from Suppliers", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Suppliers supp = new Suppliers(rdr.GetInt32(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1),
                                                   rdr.IsDBNull(2) ? "" : rdr.GetString(2), rdr.IsDBNull(3) ? "" : rdr.GetString(3));

                    lstbxRows.Items.Add(supp);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Orders")
            {
                SqlCommand cmd = new SqlCommand("select OrderID,CustomerID,EmployeeID,ShipName from Orders", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Orders order = new Orders(rdr.GetInt32(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1), rdr.GetInt32(2), rdr.IsDBNull(3) ? "" : rdr.GetString(3));

                    lstbxRows.Items.Add(order);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Categories")
            {
                SqlCommand cmd = new SqlCommand("select CategoryID,CategoryName from Categories", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Categories category = new Categories(rdr.GetInt32(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1));

                    lstbxRows.Items.Add(category);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Customers")
            {
                SqlCommand cmd = new SqlCommand("select CustomerID,CompanyName,Phone from Customers", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Customers customer = new Customers(rdr.IsDBNull(0) ? "" : rdr.GetString(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1), rdr.IsDBNull(2) ? "" : rdr.GetString(2));

                    lstbxRows.Items.Add(customer);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "CustomerCustomerDemo")
            {
                SqlCommand cmd = new SqlCommand("select CustomerID,CustomerTypeID from CustomerCustomerDemo", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    CustomerCustomerDemo cust = new CustomerCustomerDemo(rdr.IsDBNull(0) ? "" : rdr.GetString(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1));

                    lstbxRows.Items.Add(cust);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "CustomerDemographics")
            {
                SqlCommand cmd = new SqlCommand("select CustomerTypeID,CustomerDesc from CustomerDemographics", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    CustomerDemographics cd = new CustomerDemographics(rdr.IsDBNull(0) ? "" : rdr.GetString(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1));

                    lstbxRows.Items.Add(cd);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Employees")
            {
                SqlCommand cmd = new SqlCommand("select EmployeeID,FirstName,LastName,BirthDate from Employees", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Employees emp = new Employees(rdr.GetInt32(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1), rdr.IsDBNull(2) ? "" : rdr.GetString(2), rdr.GetDateTime(3));

                    lstbxRows.Items.Add(emp);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "EmployeeTerritories")
            {
                SqlCommand cmd = new SqlCommand("select EmployeeID,TerritoryID from EmployeeTerritories", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    EmployeeTerritories empt = new EmployeeTerritories(rdr.GetInt32(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1));

                    lstbxRows.Items.Add(empt);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "OrderDetails")
            {
                SqlCommand cmd = new SqlCommand("select OrderID,ProductID from [Order Details]", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    OrderDetails orderd = new OrderDetails(rdr.GetInt32(0), rdr.GetInt32(1));

                    lstbxRows.Items.Add(orderd);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Products")
            {
                SqlCommand cmd = new SqlCommand("select ProductID,ProductName from Products", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Products product = new Products(rdr.GetInt32(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1));

                    lstbxRows.Items.Add(product);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Region")
            {
                SqlCommand cmd = new SqlCommand("select RegionID from Region", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Region region = new Region(rdr.GetInt32(0));

                    lstbxRows.Items.Add(region);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Shippers")
            {
                SqlCommand cmd = new SqlCommand("select ShipperID,CompanyName from Shippers", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Shippers ship = new Shippers(rdr.GetInt32(0), rdr.IsDBNull(1) ? "" : rdr.GetString(1));

                    lstbxRows.Items.Add(ship);
                }
                rdr.Close();
            }
            else if (cmbbxTables.SelectedItem.ToString() == "Territories")
            {
                SqlCommand cmd = new SqlCommand("select TerritoryID,RegionID from Territories", cnn);

                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Territories terr = new Territories(rdr.IsDBNull(0) ? "" : rdr.GetString(0), rdr.GetInt32(1));

                    lstbxRows.Items.Add(terr);
                }
                rdr.Close();
            }
            cnn.Close();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Categories category1 = new Categories()
            {
                categoryName = "Graphic Cards",
                description  = "Graphic cards for computers",
                picture      = "https://www.gigabyte.com/FileUpload/global/news/1635/o201808201633495922.png"
            };

            Categories category2 = new Categories()
            {
                categoryName = "Memory",
                description  = "RAM for pc and laptops",
                picture      = "https://s3.us-east-2.amazonaws.com/cc-prd-s3-uploads/2020/2/7/4d1ee4b109c2d0cf8e917f9e712d3e17f4595e1b.jpeg"
            };



            Suppliers suppliers1 = new Suppliers()
            {
                companyName  = "MSI",
                contactName  = "MSI",
                contactTitle = "MSI",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                fax          = "-",
                homepage     = "msi.com",
            };

            Suppliers suppliers2 = new Suppliers()
            {
                companyName  = "Asus",
                contactName  = "Asus",
                contactTitle = "Asus",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                fax          = "-",
                homepage     = "asus.com",
            };

            Suppliers suppliers3 = new Suppliers()
            {
                companyName  = "Evga",
                contactName  = "Evga",
                contactTitle = "Evga",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                fax          = "-",
                homepage     = "evga.com",
            };

            Suppliers suppliers4 = new Suppliers()
            {
                companyName  = "Kingston",
                contactName  = "Kingston",
                contactTitle = "Kingston",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                fax          = "-",
                homepage     = "kingston.com",
            };


            Suppliers suppliers5 = new Suppliers()
            {
                companyName  = "Corsair",
                contactName  = "Corsair",
                contactTitle = "Corsair",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                fax          = "-",
                homepage     = "corsair.com",
            };


            Products products1 = new Products()
            {
                productName      = "RTX 3090",
                categories       = category1,
                suppliers        = suppliers1,
                quantityPerLabel = 20,
                unitPrice        = 999.99F,
                unitsInStock     = 50,
                unitsOnOrder     = 30,
                recorderLevel    = 10,
                discontinued     = false,
            };


            Products products2 = new Products()
            {
                productName      = "RTX 3080",
                categories       = category1,
                suppliers        = suppliers2,
                quantityPerLabel = 20,
                unitPrice        = 699.99F,
                unitsInStock     = 50,
                unitsOnOrder     = 30,
                recorderLevel    = 10,
                discontinued     = false,
            };


            Products products3 = new Products()
            {
                productName      = "RTX 3070",
                categories       = category1,
                suppliers        = suppliers3,
                quantityPerLabel = 20,
                unitPrice        = 599.99F,
                unitsInStock     = 50,
                unitsOnOrder     = 30,
                recorderLevel    = 10,
                discontinued     = false,
            };


            Products products4 = new Products()
            {
                productName      = "16 GB RAM",
                categories       = category2,
                suppliers        = suppliers4,
                quantityPerLabel = 20,
                unitPrice        = 199.99F,
                unitsInStock     = 500,
                unitsOnOrder     = 50,
                recorderLevel    = 10,
                discontinued     = false,
            };


            Products products5 = new Products()
            {
                productName      = "8 GB RAM",
                categories       = category2,
                suppliers        = suppliers5,
                quantityPerLabel = 20,
                unitPrice        = 99.99F,
                unitsInStock     = 500,
                unitsOnOrder     = 50,
                recorderLevel    = 10,
                discontinued     = false,
            };

            Employees employees1 = new Employees()
            {
                lastName        = "Doe",
                firstName       = "John",
                title           = "Manager",
                titleOfCourtesy = "Mr.",
                birthDate       = new DateTime(2000, 03, 27),
                hireDate        = new DateTime(2012, 03, 27),
                address         = "1390 Barrydowne",
                city            = "Sudbury",
                region          = "Ontario",
                postalCode      = "P3A 6B9",
                country         = "Canada",
                homePhone       = "779743912",
                extension       = "356",
                photo           = "johndoe.png",
                notes           = "-",
                photoPath       = "images/johndoe.png",
            };


            Employees employees2 = new Employees()
            {
                lastName        = "Doe",
                firstName       = "Sean",
                title           = "Manager",
                titleOfCourtesy = "Mr.",
                birthDate       = new DateTime(2000, 03, 27),
                hireDate        = new DateTime(2012, 03, 27),
                address         = "1390 Barrydowne",
                city            = "Sudbury",
                region          = "Ontario",
                postalCode      = "P3A 6B9",
                country         = "Canada",
                homePhone       = "779743912",
                extension       = "356",
                photo           = "seandoe.png",
                notes           = "-",
                photoPath       = "images/seandoe.png",
                employees       = employees1
            };


            Employees employees3 = new Employees()
            {
                lastName        = "Doe",
                firstName       = "John",
                title           = "Sales",
                titleOfCourtesy = "Mr.",
                birthDate       = new DateTime(2000, 03, 27),
                hireDate        = new DateTime(2012, 03, 27),
                address         = "1390 Barrydowne",
                city            = "Sudbury",
                region          = "Ontario",
                postalCode      = "P3A 6B9",
                country         = "Canada",
                homePhone       = "779743912",
                extension       = "356",
                photo           = "johndoe.png",
                notes           = "-",
                photoPath       = "images/johndoe.png",
                employees       = employees2
            };


            Employees employees4 = new Employees()
            {
                lastName        = "Doe",
                firstName       = "Jane",
                title           = "Sales",
                titleOfCourtesy = "Mr.",
                birthDate       = new DateTime(2000, 03, 27),
                hireDate        = new DateTime(2012, 03, 27),
                address         = "1390 Barrydowne",
                city            = "Sudbury",
                region          = "Ontario",
                postalCode      = "P3A 6B9",
                country         = "Canada",
                homePhone       = "779743912",
                extension       = "356",
                photo           = "janedoe.png",
                notes           = "-",
                photoPath       = "images/janedoe.png",
                employees       = employees2
            };


            Employees employees5 = new Employees()
            {
                lastName        = "Doe",
                firstName       = "Jane",
                title           = "Sales",
                titleOfCourtesy = "Mr.",
                birthDate       = new DateTime(2000, 03, 27),
                hireDate        = new DateTime(2012, 03, 27),
                address         = "1390 Barrydowne",
                city            = "Sudbury",
                region          = "Ontario",
                postalCode      = "P3A 6B9",
                country         = "Canada",
                homePhone       = "779743912",
                extension       = "356",
                photo           = "janedoe.png",
                notes           = "-",
                photoPath       = "images/janedoe.png",
                employees       = employees2
            };



            Customers customers1 = new Customers()
            {
                companyName  = "Linus",
                contactName  = "Linus",
                contactTitle = "Mr.",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                phone        = "779743912",
                fax          = "-",
            };


            Customers customers2 = new Customers()
            {
                companyName  = "Maruqes",
                contactName  = "Marques",
                contactTitle = "Mr.",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                phone        = "779743912",
                fax          = "-",
            };


            Customers customers3 = new Customers()
            {
                companyName  = "Dev",
                contactName  = "Dev",
                contactTitle = "Mr.",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                phone        = "779743912",
                fax          = "-",
            };



            Customers customers4 = new Customers()
            {
                companyName  = "Unbox Therapy",
                contactName  = "Dave",
                contactTitle = "Mr.",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                phone        = "779743912",
                fax          = "-",
            };


            Customers customers5 = new Customers()
            {
                companyName  = "Dave",
                contactName  = "Dave",
                contactTitle = "Mr.",
                address      = "1390 Barrydowne",
                city         = "Sudbury",
                region       = "Ontario",
                postalCode   = "P3A 6B9",
                country      = "Canada",
                phone        = "779743912",
                fax          = "-",
            };

            Shippers shippers1 = new Shippers()
            {
                companyName = "DHL",
                phone       = "779743912"
            };

            Shippers shippers2 = new Shippers()
            {
                companyName = "FedEX",
                phone       = "77973912"
            };

            Orders orders1 = new Orders()
            {
                customers      = customers1,
                employees      = employees3,
                orderDate      = new DateTime(2021, 03, 27),
                requriedDate   = new DateTime(2021, 03, 29),
                shippedDate    = new DateTime(2013, 03, 27),
                shippers       = shippers1,
                freight        = "2",
                shipName       = "DHL",
                shipAddress    = "1390",
                shipCity       = "Toronto",
                shipReigon     = "Ontario",
                shipPostalCode = "P3A",
                shipCountry    = "Canada",
            };

            Orders orders2 = new Orders()
            {
                customers      = customers2,
                employees      = employees3,
                orderDate      = new DateTime(2021, 03, 27),
                requriedDate   = new DateTime(2021, 03, 29),
                shippedDate    = new DateTime(2013, 03, 27),
                shippers       = shippers1,
                freight        = "2",
                shipName       = "DHL",
                shipAddress    = "1390",
                shipCity       = "Toronto",
                shipReigon     = "Ontario",
                shipPostalCode = "P3A",
                shipCountry    = "Canada",
            };


            Orders orders3 = new Orders()
            {
                customers      = customers3,
                employees      = employees3,
                orderDate      = new DateTime(2021, 03, 27),
                requriedDate   = new DateTime(2021, 03, 29),
                shippedDate    = new DateTime(2013, 03, 27),
                shippers       = shippers1,
                freight        = "2",
                shipName       = "DHL",
                shipAddress    = "1390",
                shipCity       = "Toronto",
                shipReigon     = "Ontario",
                shipPostalCode = "P3A",
                shipCountry    = "Canada",
            };


            Orders orders4 = new Orders()
            {
                customers      = customers4,
                employees      = employees4,
                orderDate      = new DateTime(2021, 03, 27),
                requriedDate   = new DateTime(2021, 03, 29),
                shippedDate    = new DateTime(2013, 03, 27),
                shippers       = shippers2,
                freight        = "2",
                shipName       = "FedEx",
                shipAddress    = "1390",
                shipCity       = "Toronto",
                shipReigon     = "Ontario",
                shipPostalCode = "P3A",
                shipCountry    = "Canada",
            };


            Orders orders5 = new Orders()
            {
                customers      = customers5,
                employees      = employees4,
                orderDate      = new DateTime(2021, 03, 27),
                requriedDate   = new DateTime(2021, 03, 29),
                shippedDate    = new DateTime(2013, 03, 27),
                shippers       = shippers2,
                freight        = "2",
                shipName       = "FedEx",
                shipAddress    = "1390",
                shipCity       = "Toronto",
                shipReigon     = "Ontario",
                shipPostalCode = "P3A",
                shipCountry    = "Canada",
            };



            OrderDetails orderDetails1 = new OrderDetails()
            {
                unitPrice = 999.99F,
                quantity  = 1,
                discount  = 0.00f,
                products  = products1,
                orders    = orders1
            };

            OrderDetails orderDetails2 = new OrderDetails()
            {
                unitPrice = 999.99F,
                quantity  = 1,
                discount  = 0.00f,
                products  = products1,
                orders    = orders2
            };

            OrderDetails orderDetails3 = new OrderDetails()
            {
                unitPrice = 999.99F,
                quantity  = 1,
                discount  = 0.00f,
                products  = products1,
                orders    = orders3
            };

            OrderDetails orderDetails4 = new OrderDetails()
            {
                unitPrice = 999.99F,
                quantity  = 1,
                discount  = 0.00f,
                products  = products1,
                orders    = orders4
            };


            OrderDetails orderDetails5 = new OrderDetails()
            {
                unitPrice = 999.99F,
                quantity  = 1,
                discount  = 0.00f,
                products  = products1,
                orders    = orders5
            };


            Region region1 = new Region()
            {
                regionDescription = "Test region 1"
            };

            Region region2 = new Region()
            {
                regionDescription = "Test region 2"
            };

            Territories territories1 = new Territories()
            {
                territoryDescription = "",
                region = region1
            };

            Territories territories2 = new Territories()
            {
                territoryDescription = "",
                region = region1
            };

            EmployeeTerritories employeeTerritories1 = new EmployeeTerritories()
            {
                employees   = employees1,
                territories = territories1
            };

            EmployeeTerritories employeeTerritories2 = new EmployeeTerritories()
            {
                employees   = employees3,
                territories = territories2
            };


            using (NorthWindContext ctx = new NorthWindContext())
            {
                ctx.categories.Add(category1);
                ctx.categories.Add(category2);

                ctx.products.Add(products1);
                ctx.products.Add(products2);
                ctx.products.Add(products3);
                ctx.products.Add(products4);
                ctx.products.Add(products5);

                ctx.region.Add(region1);
                ctx.region.Add(region2);

                ctx.suppliers.Add(suppliers1);
                ctx.suppliers.Add(suppliers2);
                ctx.suppliers.Add(suppliers3);
                ctx.suppliers.Add(suppliers4);
                ctx.suppliers.Add(suppliers5);


                ctx.shippers.Add(shippers1);
                ctx.shippers.Add(shippers2);

                ctx.region.Add(region1);
                ctx.region.Add(region2);

                ctx.territories.Add(territories1);
                ctx.territories.Add(territories2);

                ctx.employees.Add(employees1);
                ctx.employees.Add(employees2);
                ctx.employees.Add(employees3);
                ctx.employees.Add(employees4);
                ctx.employees.Add(employees5);

                ctx.employeeteritorries.Add(employeeTerritories1);
                ctx.employeeteritorries.Add(employeeTerritories2);

                ctx.customers.Add(customers1);
                ctx.customers.Add(customers2);
                ctx.customers.Add(customers3);
                ctx.customers.Add(customers4);
                ctx.customers.Add(customers5);

                ctx.orders.Add(orders1);
                ctx.orders.Add(orders2);
                ctx.orders.Add(orders3);
                ctx.orders.Add(orders4);
                ctx.orders.Add(orders5);

                ctx.orderdetails.Add(orderDetails1);
                ctx.orderdetails.Add(orderDetails2);
                ctx.orderdetails.Add(orderDetails3);
                ctx.orderdetails.Add(orderDetails4);
                ctx.orderdetails.Add(orderDetails5);

                try
                {
                    ctx.SaveChanges();
                }
                catch (DbEntityValidationException e)
                {
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                          eve.Entry.Entity.GetType().Name, eve.Entry.State);
                        foreach (var ve in eve.ValidationErrors)
                        {
                            Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                              ve.PropertyName, ve.ErrorMessage);
                        }
                    }
                }
            }
        }