}       //	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);
        }
Ejemplo n.º 2
0
        private void InsertNewRecordInRole()
        {
            DataSet ds = DB.ExecuteDataset("SELECT AD_Role_ID FROM AD_Role_Group WHERE ad_groupinfo_id=" + GetAD_GroupInfo_ID());

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    MProcessAccess access = new MProcessAccess(GetCtx(), 0, null);
                    access.SetAD_Process_ID(GetAD_Process_ID());
                    access.SetAD_Role_ID(Convert.ToInt32(ds.Tables[0].Rows[i]["AD_Role_ID"]));
                    access.SetIsReadWrite(true);
                    access.Save();
                }
            }
        }