/********************************************************************************/

        public oadrlib.lib.oadr2b.OptSchedule getOptOutSchedule()
        {
            oadrlib.lib.oadr2b.OptSchedule optSchedule = new oadrlib.lib.oadr2b.OptSchedule();

            optSchedule.OptReason = convertOptReasonString(OptOutReason);
            optSchedule.OptType   = OptTypeType.optOut;
            optSchedule.OptID     = OptOutID;

            return(getOptSchedule(optSchedule /*, eButtonState.OPT_OUT*/));
        }
Пример #2
0
        /********************************************************************************/

        public oadrlib.lib.oadr2b.OptSchedule getOptInSchedule()
        {
            oadrlib.lib.oadr2b.OptSchedule optSchedule = new oadrlib.lib.oadr2b.OptSchedule();

            optSchedule.OptReason = convertOptReasonString(OptInReason);
            optSchedule.OptType   = OptTypeType.optIn;
            optSchedule.OptID     = OptInID;

            return(getOptSchedule(optSchedule, eButtonState.OPT_IN));
        }
Пример #3
0
        /**********************************************************/
        // ucManageOptSchedules callbacks
        /**********************************************************/

        public void createOptSchedule(oadrlib.lib.oadr2b.OptSchedule optSchedule)
        {
            try
            {
                setVENParameters();

                m_venWrapper.createOptSchedule(optSchedule);
            }
            catch (Exception ex)
            {
                updateError(ex);
            }
        }
Пример #4
0
        /**********************************************************/

        public CreateOpt createOptSchedule(string requestID, OptSchedule optSchedule)
        {
            CreateOpt request = new CreateOpt();

            string requestBody = request.createOptSchedule(requestID, VENID, optSchedule);

            if ((request.response = (oadrCreatedOptType)postRequest(requestBody, "/EiOpt", request)) != null)
            {
                request.setEiResponse(request.response.eiResponse);
            }

            return(request);
        }
Пример #5
0
        /********************************************************************************/

        public oadrlib.lib.oadr2b.OptSchedule getOptSchedule(oadrlib.lib.oadr2b.OptSchedule optSchedule, eButtonState buttonState)
        {
            DateTime current = new DateTime(StartDate.Year, StartDate.Month, StartDate.Day);
            DateTime end     = new DateTime(EndDate.Year, EndDate.Month, EndDate.Day);

            int      scheduleDuration  = 0;
            DateTime scheduleStartTime = DateTime.Now;

            while (current <= end)
            {
                List <eButtonState> hourButtonState = m_buttonStates[current.DayOfWeek.ToString()];

                for (int hour = 0; hour < 24; hour++)
                {
                    if (hourButtonState[hour] == buttonState)
                    {
                        scheduleDuration++;

                        if (scheduleDuration == 1)
                        {
                            scheduleStartTime = current.AddHours(hour);
                        }
                    }
                    else
                    {
                        if (scheduleDuration > 0)
                        {
                            optSchedule.addOptSchedule(scheduleStartTime.ToUniversalTime(), scheduleDuration);
                            scheduleDuration = 0;
                        }
                    }
                }

                current = current.AddDays(1);
            }

            if (optSchedule.Schedule.Count == 0)
            {
                return(null);
            }

            return(optSchedule);
        }
Пример #6
0
        /********************************************************************************/

        public oadrlib.lib.oadr2b.OptSchedule getOptSchedule()
        {
            oadrlib.lib.oadr2b.OptSchedule optSchedule = new oadrlib.lib.oadr2b.OptSchedule();

            optSchedule.OptReason = convertOptReasonString(OptReason);

            optSchedule.OptType = convertOptTypeString(OptType);
            optSchedule.OptID = OptID;

            optSchedule.MarketContext = MarketContext;
            optSchedule.ResourceID = ResourceID;

            for (int i = 0; i < ScheduleList.Count; i++)
            {
                optSchedule.addOptSchedule(ScheduleList[i].StartDate.ToUniversalTime(), ScheduleList[i].Duration);
            }

            // optSchedule
            if (optSchedule.Schedule.Count == 0)
                return null;

            
            return optSchedule;
        }
Пример #7
0
        /**********************************************************/

        public string createOptSchedule(string requestID, string venID, OptSchedule optSchedule)
        {
            initOpt(requestID, optSchedule.OptID, optSchedule.OptType, optSchedule.OptReason, venID, optSchedule.MarketContext);

            if (optSchedule.ResourceID != null && optSchedule.ResourceID != "")
            {
                request.eiTarget               = new EiTargetType();
                request.eiTarget.resourceID    = new string[1];
                request.eiTarget.resourceID[0] = optSchedule.ResourceID;
            }

            request.vavailability            = new VavailabilityType();
            request.vavailability.components = new AvailableType[optSchedule.Count];

            int index = 0;

            foreach (AvailableType availableType in optSchedule.Schedule)
            {
                request.vavailability.components[index] = availableType;
                index++;
            }

            return(serializeObject(request));
        }