} // sendAlerts private int SendEmail(MWFActivity activity, String AD_Message, bool toProcess, bool toSupervisor) { if (m_client == null || m_client.GetAD_Client_ID() != activity.GetAD_Client_ID()) { m_client = MClient.Get(GetCtx(), activity.GetAD_Client_ID()); } MWFProcess process = new MWFProcess(GetCtx(), activity.GetAD_WF_Process_ID(), null); String subjectVar = activity.GetNode().GetName(); String message = activity.GetTextMsg(); if (message == null || message.Length == 0) { message = process.GetTextMsg(); } FileInfo pdf = null; PO po = activity.GetPO(); if (po is DocAction) { message = ((DocAction)po).GetDocumentInfo() + "\n" + message; pdf = ((DocAction)po).CreatePDF(); } // Inactivity Alert: Workflow Activity {0} String subject = Msg.GetMsg(m_client.GetAD_Language(), AD_Message, new Object[] { subjectVar }); // Prevent duplicates List <int> list = new List <int>(); int counter = 0; // To Activity Owner if (m_client.SendEMail(activity.GetAD_User_ID(), subject, message, pdf)) { counter++; } list.Add(activity.GetAD_User_ID()); // To Process Owner if (toProcess && process.GetAD_User_ID() != activity.GetAD_User_ID()) { if (m_client.SendEMail(process.GetAD_User_ID(), subject, message, pdf)) { counter++; } list.Add(process.GetAD_User_ID()); } // To Activity Responsible MWFResponsible responsible = MWFResponsible.Get(GetCtx(), activity.GetAD_WF_Responsible_ID()); counter += sendAlertToResponsible(responsible, list, process, subject, message, pdf); // To Process Responsible if (toProcess && process.GetAD_WF_Responsible_ID() != activity.GetAD_WF_Responsible_ID()) { responsible = MWFResponsible.Get(GetCtx(), process.GetAD_WF_Responsible_ID()); counter += sendAlertToResponsible(responsible, list, process, subject, message, pdf); } // Processor SuperVisor if (toSupervisor && m_model.GetSupervisor_ID() != 0 && !list.Contains(m_model.GetSupervisor_ID())) { if (m_client.SendEMail(m_model.GetSupervisor_ID(), subject, message, pdf)) { counter++; } list.Add(m_model.GetSupervisor_ID()); } return(counter); } // sendAlert