Пример #1
0
        public MC2Value getdatetimecontrolyears(int startYear = -1, int endYear = -1)
        {
            var result = new DataTree();

            var now = MC2DateTimeValue.Now();

            int currentYear = now.Year;

            // Display previous year for january and february.
            if (startYear == -1)
            {
                startYear = (now.Month > 2) ? currentYear : currentYear - 1;
            }

            // Default to showing next year to future.
            if (endYear == -1)
            {
                endYear = currentYear + 1;
            }

            for (int i = startYear; i <= endYear; i++)
            {
                var yearNode = result.AddNodeWithIndex();
                yearNode.Value = i.ToString();
                if (i == currentYear)
                {
                    yearNode["selected"] = true;
                }
            }

            return(result);
        }
Пример #2
0
 public MC2Value addnodewithindex(DataTree datatree)
 {
     return(datatree.AddNodeWithIndex());
 }