当前位置: 首页>>代码示例>>C#>>正文


C# DBConnection_Accessor.GetDB方法代码示例

本文整理汇总了C#中DBConnection_Accessor.GetDB方法的典型用法代码示例。如果您正苦于以下问题:C# DBConnection_Accessor.GetDB方法的具体用法?C# DBConnection_Accessor.GetDB怎么用?C# DBConnection_Accessor.GetDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBConnection_Accessor的用法示例。


在下文中一共展示了DBConnection_Accessor.GetDB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddCustomerControl_badPhoneNumber

        public void AddCustomerControl_badPhoneNumber()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            SearchFunction_Accessor sf = new SearchFunction_Accessor(db.GetDB());
            AddCustomerControl_Accessor aec = new AddCustomerControl_Accessor(db.GetDB());

            String[] D = new String[] { "10011", "Sean", "5555555555", "calgary", "M", "10011", "Customer" };

            MakePerson_Accessor mp = new MakePerson_Accessor(D, db.GetDB());
            try
            {
                d.DeletePerson(10011);
            }
            catch (Exception)
            {

            }

            ErrorWindow ew = aec.createCustomer(D);
            DataTable dt = null;
            try
            {
                dt = sf.SearchPersonID("10011");
            }
            catch (Exception e) { };
            Assert.IsTrue(dt.Rows.Count == 0);
            Assert.IsNotNull(ew);
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:29,代码来源:IntegrationTests.cs

示例2: DeletePart_NormalPath

        public void DeletePart_NormalPath()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();
            Delete_Accessor d = new Delete_Accessor(connection.GetDB());
            try
            {
                d.DeletePart(10);
            }
            catch (Exception e)
            {
            }

            String[] D = new String[] {"10", "3", "1", "1"};
            MakePart_Accessor part = new MakePart_Accessor(D, connection.GetDB());
            part.CreatePart();

            d.DeletePart(10);

            try
            {
                dt = SF.SearchPart("10");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 0);
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:31,代码来源:DeletePartTests.cs

示例3: AddSale_EIDNonExistent

        public void AddSale_EIDNonExistent()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            TestingFunctions tf = new TestingFunctions(db.GetDB());
            try
            {
                tf.DeleteSale("3", "121", "99999");
            }
            catch (Exception e)
            {
            }

            String[] sale = new String[] { "3", "121", "99999", "4/10/2008", "34000" };
            MakeSale sa = new MakeSale(sale, db.GetDB());
            sa.CreateSale();

            try
            {
                tf.DeleteSale("3", "121", "99999");
            }
            catch (Exception e)
            {
            }
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:26,代码来源:AddSaleTests.cs

示例4: EmployeeProgress_NormalPath

        public void EmployeeProgress_NormalPath()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            TestingFunctions tf = new TestingFunctions(db.GetDB());
            try
            {
                tf.DeleteSale("3", "121", "9");
            }
            catch (Exception e)
            {
            }

            String[] sale = new String[] { "3", "121", "9", "4/10/2008", "34000" };
            MakeSale sa = new MakeSale(sale, db.GetDB());
            sa.CreateSale();

            DataTable dt = st.CalculateProgress();
            Double actual = (Double)dt.Rows[0].ItemArray[2];
            Double expected = 34000;
            Assert.IsTrue(actual == expected);

            tf.DeleteSale("3", "121", "9");
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:25,代码来源:EmployeeSalesTests.cs

示例5: RevenueTest_MultipleSales

        public void RevenueTest_MultipleSales()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            TestingFunctions tf = new TestingFunctions(db.GetDB());
            try
            {
                tf.DeleteSale("3", "121", "9");
                tf.DeleteSale("7", "121", "9");
            }
            catch (Exception)
            {

            }

            String[] sale = new String[] { "3", "121", "9", "3/3/3", "1200" };
            MakeSale sa = new MakeSale(sale, db.GetDB());
            sa.CreateSale();

            String[] sale2 = new String[] { "7", "121", "9", "3/3/3", "1200" };
            MakeSale sa2 = new MakeSale(sale2, db.GetDB());
            sa2.CreateSale();

            String s = st.Revenue();

            Assert.IsTrue(int.Parse(s) == 2400);

            tf.DeleteSale("3", "121", "9");
            tf.DeleteSale("7", "121", "9");
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:31,代码来源:RevenueTests.cs

示例6: DeletePerson_NormalPath

        public void DeletePerson_NormalPath()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();
            Delete_Accessor d = new Delete_Accessor(connection.GetDB());
            try
            {
                d.DeletePerson(1005);
            }
            catch (Exception e)
            {
            }
            String[] p = new String[] {"1005", "1", "1123123123", "1", "M"};
            MakePerson_Accessor pers = new MakePerson_Accessor(p, connection.GetDB());
            pers.CreatePerson();
            MakeEmployee_Accessor person = new MakeEmployee_Accessor("1005", "1234", "3/3/3", "", connection.GetDB());

            person.CreateEmployee();

            d.DeletePerson(1005);

            try
            {
                dt = SF.SearchPersonID("1005");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 0);
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:33,代码来源:DeletePersonTests.cs

示例7: AddCustomerControl_constructor

        public void AddCustomerControl_constructor()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            AddCustomerControl_Accessor acc = new AddCustomerControl_Accessor(db.GetDB());

            Assert.IsNotNull(acc);
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:8,代码来源:IntegrationTests.cs

示例8: DeleteVehicle_ExistsInSale

        public void DeleteVehicle_ExistsInSale()
        {
            DBConnection_Accessor connection = new DBConnection_Accessor();
            Delete_Accessor d = new Delete_Accessor(connection.GetDB());

            TestingFunctions tf = new TestingFunctions(connection.GetDB());
            try
            {
                tf.DeleteSale("112", "121", "9");
            }
            catch (Exception e)
            {
            }
            try
            {
                d.DeleteVehicle(112);
            }
            catch (Exception e)
            {
            }
            String[] D = new String[] { "112", "1", "1", "1", "1", "1" };

            MakeVehicle_Accessor veh = new MakeVehicle_Accessor(D, connection.GetDB());
            veh.CreateVehicle();
            MakeCar_Accessor car = new MakeCar_Accessor("112", "smart car", connection.GetDB());
            car.CreateCar();

            String[] sale = new String[] { "112", "121", "9", "4/10/2008", "34000" };
            MakeSale sa = new MakeSale(sale, connection.GetDB());
            sa.CreateSale();

            try
            {
                d.DeleteVehicle(112);
            }
            catch (Exception ex)
            {
                try
                {
                    tf.DeleteSale("112", "121", "9");
                }
                catch (Exception e)
                {
                }

                throw ex;
            }
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:48,代码来源:DeleteVehicleTests.cs

示例9: MonthlySales_NoSalesValidMonth

 public void MonthlySales_NoSalesValidMonth()
 {
     DBConnection_Accessor db = new DBConnection_Accessor();
     StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());
     string s = st.MonthlySales("1", "2001");
     Assert.IsTrue(int.Parse(s) == 0);
 }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:7,代码来源:MonthlySalesTests.cs

示例10: SearchName_NonExistent

        public void SearchName_NonExistent()
        {
            //Person array = id, name, phone no, address, sex
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();
            //String[] p = new String[] { "1", "1", "1", "1", "1" };

            //MakePerson_Accessor Person = new MakePerson_Accessor(p, connection.GetDB());
            //Person.DeletePerson();
            //Person.CreatePerson();

            try
            {
                dt = SF.SearchPersonName("dyrone tonkson");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 0);

            //Person.DeletePerson();
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:25,代码来源:SearchPersonNameTests.cs

示例11: SearchID_NormalPath

        public void SearchID_NormalPath()
        {
            //Person array = id, name, phone no, address, sex
            DBConnection_Accessor connection = new DBConnection_Accessor();
            SearchFunction_Accessor SF = new SearchFunction_Accessor(connection.GetDB());
            DataTable dt = new DataTable();
            //String[] p = new String[] {"1", "1", "1", "1", "1"};

            /*
            MakePerson_Accessor Person = new MakePerson_Accessor(p, connection.GetDB());
            Person.DeletePerson();
            Person.CreatePerson();
            */
            try
            {
                dt = SF.SearchPersonID("3");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt.Rows.Count == 1);

            //Person.DeletePerson();
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:26,代码来源:SearchPersonIDTests.cs

示例12: AddEngine_DeleteInstance

        public void AddEngine_DeleteInstance()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            MakeEngine_Accessor mc = new MakeEngine_Accessor("1", "", "", db.GetDB());
            Delete_Accessor d = new Delete_Accessor(db.GetDB());
            String[] D = new String[] { "1", "", "", "", "", "" };

            MakePart_Accessor mp = new MakePart_Accessor(D, db.GetDB());
            try
            {
                d.DeletePart(1);
            }
            catch (Exception)
            {

            }
            mp.CreatePart();
            mc.CreateEngine();

            SearchFunction_Accessor SF = new SearchFunction_Accessor(db.GetDB());
            DataTable dt1 = new DataTable();
            DataTable dt2 = new DataTable();

            try
            {
                dt2 = SF.SearchPart("1");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            mc.DeleteEngine();
            mp.DeletePart();

            try
            {
                dt1 = SF.SearchPart("1");
            }
            catch (OleDbException ex)
            {
                throw ex;
            }

            Assert.IsTrue(dt1.Rows.Count == 0 && dt2.Rows.Count == 1);
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:46,代码来源:AddPartTests.cs

示例13: VehicleParts_NoVehicle

        public void VehicleParts_NoVehicle()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = st.VehicleParts("2");
            Assert.IsTrue(dt.Rows.Count == 0);
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:8,代码来源:VehiclePartsTests.cs

示例14: EmployeeProgress_NoSales

        public void EmployeeProgress_NoSales()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            StatsCalc_Accessor st = new StatsCalc_Accessor(db.GetDB());

            DataTable dt = st.CalculateProgress();

            Assert.IsTrue(dt.Rows.Count == 0);
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:9,代码来源:EmployeeSalesTests.cs

示例15: AddVHR_NegativeID

        public void AddVHR_NegativeID()
        {
            DBConnection_Accessor db = new DBConnection_Accessor();
            String[] D = new String[] { "-5", "22", "", "", "", "" };
            MakeVHR_Accessor mc = new MakeVHR_Accessor(D, db.GetDB());
            TestingFunctions t = new TestingFunctions(db.GetDB());

            MakeVehicle_Accessor mp = new MakeVehicle_Accessor(D, db.GetDB());
            try
            {
                t.DeleteVHR(-5);
            }
            catch (Exception)
            {

            }
            mc.CreateVHR();
        }
开发者ID:dmryan,项目名称:CPSC471-Project,代码行数:18,代码来源:AddVHRTests.cs


注:本文中的DBConnection_Accessor.GetDB方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。