Example #1
0
        /// <summary>
        /// Gets the groups by security entity.
        /// </summary>
        /// <param name="securityEntityId">The security entity ID.</param>
        /// <returns>DataTable.</returns>
        public DataTable GetGroupsBySecurityEntity(int securityEntityId)
        {
            MGroupProfile myProfile = new MGroupProfile();

            myProfile.SecurityEntityId = securityEntityId;
            m_DGroups.Profile          = myProfile;
            return(m_DGroups.GroupsBySecurityEntity());
        }
Example #2
0
        /// <summary>
        /// Gets the profile.
        /// </summary>
        /// <param name="groupId">The group ID.</param>
        /// <returns>MGroupProfile.</returns>
        public MGroupProfile GetProfile(int groupId)
        {
            MGroupProfile retProfile = new MGroupProfile();

            retProfile.Id     = groupId;
            m_DGroups.Profile = retProfile;
            retProfile        = new MGroupProfile(m_DGroups.ProfileData());
            return(retProfile);
        }
Example #3
0
        MGroupProfile populateProfile(MUIGroupProfile profile)
        {
            MGroupProfile mRetVal = new MGroupProfile();

            mRetVal.Name             = profile.Name;
            mRetVal.Description      = profile.Description;
            mRetVal.Id               = profile.Id;
            mRetVal.SecurityEntityId = SecurityEntityUtility.CurrentProfile().Id;
            return(mRetVal);
        }
Example #4
0
 /// <summary>
 /// Updates the group.
 /// </summary>
 /// <param name="profile">The profile.</param>
 /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
 public void Save(MGroupProfile profile)
 {
     if (profile == null)
     {
         throw new ArgumentNullException("profile", "profile cannot be a null reference (Nothing in Visual Basic)!!");
     }
     m_DGroups.Profile = profile;
     if (DatabaseIsOnline())
     {
         m_DGroups.Save();
     }
 }
Example #5
0
        /// <summary>
        /// Deletes the group.
        /// </summary>
        /// <param name="profile">The profile.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
        public bool DeleteGroup(MGroupProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile", "profile cannot be a null reference (Nothing in Visual Basic)!!");
            }
            bool retVal = false;

            m_DGroups.Profile = profile;
            if (DatabaseIsOnline())
            {
                retVal = m_DGroups.DeleteGroup();
            }
            return(retVal);
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String mGroupSeqId = GWWebHelper.GetQueryValue(Request, "GroupSeqID");

            if (!String.IsNullOrEmpty(mGroupSeqId))
            {
                int mGroupID = int.Parse(mGroupSeqId);
                if (mGroupID != -1)
                {
                    m_Profile = GroupUtility.GetProfile(mGroupID);
                }
                else
                {
                    m_Profile = new MGroupProfile();
                }
                HttpContext.Current.Session.Add("EditId", m_Profile.Id);
                populatePage();
            }
        }
Example #7
0
        public IHttpActionResult Save(MUIGroupProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("uiProfile", "uiProfile cannot be a null reference (Nothing in Visual Basic)!");
            }
            string        mRetVal        = "false";
            MGroupProfile mProfileToSave = new MGroupProfile();
            MSecurityInfo mSecurityInfo  = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditGroups", true)), AccountUtility.CurrentProfile());
            Logger        mLog           = Logger.Instance();

            if (HttpContext.Current.Items["EditId"] != null)
            {
                if (profile.Id == -1)
                {
                    if (!mSecurityInfo.MayAdd)
                    {
                        Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add");
                        mLog.Error(mError);
                        return(this.InternalServerError(mError));
                    }
                    mProfileToSave.AddedBy   = AccountUtility.CurrentProfile().Id;
                    mProfileToSave.AddedDate = DateTime.Now;
                }
                else
                {
                    if (!mSecurityInfo.MayAdd)
                    {
                        Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to edit");
                        mLog.Error(mError);
                        return(this.InternalServerError(mError));
                    }
                    //mProfileToSave = RoleUtility.GetProfile(profile.Id);

                    mProfileToSave.UpdatedBy   = AccountUtility.CurrentProfile().Id;
                    mProfileToSave.UpdatedDate = DateTime.Now;
                }
            }
            mProfileToSave = populateProfile(profile);
            GroupUtility.Save(mProfileToSave);
            return(Ok(mRetVal));
        }
Example #8
0
        public IHttpActionResult Delete([FromUri] int groupSeqId)
        {
            string        mRetVal       = "false";
            MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditGroups", true)), AccountUtility.CurrentProfile());

            if (!mSecurityInfo.MayDelete)
            {
                Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to delete");
                Logger    mLog   = Logger.Instance();
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            else
            {
                if (HttpContext.Current.Items["EditId"] != null)
                {
                    int mEditId = int.Parse(HttpContext.Current.Items["EditId"].ToString());
                    if (mEditId == groupSeqId)
                    {
                        MGroupProfile mProfile = GroupUtility.GetProfile(groupSeqId);
                        GroupUtility.Delete(mProfile);
                    }
                    else
                    {
                        Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                        Logger    mLog   = Logger.Instance();
                        mLog.Error(mError);
                        return(this.InternalServerError(mError));
                    }
                }
                else
                {
                    Exception mError = new Exception("The identifier unknown and nothing has been saved!!!!");
                    Logger    mLog   = Logger.Instance();
                    mLog.Error(mError);
                    return(this.InternalServerError(mError));
                }
            }

            return(Ok(mRetVal));
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MAccountProfile updatingAccount = null;
            MGroupProfile   mGroupProfile   = GroupUtility.GetProfile(int.Parse(HttpContext.Current.Request["GroupSeqId"]));

            txtEditID.Text = mGroupProfile.Id.ToString();
            litGroup.Text  = mGroupProfile.Name;
            HttpContext.Current.Session.Add("EditId", mGroupProfile.Id);
            updatingAccount = AccountUtility.CurrentProfile();

            DataView myDataView = RoleUtility.GetAllRolesBySecurityEntity(int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId].ToString())).DefaultView;

            if (!updatingAccount.IsSystemAdmin)
            {
                String rowFilter = "IS_SYSTEM <> 1 AND IS_SYSTEM_ONLY <> 1";
                myDataView.RowFilter = rowFilter;
            }
            try
            {
                MGroupProfile myGroupProfile = new MGroupProfile();
                myGroupProfile = GroupUtility.GetProfile(int.Parse(txtEditID.Text.ToString()));
                litGroup.Text  = myGroupProfile.Name;
                MGroupRoles mProfile = new MGroupRoles();
                mProfile.SecurityEntityId = int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId].ToString());
                mProfile.GroupSeqId       = int.Parse(txtEditID.Text.ToString());
                ctlMembers.SelectedItems  = GroupUtility.GetSelectedRoles(mProfile);
            }
            catch (Exception ex)
            {
                Logger log = Logger.Instance();
                log.Debug(ex);
            }
            ctlMembers.DataSource = myDataView;
            ctlMembers.DataField  = "Name";
            ctlMembers.DataBind();
        }