示例#1
0
 /// <summary>
 ///Parent Constructor
 /// </summary>
 /// <param name="parent">parent</param>
 /// <param name="AD_Role_ID">role id</param>
 public MWindowAccess(MWindow parent, int AD_Role_ID)
     : base(parent.GetCtx(), 0, parent.Get_TrxName())
 {
     SetClientOrg(parent);
     SetAD_Window_ID(parent.GetAD_Window_ID());
     SetAD_Role_ID(AD_Role_ID);
 }
 /// <summary>
 ///Parent Constructor
 /// </summary>
 /// <param name="parent">parent</param>
 /// <param name="from">from copy from</param>
 public MTab(MWindow parent, MTab from)
     : this(parent.GetCtx(), 0, parent.Get_Trx())
 {
     CopyValues(from, this);
     SetClientOrg(parent);
     SetAD_Window_ID(parent.GetAD_Window_ID());
     SetEntityType(parent.GetEntityType());
 }
 /// <summary>
 ///Parent Constructor
 /// </summary>
 /// <param name="parent">parent</param>
 public MTab(MWindow parent)
     : this(parent.GetCtx(), 0, parent.Get_Trx())
 {
     ///this(parent.getCtx(), 0, parent.get_TrxName());
     SetClientOrg(parent);
     SetAD_Window_ID(parent.GetAD_Window_ID());
     SetEntityType(parent.GetEntityType());
 }
        /// <summary>
        /// Get the Parent Table
        /// </summary>
        /// <param name="tab"></param>
        /// <returns></returns>
        public MTable GetParentTable(MWindow win, MTab currentTab)
        {
            MTab[] tabs = win.GetTabs(false, null);
            MTab   tab  = tabs[currentTab.GetTabLevel()];

            if (currentTab.GetTabLevel() == 0)
            {
                return(null);
            }
            return(MTable.Get(GetCtx(), tab.GetAD_Table_ID()));
        }
        }       //	addStatistics

        /// <summary>
        ///   After Save
        /// </summary>
        /// <param name="newRecord">new</param>
        /// <param name="success">success</param>
        /// <returns>success</returns>
        protected override bool AfterSave(bool newRecord, bool success)
        {
            if (newRecord)      //	Add to all automatic roles
            {
                MRole[]        roles = MRole.GetOf(GetCtx(), "IsManual='N'");
                MProcessAccess pa;
                for (int i = 0; i < roles.Length; i++)
                {
                    pa = new MProcessAccess(this, roles[i].GetAD_Role_ID());
                    pa.Save();
                    pa = null;
                }
            }
            //	Menu/Workflow
            else if (Is_ValueChanged("IsActive") || Is_ValueChanged("Name") ||
                     Is_ValueChanged("Description") || Is_ValueChanged("Help"))
            {
                MMenu[] menues = MMenu.Get(GetCtx(), "AD_Process_ID=" + GetAD_Process_ID());
                for (int i = 0; i < menues.Length; i++)
                {
                    menues[i].SetIsActive(IsActive());
                    menues[i].SetName(GetName());
                    menues[i].SetDescription(GetDescription());
                    menues[i].Save();
                }
                X_AD_WF_Node[] nodes = MWindow.GetWFNodes(GetCtx(), "AD_Process_ID=" + GetAD_Process_ID());
                for (int i = 0; i < nodes.Length; i++)
                {
                    bool changed = false;
                    if (nodes[i].IsActive() != IsActive())
                    {
                        nodes[i].SetIsActive(IsActive());
                        changed = true;
                    }
                    if (nodes[i].IsCentrallyMaintained())
                    {
                        nodes[i].SetName(GetName());
                        nodes[i].SetDescription(GetDescription());
                        nodes[i].SetHelp(GetHelp());
                        changed = true;
                    }
                    if (changed)
                    {
                        nodes[i].Save();
                    }
                }
            }
            return(success);
        }
示例#6
0
        /// <summary>
        ///Get MWindow from Cache
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="AD_Window_ID">id</param>
        /// <returns>MWindow</returns>
        public static MWindow Get(Ctx ctx, int AD_Window_ID)
        {
            int     key      = AD_Window_ID;
            MWindow retValue = (MWindow)s_cache[key];

            if (retValue != null)
            {
                return(retValue);
            }
            retValue = new MWindow(ctx, AD_Window_ID, null);
            if (retValue.Get_ID() != 0)
            {
                s_cache.Add(key, retValue);
            }
            return(retValue);
        }