Example #1
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Please tell me what day of the week it is today");
                string input = Console.ReadLine().ToLower();
                //Console.WriteLine(DayOfTheWeek.IsDefined(typeof(DayOfTheWeek), input));
                DayOfTheWeek day = (DayOfTheWeek)Enum.Parse(typeof(DayOfTheWeek), input);

                Console.WriteLine("\nThank you, the day for today is set to: " + day.ToString());
            }
            catch (ArgumentException e)
            {
                Console.WriteLine("Not a valid enum: " + e.Message);
            }
            catch (Exception e)
            {
                Console.WriteLine("Something went wrong: " + e.Message);
            }
            finally
            {
                Console.WriteLine("\nThis is the end of the program, press enter to exit");
                Console.ReadLine();
            }
        }
Example #2
0
        public void Delete(int id)
        {
            DayOfTheWeek day = _db.DayOfTheWeek.Find(id);

            _db.DayOfTheWeek.Remove(day);
            _db.SaveChanges();
        }
Example #3
0
        public PartialViewResult GetSchedules(int[] stations, DateTime date)
        {
            try
            {
                ViewBag.Date = date;
                if (date < DateTime.Today)
                {
                    return(PartialView("_getSchedules", new List <ScheduleTravelClass>()));
                }

                int          fromId = stations[0];
                int          toId   = stations[1];
                int          from   = Convert.ToInt32(Location.From);
                int          to     = Convert.ToInt32(Location.To);
                DayOfTheWeek day    = db.DayOfTheWeeks.Where(x => x.Name.Equals(date.DayOfWeek.ToString())).Single();
                //var schedules = db.Schedules.Where(x => x.FromStationId == stations[0] && x.ToStationId == stations[1]).ToList();
                // var schedules = db.Schedules.Where(x => x.FromStationId == stations[0] && x.ToStationId == stations[1]).ToList();
                var schedules = db.Schedules.Where(x => x.ScheduleStations.Any(y => y.StationId == fromId && y.Location == from) &&
                                                   x.ScheduleStations.Any(y => y.StationId == toId && y.Location == to)).ToList();
                var daySchedules = schedules.Where(x => x.ScheduleDayOfTheWeeks.Any(y => y.DayOfTheWeek == day)).ToList();
                List <ScheduleTravelClass> scheduleTravelClasses = new List <ScheduleTravelClass>();
                foreach (var item in daySchedules)
                {
                    scheduleTravelClasses.AddRange(item.ScheduleTravelClasses);
                }

                return(PartialView("_getSchedules", scheduleTravelClasses));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #4
0
        private void AddSession(InstrumentSession session = null)
        {
            if (session != null)
            {
                Sessions.Add(new SessionViewModel(session));
                Model.Sessions.Add(session);
                return;
            }

            var toAdd = new InstrumentSession {
                IsSessionEnd = true
            };

            if (Sessions.Count == 0)
            {
                toAdd.OpeningDay = DayOfTheWeek.Monday;
                toAdd.ClosingDay = DayOfTheWeek.Monday;
            }
            else
            {
                DayOfTheWeek maxDay = (DayOfTheWeek)Math.Min(6, Sessions.Max(x => (int)x.OpeningDay) + 1);
                toAdd.OpeningDay = maxDay;
                toAdd.ClosingDay = maxDay;
            }
            Sessions.Add(new SessionViewModel(toAdd));
            Model.Sessions.Add(toAdd);
        }
        public static string ToPolishString(this DayOfTheWeek dayOfTheWeek)
        {
            switch (dayOfTheWeek)
            {
            case DayOfTheWeek.Monday:
                return("Poniedziałek");

            case DayOfTheWeek.Tuesday:
                return("Wtorek");

            case DayOfTheWeek.Wednesday:
                return("Środa");

            case DayOfTheWeek.Thursday:
                return("Czwartek");

            case DayOfTheWeek.Friday:
                return("Piątek");

            case DayOfTheWeek.Saturday:
                return("Sobota");

            case DayOfTheWeek.Sunday:
                return("Niedziela");

            default:
                return("default");
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            DayOfTheWeek day = new DayOfTheWeek();

            Console.WriteLine(day["Sun"]);
            Console.ReadKey();
        }
Example #7
0
        public static int ToInt(this DayOfTheWeek dayOfTheWeek)
        {
            int dayIndex = (int)dayOfTheWeek - (int)CalendarScheme.FirstDayOfTheWeek;

            dayIndex = dayIndex.DMod(7);
            return(dayIndex + 1);
        }
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.Bias:
                    this.delta = TimeSpan.FromMinutes(jsonProperty.ReadAsInt(key));
                    break;

                case XmlElementNames.Time:
                    this.timeOfDay = TimeSpan.Parse(jsonProperty.ReadAsString(key));
                    break;

                case XmlElementNames.DayOrder:
                    this.dayOrder = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.DayOfWeek:
                    this.dayOfTheWeek = jsonProperty.ReadEnumValue <DayOfTheWeek>(key);
                    break;

                case XmlElementNames.Month:
                    this.month = jsonProperty.ReadAsInt(key);
                    break;

                case XmlElementNames.Year:
                    this.year = jsonProperty.ReadAsInt(key);
                    break;

                default:
                    break;
                }
            }
        }
Example #9
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            if (!timer.Enabled)
            {
                int minutesLeft = (int)numericUpDownMinutes.Value;
                int secondsLeft = (int)numericUpDownSeconds.Value;

                _totalTimeLeft = new TimeSpan(0, minutesLeft, secondsLeft);
                _totalTimerRight = new TimeSpan(0, 0, 0);
                
                buttonStart.Text = "Стоп";
                timer.Enabled = true;
                int d = (int) DateTime.Now.DayOfWeek;
                DayOfWeek k = (DayOfWeek)DateTime.Now.DayOfWeek;
                DayOfTheWeek dayOfTheWeek = new DayOfTheWeek();
               
                label1.Text = dayOfTheWeek.Day(k);
                label4.Text = d.ToString();
                //label1.Text = k.ToString()
            }
            else
            {
                timer.Enabled = false;
                buttonStart.Text = "Пуск";
            }
            
        }
Example #10
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.Bias:
            this.delta = TimeSpan.FromMinutes(reader.ReadElementValue <int>());
            return(true);

        case XmlElementNames.Time:
            this.timeOfDay = TimeSpan.Parse(reader.ReadElementValue());
            return(true);

        case XmlElementNames.DayOrder:
            this.dayOrder = reader.ReadElementValue <int>();
            return(true);

        case XmlElementNames.DayOfWeek:
            this.dayOfTheWeek = reader.ReadElementValue <DayOfTheWeek>();
            return(true);

        case XmlElementNames.Month:
            this.month = reader.ReadElementValue <int>();
            return(true);

        case XmlElementNames.Year:
            this.year = reader.ReadElementValue <int>();
            return(true);

        default:
            return(false);
        }
    }
Example #11
0
 public void AdjustMonth(DayOfTheWeek delayDay)
 {
     for (int i = 0; i < Days.Count; i++)
     {
         Days[i].dayName = (Days[i].dayName + Convert.ToInt32(delayDay));
         if ((Convert.ToInt32(Days[i].dayName) % 7) == 0)
         {
             Days[i].dayName = DayOfTheWeek.Sun;
         }
         if ((Convert.ToInt32(Days[i].dayName) % 7) == 1)
         {
             Days[i].dayName = DayOfTheWeek.Mon;
         }
         if ((Convert.ToInt32(Days[i].dayName) % 7) == 2)
         {
             Days[i].dayName = DayOfTheWeek.Tue;
         }
         if ((Convert.ToInt32(Days[i].dayName) % 7) == 3)
         {
             Days[i].dayName = DayOfTheWeek.Wed;
         }
         if ((Convert.ToInt32(Days[i].dayName) % 7) == 4)
         {
             Days[i].dayName = DayOfTheWeek.Thu;
         }
         if ((Convert.ToInt32(Days[i].dayName) % 7) == 5)
         {
             Days[i].dayName = DayOfTheWeek.Fri;
         }
         if ((Convert.ToInt32(Days[i].dayName) % 7) == 6)
         {
             Days[i].dayName = DayOfTheWeek.Sat;
         }
     }
 }
Example #12
0
        public MainScreen()
        {
            InitializeComponent();

            //_timeTable.Columns.Add(new DataColumn("교시", typeof(string)));
            //_timeTable.Columns.Add(new DataColumn("           월            ", typeof(string)));
            //_timeTable.Columns.Add(new DataColumn("           화            ", typeof(string)));
            //_timeTable.Columns.Add(new DataColumn("           수            ", typeof(string)));
            //_timeTable.Columns.Add(new DataColumn("           목            ", typeof(string)));
            //_timeTable.Columns.Add(new DataColumn("           금            ", typeof(string)));
            //_timeTable.Rows.Add("\n\n1\n\n");
            //_timeTable.Rows.Add("\n\n2\n\n");
            //_timeTable.Rows.Add("\n\n3\n\n");
            //_timeTable.Rows.Add("\n\n4\n\n");
            //_timeTable.Rows.Add("\n\n5\n\n");
            //_timeTable.Rows.Add("\n\n6\n\n");
            //_timeTable.Rows.Add("\n\n7\n\n");
            //_timeTable.Rows.Add("\n\n8\n\n");
            //_timeTable.Rows.Add("\n\n9\n\n");
            //_timeTable.Rows.Add("\n\n10\n\n");
            //_timeTable.Rows.Add("\n\n11\n\n");
            //_timeTable.Rows.Add("\n\n12\n\n");
            DayOfTheWeek a = new DayOfTheWeek("1", null, null, null, null, null, null);

            DayList.Add(a);
            DayOfTheWeek b = new DayOfTheWeek("2", null, null, null, null, null, null);

            DayList.Add(b);
            DayOfTheWeek c = new DayOfTheWeek("3", null, null, null, null, null, null);

            DayList.Add(c);
            DayOfTheWeek d = new DayOfTheWeek("4", null, null, null, null, null, null);

            DayList.Add(d);
            DayOfTheWeek e = new DayOfTheWeek("5", null, null, null, null, null, null);

            DayList.Add(e);
            DayOfTheWeek f = new DayOfTheWeek("6", null, null, null, null, null, null);

            DayList.Add(f);
            DayOfTheWeek g = new DayOfTheWeek("7", null, null, null, null, null, null);

            DayList.Add(g);
            DayOfTheWeek h = new DayOfTheWeek("8", null, null, null, null, null, null);

            DayList.Add(h);
            DayOfTheWeek i = new DayOfTheWeek("9", null, null, null, null, null, null);

            DayList.Add(i);
            DayOfTheWeek j = new DayOfTheWeek("10", null, null, null, null, null, null);

            DayList.Add(j);
            DayOfTheWeek k = new DayOfTheWeek("11", null, null, null, null, null, null);

            DayList.Add(k);
            DayOfTheWeek l = new DayOfTheWeek("12", null, null, null, null, null, null);

            DayList.Add(l);
            TimeTable.ItemsSource = DayList;
        }
Example #13
0
 public Purchase(string name, int price, int quantity, DayOfTheWeek day)
 {
     this.name     = name;
     this.price    = price;
     this.quantity = quantity;
     this.day      = day;
 }
Example #14
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            if (!timer.Enabled)
            {
                int minutesLeft = (int)numericUpDownMinutes.Value;
                int secondsLeft = (int)numericUpDownSeconds.Value;

                _totalTimeLeft   = new TimeSpan(0, minutesLeft, secondsLeft);
                _totalTimerRight = new TimeSpan(0, 0, 0);

                buttonStart.Text = "Стоп";
                timer.Enabled    = true;
                int          d            = (int)DateTime.Now.DayOfWeek;
                DayOfWeek    k            = (DayOfWeek)DateTime.Now.DayOfWeek;
                DayOfTheWeek dayOfTheWeek = new DayOfTheWeek();

                label1.Text = dayOfTheWeek.Day(k);
                label4.Text = d.ToString();
                //label1.Text = k.ToString()
            }
            else
            {
                timer.Enabled    = false;
                buttonStart.Text = "Пуск";
            }
        }
Example #15
0
        public static DayOfWeek ToDayOfWeek(this DayOfTheWeek dayOfTheWeek)
        {
            switch (dayOfTheWeek)
            {
            case DayOfTheWeek.Monday:
                return(DayOfWeek.Monday);

            case DayOfTheWeek.Tuesday:
                return(DayOfWeek.Tuesday);

            case DayOfTheWeek.Wednesday:
                return(DayOfWeek.Wednesday);

            case DayOfTheWeek.Thursday:
                return(DayOfWeek.Thursday);

            case DayOfTheWeek.Friday:
                return(DayOfWeek.Friday);

            case DayOfTheWeek.Saturday:
                return(DayOfWeek.Saturday);

            case DayOfTheWeek.Sunday:
                return(DayOfWeek.Sunday);

            default:
                throw new InvalidEnumArgumentException(nameof(dayOfTheWeek), (int)dayOfTheWeek, dayOfTheWeek.GetType());
            }
        }
Example #16
0
        public PartialViewResult GetSchedulesForBooking(int[] stations, DateTime date)
        {
            try
            {
                ViewBag.Date = date;
                if (date < DateTime.Today)
                {
                    return(PartialView("_getBookingSchedules", new List <ScheduleTravelClass>()));
                }

                int          fromId         = stations[0];
                int          toId           = stations[1];
                int          from           = Convert.ToInt32(Location.From);
                int          to             = Convert.ToInt32(Location.To);
                DayOfTheWeek day            = db.DayOfTheWeeks.Where(x => x.Name.Equals(date.DayOfWeek.ToString())).Single();
                var          paymentMethods = new SelectList(db.PaymentMethods.Where(x => x.IsActive).AsEnumerable(), "Id", "Name");
                ViewBag.PaymentMethodId = paymentMethods;

                var schedules = db.Schedules.Where(x => x.IsActive && x.ScheduleStations.Any(y => y.StationId == fromId && y.Location == from) &&
                                                   x.ScheduleStations.Any(y => y.StationId == toId && y.Location == to)).ToList();
                var daySchedules = schedules.Where(x => x.ScheduleDayOfTheWeeks.Any(y => y.DayOfTheWeek == day)).ToList();
                List <ScheduleTravelClass> scheduleTravelClasses = new List <ScheduleTravelClass>();
                foreach (var item in daySchedules)
                {
                    scheduleTravelClasses.AddRange(item.ScheduleTravelClasses);
                }

                return(PartialView("_getBookingSchedules", scheduleTravelClasses));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #17
0
    /// <summary>
    /// Initializes a new instance of the <see cref="LegacyAvailabilityTimeZoneTime"/> class.
    /// </summary>
    /// <param name="transitionTime">The transition time used to initialize this instance.</param>
    /// <param name="delta">The offset used to initialize this instance.</param>
    LegacyAvailabilityTimeZoneTime(TimeZoneInfo.TransitionTime transitionTime, TimeSpan delta)
        : this()
    {
        this.delta = delta;

        if (transitionTime.IsFixedDateRule)
        {
            // TimeZoneInfo doesn't support an actual year. Fixed date transitions occur at the same
            // date every year the adjustment rule the transition belongs to applies. The best thing
            // we can do here is use the current year.
            this.year      = DateTime.Today.Year;
            this.month     = transitionTime.Month;
            this.dayOrder  = transitionTime.Day;
            this.timeOfDay = transitionTime.TimeOfDay.TimeOfDay;
        }
        else
        {
            // For floating rules, the mapping is direct.
            this.year         = 0;
            this.month        = transitionTime.Month;
            this.dayOfTheWeek = EwsUtilities.SystemToEwsDayOfTheWeek(transitionTime.DayOfWeek);
            this.dayOrder     = transitionTime.Week;
            this.timeOfDay    = transitionTime.TimeOfDay.TimeOfDay;
        }
    }
Example #18
0
        public async Task <IActionResult> Edit(Guid id, [Bind("DayOfTheWeekId,Name")] DayOfTheWeek dayOfTheWeek)
        {
            if (id != dayOfTheWeek.DayOfTheWeekId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dayOfTheWeek);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DayOfTheWeekExists(dayOfTheWeek.DayOfTheWeekId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dayOfTheWeek));
        }
Example #19
0
 private void FridayChecked(object sender, RoutedEventArgs e)
 {
     DayOutput.Text = "Freitag";
     CurrDay        = DayOfTheWeek.Friday;
     FillEntrys();
     ReCalcAndUpdateInfoLine();
 }
Example #20
0
 private void WednsdayChecked(object sender, RoutedEventArgs e)
 {
     DayOutput.Text = "Mittwoch";
     CurrDay        = DayOfTheWeek.Wednesday;
     FillEntryTable();
     ReCalcAndUpdateInfoLine();
 }
Example #21
0
 private void MondayChecked(object sender, RoutedEventArgs e)
 {
     CurrDay        = DayOfTheWeek.Monday;
     DayOutput.Text = "Montag";
     FillEntrys();
     ReCalcAndUpdateInfoLine();
 }
Example #22
0
        public static string ToPolishString(this DayOfTheWeek enumDayOfTheWeek)
        {
            switch (enumDayOfTheWeek)
            {
            case 0:
                return("Poniedziałek");

            case (DayOfTheWeek)1:
                return("Wtorek");

            case (DayOfTheWeek)2:
                return("Środa");

            case (DayOfTheWeek)3:
                return("Czwartek");

            case (DayOfTheWeek)4:
                return("Piątek");

            case (DayOfTheWeek)5:
                return("Sobota");

            case (DayOfTheWeek)6:
                return("Niedziela");

            default:
                return("poniedziałek");
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LegacyAvailabilityTimeZoneTime"/> class.
        /// </summary>
        /// <param name="transitionTime">The transition time used to initialize this instance.</param>
        /// <param name="delta">The offset used to initialize this instance.</param>
        internal LegacyAvailabilityTimeZoneTime(TimeZoneInfo.TransitionTime transitionTime, TimeSpan delta)
            : this()
        {
            this.delta = delta;

            if (transitionTime.IsFixedDateRule)
            {
                // TimeZoneInfo doesn't support an actual year. Fixed date transitions occur at the same
                // date every year the adjustment rule the transition belongs to applies. The best thing
                // we can do here is use the current year.
                this.year = DateTime.Today.Year;
                this.month = transitionTime.Month;
                this.dayOrder = transitionTime.Day;
                this.timeOfDay = transitionTime.TimeOfDay.TimeOfDay;
            }
            else
            {
                // For floating rules, the mapping is direct.
                this.year = 0;
                this.month = transitionTime.Month;
                this.dayOfTheWeek = EwsUtilities.SystemToEwsDayOfTheWeek(transitionTime.DayOfWeek);
                this.dayOrder = transitionTime.Week;
                this.timeOfDay = transitionTime.TimeOfDay.TimeOfDay;
            }
        }
Example #24
0
 private void SundayChecked(object sender, RoutedEventArgs e)
 {
     DayOutput.Text = "Sonntag";
     CurrDay        = DayOfTheWeek.Sunday;
     FillEntryTable();
     ReCalcAndUpdateInfoLine();
 }
Example #25
0
        public void ShouldReturnNextYear(Month month, DayOfTheWeek day, DayOfTheWeekIndex index, string expected)
        {
            var date         = DateTime.Parse("2017-01-01");
            var expectedDate = DateTime.Parse(expected);
            var actual       = date.AddRelativeYears(1, month, day, index);

            Assert.Equal(expectedDate, actual);
        }
Example #26
0
 public EulerDate(int year, int month, int day, DayOfTheWeek dayOfTheWeek, DateTime upperBound)
 {
     Day          = day;
     Month        = month.ToMonth();
     Year         = year;
     DayOfTheWeek = dayOfTheWeek;
     UpperBound   = upperBound;
 }
Example #27
0
        public void ShouldReturnNextMonth(DayOfTheWeek day, DayOfTheWeekIndex index, string from, string expected)
        {
            var date         = DateTime.Parse(from);
            var expectedDate = DateTime.Parse(expected);
            var actual       = date.AddRelativeMonths(1, day, index);

            Assert.Equal(expectedDate, actual);
        }
 public Criteria(Color color, Country country, Town town, GoodBad goodBad, DayOfTheWeek dayOfTheWeek, Daytime daytime)
 {
     this.Color        = color;
     this.Country      = country;
     this.Town         = town;
     this.GoodBad      = goodBad;
     this.DayOfTheWeek = dayOfTheWeek;
     this.Daytime      = daytime;
 }
Example #29
0
        public void Constructor_StoresDate_Date()
        {
            string       date = "5/13/2020";
            DayOfTheWeek day  = new DayOfTheWeek(date);

            string result = day.Date;

            Assert.AreEqual(result, date);
        }
Example #30
0
 public void CalculateDayOfTheWeek()  //bedziemy obliczac dzień na podstawie daty
 {
     if (UserDateOfBirth == null)
     {
         Console.WriteLine("Próbowano obliczyć dzień tygodnia bez podania daty");
         return;
     }
     UserDayOfTheWeek = Calculator.CalculateDayOfTheWeek(UserDateOfBirth);
 }
Example #31
0
 /// <summary>
 /// Generates the days into the week
 /// </summary>
 private static void GenerateDaysOfThWeekAndAddToWeek()
 {//There ist a better solution (Gernerating dynamic) F**k BackEnd
     for (int i = 0; i < 7; i++)
     {
         Day d = new Day((DayOfTheWeek)i);
         CurrWeek.AddDay(d);
     }
     CurrDay = DayOfTheWeek.Monday;
 }
Example #32
0
        public void CalculateDayOfTheWeek()
        {
            if (UserDateOdBirth == null)
            {
                Console.WriteLine("starano się obliczyć dzień tygodnia bez podania daty urodzenia");
            }

            UserDayOfTheWeek = Calculator.CalculateDayOfTheWeek(UserDateOdBirth);
        }
        /// <summary>
        /// Initializes this transition based on the specified transition time.
        /// </summary>
        /// <param name="transitionTime">The transition time to initialize from.</param>
        internal override void InitializeFromTransitionTime(TimeZoneInfo.TransitionTime transitionTime)
        {
            base.InitializeFromTransitionTime(transitionTime);

            this.dayOfTheWeek = EwsUtilities.SystemToEwsDayOfTheWeek(transitionTime.DayOfWeek);

            // TimeZoneInfo uses week indices from 1 to 5, 5 being the last week of the month.
            // EWS uses -1 to denote the last week of the month.
            this.weekIndex = transitionTime.Week == 5 ? -1 : transitionTime.Week;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RelativeMonthlyPattern"/> class.
 /// </summary>
 /// <param name="startDate">The date and time when the recurrence starts.</param>
 /// <param name="interval">The number of months between each occurrence.</param>
 /// <param name="dayOfTheWeek">The day of the week each occurrence happens.</param>
 /// <param name="dayOfTheWeekIndex">The relative position of the day within the month.</param>
 public RelativeMonthlyPattern(
     DateTime startDate,
     int interval,
     DayOfTheWeek dayOfTheWeek,
     DayOfTheWeekIndex dayOfTheWeekIndex)
     : base(startDate, interval)
 {
     this.DayOfTheWeek = dayOfTheWeek;
     this.DayOfTheWeekIndex = dayOfTheWeekIndex;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeChangeRecurrence"/> class.
 /// </summary>
 /// <param name="dayOfTheWeekIndex">The index of the day in the month at which the time change occurs.</param>
 /// <param name="dayOfTheWeek">The day of the week the time change occurs.</param>
 /// <param name="month">The month the time change occurs.</param>
 public TimeChangeRecurrence(
     DayOfTheWeekIndex dayOfTheWeekIndex,
     DayOfTheWeek dayOfTheWeek,
     Month month)
     : this()
 {
     this.dayOfTheWeekIndex = dayOfTheWeekIndex;
     this.dayOfTheWeek = dayOfTheWeek;
     this.month = month;
 }
    static void Main(string[] args)
    {
        Console.Title = "Day of the week";

        DayOfTheWeek now = new DayOfTheWeek();

        Console.ForegroundColor = ConsoleColor.Yellow;
        Console.WriteLine("Current day of the week is {0}", now.Day);
        
        Console.WriteLine();
        Console.ResetColor();
    }
Example #37
0
 public Form1()
 {
     InitializeComponent();
     labelTime.Text = DateTime.Now.ToLongTimeString();
     timer.Tick += new EventHandler(ShowTime);
     timer.Interval = 1000;
     timer.Start();
     labelDate.Text = DateTime.Now.ToLongDateString();
      DayOfWeek k = (DayOfWeek)DateTime.Now.DayOfWeek;
         DayOfTheWeek dayOfTheWeek = new DayOfTheWeek();
     labelDay.Text = dayOfTheWeek.Day(k);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RelativeYearlyPattern"/> class.
 /// </summary>
 /// <param name="startDate">The date and time when the recurrence starts.</param>
 /// <param name="month">The month of the year each occurrence happens.</param>
 /// <param name="dayOfTheWeek">The day of the week each occurrence happens.</param>
 /// <param name="dayOfTheWeekIndex">The relative position of the day within the month.</param>
 public RelativeYearlyPattern(
     DateTime startDate,
     Month month,
     DayOfTheWeek dayOfTheWeek,
     DayOfTheWeekIndex dayOfTheWeekIndex)
     : base(startDate)
 {
     this.Month = month;
     this.DayOfTheWeek = dayOfTheWeek;
     this.DayOfTheWeekIndex = dayOfTheWeekIndex;
 }
 /// <summary>
 /// Tries to read element from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>True if element was read.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     if (base.TryReadElementFromXml(reader))
     {
         return true;
     }
     else
     {
         switch (reader.LocalName)
         {
             case XmlElementNames.DayOfWeek:
                 this.dayOfTheWeek = reader.ReadElementValue<DayOfTheWeek>();
                 return true;
             case XmlElementNames.Occurrence:
                 this.weekIndex = reader.ReadElementValue<int>();
                 return true;
             default:
                 return false;
         }
     }
 }
 /// <summary>
 /// Tries to read element from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>True if element was read.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.Bias:
             this.delta = TimeSpan.FromMinutes(reader.ReadElementValue<int>());
             return true;
         case XmlElementNames.Time:
             this.timeOfDay = TimeSpan.Parse(reader.ReadElementValue());
             return true;
         case XmlElementNames.DayOrder:
             this.dayOrder = reader.ReadElementValue<int>();
             return true;
         case XmlElementNames.DayOfWeek:
             this.dayOfTheWeek = reader.ReadElementValue<DayOfTheWeek>();
             return true;
         case XmlElementNames.Month:
             this.month = reader.ReadElementValue<int>();
             return true;
         case XmlElementNames.Year:
             this.year = reader.ReadElementValue<int>();
             return true;
         default:
             return false;
     }
 }