//Public intWeekFirst As Integer = WYFirst.Week //Public intYearFirst As Integer = WYFirst.Year //Public strDateFirst As String = WYFirst.MondayDate //Public intWeekLast As Integer = WYLast.Week //Public intYearLast As Integer = WYLast.Year //Public strDateLast As String = WYLast.MondayDate public WeekDate(WeekYear wyFirst, WeekYear wyLast) { this.WYFirst = wyFirst; this.WYLast = wyLast; SetWeekDateArrays(); }
public WeekYear GetWeekYearLast(WeekYear wyFirst) { int intWeek = wyFirst.Week; int intYear = wyFirst.Year; int intWeekLast = 0; int intYearLast = 0; WeekYear wyLast = new WeekYear(); int intNoOfWeeks = GetNoOfWeeks(intYear); // intWeekLast = intWeek + cWeekSpan; intYearLast = intYear; //If intWeekLast > 52 Then // intWeekLast = intWeekLast - 52 // intYearLast = intYear + 1 //End If if (intWeekLast > intNoOfWeeks) { intWeekLast = intWeekLast - intNoOfWeeks; intYearLast = intYear + 1; } // wyLast.Week = intWeekLast; wyLast.Year = intYearLast; wyLast.MondayDate = GetWeekMondayDate(intWeekLast, intYearLast); // return wyLast; }
public WeekYear GetWeekYearFirst(WeekYear wyCurrent, bool blnNext) { int intWeek = wyCurrent.Week; int intYear = wyCurrent.Year; int intWeekFirst = 0; int intYearFirst = 0; WeekYear wyFirst = new WeekYear(); int intNoOfWeeks = GetNoOfWeeks(intYear); // // Check how many weeks in the year // Forward if (blnNext) { intWeekFirst = intWeek + cMoveWeeks; intYearFirst = intYear; //If intWeekFirst > 52 Then // intWeekFirst = intWeekFirst - 52 // intYearFirst = intYear + 1 //End If if (intWeekFirst > intNoOfWeeks) { intWeekFirst = intWeekFirst - intNoOfWeeks; intYearFirst = intYear + 1; } // Back } else { intWeekFirst = intWeek - cMoveWeeks; intYearFirst = intYear; //If intWeekFirst <= 0 Then // intWeekFirst = 52 + intWeekFirst // intYearFirst = intYear - 1 //End If if (intWeekFirst <= 0) { intWeekFirst = intNoOfWeeks + intWeekFirst; intYearFirst = intYear - 1; } } // wyFirst.Week = intWeekFirst; wyFirst.Year = intYearFirst; wyFirst.MondayDate = GetWeekMondayDate(intWeekFirst, intYearFirst); // return wyFirst; }
public WeekYear GetWeekYear(System.DateTime dtmDate) { WeekYear wyCurrent = new WeekYear(); string strWeekMondayDate = GetWeekMondayDate(dtmDate).ToShortDateString(); // Get Week No and Year from table int intCurrWeek = 0; int intCurrYear = 0; string strSQL = null; strSQL = "SELECT WeekNo, WeekNoYear "; strSQL += "FROM tblWeeks "; strSQL += "WHERE WeekNoStartDate = '" + Convert.ToDateTime(strWeekMondayDate) + "'"; DataSet ds = general.FillDataset(strSQL); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { intCurrWeek = Convert.ToInt32(dt.Rows[0]["WeekNo"]); intCurrYear = Convert.ToInt32(dt.Rows[0]["WeekNoYear"]); } dt.Dispose(); ds.Dispose(); dt = null; ds = null; // wyCurrent.Week = intCurrWeek; wyCurrent.Year = intCurrYear; wyCurrent.MondayDate = strWeekMondayDate; // return wyCurrent; }