Пример #1
0
        public void AddUserGroup()
        {
            if ((miUserGroupId == 0) && (Validator.Count == 0))
            {
                DataTable dt = new DataTable();

                dt = DABase.Instance.ExecSP(cn_spAdd,
                                            DABase.Instance.Parameter(cn_pmLoggedUserId, miLoggedUserId),
                                            DABase.Instance.Parameter(cn_pmUserGroupId, miUserGroupId),
                                            DABase.Instance.Parameter(cn_pmUserGroupCode, msUserGroupCode),
                                            DABase.Instance.Parameter(cn_pmUserGroupName, msUserGroupName),
                                            DABase.Instance.Parameter(cn_pmNewId, miUserGroupId));

                int oNewUserGroupId;
                UserGroupPermissions oNewPermissions = null;;
                foreach (DataRow dRow in dt.Rows)
                {
                    oNewUserGroupId = Convert.ToInt32(dRow[0]);
                    oNewPermissions = UserGroupPermissions.GetUserGroupPermissions(miLoggedUserId, oNewUserGroupId, true);
                }

                foreach (UserGroupPermission p in this.UserGroupPermissions)
                {
                    UserGroupPermission n = oNewPermissions.Where(x => x.FormName == p.FormName).First();

                    n.CanCreate = p.CanCreate;
                    n.CanRead   = p.CanRead;
                    n.CanUpdate = p.CanUpdate;
                    n.CanDelete = p.CanDelete;
                    n.SetUserGroupPermission(miLoggedUserId);
                }

                this.SetEntityState(EntityStateType.Added);
                UserGroups.Listing.List(miLoggedUserId);
            }
            else
            {
                MessageBox.Show(Validator.ToString());
            }
        }
Пример #2
0
 public static UserGroupPermissions GetUserGroupPermissions(int iLoggedUserId, int iUserGroupId, bool bRefresh)
 {
     m_PermissionInstance = new UserGroupPermissions(iLoggedUserId, iUserGroupId);
     Load(iLoggedUserId, iUserGroupId);
     return(m_PermissionInstance);
 }