Exemplo n.º 1
0
        }   //  sendAlert

        private bool Escalate(MRequest request)
        {
            //  Get Supervisor
            MUser supervisor    = request.GetSalesRep(); //	self
            int   supervisor_ID = request.GetSalesRep().GetSupervisor_ID();

            if ((supervisor_ID == 0) && (m_model.GetSupervisor_ID() != 0))
            {
                supervisor_ID = m_model.GetSupervisor_ID();
            }
            if ((supervisor_ID != 0) && (supervisor_ID != request.GetAD_User_ID()))
            {
                supervisor = MUser.Get(GetCtx(), supervisor_ID);
            }

            //  Escalated: Request {0} to {1}
            String subject = Msg.GetMsg(m_client.GetAD_Language(), "RequestEscalate",
                                        new String[] { request.GetDocumentNo(), supervisor.GetName() });
            String to = request.GetSalesRep().GetEMail();

            if ((to == null) || (to.Length == 0))
            {
                log.Warning("SalesRep has no EMail - " + request.GetSalesRep());
            }
            else
            {
                m_client.SendEMail(request.GetSalesRep_ID(), subject, request.GetSummary(), request.CreatePDF());
            }

            //	Not the same - send mail to supervisor
            if (request.GetSalesRep_ID() != supervisor.GetAD_User_ID())
            {
                to = supervisor.GetEMail();
                if ((to == null) || (to.Length == 0))
                {
                    log.Warning("Supervisor has no EMail - " + supervisor);
                }
                else
                {
                    m_client.SendEMail(supervisor.GetAD_User_ID(), subject, request.GetSummary(), request.CreatePDF());
                }
            }

            //  ----------------
            request.SetDueType();
            request.SetIsEscalated(true);
            request.SetResult(subject);
            return(request.Save());
        }   //  escalate
Exemplo n.º 2
0
        }       //  processRequests

        private bool SendEmail(MRequest request, String AD_Message)
        {
            //  Alert: Request {0} overdue
            String subject = Msg.GetMsg(m_client.GetAD_Language(), AD_Message,
                                        new String[] { request.GetDocumentNo() });

            return(m_client.SendEMail(request.GetSalesRep_ID(), subject, request.GetSummary(), request.CreatePDF()));
        }   //  sendAlert
Exemplo n.º 3
0
        }       //	MChangeRequest

        /**
         *  CRM Request Constructor
         *	@param request request
         *	@param group request group
         */
        public MChangeRequest(MRequest request, MGroup group)
            : this(request.GetCtx(), 0, request.Get_Trx())
        {
            SetClientOrg(request);
            SetName(Msg.GetElement(GetCtx(), "R_Request_ID") + ": " + request.GetDocumentNo());
            SetHelp(request.GetSummary());
            //
            SetM_BOM_ID(group.GetM_BOM_ID());
            SetM_ChangeNotice_ID(group.GetM_ChangeNotice_ID());
        }       //	MChangeRequest
Exemplo n.º 4
0
        }       //	findSalesRep

        /**
         *  Find SalesRep/User based on Request Type and Question.
         *  @param request request
         *  @return SalesRep_ID user
         */
        private int FindSalesRep(MRequest request)
        {
            String QText = request.GetSummary();

            if (QText == null)
            {
                QText = "";
            }
            else
            {
                QText = QText.ToUpper();
            }
            //
            MRequestProcessorRoute[] routes = m_model.GetRoutes(false);
            for (int i = 0; i < routes.Length; i++)
            {
                MRequestProcessorRoute route = routes[i];

                //	Match first on Request Type
                if ((request.GetR_RequestType_ID() == route.GetR_RequestType_ID()) &&
                    (route.GetR_RequestType_ID() != 0))
                {
                    return(route.GetAD_User_ID());
                }

                //	Match on element of keyword
                String keyword = route.GetKeyword();
                if (keyword != null)
                {
                    StringTokenizer st = new StringTokenizer(keyword.ToUpper(), " ,;\t\n\r\f");
                    while (st.HasMoreElements())
                    {
                        if (QText.IndexOf(st.NextToken()) != -1)
                        {
                            return(route.GetAD_User_ID());
                        }
                    }
                }
            }   //	for all routes

            return(m_model.GetSupervisor_ID());
        }   //  findSalesRep
Exemplo n.º 5
0
        /// <summary>
        /// Prepare notice message.
        /// </summary>
        /// <param name="list">list of the values changed.</param>
        private void prepareNotificMsg(List <String> list)
        {
            if (mailText_ID == 0)
            {
                message = new StringBuilder();
                //		UpdatedBy: Joe
                int   UpdatedBy = GetCtx().GetAD_User_ID();
                MUser from      = MUser.Get(GetCtx(), UpdatedBy);
                if (from != null)
                {
                    message.Append(Msg.Translate(GetCtx(), "UpdatedBy")).Append(": ")
                    .Append(from.GetName());
                }
                //		LastAction/Created: ...
                if (_req.GetDateLastAction() != null)
                {
                    message.Append("\n").Append(Msg.Translate(GetCtx(), "DateLastAction"))
                    .Append(": ").Append(_req.GetDateLastAction());
                }
                else
                {
                    message.Append("\n").Append(Msg.Translate(GetCtx(), "Created"))
                    .Append(": ").Append(_req.GetCreated());
                }
                //	Changes
                for (int i = 0; i < list.Count; i++)
                {
                    X_R_Request req = new X_R_Request(GetCtx(), 0, null);

                    String columnName = (String)list[i];
                    message.Append("\n").Append(Msg.GetElement(GetCtx(), columnName))
                    .Append(": ").Append(_reqAction.getColumnValue(columnName))
                    .Append(" -> ").Append(_req.getColumnValue(columnName));
                }
                //	NextAction
                if (_req.GetDateNextAction() != null)
                {
                    message.Append("\n").Append(Msg.Translate(GetCtx(), "DateNextAction"))
                    .Append(": ").Append(_req.GetDateNextAction());
                }
                message.Append(SEPARATOR)
                .Append(_req.GetSummary());
                if (_req.GetResult() != null)
                {
                    message.Append("\n----------\n").Append(_req.GetResult());
                }
                message.Append(_req.GetMailTrailer(null));
            }
            else
            {
                message = new StringBuilder();

                MMailText text = new MMailText(GetCtx(), mailText_ID, null);
                text.SetPO(_req, true); //Set _Po Current value
                subject += _req.GetDocumentNo() + ": " + text.GetMailHeader();

                message.Append(text.GetMailText(true));
                if (_req.GetDateNextAction() != null)
                {
                    message.Append("\n").Append(Msg.Translate(GetCtx(), "DateNextAction"))
                    .Append(": ").Append(_req.GetDateNextAction());
                }

                // message.Append(GetMailTrailer(null));
            }
        }