/// <summary>
        /// 创建外拨活动
        /// </summary>
        /// <param name="_confService"></param>
        /// <param name="campaignname"></param>
        /// <param name="tenantid"></param>
        /// <param name="switchname"></param>
        public static void CreateCampaign(IConfService _confService, string campaignname,
                                          int tenantid, string switchname)
        {
            CfgTenantQuery qTenant = new CfgTenantQuery();

            qTenant.Dbid = tenantid;
            CfgTenant      tenant  = _confService.RetrieveObject <CfgTenant>(qTenant);
            CfgSwitchQuery qSwitch = new CfgSwitchQuery();

            qSwitch.Name       = switchname;
            qSwitch.TenantDbid = tenant.DBID;
            CfgSwitch @switch = _confService
                                .RetrieveObject <CfgSwitch>(qSwitch);

            CfgCampaign campaign = new CfgCampaign(_confService);

            try
            {
                campaign.Name   = campaignname;
                campaign.Tenant = tenant;


                campaign.Save();
            }
            catch (Exception ex)
            {
                log.Error("can not create campaignname " + campaignname + ":" + ex.Message);
            }
        }
Beispiel #2
0
 internal static void GetSwitchType()
 {
     if (_configContainer.AllKeys.Contains("switch-type") && _configContainer.GetValue("switch-type") != null)
     {
         var _switchQuery = new CfgSwitchQuery();
         _switchQuery.TenantDbid = _configContainer.TenantDbId;
         _switchQuery.Name       = _configContainer.GetValue("switch-type");
         try
         {
             var _switch = _configContainer.ConfServiceObject.RetrieveObject <CfgSwitch>(_switchQuery);
             if (_switch != null)
             {
                 Datacontext.GetInstance().SwitchType = _switch;
             }
             else
             {
                 _switchQuery            = new CfgSwitchQuery();
                 _switchQuery.TenantDbid = _configContainer.TenantDbId;
                 var _switchICollection = _configContainer.ConfServiceObject.RetrieveMultipleObjects <CfgSwitch>(_switchQuery);
                 foreach (CfgSwitch item in _switchICollection)
                 {
                     Datacontext.GetInstance().SwitchType = item;
                 }
             }
         }
         catch
         {
             _switchQuery            = new CfgSwitchQuery();
             _switchQuery.TenantDbid = _configContainer.TenantDbId;
             var _switchICollection = _configContainer.ConfServiceObject.RetrieveMultipleObjects <CfgSwitch>(_switchQuery);
             foreach (CfgSwitch item in _switchICollection)
             {
                 Datacontext.GetInstance().SwitchType = item;
             }
         }
         finally
         {
             if (Datacontext.GetInstance().SwitchType != null)
             {
                 _logger.Info("T-server switch type: " + Datacontext.GetInstance().SwitchType.Type.ToString());
                 Datacontext.GetInstance().SwitchName = Datacontext.GetInstance().SwitchType.Type == CfgSwitchType.CFGLucentDefinityG3 ? "avaya" : ((Datacontext.GetInstance().SwitchType.Type == CfgSwitchType.CFGNortelDMS100 || Datacontext.GetInstance().SwitchType.Type == CfgSwitchType.CFGNortelMeridianCallCenter) ? "nortel" : "avaya");
             }
         }
     }
 }