/// <summary> /// This method retrieves the typical week used by the TOU schedule. /// </summary> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 10/01/08 jrf 9.50 Created. // private void RetrieveANSITypicalWeek() { short sDisplayProgress = 0; short sResponse = DEVICE_SERVER_SUCCESS; object objValue = null; //Get the typical week sResponse = VirtualDevice.GetValue(TOU_SEASON_1_DAY_TYPE_MAP, ref objValue, sDisplayProgress); if (DEVICE_SERVER_SUCCESS == sResponse && null != objValue) { //extract the daytype for each day of the typical week. int iTypicalWeek = (int)objValue; int iSunday = SUNDAY_MASK & iTypicalWeek; int iMonday = (MONDAY_MASK & iTypicalWeek) >> 2; int iTuesday = (TUESDAY_MASK & iTypicalWeek) >> 4; int iWednesday = (WEDNESDAY_MASK & iTypicalWeek) >> 6; int iThursday = (THURSDAY_MASK & iTypicalWeek) >> 8; int iFriday = (FRIDAY_MASK & iTypicalWeek) >> 10; int iSaturday = (SATURDAY_MASK & iTypicalWeek) >> 12; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.SUNDAY] = m_TOUSchedule.NormalDays[iSunday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.MONDAY] = m_TOUSchedule.NormalDays[iMonday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.TUESDAY] = m_TOUSchedule.NormalDays[iTuesday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.WEDNESDAY] = m_TOUSchedule.NormalDays[iWednesday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.THURSDAY] = m_TOUSchedule.NormalDays[iThursday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.FRIDAY] = m_TOUSchedule.NormalDays[iFriday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.SATURDAY] = m_TOUSchedule.NormalDays[iSaturday]; } }
/// <summary> /// This method reverse engineers the active custom schedule from the given /// MIF file. /// </summary> /// <returns>The reverse engineered custom schedule.</returns> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 10/08/08 jrf 9.50 Created. // private void ReverseEngineerCustomSchedule() { object objValue = null; short sResponse = DEVICE_SERVER_SUCCESS; short sDisplayProgress = 0; DateTime[] adtBillingDates; DateCollection colBillingDates = new DateCollection(); if (false == m_bHasHHFBeenRead) { sResponse = (short)OpenHHF(); } if (DEVICE_SERVER_SUCCESS == sResponse) { //Get the array of billing dates sResponse = VirtualDevice.GetValue(BILLING_SCHEDULE_ITEMS, ref objValue, sDisplayProgress); } if (DEVICE_SERVER_SUCCESS == sResponse && null != objValue) { adtBillingDates = (DateTime[])Convert.ChangeType(objValue, typeof(DateTime[]), CultureInfo.InvariantCulture); //Populate a date collection foreach (DateTime dtDate in adtBillingDates) { colBillingDates.Add(dtDate); } //Add dates to the new schedule m_CustomSchedule = new CCustomSchedule(); m_CustomSchedule.AddDates(colBillingDates); } }
/// <summary> /// This method retrieves the typical week used by the TOU schedule. /// </summary> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ --------------------------------------------- // 10/01/08 jrf 9.50 Created. // private void RetrieveSCSTypicalWeek() { short sDisplayProgress = 0; short sResponse = DEVICE_SERVER_SUCCESS; object objValue = null; int iSunday = 0; int iMonday = 0; int iTuesday = 0; int iWednesday = 0; int iThursday = 0; int iFriday = 0; int iSaturday = 0; //Get the typical week sResponse = VirtualDevice.GetValue(TOU_SUNDAY_SCHED, ref objValue, sDisplayProgress); if (DEVICE_SERVER_SUCCESS == sResponse && null != objValue) { iSunday = (int)Convert.ChangeType(objValue, typeof(int), CultureInfo.InvariantCulture); } sResponse = VirtualDevice.GetValue(TOU_MONDAY_SCHED, ref objValue, sDisplayProgress); if (DEVICE_SERVER_SUCCESS == sResponse && null != objValue) { iMonday = (int)Convert.ChangeType(objValue, typeof(int), CultureInfo.InvariantCulture); } sResponse = VirtualDevice.GetValue(TOU_TUESDAY_SCHED, ref objValue, sDisplayProgress); if (DEVICE_SERVER_SUCCESS == sResponse && null != objValue) { iTuesday = (int)Convert.ChangeType(objValue, typeof(int), CultureInfo.InvariantCulture); } sResponse = VirtualDevice.GetValue(TOU_WEDNESDAY_SCHED, ref objValue, sDisplayProgress); if (DEVICE_SERVER_SUCCESS == sResponse && null != objValue) { iWednesday = (int)Convert.ChangeType(objValue, typeof(int), CultureInfo.InvariantCulture); } sResponse = VirtualDevice.GetValue(TOU_THURSDAY_SCHED, ref objValue, sDisplayProgress); if (DEVICE_SERVER_SUCCESS == sResponse && null != objValue) { iThursday = (int)Convert.ChangeType(objValue, typeof(int), CultureInfo.InvariantCulture); } sResponse = VirtualDevice.GetValue(TOU_FRIDAY_SCHED, ref objValue, sDisplayProgress); if (DEVICE_SERVER_SUCCESS == sResponse && null != objValue) { iFriday = (int)Convert.ChangeType(objValue, typeof(int), CultureInfo.InvariantCulture); } sResponse = VirtualDevice.GetValue(TOU_SATURDAY_SCHED, ref objValue, sDisplayProgress); if (DEVICE_SERVER_SUCCESS == sResponse && null != objValue) { iSaturday = (int)Convert.ChangeType(objValue, typeof(int), CultureInfo.InvariantCulture); } m_TOUSchedule.TypicalWeek[(int)eTypicalDay.SUNDAY] = m_TOUSchedule.NormalDays[iSunday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.MONDAY] = m_TOUSchedule.NormalDays[iMonday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.TUESDAY] = m_TOUSchedule.NormalDays[iTuesday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.WEDNESDAY] = m_TOUSchedule.NormalDays[iWednesday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.THURSDAY] = m_TOUSchedule.NormalDays[iThursday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.FRIDAY] = m_TOUSchedule.NormalDays[iFriday]; m_TOUSchedule.TypicalWeek[(int)eTypicalDay.SATURDAY] = m_TOUSchedule.NormalDays[iSaturday]; }