Ejemplo n.º 1
0
        private void FoodDecision()
        {
            DateTime CurrentTime, OpenTime, ClosingTime, DinnerTime;

            string  dinnerTime = "3:00 pm";
            Boolean timefound  = false;


            CurrentTime = DateTime.Now;
            DinnerTime  = Convert.ToDateTime(dinnerTime); //dinnerTime
            OpenTime    = CurrentTime; ClosingTime = CurrentTime;


            mssg = String.Format("The Current Time: {0}", CurrentTime.ToString("t"));
            Debug.WriteLine(mssg);

            if (opentime.ToLower().Contains("am"))
            {
                OpenTime = Convert.ToDateTime(opentime);  // opentime  timeconv[0]
                mssg     = String.Format("The Open Time: {0}", OpenTime.ToString("t"));
                Debug.WriteLine(mssg);
            }

            if (closetime.ToLower().Contains("pm"))
            {
                ClosingTime = Convert.ToDateTime(closetime);  // opentime  timeconv[0]
                mssg        = String.Format("The Close Time: {0}", ClosingTime.ToString("t"));
                Debug.WriteLine(mssg);
            }

            if (!timefound && CurrentTime.TimeOfDay < OpenTime.TimeOfDay)
            {
                foodDecision = String.Format(" Oh No, Ted's not open yet! "); timefound = true;
            }
            if (!timefound && CurrentTime.TimeOfDay > ClosingTime.TimeOfDay)
            {
                foodDecision = String.Format(" Oh No, Ted's closed up! "); timefound = true;
            }

            if (!timefound && CurrentTime.TimeOfDay < DinnerTime.TimeOfDay)
            {
                foodDecision = String.Format(" It is time to go to Ted’s for lunch! "); timefound = true;
            }
            if (!timefound && CurrentTime.TimeOfDay > DinnerTime.TimeOfDay)
            {
                foodDecision = String.Format("It is time to go to Ted’s for dinner!"); timefound = true;
            }

            if (timefound)
            {
                Debug.WriteLine("The time selection chose foodDecision! ");
            }
            else
            {
                Debug.WriteLine(" The time remains uncertain ");
            }
        }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            var hashCode = 909073441;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + ActualPrice.GetHashCode();
            hashCode = hashCode * -1521134295 + IsOpened.GetHashCode();
            hashCode = hashCode * -1521134295 + ClosingTime.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Description);

            hashCode = hashCode * -1521134295 + EqualityComparer <Guid> .Default.GetHashCode(CategoryId);

            hashCode = hashCode * -1521134295 + EqualityComparer <Guid> .Default.GetHashCode(AccountId);

            return(hashCode);
        }