private IAccessPolicy GetAccess(List<Security> TaskCodes)
        {
            IAccessPolicy accessSecurity = new AccessPolicy();

            accessSecurity.Enabled = true;
            accessSecurity.ReadOnly = false;
            accessSecurity.Masking = false;
            accessSecurity.Visibility = true;

            if (TaskCodes != null && TaskCodes.Count > 0)
            {
                foreach (Security security in TaskCodes)
                {
                    bool securityCodeExist =this.IsAuthorized(security.TaskCode);
                    if (security.AccessType == AccessType.Enable)
                    {
                        accessSecurity.Enabled = securityCodeExist ? true : false;
                    }

                    if (security.AccessType == AccessType.Readonly)
                    {
                        accessSecurity.ReadOnly = securityCodeExist ? false : true;
                    }

                    if (security.AccessType == AccessType.Masking)
                    {
                        accessSecurity.Masking = securityCodeExist ? false : true;
                    }

                    if (security.AccessType == AccessType.Visible)
                    {
                        accessSecurity.Visibility = securityCodeExist ? true : false;
                    }
                }
            }
            return accessSecurity;
        }
        private IAccessPolicy GetAccess(List <Security> TaskCodes)
        {
            IAccessPolicy accessSecurity = new AccessPolicy();

            accessSecurity.Enabled    = true;
            accessSecurity.ReadOnly   = false;
            accessSecurity.Masking    = false;
            accessSecurity.Visibility = true;

            if (TaskCodes != null && TaskCodes.Count > 0)
            {
                foreach (Security security in TaskCodes)
                {
                    bool securityCodeExist = this.IsAuthorized(security.TaskCode);
                    if (security.AccessType == AccessType.Enable)
                    {
                        accessSecurity.Enabled = securityCodeExist ? true : false;
                    }

                    if (security.AccessType == AccessType.Readonly)
                    {
                        accessSecurity.ReadOnly = securityCodeExist ? false : true;
                    }

                    if (security.AccessType == AccessType.Masking)
                    {
                        accessSecurity.Masking = securityCodeExist ? false : true;
                    }

                    if (security.AccessType == AccessType.Visible)
                    {
                        accessSecurity.Visibility = securityCodeExist ? true : false;
                    }
                }
            }
            return(accessSecurity);
        }