示例#1
0
        /// <summary>
        /// This only registers the ProviderInfo systemSupport block(s)
        /// </summary>
        /// <param name="registerGuid"></param>
        /// <param name="info"></param>
        protected virtual void register(string registerGuid, ServiceDescription[] info)
        {
            StringBuilder message = new StringBuilder();
            ProcessAgentDB dbTicketing = new ProcessAgentDB();
            message.AppendLine("Register called on " + ProcessAgentDB.ServiceAgent.codeBaseUrl);

            if (info != null && info.Length > 0)
            {
                foreach (ServiceDescription sd in info)
                {
                    Coupon coupon = null;
                    if (sd.coupon != null)
                    {
                        coupon = sd.coupon;
                    }
                    if (sd.serviceProviderInfo != null && sd.serviceProviderInfo.Length > 0)
                    {
                        XmlQueryDoc xdoc = new XmlQueryDoc(sd.serviceProviderInfo);
                        string descriptorType = xdoc.GetTopName();
                        if (descriptorType.Equals("systemSupport"))
                        {
                            SystemSupport ss = SystemSupport.Parse(xdoc);
                            if (ss.agentGuid != null && ss.agentGuid.Length > 0)
                            {
                                int id = dbTicketing.GetProcessAgentID(ss.agentGuid);
                                if (id > 0)
                                {
                                    dbTicketing.SaveSystemSupport(ss.agentGuid, ss.contactEmail, ss.bugEmail,
                                        ss.infoUrl, ss.description, ss.location);
                                    if (sd.consumerInfo != null && sd.consumerInfo.CompareTo("requestSystemSupport") == 0)
                                    {
                                        ProcessAgentInfo paInfo = dbTicketing.GetProcessAgentInfo(ss.agentGuid);
                                        if (paInfo != null)
                                        {
                                            SystemSupport mySS = dbTicketing.RetrieveSystemSupport(ProcessAgentDB.ServiceGuid);
                                            if (mySS != null)
                                            {
                                                ServiceDescription[] values = new ServiceDescription[1];
                                                values[0] = new ServiceDescription(mySS.ToXML(), null, null);
                                                ProcessAgentProxy proxy = new ProcessAgentProxy();
                                                proxy.Url = paInfo.webServiceUrl;
                                                proxy.AgentAuthHeaderValue = new AgentAuthHeader();
                                                proxy.AgentAuthHeaderValue.coupon = paInfo.identOut;
                                                proxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
                                                proxy.Register(registerGuid, values);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }