示例#1
0
        }       //	toString

        /// <summary>
        ///	Before Save
        /// </summary>
        /// <param name="newRecord">new</param>
        /// <returns>true if can be saved</returns>
        protected override Boolean BeforeSave(Boolean newRecord)
        {
            //	Ctx to start with /
            if (!GetWebContext().StartsWith("/"))
            {
                SetWebContext("/" + GetWebContext());
            }
            //	Org to Warehouse
            if (newRecord || Is_ValueChanged("M_Warehouse_ID") || GetAD_Org_ID() == 0)
            {
                MWarehouse wh = new MWarehouse(GetCtx(), GetM_Warehouse_ID(), Get_TrxName());
                SetAD_Org_ID(wh.GetAD_Org_ID());
            }

            String url = GetURL();

            if (url == null)
            {
                url = "";
            }
            Boolean urlOK = url.StartsWith("http://") || url.StartsWith("https://");

            if (!urlOK) // || url.indexOf("localhost") != -1)
            {
                log.SaveError("FillMandatory", Msg.GetElement(GetCtx(), "URL")
                              + " - e.g. http://www.ViennaAdvantage.com");
                return(false);
            }

            return(true);
        }       //	beforeSave