using System;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.ServicesAgent;

namespace QMTask.DataDeal
{
    /// <summary>
    /// 服务调用工具
    /// 创建者:王丹丹
    /// 创建时间:2015-03-17
    /// </summary>
    public class ServiceUtil
    {
        #region 获取服务代理

        public ServiceAgent GetServiceAgent()
        {
            try
            {
                //创建代理
                ServiceAgent agent = new ServiceAgent();

                //设置凭据
                agent.ClientCredential = new QMFrameWork.ServiceInterface.CredentialInfo();

                if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["ServiceCredential"]) == false)
                    agent.ClientCredential.CredentialID = ConfigurationManager.AppSettings["ServiceCredential"];

                return agent;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        #endregion

    }
}