/// <param name="row">zero-based row number</param> /// <param name="column">zero-based column number</param> private static PersianDate monthModeRowColumnToDate(int row, int column, PersianDate displayDate) { int year = displayDate.Year; int month = displayDate.Month; PersianDate firstDay = new PersianDate(year, month, 1); int fstCol = 2 + (int)firstDay.PersianDayOfWeek; int fstRow = fstCol == 1 ? 2 : 1; int dayDifference = (row) * 7 + column + 1 - ((fstRow - 1) * 7 + fstCol); return(firstDay.AddDays(dayDifference)); }
private static PersianDate MonthModeRowColumnToDate(int row, int column, PersianDate firstDayInMonth) { int firstCol = (int)firstDayInMonth.PersianDayOfWeek + 1; int dayDifference = (row * 7) + column - firstCol; if (firstDayInMonth == PersianDate.MinValue && dayDifference < 0) { return(null); } if (firstDayInMonth.Year == PersianDate.MaxValue.Year && firstDayInMonth.Month == PersianDate.MaxValue.Month && dayDifference > 9) { return(null); } return(firstDayInMonth.AddDays(dayDifference)); }
/// <param name="row">zero-based row number</param> /// <param name="column">zero-based column number</param> private static PersianDate monthModeRowColumnToDate(int row, int column, PersianDate displayDate) { int year = displayDate.Year; int month = displayDate.Month; PersianDate firstDay = new PersianDate(year, month, 1); int fstCol = 2 + (int)firstDay.PersianDayOfWeek; int fstRow = fstCol == 1 ? 2 : 1; int dayDifference = (row) * 7 + column + 1 - ((fstRow - 1) * 7 + fstCol); return firstDay.AddDays(dayDifference); }