本文整理汇总了C#中System.Globalization.GregorianCalendar.GetMonthsInYear方法的典型用法代码示例。如果您正苦于以下问题:C# GregorianCalendar.GetMonthsInYear方法的具体用法?C# GregorianCalendar.GetMonthsInYear怎么用?C# GregorianCalendar.GetMonthsInYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.GregorianCalendar
的用法示例。
在下文中一共展示了GregorianCalendar.GetMonthsInYear方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WorkYear
public WorkYear(int year, WorkDayParserSettings parserSettings, int hitListLookBackInWeeks, float hoursPerDay, PNSearchViewModel pnSearch, PositionSearchViewModel positionSearch)
{
this.hitListLookBackInWeeks = hitListLookBackInWeeks;
this.pnSearch = pnSearch;
this.positionSearch = positionSearch;
this.Year = year;
this.Months = new ObservableCollection<WorkMonth>();
this.Weeks = new ObservableCollection<WorkWeek>();
var germanSpecialDays = SpecialDaysUtils.GetGermanSpecialDays(year);
var cal = new GregorianCalendar();
for (int month = 1; month <= cal.GetMonthsInYear(year); month++)
{
WorkMonth wm = new WorkMonth(year, month, germanSpecialDays, parserSettings, hoursPerDay);
this.Months.Add(wm);
foreach (var workWeek in wm.Weeks)
{
this.Weeks.Add(workWeek);
workWeek.PropertyChanged += this.workWeek_PropertyChanged;
}
}
this.ProjectHitlist = new QuickFillObservableCollection<HitlistInfo>();
this.PositionHitlist = new QuickFillObservableCollection<HitlistInfo>();
this.UpdateProjectHitlistAsync();
this.UpdatePositionHitlistAsync();
}
示例2: PosTest3
public void PosTest3()
{
System.Globalization.Calendar kC = new KoreanCalendar();
System.Globalization.Calendar gC = new GregorianCalendar();
DateTime dateTime = gC.ToDateTime(2004, 2, 29, 0, 0, 0, 0);
int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime));
int actualValue;
actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
Assert.Equal(expectedValue, actualValue);
}
示例3: PosTest2
public void PosTest2()
{
System.Globalization.Calendar kC = new KoreanCalendar();
System.Globalization.Calendar gC = new GregorianCalendar();
DateTime dateTime = new DateTime(DateTime.MaxValue.Ticks, DateTimeKind.Utc);
int expectedValue = gC.GetMonthsInYear(dateTime.Year, gC.GetEra(dateTime));
int actualValue;
actualValue = kC.GetMonthsInYear(dateTime.Year + 2333, kC.GetEra(dateTime));
Assert.Equal(expectedValue, actualValue);
}
示例4: PosTest5
public void PosTest5()
{
int era = c_AD_ERA;
System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
int year;
int expectedMonths, actualMonths;
year = GetAYear(myCalendar);
expectedMonths = c_MONTHS_IN_YEAR;
actualMonths = myCalendar.GetMonthsInYear(year, era);
Assert.Equal(expectedMonths, actualMonths);
}
示例5: WorkYear
public WorkYear(int year, IEnumerable<ShortCut> shortCuts, int hitListLookBackInWeeks, float hoursPerDay, PNSearchViewModel pnSearch, PositionSearchViewModel positionSearch)
{
this.hitListLookBackInWeeks = hitListLookBackInWeeks;
this.pnSearch = pnSearch;
this.positionSearch = positionSearch;
this.Year = year;
this.Months = new ObservableCollection<WorkMonth>();
this.Weeks = new ObservableCollection<WorkWeek>();
var germanSpecialDays = SpecialDaysUtils.GetGermanSpecialDays(year);
var cal = new GregorianCalendar();
for (int month = 1; month <= cal.GetMonthsInYear(year); month++) {
WorkMonth wm = new WorkMonth(year, month, germanSpecialDays, shortCuts, hoursPerDay);
this.Months.Add(wm);
foreach (var workWeek in wm.Weeks) {
this.Weeks.Add(workWeek);
workWeek.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.workWeek_PropertyChanged);
}
}
}
示例6: NegTest5
public void NegTest5()
{
System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
int year, era;
year = GetAYear(myCalendar);
era = 3;
Assert.Throws<ArgumentOutOfRangeException>(() =>
{
myCalendar.GetMonthsInYear(year, era);
});
}
示例7: NegTest4
public void NegTest4()
{
int era = c_CURRENT_ERA;
System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
int year;
year = myCalendar.MinSupportedDateTime.Year - 100;
Assert.Throws<ArgumentOutOfRangeException>(() =>
{
myCalendar.GetMonthsInYear(year, era);
});
}
示例8: PosTest10
public void PosTest10()
{
int era = c_CURRENT_ERA;
System.Globalization.Calendar myCalendar = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
int year;
int expectedMonths, actualMonths;
year = myCalendar.MinSupportedDateTime.Year;
expectedMonths = c_MONTHS_IN_YEAR;
actualMonths = myCalendar.GetMonthsInYear(year, era);
Assert.Equal(expectedMonths, actualMonths);
}