Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            var recruiterName = (Recruiter == null ? "None Assigned" : Recruiter.ToString());

            return($"InitialDate: {InitialDate.ToString(Common.Utilities.DateFormat)}, Recruiter: {recruiterName}, ApproachMethod: {ApproachMethod}");
        }
Ejemplo n.º 2
0
        private Grid RefreshGrid()
        {
            var newCalendarGrid = new Grid {
                RowSpacing = 1, ColumnSpacing = 1
            };

            newCalendarGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            newCalendarGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(0.5, GridUnitType.Star)
            });
            for (var i = 2; i <= 6; i++)
            {
                newCalendarGrid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }
            for (var i = 0; i <= 6; i++)
            {
                newCalendarGrid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
            }
            var firstDayOfMonth = new DateTime(InitialDate.Year, InitialDate.Month, 1);
            var dayOfWeekEU     = firstDayOfMonth.DayOfWeek == 0 ? 7 : (int)firstDayOfMonth.DayOfWeek;
            var currCalDay      = firstDayOfMonth.AddDays(-dayOfWeekEU + 1);
            var leftButton      = new Button {
                Text = "<", Style = UnselectedDateStyle, IsEnabled = true
            };

            leftButton.Clicked += LeftButtonClicked;
            newCalendarGrid.Children.Add(leftButton, 0, 0);
            var rightButton = new Button {
                Text = ">", Style = UnselectedDateStyle, IsEnabled = true
            };

            rightButton.Clicked += RigthButtonClicked;
            newCalendarGrid.Children.Add(rightButton, 6, 0);
            bool IsEnabled = true;

            for (var y = 2; y <= 7; y++)
            {
                for (var x = 0; x <= 6; x++)
                {
                    if (y == 2)
                    {
                        var dayOfWeekLabel = new Label()
                        {
                            VerticalTextAlignment   = TextAlignment.Center,
                            HorizontalTextAlignment = TextAlignment.Center,
                            Text = currCalDay.ToString("ddd")
                        };
                        newCalendarGrid.Children.Add(dayOfWeekLabel, x, 1);
                    }
                    ;
                    if (HideOtherMonthsDates && currCalDay.Month != InitialDate.Month)
                    {
                        currCalDay = currCalDay.AddDays(1);
                        continue;
                    }


                    IsEnabled = currCalDay.Month == InitialDate.Month;

                    int currentDayOfWeek = Convert.ToInt32(Math.Pow(2, (double)currCalDay.DayOfWeek));
                    var buttonStyle      = ((currentDayOfWeek & WeeklyHolydays) > 0) ? HolydayStyle : UnselectedDateStyle;

                    //TODO need check with Resharper
                    buttonStyle = (UnplannedWorkingDays?.Contains(currCalDay) ?? false) ? UnselectedDateStyle : buttonStyle;
                    buttonStyle = (UnplannedHolydays?.Contains(currCalDay) ?? false) ? HolydayStyle : buttonStyle;

                    var dateButton = new Button {
                        Text = currCalDay.Day.ToString(), Style = buttonStyle, IsEnabled = IsEnabled
                    };
                    dateButton.Clicked += DateClicked;
                    newCalendarGrid.Children.Add(dateButton, x, y);
                    currCalDay = currCalDay.AddDays(1);
                }
            }

            var monthLabel = new Label
            {
                Text = InitialDate.ToString("MMMM yyyy"),
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                TextColor = Color.Black,
                FontSize  = 20
            };

            newCalendarGrid.Children.Add(monthLabel, 1, 0);
            Grid.SetColumnSpan(monthLabel, 5);
            return(newCalendarGrid);
        }