Exemplo n.º 1
0
        }       //	prepare

        /// <summary>
        ///	Process It
        /// </summary>
        /// <returns>message</returns>
        protected override String DoIt()
        {
            MRequest request = new MRequest(GetCtx(), _R_Request_ID, Get_TrxName());

            log.Info(request.ToString());
            if (request.Get_ID() == 0)
            {
                throw new Exception("@NoRequsetFound@ " + _R_Request_ID);
            }

            request.SetR_Status_ID();           //	set default status
            request.SetProcessed(false);
            if (request.Save() && !request.IsProcessed())
            {
                return("@Created Successfully@");
            }
            return("@Error@");
        } //	doUt
Exemplo n.º 2
0
        /**
         *  Create Request from Lead
         *  @param R_RequestType_ID request type
         *	@return error message
         */
        private String CreateRequest(int R_RequestType_ID)
        {
            if (GetR_Request_ID() != 0)
            {
                return("@AlreadyExists@: @R_Request_ID@ (ID=" + GetR_Request_ID() + ")");
            }
            if (GetC_BPartner_ID() == 0)
            {
                String retValue = CreateBP();
                if (retValue != null)
                {
                    return(retValue);
                }
            }
            _request = new MRequest(GetCtx(), 0, Get_TrxName());
            _request.SetAD_Org_ID(GetAD_Org_ID());
            String summary = GetName();

            if (summary == null)
            {
                summary = GetHelp();
            }
            if (summary == null)
            {
                summary = GetSummary();
            }
            if (summary == null)
            {
                summary = GetDescription();
            }
            _request.SetSummary(summary);
            //
            _request.SetR_RequestType_ID(R_RequestType_ID);
            if (IsR_Status_IDValid(GetR_Status_ID()))
            {
                _request.SetR_Status_ID(GetR_Status_ID());
            }
            else
            {
                _request.SetR_Status_ID();
            }
            //
            _request.SetC_Lead_ID(GetC_Lead_ID());
            //
            _request.SetC_BPartner_ID(GetC_BPartner_ID());
            _request.SetAD_User_ID(GetAD_User_ID());
            _request.SetC_Project_ID(GetC_Project_ID());
            _request.SetC_Campaign_ID(GetC_Campaign_ID());
            _request.SetR_Source_ID(GetR_Source_ID());
            _request.SetC_BPartnerSR_ID(GetC_BPartnerSR_ID());
            _request.SetC_SalesRegion_ID(GetC_SalesRegion_ID());

            _request.SetSalesRep_ID(GetSalesRep_ID());
            if (!_request.Save())
            {
                return("@SaveError@");
            }
            //
            SetR_Request_ID(_request.GetR_Request_ID());
            return(null);
        }