Esempio n. 1
0
        /// <summary>
        /// Create a new schedule set in the Connection directory 
        /// </summary>
        /// <param name="pConnectionServer">
        /// Connection server being edited
        /// </param>
        /// <param name="pDisplayName">
        /// Name of the new schedule set - must be unique.
        /// </param>
        /// <param name="pOwnerLocationObjectId">
        /// location ObjectId to assign as the owner of a schedule.  If the primary location of the local server is used then the schedule
        /// set will be visible in the direcotry on the CUCA web page.
        /// Must pass either this or the OwerUserObjectId value, both cannot be blank.
        /// </param>
        /// <param name="pOwnerSubscriberObjectId">
        /// User to act as owner of schedule set.  A user owns a schedule set when it's associated with one of their notification devices
        /// and it doesn't show up in the CUCA web page.
        /// </param>
        /// <param name="pScheduleSet">
        /// If the schedule set is created, an instance of the ScheduleSet class is passed back on this parameter
        /// </param>
        /// <returns>
        /// Instance of the WebCallResult class.
        /// </returns>
        public static WebCallResult AddScheduleSet(ConnectionServerRest pConnectionServer,
            string pDisplayName,
            string pOwnerLocationObjectId,
            string pOwnerSubscriberObjectId,
            out ScheduleSet pScheduleSet)
        {
            pScheduleSet = null;

            WebCallResult res = AddScheduleSet(pConnectionServer, pDisplayName, pOwnerLocationObjectId, pOwnerSubscriberObjectId);

            //if the create goes through, fetch the schedule as an object and return it all filled in.
            if (res.Success)
            {
                res = GetScheduleSet(out pScheduleSet, pConnectionServer, res.ReturnedObjectId);
            }

            return res;
        }
Esempio n. 2
0
        /// <summary>
        /// Overloaded version of method that returns a copy of the schedule set as an out parameter
        /// </summary>
        /// <param name="pConnectionServer">
        /// Connection server to create the schedule items on.
        /// </param>
        /// <param name="pDisplayName">
        /// Display name to assign to the schedule
        /// </param>
        /// <param name="pOwnerLocationObjectId">
        /// Owner of the schedule - primary location object of a server means it's a "system schedule" and is visible in 
        /// CUCA on the schedules page.
        /// </param>
        /// <param name="pOwnerSubscriberObjectId">
        /// If the owner is a subscriber it's generally used as a notification device item.
        /// </param>
        /// <param name="pStartTime">
        /// the start time (in minutes) for the active day or days.  the start time is stored as the number of minutes from 
        /// midnight.  so a value of 480 would mean 8:00 am and 1020 would mean 5:00 pm.  in addition, a value of 0 for the 
        /// start time indicates 12:00 am.
        /// </param>
        /// <param name="pEndTime">
        /// the end time (in minutes) for the active day or days.  the end time is stored as the number of minutes from 
        /// midnight. so a value of 480 would mean 8:00 am and 1020 would mean 5:00 pm. in addition, a value of 0 means 
        /// "till the end of the day" (e.g.  11:59:59 pm in linux land).
        /// </param>
        /// <param name="pActiveMonday"></param>
        /// <param name="pActiveTuesday"></param>
        /// <param name="pActiveWednesday"></param>
        /// <param name="pActiveThursday"></param>
        /// <param name="pActiveFriday"></param>
        /// <param name="pActiveSaturday"></param>
        /// <param name="pActiveSunday"></param>
        /// <param name="pStartDate"></param>
        /// <param name="pEndDate"></param>
        /// <param name="pScheduleSet">
        /// Resulting schedule set created is returned on this out parameter
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class - if all goes through the ObjectId of the newly created ScheduleSet will
        /// be returned in the ReturnedObjectId property.
        /// </returns>
        public static WebCallResult AddQuickSchedule(ConnectionServerRest pConnectionServer, string pDisplayName,
            string pOwnerLocationObjectId, string pOwnerSubscriberObjectId,
            int pStartTime, int pEndTime, bool pActiveMonday,
            bool pActiveTuesday, bool pActiveWednesday,bool pActiveThursday,
            bool pActiveFriday, bool pActiveSaturday,bool pActiveSunday,
            DateTime? pStartDate, DateTime? pEndDate, out ScheduleSet pScheduleSet)
        {
            pScheduleSet = null;
            WebCallResult res = AddQuickSchedule(pConnectionServer, pDisplayName, pOwnerLocationObjectId,
                                                 pOwnerSubscriberObjectId, pStartTime, pEndTime,
                                                 pActiveMonday, pActiveThursday, pActiveWednesday, pActiveThursday,
                                                 pActiveFriday, pActiveSaturday, pActiveSunday, pStartDate,pEndDate);

            //if the create goes through, fetch the ScheduleSet as an object and return it.
            if (res.Success)
            {
                res = GetScheduleSet(out pScheduleSet, pConnectionServer, res.ReturnedObjectId);
            }

            return res;
        }
Esempio n. 3
0
        /// <summary>
        /// returns a single ScheduleSet object from an ObjectId string passed in or optionally a displayname string.
        /// </summary>
        /// <param name="pConnectionServer">
        /// Connection server that the ScheduleSet is homed on.
        /// </param>
        /// <param name="pObjectId">
        /// The ObjectId of the ScheduleSet to load
        /// </param>
        /// <param name="pScheduleSet">
        /// The out param that the filled out instance of the ScheduleSet class is returned on.
        /// </param>
        /// <param name="pDisplayName">
        /// Optional name to search for ScheduleSet list on.  If both the ObjectId and name are passed, the objectID is used.
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        public static WebCallResult GetScheduleSet(out ScheduleSet pScheduleSet, ConnectionServerRest pConnectionServer, string pObjectId = "",
            string pDisplayName = "")
        {
            WebCallResult res = new WebCallResult();
            res.Success = false;

            pScheduleSet = null;

            if (pConnectionServer == null)
            {
                res.ErrorText = "Null Connection server object passed to GetSchedule";
                return res;
            }

            //you need an objectID and/or a display name - both being blank is not acceptable
            if ((string.IsNullOrEmpty(pObjectId)) & (string.IsNullOrEmpty(pDisplayName)))
            {
                res.ErrorText = "Empty objectId and DisplayName passed to GetSchedule";
                return res;
            }

            //create a new DistributionList instance passing the ObjectId (or alias) which fills out the data automatically
            try
            {
                pScheduleSet = new ScheduleSet(pConnectionServer, pObjectId, pDisplayName);
                res.Success = true;
            }
            catch (UnityConnectionRestException ex)
            {
                return ex.WebCallResult;
            }
            catch (Exception ex)
            {
                res.ErrorText = "Failed to fetch scheduleset in GetScheduleSet:" + ex.Message;
            }

            return res;
        }