Beispiel #1
0
        static void chooseFactory(int id)
        {
            int level = judgeLevel(id);

            if (level == 1) //省级公司
            {
                IFactory      cpyFactory    = new ProvinceFactory();
                CreateCompany createCompany = cpyFactory.createcompany();
                createCompany.CompanyID    = id;
                createCompany.CompanyName  = CompanyName;
                createCompany.Childcompany = DBhelper.GetChildcompany(id);
                createCompany.createword();
            }
            else if (level == 2) //市级公司
            {
                IFactory      cpyFactory    = new CityFactory();
                CreateCompany createCompany = cpyFactory.createcompany();
                createCompany.CompanyID    = id;
                createCompany.CompanyName  = CompanyName;
                createCompany.Childcompany = DBhelper.GetChildcompany(id);
                createCompany.createword();
            }
            else if (level == 3) //县级公司
            {
                IFactory      cpyFactory    = new CountryFactory();
                CreateCompany createCompany = cpyFactory.createcompany();
                createCompany.CompanyID    = id;
                createCompany.CompanyName  = CompanyName;
                createCompany.Childcompany = DBhelper.GetChildcompany(id);
                createCompany.createword();
            }
        }