当前位置: 首页>>代码示例>>C#>>正文


C# ResultSet.FindRow方法代码示例

本文整理汇总了C#中ResultSet.FindRow方法的典型用法代码示例。如果您正苦于以下问题:C# ResultSet.FindRow方法的具体用法?C# ResultSet.FindRow怎么用?C# ResultSet.FindRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ResultSet的用法示例。


在下文中一共展示了ResultSet.FindRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTimetableDetails

        // Used to get a dictionary of timetable details from the database
        public Dictionary<string, TimetableDetails> GetTimetableDetails(DateTime date)
        {
            string query = string.Format("Date = '{0}'", string.Format("{0:MM-dd-yy}", date));
            ResultSet timetableResults = new ResultSet(GetDataReader("[BusTripTable]", query)); // Search the database for all details relating to the specified date
            CloseConnection();

            Dictionary<string, TimetableDetails> details = new Dictionary<string, TimetableDetails>();

            string[] timeSlots = { "8.30 - 10.15", "2.00 - 3.45 ", "10.45 - 1.45", "4.00 - 7.00 " };

            for(int i = 0; i < timeSlots.Length; i++){ // Go through each possible timeslot and add the details about it to the details Dictionary

                TimetableDetails timetableDetails = new TimetableDetails();

                int row = timetableResults.FindRow<string>(2, timeSlots[i]); // Find the row which stores the data for this time slot

                if (row == -1) // If there is no-one registered for this time slot use the small bus
                {
                    timetableDetails.busUsed = "9 Person";
                    timetableDetails.seatsLeft = 24;
                    details.Add(timeSlots[i], timetableDetails);
                    continue;
                }

                if(timetableResults.GetData<int>(4, row) < 9) // If there are less than 9 people registered for this bus use the small bus
                {
                    timetableDetails.busUsed = "9 Person";
                }
                else if (timetableResults.GetData<int>(4, row) < 17) // If there are >= 9 and < 17 people use the bigger bus
                {
                    timetableDetails.busUsed = "17 Person";
                }
                else // If there are >= 17 people use both busses
                {
                    timetableDetails.busUsed = "Both";
                }

                timetableDetails.seatsLeft = 24 - timetableResults.GetData<int>(4, row); // calculate the seats left now that we have found the number of seats

                details.Add(timeSlots[i], timetableDetails); // Add these details to the dictionary

            } // End of the loop through all of the time slots

            return details;
        }
开发者ID:StefanKennedy,项目名称:NorthCoast,代码行数:46,代码来源:BusDAL.cs


注:本文中的ResultSet.FindRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。