/// <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); } }
/// <summary> /// 删除一个外拨活动 /// </summary> /// <param name="_confService"></param> /// <param name="campaignname"></param> /// <param name="tenantid"></param> /// <param name="switchname"></param> public static void DeleteCampaign(IConfService _confService, string campaignname, int tenantid, string switchname) { CfgCampaignQuery qcampaign = new CfgCampaignQuery(_confService); try { qcampaign.Name = campaignname; qcampaign.TenantDbid = tenantid; CfgCampaign campaign = _confService.RetrieveObject <CfgCampaign>(qcampaign); campaign.Delete(); } catch (Exception ex) { log.Error("can not create campaignname " + campaignname + ":" + ex.Message); } }
/// <summary> /// 获取外拨群组列表 /// </summary> /// <param name="_confService"></param> /// <param name="campaignname"></param> /// <param name="tenantid"></param> /// <param name="switchname"></param> public static ICollection <CfgCampaignGroup> RetrieveCampaignGroupList(IConfService _confService, CfgCampaign campaign, int tenantid) { ICollection <CfgCampaignGroup> campaigngroup = null; CfgCampaignGroupQuery qcampaigngroup = new CfgCampaignGroupQuery(_confService); try { qcampaigngroup.TenantDbid = tenantid; qcampaigngroup.CampaignDbid = campaign.DBID; campaigngroup = _confService .RetrieveMultipleObjects <CfgCampaignGroup>(qcampaigngroup); } catch (Exception ex) { log.Error("获取CfgCampaignGroup列表失败 " + ex.Message); } return(campaigngroup); }