Example #1
0
        public int ShUpdate(string dn, tUserData userData, out tExtendedResult extendedResult, bool updateExisting = false)
        {
            //The apply action tells the web service to apply the settings supplied in the field elements, creating
            //or modifying the objects as required. This is the default action, and is the behavior if the Action
            //attribute is not specified explicitly
            //this is why you may not see action specified in the script or here.


            if (string.IsNullOrEmpty(dn))
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name + ": dn is required and was not supplied.");
            }

            if (userData == null)
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name + ": userData is required and was not supplied.");
            }

            if (updateExisting)
            {
                var serviceIndication = userData.ShData[0].ServiceIndication;

                var sequenceNumber = RetrieveCurrentSequenceNumber(dn, serviceIndication);
                if (sequenceNumber > 0)
                {
                    userData.ShData[0].SequenceNumber = _utilities.IncrementSequenceNumber(sequenceNumber);
                }
                else
                {
                    //if the subscriber doesn't exist then forcing a sequence number of 0 and forcing not to ignore sequence number.
                    userData.ShData[0].SequenceNumber = 0;
                }
            }

            //tMeta_Subscriber_Alarms alarms;
            var resultCode = _sh.ShUpdate(dn, 0, userData, _originHost, out extendedResult);

            //Checks to make sure the request was a success and if not throws an exception and tacks on the extended result to the exception.
            _utilities.CheckResultCode(resultCode, extendedResult, null);

            return(resultCode);

            //alarms = RetrieveAlarms(dn);
        }
Example #2
0
        public int ShUpdate(string dn, tUserData userData, out tExtendedResult extendedResult, bool updateExisting = false)
        {
            if (string.IsNullOrEmpty(dn))
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name + ": dn is required and was not supplied.");
            }

            if (userData == null)
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name + ": userData is required and was not supplied.");
            }

            if (updateExisting)
            {
                var serviceIndication = userData.ShData.RepositoryData.ServiceIndication;
                var sequenceNumber    = RetrieveCurrentSequenceNumber(dn, serviceIndication);
                if (sequenceNumber > 0)
                {
                    userData.ShData.RepositoryData.SequenceNumber = _utilities.IncrementSequenceNumber(sequenceNumber);
                    userData.ShData.RepositoryData.ServiceData.Item.IgnoreSequenceNumber = tTrueFalse.False;
                }
                else
                {
                    //if the subscriber doesn't exist then forcing a sequence number of 0 and forcing not to ignore sequence number.
                    userData.ShData.RepositoryData.SequenceNumber = 0;
                    userData.ShData.RepositoryData.ServiceData.Item.IgnoreSequenceNumber = tTrueFalse.False;
                }
            }

            //tMeta_Subscriber_Alarms alarms;
            var resultCode = _sh.ShUpdate(dn, 0, userData, _originHost, out extendedResult);

            //Checks to make sure the request was a success and if not throws an exception and tacks on the extended result to the exception.
            _utilities.CheckResultCode(resultCode, extendedResult, null);

            return(resultCode);

            //alarms = RetrieveAlarms(dn);
        }