Пример #1
0
            //NEW METHOD
            // a method that takes date as input
            // query where date==inputDate in the bookingsDetails
            //return list



            public Boolean overlap(ClassName comparing)
            {
                if (this.compareDates("" + comparing.dDate, "" + this.dDate))
                {
                    //NEW METHOD
                    // (query-- get list back) get list of dates in the bookingsdetail tb where the date== comparing.dDate
                    var list = GetBookings(comparing.dDate);

                    foreach (var item in list)
                    {
                        //change this.shour to item.shour... and the rest as well
                        if (comparing.sHour() < item.sHour() && (comparing.eHour() < item.sHour()))
                        {
                            return(false);
                        }
                        else if (comparing.sHour() == item.sHour() && comparing.sMinute() < item.sMinute() && (comparing.eHour() < item.sHour()))
                        {
                            return(false);
                        }
                        else if (comparing.sHour() < item.sHour() && (comparing.eHour() == item.sHour()) && comparing.eMinute() < item.eMinute())
                        {
                            return(false);
                        }
                        else if (comparing.sHour() == item.sHour() && comparing.sMinute() < item.sMinute() && (comparing.eHour() == item.sHour()) && comparing.eMinute() < item.eMinute())
                        {
                            return(false);
                        }
                        return(true);
                    }
                    //for loop of list// or foreach
                    //do this hour/min/sec
                }
                //if date doesnt exist then just add it
                return(false);
            }