Exemplo n.º 1
0
 public DataRightEventArgs(TkDbContext context, IUserInfo user,
                           IFieldInfoIndexer fieldIndexer, IPageStyle style, DataRow row)
     : base(context, user, fieldIndexer)
 {
     Style = style;
     Row   = row;
 }
Exemplo n.º 2
0
        //[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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
 public void SetMetaData(IPageStyle style, IMetaData metaData)
 {
     if (UseXsltArgs)
     {
         fMetaData = metaData;
     }
 }
Exemplo n.º 6
0
        public ObjectOperateRightEventArgs(IPageStyle style, object mainObj)
        {
            TkDebug.AssertArgumentNull(style, "style", null);

            MainObj = mainObj;
            Style   = style;
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 8
0
 public Tk55Parser(string parser, string moduleCreator, IPageStyle style, string source)
 {
     Parser        = parser;
     ModuleCreator = moduleCreator;
     Style         = style;
     Source        = source;
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 11
0
 public bool CanUseMetaData(IPageStyle style)
 {
     if (style.Style == PageStyle.Insert)
     {
         return(UseMetaData);
     }
     return(false);
 }
Exemplo n.º 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);
        }
Exemplo n.º 13
0
        public SubFunctionKey(IPageStyle style, string source)
        {
            TkDebug.AssertArgumentNull(style, nameof(style), null);
            TkDebug.AssertArgumentNullOrEmpty(source, nameof(source), null);

            Style = style;
            Source = source;
        }
Exemplo n.º 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));
     }
 }
Exemplo n.º 15
0
 public bool CanUseMetaData(IPageStyle style)
 {
     if (TestPageStyleForMetaData(style))
     {
         return(UseMetaData);
     }
     return(false);
 }
Exemplo n.º 16
0
        public PageDataProxy(IPageData source, IPageStyle style)
        {
            TkDebug.AssertArgumentNull(source, "source", null);
            TkDebug.AssertArgumentNull(style, "style", null);

            fSource = source;
            fStyle  = style;
        }
Exemplo n.º 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();
 }
Exemplo n.º 18
0
        public static void FillCodeTable(this TableResolver resolver, IPageStyle style)
        {
            MetaDataTableResolver metaResolver = resolver as MetaDataTableResolver;

            if (metaResolver != null)
            {
                metaResolver.FillCodeTable(style);
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 20
0
        public override bool Equals(object obj)
        {
            IPageStyle style1 = obj as IPageStyle;

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

            return(MetaDataUtil.Equals(this, style1));
        }
Exemplo n.º 21
0
 internal void SetControl(IPageStyle style)
 {
     if (style.Style == PageStyle.Detail)
     {
         InternalControl.Control = GetDetailControl(InternalControl.SrcControl);
     }
     else
     {
         InternalControl.Control = GetControl(InternalControl.SrcControl);
     }
 }
Exemplo n.º 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}");
        }
Exemplo n.º 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);
 }
Exemplo n.º 24
0
 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);
         }
     }
 }
Exemplo n.º 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;
            }
        }
Exemplo n.º 26
0
        public int GetOrder(IPageStyle style)
        {
            PageConfigItem item = GetConfigItem(style);

            if (item == null || item.Order == 0)
            {
                return(Order);
            }
            else
            {
                return(item.Order);
            }
        }
Exemplo n.º 27
0
        public ControlType GetControl(IPageStyle style)
        {
            PageConfigItem item = GetConfigItem(style);

            if (item == null)
            {
                return(Control);
            }
            else
            {
                return(item.Control);
            }
        }
Exemplo n.º 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);
             }
         }
     }
 }
Exemplo n.º 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);
            }
Exemplo n.º 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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 33
0
 public void SetMetaData(IPageStyle style, IMetaData metaData)
 {
     fMetaData = metaData as Tk5ListMetaData;
 }
Exemplo n.º 34
0
 public bool CanUseMetaData(IPageStyle style)
 {
     return style.Style == PageStyle.List;
 }
Exemplo n.º 35
0
 public ControlType GetControl(IPageStyle style)
 {
     return Control;
 }
Exemplo n.º 36
0
 public int GetOrder(IPageStyle style)
 {
     return Order;
 }
Exemplo n.º 37
0
 public string GetCustomControl(IPageStyle style)
 {
     return null;
 }