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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations