Пример #1
0
        public void TotalBookBike()
        {
            TBikeDAL  MyDAL           = new TBikeDAL();
            DataTable ResultTableBike = MyDAL.ShowAllBikeTable();
            int       i            = 0;
            int       TotalCount   = 0;
            string    MostBookBike = "";
            string    BicycleName  = "";

            foreach (DataRow Row in ResultTableBike.Rows)
            {
                string    BicycleID   = Convert.ToString(ResultTableBike.Rows[i]["BicycleID"]);
                DataTable ResultTable = MyDAL.SelectBookingByMonthBicycle(BicycleID, datebymonth);
                int       MaxCounter  = 0;
                foreach (DataRow row in ResultTable.Rows)
                {
                    BicycleName = Convert.ToString(ResultTable.Rows[MaxCounter]["BicycleName"]);
                    MaxCounter++;
                }

                if (TotalCount < MaxCounter)
                {
                    TotalCount   = MaxCounter;
                    MostBookBike = BicycleName;
                }
                i++;
            }
            TBMostBook.Text = MostBookBike;
        }