Ejemplo n.º 1
0
        public virtual IEnumerable <string> GetOperator(OperateRightEventArgs e)
        {
            DataRow row = e.Row;

            if (row == null)
            {
                return(EmptyRowRights);
            }
            try
            {
                object value = row[FieldName];
                if (value == DBNull.Value)
                {
                    if (fNullItem != null)
                    {
                        return(fNullItem.Rights);
                    }
                }
                else
                {
                    FieldOperateRightItem item = fList[value.ToString()];
                    if (item != null)
                    {
                        return(item.Rights);
                    }
                }
            }
            catch
            {
            }
            return(null);
        }
Ejemplo n.º 2
0
        public IEnumerable <string> GetOperator(OperateRightEventArgs e)
        {
            if (e.Style.Style == PageStyle.List)
            {
                if (e.Row == null)
                {
                    if (fOperators.Contains(UpdateKind.Insert))
                    {
                        return(EnumUtil.Convert(RightConst.INSERT));
                    }
                    return(null);
                }
                else
                {
                    List <string> result = new List <string>(2);
                    if (fOperators.Contains(UpdateKind.Update))
                    {
                        result.Add(RightConst.UPDATE);
                    }
                    if (fOperators.Contains(UpdateKind.Delete))
                    {
                        result.Add(RightConst.DELETE);
                    }
                    if (result.Count == 0)
                    {
                        return(null);
                    }
                    return(result);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        public IEnumerable <string> GetOperator(OperateRightEventArgs e)
        {
            if (e.Row == null)
            {
                return(null);
            }
            List <string> result = new List <string>()
            {
                RightConst.INSERT, RightConst.UPDATE
            };

            if (fOtherOperators != null)
            {
                result.AddRange(fOtherOperators);
            }

            if (DisableRootDelete)
            {
                string layer = e.Row.GetString(LayerFieldName);
                if (layer.Length > 3)
                {
                    result.Add(RightConst.DELETE);
                }
            }
            else
            {
                result.Add(RightConst.DELETE);
            }

            return(result);
        }
Ejemplo n.º 4
0
        public IEnumerable <string> GetOperator(OperateRightEventArgs e)
        {
            IFunctionRight funcRight = WebGlobalVariable.SessionGbl.AppRight.FunctionRight;

            TkDebug.AssertNotNull(funcRight, "系统没有配置功能权限", this);

            return(funcRight.GetSubFunctions(FunctionKey));
        }
Ejemplo n.º 5
0
        public override IEnumerable <string> GetOperator(OperateRightEventArgs e)
        {
            var result = base.GetOperator(e);

            if (result == null)
            {
                return(null);
            }
            IFunctionRight funcRight = WebGlobalVariable.SessionGbl.AppRight.FunctionRight;

            TkDebug.AssertNotNull(funcRight, "系统没有配置功能权限", this);
            var nextResult = from item in result
                             where funcRight.IsSubFunction(item, FunctionKey)
                             select item;

            return(nextResult);
        }
Ejemplo n.º 6
0
        public IEnumerable <string> GetOperator(OperateRightEventArgs e)
        {
            if (fRights == null)
            {
                return(null);
            }

            var items = from right in fRights
                        let opers = right.GetOperator(e)
                                    where opers != null
                                    select opers;
            var first = items.FirstOrDefault();

            if (first == null)
            {
                return(null);
            }

            var intersection = items.Skip(1)
                               .Aggregate(new HashSet <string>(first),
                                          (h, a) => { h.IntersectWith(a); return(h); });

            return(intersection);
        }