Ejemplo n.º 1
0
        private void FilterValueDateBox_OnDateIntervalChanged(object sender, EventArgs e)
        {
            DateIntervalInputBox inputBox = sender as DateIntervalInputBox;

            if (inputBox != null)
            {
                SelectedFilterValue = inputBox.DateInterval.ToString();
            }
        }
Ejemplo n.º 2
0
        private void ChangedValue(DatePartTextBox t, TextBoxType tType, bool positiveIncrement, int currentValue)
        {
            if (Int32.TryParse(t.Text, out currentValue))
            {
                switch (tType)
                {
                case TextBoxType.Year:
                    if (positiveIncrement)
                    {
                        t.Text = (currentValue + 1).ToString();
                    }
                    else
                    {
                        if (currentValue > 1900)
                        {
                            t.Text = (currentValue - 1).ToString();
                        }
                    }
                    break;

                case TextBoxType.Month:
                    if (positiveIncrement)
                    {
                        if (currentValue < 12)
                        {
                            t.Text = (currentValue + 1).ToString();
                        }
                    }
                    else
                    {
                        if (currentValue > 1)
                        {
                            t.Text = (currentValue - 1).ToString();
                        }
                    }
                    break;

                case TextBoxType.Day:
                {
                    if (positiveIncrement && PartDetail != null)
                    {
                        DateIntervalInputBox dBox = PartDetail as DateIntervalInputBox;
                        if (dBox != null)
                        {
                            if (IsStart)
                            {
                                int daysInMonth = DateTime.DaysInMonth(dBox.DateInterval.StartDateParts.Year, dBox.DateInterval.StartDateParts.Month);
                                if (currentValue < daysInMonth)
                                {
                                    t.Text = (currentValue + 1).ToString();
                                }
                            }
                            else
                            {
                                int daysInMonth = DateTime.DaysInMonth(dBox.DateInterval.EndDateParts.Year, dBox.DateInterval.EndDateParts.Month);
                                if (currentValue < daysInMonth)
                                {
                                    t.Text = (currentValue + 1).ToString();
                                }
                            }
                        }
                    }
                    else
                    {
                        if (currentValue > 1)
                        {
                            t.Text = (currentValue - 1).ToString();
                        }
                    }
                }
                break;
                }
            }

            t.SelectAll();
        }