예제 #1
0
        public IActionResult Index()
        {





            SingleFamily sf = new SingleFamily();
            HomeFactory homeFactory = new Homes.HomeFactory(sf);
            Home singleFamily=homeFactory.BuildTheHome();


            Ranch ranch = new Ranch();
            homeFactory = new HomeFactory(ranch);
            Home ranchHome = homeFactory.BuildTheHome();

            //Logger l = new Logger();
            //LoggerFactory lf = new LoggerFactory(l);
            //lf.NotifyLog("");
            //l.Number = 5;
            //var test = l.total;
            //l.Number = 4;
            //var t = l.total;

            return View();
        }
예제 #2
0
 // No clue if this needs to be thread safe
 public static HomeFactory instance()
 {
     if (_instance == null)
     {
         lock (syncRoot){
             if (_instance == null)
             {
                 _instance = new HomeFactory();
             }
         }
     }
     return(_instance);
 }
예제 #3
0
    void Start()
    {
        // Home Array
        int numSpaces = GetComponent <GridManager>().numSpaces;

        if (GetComponent <Persistance>().persistanceManager.GetComponent <PersistanceManager>().isSaved())
        {
            loadHomes();
        }
        else
        {
            homes = new Home[numSpaces];
        }
        factory = HomeFactory.instance();
    }
예제 #4
0
        public ActionResult Contact(ContactUsViewModel model)
        {
            if (ModelState.IsValid)
            {
                var repo = HomeFactory.GetRepo();

                try
                {
                    repo.AddContact(model.contactUs);
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                return(View());
            }
        }
예제 #5
0
        public string Get(String id)
        {
            HomeFactory houseFactory = new HomeFactory();

            return(houseFactory.createHome(id));
        }
예제 #6
0
        public string Get()
        {
            HomeFactory houseFactory = new HomeFactory();

            return(houseFactory.createHomeList());
        }
예제 #7
0
        static void Main(string[] args)
        {
            City   city    = new City();
            string pattern = @"[\d.]+";
            Regex  regex   = new Regex(pattern);
            //Matcher matcher;
            string      line    = Console.ReadLine();
            int         counter = 0;
            HomeFactory factory = new HomeFactory();

            while (line != "Democracy")
            {
                counter++;
                if (line == "EVN")
                {
                    Console.WriteLine($"Total consumption: {city.getConsumption()}");
                    if (counter % 3 == 0)
                    {
                        city.receiveSalary();
                    }

                    line = Console.ReadLine();
                    continue;
                }
                else if (line == "EVN bill")
                {
                    if (counter % 3 == 0)
                    {
                        city.receiveSalary();
                    }
                    city.payBills();
                    line = Console.ReadLine();
                    continue;
                }
                string homeType     = line.Substring(0, line.IndexOf("("));
                string homeArgsLine = "";
                if (line.IndexOf(" Child") == -1)
                {
                    homeArgsLine = line;
                }
                else
                {
                    homeArgsLine = line.Substring(0, line.IndexOf(" Child"));
                }

                MatchCollection match         = regex.Matches(homeArgsLine);
                List <String>   homeArguments = new List <string>();
                foreach (Match m in match)
                {
                    homeArguments.Add(m.Groups[0].Value);
                }

                List <Child> currentChildrenList = new List <Child>();
                if (line.Contains("Child"))
                {
                    string[] separatingChars = { " Child" };

                    string   childArgsLine = line.Substring(line.IndexOf(" Child"), line.Length - line.IndexOf(" Child"));
                    string[] childrenInfo  = childArgsLine.Split(separatingChars, System.StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < childrenInfo.Length; i++)
                    {
                        List <decimal> childArgs = new List <decimal>();
                        if (childrenInfo[i].Length > 0)
                        {
                            match = regex.Matches(childrenInfo[i]);

                            foreach (Match m in match)
                            {
                                childArgs.Add(decimal.Parse(m.Groups[0].Value));
                            }
                            Child child = new Child(childArgs[0]);
                            for (int j = 1; j < childArgs.Count; j++)
                            {
                                Toy toy = new Toy(childArgs[j]);
                                child.addToys(toy);
                            }
                            currentChildrenList.Add(child);
                        }
                    }
                }

                Home home = factory.createHome(homeType, homeArguments, currentChildrenList);

                home.calcSalaries();
                home.totalBills();
                city.addHome(home);
                if (counter % 3 == 0)
                {
                    city.receiveSalary();
                }
                line = Console.ReadLine();
            }

            Console.WriteLine($"Total population: {city.getPopulation()}");
        }
예제 #8
0
 public HomeController()
 {
     homeFactory = new HomeFactory();
 }
예제 #9
0
        public ActionResult Specials()
        {
            var model = HomeFactory.GetRepo().GetSpecials();

            return(View(model));
        }
예제 #10
0
        public ActionResult Index()
        {
            var model = HomeFactory.GetRepo().GetHomePage();

            return(View(model));
        }