Search in sources :

Example 6 with Campaign

use of com.axelor.apps.marketing.db.Campaign in project axelor-open-suite by axelor.

the class CampaignController method sendReminderEmail.

public void sendReminderEmail(ActionRequest request, ActionResponse response) {
    Campaign campaign = request.getContext().asType(Campaign.class);
    try {
        campaign = Beans.get(CampaignRepository.class).find(campaign.getId());
        if (campaign.getInvitedPartnerSet().isEmpty() && campaign.getInvitedPartnerSet().isEmpty()) {
            response.setFlash(I18n.get(IExceptionMessage.REMINDER_EMAIL1));
            return;
        }
        MetaFile logFile = Beans.get(CampaignService.class).sendReminderEmail(campaign);
        if (logFile == null) {
            response.setFlash(I18n.get(IExceptionMessage.EMAIL_SUCCESS));
        } else {
            response.setFlash(I18n.get(IExceptionMessage.EMAIL_ERROR2));
        }
        response.setValue("emailLog", logFile);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : CampaignService(com.axelor.apps.marketing.service.CampaignService) Campaign(com.axelor.apps.marketing.db.Campaign) MetaFile(com.axelor.meta.db.MetaFile)

Example 7 with Campaign

use of com.axelor.apps.marketing.db.Campaign in project axelor-open-suite by axelor.

the class CampaignController method sendEmail.

public void sendEmail(ActionRequest request, ActionResponse response) {
    Campaign campaign = request.getContext().asType(Campaign.class);
    try {
        campaign = Beans.get(CampaignRepository.class).find(campaign.getId());
        if (campaign.getLeadSet().isEmpty() && campaign.getPartnerSet().isEmpty()) {
            response.setFlash(I18n.get(IExceptionMessage.EMPTY_TARGET));
            return;
        }
        MetaFile logFile = Beans.get(CampaignService.class).sendEmail(campaign);
        if (logFile == null) {
            response.setFlash(I18n.get(IExceptionMessage.EMAIL_SUCCESS));
        } else {
            response.setFlash(I18n.get(IExceptionMessage.EMAIL_ERROR2));
        }
        response.setValue("emailLog", logFile);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : CampaignService(com.axelor.apps.marketing.service.CampaignService) Campaign(com.axelor.apps.marketing.db.Campaign) MetaFile(com.axelor.meta.db.MetaFile)

Example 8 with Campaign

use of com.axelor.apps.marketing.db.Campaign in project axelor-open-suite by axelor.

the class CampaignController method markLeadPresent.

public void markLeadPresent(ActionRequest request, ActionResponse response) {
    Campaign campaign = request.getContext().getParent().asType(Campaign.class);
    Lead lead = request.getContext().asType(Lead.class);
    lead = Beans.get(LeadRepository.class).find(lead.getId());
    try {
        Beans.get(CampaignService.class).markLeadPresent(Beans.get(CampaignRepository.class).find(campaign.getId()), lead);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : CampaignService(com.axelor.apps.marketing.service.CampaignService) Campaign(com.axelor.apps.marketing.db.Campaign) Lead(com.axelor.apps.crm.db.Lead)

Example 9 with Campaign

use of com.axelor.apps.marketing.db.Campaign in project axelor-open-suite by axelor.

the class CampaignController method addParticipatingTargets.

public void addParticipatingTargets(ActionRequest request, ActionResponse response) {
    Campaign campaignContext = request.getContext().asType(Campaign.class);
    try {
        Beans.get(CampaignService.class).addParticipatingTargets(Beans.get(CampaignRepository.class).find(campaignContext.getId()), campaignContext);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : CampaignService(com.axelor.apps.marketing.service.CampaignService) Campaign(com.axelor.apps.marketing.db.Campaign)

Example 10 with Campaign

use of com.axelor.apps.marketing.db.Campaign in project axelor-open-suite by axelor.

the class CampaignController method generateEvents.

public void generateEvents(ActionRequest request, ActionResponse response) {
    Campaign campaign = request.getContext().asType(Campaign.class);
    try {
        campaign = Beans.get(CampaignRepository.class).find(campaign.getId());
        Beans.get(CampaignService.class).generateEvents(campaign);
        response.setAttr("plannedEventsPanel", "refresh", true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : CampaignService(com.axelor.apps.marketing.service.CampaignService) Campaign(com.axelor.apps.marketing.db.Campaign)

Aggregations

Campaign (com.axelor.apps.marketing.db.Campaign)11 CampaignService (com.axelor.apps.marketing.service.CampaignService)10 MetaFile (com.axelor.meta.db.MetaFile)2 Partner (com.axelor.apps.base.db.Partner)1 Lead (com.axelor.apps.crm.db.Lead)1 IExceptionMessage (com.axelor.apps.marketing.exception.IExceptionMessage)1 Message (com.axelor.apps.message.db.Message)1 Transactional (com.google.inject.persist.Transactional)1