Beispiel #1
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));
            }
        }