예제 #1
0
        public Entitlement[] LookupEntitlementList(decimal instance_id, string validate_flag)
        {
            Entitlement[] retvals = new Entitlement[0];
            string logMessage, logNote;

            if (String.IsNullOrWhiteSpace(EntitlementListURL) || 
                String.IsNullOrWhiteSpace(EntitlementServiceUsername) ||
                String.IsNullOrWhiteSpace(EntitlementServicePassword))
            {
                throw new Exception("Provider's InitForEntitlement not run.");
            }
            ENTITLEMENT.OKS_ENTITLEMENTS_PUB_Service client = EBSProxyFactory.GetEntitlementInstance(EntitlementListURL, EntitlementServiceUsername, EntitlementServicePassword, EntitlementServiceTimeout);
            ENTITLEMENT.SOAHeader hdr = new ENTITLEMENT.SOAHeader();
            hdr.Responsibility = "OKS_MANAGER";
            hdr.RespApplication = "OKS";
            hdr.SecurityGroup = "STANDARD";
            hdr.NLSLanguage = "AMERICAN";
            hdr.Org_Id = "204";

            client.SOAHeaderValue = hdr;

            ENTITLEMENT.InputParameters5 ip = new ENTITLEMENT.InputParameters5();
            ip.P_API_VERSION = 1;
            ip.P_API_VERSIONSpecified = true;
            ip.P_INIT_MSG_LIST = "T";
            ip.P_INP_REC = new Accelerator.EBS.SharedServices.ProxyClasses.Entitlement.APPSOKS_ENTITLEMENTS_X226932X4X3(); 
            ip.P_INP_REC.VALIDATE_FLAG = validate_flag;
            ip.P_INP_REC.CONTRACT_NUMBER = "";
            //log input parameters
            string parameters = String.Format("GET_CONTRACTS__1 for instance_id {0}", instance_id.ToString());

            if (instance_id > 0)
            {
                ip.P_INP_REC.PRODUCT_ID = instance_id;
                ip.P_INP_REC.PRODUCT_IDSpecified = true;
            }
            else
            {
                logMessage = parameters + ". No valid parameters found. No search performed.";
                logNote = null;
                ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote);
                return retvals;
            }
            
            logMessage = parameters + ". Request payload.";
            logNote = serializer.Serialize(ip);
            ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote);
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            
            StringBuilder response = new StringBuilder("[{}");
            try
            {
                ENTITLEMENT.OutputParameters5 opList = client.GET_CONTRACTS__1(ip);
                List<Entitlement> entitlements = new List<Entitlement>();

                foreach (ENTITLEMENT_LIST op in opList.X_ENT_CONTRACTS)
                {
                    Entitlement e = new Entitlement(getPropertyValues(op), instance_id, validate_flag);
                    entitlements.Add(e);
                    response.Append(",").Append(e.ToJSON());
                }
                retvals = entitlements.ToArray();
            }

            catch (Exception ex)
            {
                handleEBSException(ex, parameters);
                throw;
            }

            stopwatch.Stop();
            int timeElapsed = stopwatch.Elapsed.Milliseconds;
            logMessage = new StringBuilder(parameters)
                .Append(" returned ").Append(retvals.Count()).Append(" records in ")
                .Append(timeElapsed).Append("ms")
                .ToString();
            logNote = response.Append(",{\"Count\":").Append("\"")
                .Append(retvals.Count()).Append("\"}]").ToString();
            ConfigurationSetting.logWrap.DebugLog(logMessage: logMessage, logNote: logNote, timeElapsed: timeElapsed);
            return retvals;
        }
 /// <remarks/>
 public void GET_CONTRACTS__1Async(InputParameters5 InputParameters) {
     this.GET_CONTRACTS__1Async(InputParameters, null);
 }
 /// <remarks/>
 public void GET_CONTRACTS__1Async(InputParameters5 InputParameters, object userState) {
     if ((this.GET_CONTRACTS__1OperationCompleted == null)) {
         this.GET_CONTRACTS__1OperationCompleted = new System.Threading.SendOrPostCallback(this.OnGET_CONTRACTS__1OperationCompleted);
     }
     this.InvokeAsync("GET_CONTRACTS__1", new object[] {
                 InputParameters}, this.GET_CONTRACTS__1OperationCompleted, userState);
 }
 /// <remarks/>
 public System.IAsyncResult BeginGET_CONTRACTS__1(InputParameters5 InputParameters, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("GET_CONTRACTS__1", new object[] {
                 InputParameters}, callback, asyncState);
 }