public static void Main()
    {
        Table[] table = new Table[10];
        Random  r     = new Random();

        for (int i = 0; i < table.Length; i++)
        {
            int newWidth;
            int newHeight;

            if (i < 5)
            {
                newWidth  = r.Next(50, 201);
                newHeight = r.Next(50, 201);
                table[i]  = new Table(newWidth, newHeight);
            }
            else
            {
                newWidth  = r.Next(40, 121);
                newHeight = r.Next(40, 121);
                table[i]  = new CoffeeTable(newWidth, newHeight);
            }
        }

        for (int i = 0; i < table.Length; i++)
        {
            table[i].ShowData();
        }
    }
    public static void Main()
    {
        Table[] table = new Table[10];
        Random  r     = new Random();

        // Let's add data
        for (int i = 0; i < 5; i++)
        {
            table[i] = new Table(r.Next(50, 201), r.Next(50, 201));
        }
        for (int i = 5; i < 10; i++)
        {
            table[i] = new CoffeeTable(r.Next(40, 121), r.Next(40, 121));
        }

        // And display them in two different ways
        for (int i = 0; i < 10; i++)
        {
            table[i].ShowData();
        }
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(table[i].ToString());
        }
    }
Exemplo n.º 3
0
        public IActionResult Test2()
        {
            IDbConnection db = new SqlConnection("Server=GWJSN13\\SQLEXPRESS; Database=Coffee2; user id=admin; password=pass1;");

            db.Open();
            CoffeeTable.Delete(4);
            db.Close();
            return(View("Delete"));
        }
Exemplo n.º 4
0
        public IActionResult Detail(int ProductID)
        {
            IDbConnection db = new SqlConnection("Server=GWJSN13\\SQLEXPRESS; Database=Coffee2; user id=admin; password=pass1;");

            db.Open();
            CoffeeTable details = db.QuerySingle <CoffeeTable>($"SELECT * FROM CoffeeTable WHERE ProductID = {ProductID}");

            db.Close();
            return(View(details));
        }
Exemplo n.º 5
0
        public IActionResult Delete(long ProductID)
        {
            //IDbConnection db = new SqlConnection("Server=GWJSN13\\SQLEXPRESS; Database=Coffee2; user id=admin; password=pass1;");
            //db.Open();
            //CoffeeTable.Delete(ProductID);
            //db.Close();
            //return View("Add");

            CoffeeTable.Read(ProductID);
            CoffeeTable.Delete(ProductID);
            return(View("Delete"));
        }
Exemplo n.º 6
0
        public IActionResult Edit(long ProductID)
        {
            ViewBag.PageName = "Edit";
            CoffeeTable prod = CoffeeTable.Read(ProductID);

            ViewBag.ProductID          = prod.ProductID;
            ViewBag.ProductName        = prod.ProductName;
            ViewBag.ProductDescription = prod.Description;
            ViewBag.ProductPrice       = prod.Price;
            ViewBag.ProductCategory    = prod.Category;
            return(View("Add"));
        }
        public List <CoffeeTable> LoadTableList()
        {
            List <CoffeeTable> tableList = new List <CoffeeTable>();
            string             query     = "select * from CoffeeTable";
            DataTable          data      = ConnectDB.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                CoffeeTable table = new CoffeeTable(item);
                tableList.Add(table);
            }

            return(tableList);
        }
Exemplo n.º 8
0
        public IActionResult SaveNew(long productID, string productName, string productDescription, decimal productPrice, string productCategory)
        {
            if (productID >= 1)
            {
                CoffeeTable.Update(productID, productName, productDescription, productPrice, productCategory);
            }
            else
            {
                CoffeeTable.Create(productName, productDescription, productPrice, productCategory);
            }

            ViewBag.Message = "The Product has been saved.";
            List <CoffeeTable> prod = CoffeeTable.Read();

            return(View("Index", prod));
        }
Exemplo n.º 9
0
 //RUN THIS MAIN FUNCTION TO GET THE OUTPUTS FOR ALL OF THE ASSIGNMENT QUESTIONS
 public static void Main(string[] args){//MAIN FUNCTION MAIN FUNCTION
     CityDerivedClass ob = new CityDerivedClass(); ob.Anything();//END OF QUESTION #1
     
     CarOne car = new CarOne();
     Console.WriteLine($"" +
         $"CarColor: {car.CarColor()}\n" +
         $"CarEngine: {car.Engine()}\n" +
         $"CarTyre: {car.Tyre()}\n" +
         $"CarSoundSystem: {car.SoundSystem()}\n"
     );// END OF QUESTION #2
     
     FiveEmployees();// END OF QUESTION #3
     
     Algorithms algo = new Algorithms(); algo.diamond();// END OF QUESTION #4
     
     var vc = algo.CountVowelConsonant("Buffalo NewYork");
     Console.WriteLine($"Vowels: {vc["v"]} Consonants: {vc["c"]}");// END OF QUESTION #5
     
     var cw = algo.countWords("I am King Nordee; Son of Chief Amos A Nordee");
     Console.WriteLine($"wordCount: {cw}");// END OF QUESTION #6
     
     Stack<int> stack = new Stack<int>(); for(int i=0; i<10; i++) stack.Push(i);
     Console.WriteLine($"FoundInStack?: {algo.ProbeStack(stack, 8)}");// END OF QUESTION #7
     
     Console.WriteLine($"NumSum: {algo.NumSum(12345)}");// END OF QUESTION #8
     
     Console.WriteLine($"IsPalindrome: {algo.IsPalindrome(1111)}");// END OF QUESTION #9
     
     Console.WriteLine($"ToBinary: {algo.DecimalToBinary(100)}");// END OF QUESTION #10
     
     
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.WriteLine($"\nQuestion #11:");
     Console.ResetColor();
     var table = new Table();
     List<Table> tables = new List<Table>();
     for (int i = 0; i < 5; i++){ 
         var elem = new Table(); tables.Add(elem); 
         Console.WriteLine(elem.ShowData());
     } 
     var coffeeTable = new CoffeeTable();
     List<CoffeeTable> coffeeTables = new List<CoffeeTable>();
     for (int i = 0; i < 5; i++) {
         var elem = new CoffeeTable(); coffeeTables.Add(elem); 
         Console.WriteLine(elem.ShowData());
     }// END OF QUESTION #11
 }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            Random random = new Random();

            Table[] tables = new Table[10];
            for (int i = 0; i < 10; i++)
            {
                if (i < 5)
                {
                    tables[i] = new Table(random.Next(50, 200), random.Next(50, 200));
                    tables[i].ShowDetails();
                }
                else
                {
                    tables[i] = new CoffeeTable(random.Next(40, 120), random.Next(40, 120));
                    tables[i].ShowDetails();
                }
            }
        }
Exemplo n.º 11
0
        public override async void WillActivate()
        {
            base.WillActivate();

            await _coffeeService.InitializeAsync();

            this.CoffeeTable.SetNumberOfRows(_coffeeService.Count, "default");

            var records = _coffeeService.Records;

            int i = 0;

            foreach (var record in records)
            {
                var recordFields = record.fields;
                var coffeeName   = recordFields.nom_du_cafe;

                var rowController = (CoffeeTableRowController)CoffeeTable.GetRowController((nint)i);
                rowController.SetLabelText(coffeeName);

                i++;
            }
        }
Exemplo n.º 12
0
        //public IActionResult Index()
        //{
        //    List<CoffeeTable> prod = CoffeeTable.Read();
        //    return View(prod);
        //}

        public ActionResult Test()
        {
            List <CoffeeTable> prod = CoffeeTable.Read();

            return(View(prod));
        }
Exemplo n.º 13
0
 public FurnitureClient(Chair chair, Sofa sofa, CoffeeTable coffeeTable)
 {
     _chair       = chair;
     _sofa        = sofa;
     _coffeeTable = coffeeTable;
 }