Example #1
0
        public ITable CreateTable(string type, int tableNumber, int capacity)
        {
            //Type tableType = Assembly.GetEntryAssembly().GetTypes().FirstOrDefault(t => t.Name == type);

            //ITable table = (ITable)Activator.CreateInstance(tableType, tableNumber, capacity);

            ITable table;

            switch (type)
            {
            case nameof(InsideTable):
                table = new InsideTable(tableNumber, capacity);
                break;

            case nameof(OutsideTable):
                table = new OutsideTable(tableNumber, capacity);
                break;

            default:
                table = null;
                break;
            }

            return(table);
        }
Example #2
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            switch (type)
            {
            case "Inside":
                table = new InsideTable(tableNumber, capacity);
                break;

            case "Outside":
                table = new OutsideTable(tableNumber, capacity);
                break;

            default:
                break;
            }

            string result = string.Empty;

            if (table != null)
            {
                this.tables.Add(table);
                result = string.Format(OutputMessages.TableMade, table.TableNumber);
            }

            return(result);
        }
Example #3
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table;

            if (type == "Inside")
            {
                table = new InsideTable(tableNumber, capacity);
            }
            else
            {
                table = new OutsideTable(tableNumber, capacity);
            }
            tables.Add(table);
            return($"Added table number {table.TableNumber} in the restaurant");
        }
        public Table CreateTable(string type, int tableNumber, int capacity)
        {
            Table table = null;

            if (type == "Inside")
            {
                table = new InsideTable(tableNumber, capacity);
            }
            else if (type == "Outside")
            {
                table = new OutsideTable(tableNumber, capacity);
            }

            return(table);
        }
Example #5
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            if (type == "InsideTable")
            {
                table = new InsideTable(tableNumber, capacity);
            }
            else if (type == "OutsideTable")
            {
                table = new OutsideTable(tableNumber, capacity);
            }
            tables.Add(table);
            return($"Added table number {tableNumber} in the bakery");
        }
Example #6
0
 public string AddTable
     (string type, int tableNumber, int capacity)
 {
     if (type == "OutsideTable")
     {
         var table = new OutsideTable(tableNumber, capacity, 3.50m);
         tables.Add(table);
     }
     else
     {
         var table = new InsideTable(tableNumber, capacity, 2.50m);
         tables.Add(table);
     }
     return($"Added table number {tableNumber} in the bakery");
 }
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            if (type == nameof(OutsideTable))
            {
                table = new OutsideTable(tableNumber, capacity);
            }
            if (type == nameof(InsideTable))
            {
                table = new InsideTable(tableNumber, capacity);
            }

            this.tables.Add(table);
            return($"Added table number {tableNumber} in the bakery");
        }
Example #8
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            Table table;

            if (type.ToLower() == "insidetable")
            {
                table = new InsideTable(tableNumber, capacity);
                tables.Add(table);
            }
            else if (type.ToLower() == "outsidetable")
            {
                table = new OutsideTable(tableNumber, capacity);
                tables.Add(table);
            }
            return($"Added table number {tableNumber} in the bakery");
        }
Example #9
0
        public ITable Create(string type, int tableNumber, int capacity)
        {
            switch (type)
            {
            case "Inside":
                ITable insideTable = new InsideTable(tableNumber, capacity);
                return(insideTable);

            case "Outside":
                ITable outsideTable = new OutsideTable(tableNumber, capacity);
                return(outsideTable);

            default:
                return(null);
            }
        }
Example #10
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            if (type == "InsideTable")
            {
                table = new InsideTable(tableNumber, capacity);
            }
            else if (type == "OutsideTable")
            {
                table = new OutsideTable(tableNumber, capacity);
            }

            tables.Add(table);
            return(string.Format(OutputMessages.TableAdded, tableNumber));
        }
Example #11
0
        private ITable CreateTable(TableType tableType, int tableNumber, int capacity)
        {
            ITable table = null;

            switch (tableType)
            {
            case TableType.InsideTable:
                table = new InsideTable(tableNumber, capacity);
                break;

            case TableType.OutsideTable:
                table = new OutsideTable(tableNumber, capacity);
                break;
            }
            return(table);
        }
Example #12
0
        private ITable CreateTable(string tableType,
                                   int tableNumber, int capacity)
        {
            ITable table = null;

            if (tableType == TableType.InsideTable.ToString())
            {
                table = new InsideTable(tableNumber, capacity);
            }
            if (tableType == TableType.OutsideTable.ToString())
            {
                table = new OutsideTable(tableNumber, capacity);
            }

            return(table);
        }
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            switch (type)
            {
            case "InsideTable": table = new InsideTable(tableNumber, capacity); break;

            case "OutsideTable": table = new OutsideTable(tableNumber, capacity); break;

            default:
                break;
            }
            this.tables.Add(table);

            return(string.Format(OutputMessages.TableAdded, tableNumber));
        }
Example #14
0
        public ITable CreateTable(string type, int tableNumber, int capacity)
        {
            ITable tableToReturn = null;

            switch (type.ToLower())
            {
            case "inside":
                tableToReturn = new InsideTable(tableNumber, capacity);
                break;

            case "outside":
                tableToReturn = new OutsideTable(tableNumber, capacity);
                break;
            }

            return(tableToReturn);
        }
Example #15
0
        private static ITable CheckIFTableExistsAndCreateIt(string type, int tableNumber, int capacity)
        {
            Enum.TryParse(type, out TableType tableType);
            ITable currentTable = null;

            switch (tableType)
            {
            case TableType.InsideTable:
                currentTable = new InsideTable(tableNumber, capacity);
                break;

            case TableType.OutsideTable:
                currentTable = new OutsideTable(tableNumber, capacity);
                break;
            }
            return(currentTable);
        }
Example #16
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            string output = string.Empty;

            if (type == "Inside")
            {
                var table = new InsideTable(tableNumber, capacity);
                tables.Add(table);
                output = $"Added table number {table.TableNumber} in the restaurant";
            }
            else if (type == "Outside")
            {
                var table = new OutsideTable(tableNumber, capacity);
                tables.Add(table);
                output = $"Added table number {table.TableNumber} in the restaurant";
            }
            return(output);
        }
Example #17
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            switch (type)
            {
            case "InsideTable":
                table = new InsideTable(tableNumber, capacity);
                break;

            case "OutsideTable":
                table = new OutsideTable(tableNumber, capacity);
                break;
            }

            tableList.Add(table);                                            //TODO: idk
            return($"Added table number {table.TableNumber} in the bakery"); //TODO: if??
        }
Example #18
0
        public ITable CreateTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            if (type == "InsideTable")
            {
                table = new InsideTable(tableNumber, capacity);
            }
            else if (type == "OutsideTable")
            {
                table = new OutsideTable(tableNumber, capacity);
            }
            else
            {
                throw new ArgumentException("InvalidType");
            }

            return(table);
        }
Example #19
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            switch (type)
            {
            case "Inside":
                table = new InsideTable(tableNumber, capacity);
                break;

            case "Outside":
                table = new OutsideTable(tableNumber, capacity);
                break;
            }

            this.tables.Add(table);

            return($"Added table number {table.TableNumber} in the restaurant");
        }
Example #20
0
        public ITable CreateTables(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            if (type == "Inside")
            {
                table = new InsideTable(tableNumber, capacity);
            }
            else if (type == "Outside")
            {
                table = new OutsideTable(tableNumber, capacity);
            }
            else
            {
                throw new InvalidOperationException("Invalid table type!");
            }

            return(table);
        }
Example #21
0
        //Tова е фактори без рефлекшън.
        public ITable CtreatTable(string type, int tableNumber, int capacity)
        {
            ITable table;

            switch (type)
            {
            case "Inside":
                table = new InsideTable(tableNumber, capacity);
                break;

            case "Outside":
                table = new OutsideTable(tableNumber, capacity);
                break;

            default: table = null;
                break;
            }

            return(table);
        }
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            switch (type.ToLower())
            {
            case "inside":
                table = new InsideTable(tableNumber, capacity);
                break;

            case "outside":
                table = new OutsideTable(tableNumber, capacity);
                break;

            default: throw new ArgumentException($"Invalid table type {type}!");
            }

            this.tables.Add(table);
            return($"Added table number {table.TableNumber} in the restaurant");
        }
Example #23
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            if (type != "InsideTable" && type != "OutsideTable")
            {
                throw new ArgumentException();
            }

            Table table = null;

            if (type == "InsideTable")
            {
                table = new InsideTable(tableNumber, capacity);
            }

            if (type == "OutsideTable")
            {
                table = new OutsideTable(tableNumber, capacity);
            }

            this.tables.Add(table);
            return(String.Format(OutputMessages.TableAdded, tableNumber));
        }
Example #24
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            Table table = null;

            if (type == "InsideTable")
            {
                table = new InsideTable(tableNumber, capacity);
            }
            else if (type == "OutsideTable")
            {
                table = new OutsideTable(tableNumber, capacity);
            }

            if (table != null)
            {
                tables.Add(table);

                return($"Added table number {tableNumber} in the bakery");
            }

            return(null); // To be checked later!
        }
Example #25
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            if (type == "InsideTable" || type == "OutsideTable")
            {
                ITable table = null;

                switch (type)
                {
                case "InsideTable":
                    table = new InsideTable(tableNumber, capacity);
                    break;

                case "OutsideTable":
                    table = new OutsideTable(tableNumber, capacity);
                    break;
                }

                tables.Add(table);
                return(String.Format(OutputMessages.TableAdded, tableNumber));
            }
            return(null);
        }
Example #26
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            switch (type)
            {
            case nameof(InsideTable):
                table = new InsideTable(tableNumber, capacity);
                break;

            case nameof(OutsideTable):
                table = new OutsideTable(tableNumber, capacity);
                break;
            }
            if (table == null)
            {
                return("NotGooooodTableee");
            }

            this.tables.Add(table);

            return($"Added table number {tableNumber} in the bakery");
        }
Example #27
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = null;

            if (type.ToLower() == "insidetable")
            {
                table = new InsideTable(tableNumber, capacity);
            }
            else if (type.ToLower() == "outsidetable")
            {
                table = new OutsideTable(tableNumber, capacity);
            }

            if (table != null)
            {
                this.tables.Add(table);
                return(String.Format(OutputMessages.TableAdded, table.TableNumber));
            }
            else
            {
                throw new ArgumentNullException();
            }
        }
        public string AddTable(string type, int tableNumber, int capacity)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();

            var currentType = assembly.GetTypes().FirstOrDefault(x => x.Name == type);

            object[] args = { tableNumber, capacity };


            var table = (ITable)Activator.CreateInstance(currentType, args);

            if (type == "InsideTable")
            {
                table = new InsideTable(tableNumber, capacity);
            }
            else if (type == "OutsideTable")
            {
                table = new OutsideTable(tableNumber, capacity);
            }

            this.tables.Add(table);

            return($"Added table number {tableNumber} in the bakery");
        }