示例#1
0
 public DataRightEventArgs(TkDbContext context, IUserInfo user,
                           IFieldInfoIndexer fieldIndexer, IPageStyle style, DataRow row)
     : base(context, user, fieldIndexer)
 {
     Style = style;
     Row   = row;
 }
        //[DynamicElement(ObjectOperatorsConfigFactory.REG_NAME)]
        //[TagElement(NamespaceType.Toolkit)]
        //public IConfigCreator<IObjectOperatorsConfig> DetailOperators { get; private set; }

        //private BaseObjectSource<T> CreateSource<T>(ObjectSourceConfig sourceConfig,
        //    Func<T, BaseObjectSource<T>> createFunc) where T : class
        //{
        //    T objectSource = sourceConfig.CreateObjectSource().Convert<T>();
        //    BaseObjectSource<T> source = createFunc(objectSource);
        //    source.UseMetaData = UseMetaData;
        //    source.ObjectName = ObjectName;

        //    return source;
        //}

        protected override void CheckPageStyle(IPageStyle style)
        {
            if ((style.Style & DisablePage) == style.Style)
            {
                throw new ErrorOperationException("该页面被禁止,无法访问", this);
            }
        }
示例#3
0
        public static bool Equals(IPageStyle style1, IPageStyle style2)
        {
            if (style1 == null && style2 == null)
            {
                return(true);
            }
            if (style1 == null || style2 == null)
            {
                return(false);
            }

            switch (style1.Style)
            {
            case PageStyle.Custom:
                return(style1.Operation == style2.Operation);

            case PageStyle.Insert:
            case PageStyle.Update:
            case PageStyle.Delete:
            case PageStyle.Detail:
            case PageStyle.List:
                return(style1.Style == style2.Style);

            default:
                return(false);
            }
        }
示例#4
0
        public static bool IsShowInList(IFieldControl control, Tk5ListDetailConfig listDetail,
                                        FieldKind kind, IPageStyle style, bool isInTable)
        {
            if (control == null)
            {
                return(false);
            }
            if ((control.DefaultShow & PageStyle.List) != PageStyle.List ||
                kind != FieldKind.Data)
            {
                return(false);
            }

            if (isInTable)
            {
                var ctrl = control.GetControl(style);
                if (ctrl == ControlType.Hidden)
                {
                    return(false);
                }
                if (listDetail != null && listDetail.Search == FieldSearchMethod.Only)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#5
0
 public void SetMetaData(IPageStyle style, IMetaData metaData)
 {
     if (UseXsltArgs)
     {
         fMetaData = metaData;
     }
 }
示例#6
0
        public ObjectOperateRightEventArgs(IPageStyle style, object mainObj)
        {
            TkDebug.AssertArgumentNull(style, "style", null);

            MainObj = mainObj;
            Style   = style;
        }
示例#7
0
        public string GetTemplateUrl(IPageStyle style, IPageData pageData)
        {
            if (style == null || pageData == null)
            {
                return(string.Empty);
            }

            var       info        = pageData.SourceInfo;
            string    source      = info.Source;
            PageStyle pageStyle   = style.Style;
            string    styleString = pageStyle.ToString().ToLower(ObjectUtil.SysCulture);

            switch (pageStyle)
            {
            case PageStyle.Custom:
                return($"c/{info.ModuleCreator}/{style}/{source}");

            case PageStyle.Insert:
            case PageStyle.List:
            case PageStyle.Update:
            case PageStyle.Delete:
            case PageStyle.Detail:
                return($"c/{info.ModuleCreator}/{styleString}/{source}");

            default:
                TkDebug.ThrowImpossibleCode(this);
                return(null);
            }
        }
示例#8
0
 public Tk55Parser(string parser, string moduleCreator, IPageStyle style, string source)
 {
     Parser        = parser;
     ModuleCreator = moduleCreator;
     Style         = style;
     Source        = source;
 }
示例#9
0
        public override void FillCodeTable(IPageStyle style)
        {
            TkDebug.AssertArgumentNull(style, "style", this);

            if (style.Style == PageStyle.List)
            {
                var queryCodeTables = (from field in CurrentSchemeEx.Fields
                                       let tk5Field = field as ITk5FieldInfo
                                                      where IsQueryField(tk5Field)
                                                      select tk5Field.Decoder.RegName).Distinct().ToArray();
                if (queryCodeTables.Length == 0)
                {
                    return;
                }

                InitializeCodeTable(style);
                foreach (string regName in queryCodeTables)
                {
                    CodeTable code = CodeTables.GetFilledCodeTable(regName);
                    if (code != null)
                    {
                        code.Fill(HostDataSet, Context);
                    }
                }
            }
            else
            {
                base.FillCodeTable(style);
            }
        }
示例#10
0
        //public PageSourceInfo(string source)
        //    : this(null, null, source, true)
        //{
        //}

        public PageSourceInfo(string parser, string moduleCreator, IPageStyle style, string source, bool isContent)
        {
            TkDebug.AssertArgumentNullOrEmpty(parser, nameof(parser), null);
            TkDebug.AssertArgumentNullOrEmpty(source, nameof(source), null);

            Parser = parser;
            if (string.IsNullOrEmpty(moduleCreator))
            {
                ModuleCreator = "xml";
            }
            else
            {
                ModuleCreator = moduleCreator.ToLower(ObjectUtil.SysCulture);
            }
            if (style == null)
            {
                Style = (PageStyleClass)string.Empty;
            }
            else
            {
                Style = style;
            }
            Source    = source;
            IsContent = isContent;
        }
示例#11
0
 public bool CanUseMetaData(IPageStyle style)
 {
     if (style.Style == PageStyle.Insert)
     {
         return(UseMetaData);
     }
     return(false);
 }
示例#12
0
        public static OutputData CreateOutputData(IMetaData metaData, ISource source,
                                                  IPageStyle style, IPageData inputData)
        {
            MetaDataUtil.SetMetaData(source, style, metaData);
            OutputData outputData = source.DoAction(inputData);

            return(outputData);
        }
示例#13
0
        public SubFunctionKey(IPageStyle style, string source)
        {
            TkDebug.AssertArgumentNull(style, nameof(style), null);
            TkDebug.AssertArgumentNullOrEmpty(source, nameof(source), null);

            Style = style;
            Source = source;
        }
示例#14
0
 public void SetMetaData(IPageStyle style, IMetaData metaData)
 {
     MainResolver.ReadMetaData(metaData.GetTableScheme(MainResolver.TableName));
     foreach (var resolver in fDetailResolvers)
     {
         resolver.Item1.ReadMetaData(metaData.GetTableScheme(resolver.Item1.TableName));
     }
 }
 public bool CanUseMetaData(IPageStyle style)
 {
     if (TestPageStyleForMetaData(style))
     {
         return(UseMetaData);
     }
     return(false);
 }
示例#16
0
        public PageDataProxy(IPageData source, IPageStyle style)
        {
            TkDebug.AssertArgumentNull(source, "source", null);
            TkDebug.AssertArgumentNull(style, "style", null);

            fSource = source;
            fStyle  = style;
        }
示例#17
0
 protected override void OnReadMetaData(TableResolver resolver,
                                        IPageStyle style, ITableSchemeEx scheme)
 {
     fListFields = (from field in scheme.Fields
                    let tk5field = field.Convert <Tk5FieldInfoEx>()
                                   where IsListField(tk5field, style)
                                   orderby field.Control.GetOrder(style)
                                   select MetaDataTableResolver.GetSortField(field)).ToList();
 }
示例#18
0
        public static void FillCodeTable(this TableResolver resolver, IPageStyle style)
        {
            MetaDataTableResolver metaResolver = resolver as MetaDataTableResolver;

            if (metaResolver != null)
            {
                metaResolver.FillCodeTable(style);
            }
        }
示例#19
0
        public OperateRightEventArgs(IPageStyle style, string source, DataRow row)
        {
            TkDebug.AssertArgumentNull(style, nameof(style), null);
            TkDebug.AssertArgumentNullOrEmpty(source, nameof(source), null);

            Row    = row;
            Source = source;
            Style  = style;
        }
示例#20
0
        public override bool Equals(object obj)
        {
            IPageStyle style1 = obj as IPageStyle;

            if (style1 == null)
            {
                return(false);
            }

            return(MetaDataUtil.Equals(this, style1));
        }
示例#21
0
 internal void SetControl(IPageStyle style)
 {
     if (style.Style == PageStyle.Detail)
     {
         InternalControl.Control = GetDetailControl(InternalControl.SrcControl);
     }
     else
     {
         InternalControl.Control = GetControl(InternalControl.SrcControl);
     }
 }
示例#22
0
        public string Build(IPageStyle style, string moduleCreator, string source,
                            bool isContent = true, string handler = "c")
        {
            if (!(style is PageStyleClass styleClass))
            {
                styleClass = PageStyleClass.FromStyle(style);
            }
            string director = isContent ? string.Empty : "~";

            return($"/{handler}/{director}{moduleCreator}/{styleClass}/{source}");
        }
示例#23
0
 private void CopyFromProperyField(PropertyFieldInfo field, IPageStyle style)
 {
     Hint         = field.Hint;
     HintPosition = field.HintPosition;
     SetFieldControl(field, style);
     if (field.Upload != null)
     {
         Upload = new Tk5UploadConfig(field.Upload);
     }
     SetDisplay(style);
 }
 public virtual void SetMetaData(IPageStyle style, IMetaData metaData)
 {
     if (TestPageStyleForMetaData(style))
     {
         ITableSchemeEx scheme = metaData.GetTableScheme(MainResolver.TableName);
         if (scheme != null)
         {
             MainResolver.ReadMetaData(scheme);
             OnReadMetaData(MainResolver, style, scheme);
         }
     }
 }
示例#25
0
        public SimpleFieldControl(IFieldControl control, IPageStyle style)
        {
            fStyle     = style.Style;
            Order      = control.GetOrder(style);
            SrcControl = control.GetControl(style);
            var customCtrl = control.GetCustomControl(style);

            if (customCtrl != null)
            {
                CustomControl     = customCtrl.Item1;
                CustomControlData = customCtrl.Item2;
            }
        }
示例#26
0
        public int GetOrder(IPageStyle style)
        {
            PageConfigItem item = GetConfigItem(style);

            if (item == null || item.Order == 0)
            {
                return(Order);
            }
            else
            {
                return(item.Order);
            }
        }
示例#27
0
        public ControlType GetControl(IPageStyle style)
        {
            PageConfigItem item = GetConfigItem(style);

            if (item == null)
            {
                return(Control);
            }
            else
            {
                return(item.Control);
            }
        }
示例#28
0
 public void SetMetaData(IPageStyle style, IMetaData metaData)
 {
     foreach (var item in fList)
     {
         ISupportMetaData support = item.PageMaker as ISupportMetaData;
         if (support != null)
         {
             if (support.CanUseMetaData(style))
             {
                 support.SetMetaData(style, metaData);
             }
         }
     }
 }
示例#29
0
            public bool IsShowInList(IPageStyle style, bool isInTable)
            {
                var ctrl = Control.Convert <FieldControlAttribute>();

                if ((ctrl.DefaultShow & PageStyle.List) != PageStyle.List)
                {
                    return(false);
                }

                if (isInTable)
                {
                    return(ctrl.Control != ControlType.Hidden);
                }
                return(true);
            }
示例#30
0
        private string CheckPageStyle(IPageData pageData)
        {
            IPageStyle style = pageData.Style;

            TkDebug.Assert(style.Style == PageStyle.Custom, string.Format(ObjectUtil.SysCulture,
                                                                          "地址错误,导入地址均为Custom类型,当前页面类型为{0}", style), this);

            string oper = style.Operation;

            if (string.IsNullOrEmpty(oper))
            {
                return(ImportConst.DEFAULT);
            }
            return(oper);
        }
示例#31
0
        protected override void SetConstraints(IPageStyle style)
        {
            base.SetConstraints(style);

            IFieldInfo mobile = GetFieldInfo("Mobile");
            //IFieldInfo email = GetFieldInfo("Email");
            var constraint = new MultipleNotEmptyConstraint(mobile, GetFieldInfo("Weixin"));

            Constraints.Add(constraint);
            //Constraints.Add(new EmailConstraint(email));
            //Constraints.Add(new MobileConstraint(mobile));
            Constraints.Add(new NotEmptyConstraint(GetFieldInfo("Name")));

            IFieldInfo logonName = GetFieldInfo("UserLogonName");
            Constraints.Add(new NotEmptyConstraint(logonName));
            Constraints.Add(new SingleValueConstraint(logonName));
            Constraints.Add(new RegexConstraint(logonName, logonName.DisplayName + "只能由字母和数字构成",
                "^[0-9a-zA-Z]+$"));
        }
 public bool CanUseMetaData(IPageStyle style)
 {
     return true;
 }
 public void SetMetaData(IPageStyle style, IMetaData metaData)
 {
     fMetaData = metaData as Tk5ListMetaData;
 }
 public bool CanUseMetaData(IPageStyle style)
 {
     return style.Style == PageStyle.List;
 }
 public ControlType GetControl(IPageStyle style)
 {
     return Control;
 }
 public int GetOrder(IPageStyle style)
 {
     return Order;
 }
 public string GetCustomControl(IPageStyle style)
 {
     return null;
 }