public ObjectReferencePropertyTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.Generator.Templates.Serialization.SerializationMembersList serializationList, string moduleNamespace, string ownInterface, string name, string implNameUnused, string eventName, string fkBackingName, string fkGuidBackingName, string referencedInterface, string referencedImplementation, string associationNameUnused, string targetRoleNameUnused, string positionPropertyName, string inverseNavigatorName, bool inverseNavigatorIsList, bool notifyInverseCollection, bool eagerLoading, bool relDataTypeExportable, bool callGetterSetterEvents, bool isCalculated, bool disableExport)
            : base(_host)
        {
			this.ctx = ctx;
			this.serializationList = serializationList;
			this.moduleNamespace = moduleNamespace;
			this.ownInterface = ownInterface;
			this.name = name;
			this.implNameUnused = implNameUnused;
			this.eventName = eventName;
			this.fkBackingName = fkBackingName;
			this.fkGuidBackingName = fkGuidBackingName;
			this.referencedInterface = referencedInterface;
			this.referencedImplementation = referencedImplementation;
			this.associationNameUnused = associationNameUnused;
			this.targetRoleNameUnused = targetRoleNameUnused;
			this.positionPropertyName = positionPropertyName;
			this.inverseNavigatorName = inverseNavigatorName;
			this.inverseNavigatorIsList = inverseNavigatorIsList;
			this.notifyInverseCollection = notifyInverseCollection;
			this.eagerLoading = eagerLoading;
			this.relDataTypeExportable = relDataTypeExportable;
			this.callGetterSetterEvents = callGetterSetterEvents;
			this.isCalculated = isCalculated;
			this.disableExport = disableExport;

        }
示例#2
0
        public System.Drawing.Image ToImage(Zetbox.App.GUI.Icon icon)
        {
            if (icon == null) return null;
            if (icon.ObjectState == DataObjectState.New) return null;

            try
            {
                System.Drawing.Image bmp;
                if (!_cache.TryGetValue(icon.ExportGuid, out bmp))
                {
                    var realIcon = Context.FindPersistenceObject<Zetbox.App.GUI.Icon>(icon.ExportGuid);
                    if (realIcon.Blob == null)
                    {
                        Logging.Log.WarnFormat("Icon#{0} has no associated request", realIcon.ID);
                        return null;
                    }
                    bmp = System.Drawing.Image.FromStream(realIcon.Blob.GetStream());
                    _cache[icon.ExportGuid] = bmp;
                }
                return bmp;
            }
            catch (Exception ex)
            {
                Logging.Log.Info("Error while loading Icon", ex);
                return null;
            }
        }
 public static void CreateFilterModel(Zetbox.App.GUI.MonthFilterConfiguration obj, MethodReturnEventArgs<IFilterModel> e, Zetbox.API.IZetboxContext ctx)
 {
     var mdl = MonthValueFilterModel.Create(FrozenContext, obj.GetLabel(), FilterValueSource.FromProperty(obj.Property), obj.IsCurrentMonthDefault ?? false);
     mdl.Required = obj.Required;
     mdl.RefreshOnFilterChanged = obj.RefreshOnFilterChanged;
     e.Result = mdl;
 }
示例#4
0
        public Template(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.Module module)
            : base(_host)
        {
			this.ctx = ctx;
			this.module = module;

        }
示例#5
0
文件: Report.cs 项目: daszat/zetbox
        public void CreateReport(Zetbox.App.SchemaMigration.MigrationProject obj)
        {
            this._obj = obj;

            NewHeading1("Summary");
            foreach (var s in obj.StagingDatabases)
            {
                RenderTableMappings(s);
            }

            foreach (var s in obj.StagingDatabases)
            {
                foreach (var tbl in s.SourceTables.Where(i => i.DestinationObjectClass != null).OrderBy(i => i.Name))
                {
                    var r = new SourceTableMappingReport(Section);
                    r.CreateReport(tbl);
                }

                foreach (var tbl in s.SourceTables.Where(i => i.DestinationObjectClass == null && i.Status != MappingStatus.Ignored).OrderBy(i => i.Name))
                {
                    var r = new SourceTableMappingReport(Section);
                    r.CreateReport(tbl);
                }
            }
        }
示例#6
0
 public static void Open(Zetbox.App.GUI.Icon obj)
 {
     if (obj.Blob != null)
     {
         obj.Blob.Open();
     }
 }
 /// <summary>
 /// Opens a dialog to let the user choose a type references from the specified assembly.
 /// </summary>
 /// <param name="assembly">the assembly to choose from</param>
 protected void ChooseTypeRefFromAssembly(Zetbox.App.Base.Assembly assembly)
 {
     var regenerateCmd = ViewModelFactory.CreateViewModel<RegenerateTypeRefsCommand.Factory>().Invoke(DataContext, Parent, this);
     var selectionTask = ViewModelFactory.CreateViewModel<DataObjectSelectionTaskViewModel.Factory>().Invoke(
         DataContext,
         Parent,
         typeof(TypeRef).GetObjectClass(FrozenContext),
         () => DataContext.GetQuery<Zetbox.App.Base.TypeRef>(),
         (chosen) =>
         {
             if (chosen != null)
             {
                 this.ParentType.Value = chosen.FirstOrDefault();
             }
         },
         new List<CommandViewModel>() { regenerateCmd }
     );
     //var filter = selectionTask.ListViewModel.Filter.Single(i => i.Property.ExportGuid == new Guid("885BFA97-3D43-48BB-A0AA-1049298714FF"));
     //filter.Value = filter.PossibleValues
     //    .Cast<KeyValuePair<DataObjectViewModel, string>>()
     //    .Where(m => m.Key != null)
     //    .FirstOrDefault(m => m.Key.Object == assembly)
     //    .Key;
     regenerateCmd.ListModel = selectionTask.ListViewModel;
     ViewModelFactory.ShowDialog(selectionTask);
 }
        public static void CreateFilterModel(Zetbox.App.GUI.SinglePropertyFilterConfiguration obj, MethodReturnEventArgs<IFilterModel> e)
        {
            var mdl = new SingleValueFilterModel();
            mdl.Label = obj.GetLabel();
            mdl.Required = obj.Required;
            mdl.ValueSource = FilterValueSource.FromProperty(obj.Property);

            mdl.ViewModelType = obj.ViewModelDescriptor;
            mdl.RequestedKind = obj.RequestedKind;

            mdl.FilterArguments.Add(new FilterArgumentConfig(obj.Property.GetDetachedValueModel(true), /*cfg.ArgumentViewModel ?? */ obj.Property.ValueModelDescriptor));
            if (obj.Property is StringProperty)
            {
                mdl.Operator = FilterOperators.Contains;
            }
            else if (obj.Property is EnumerationProperty)
            {
                mdl.RefreshOnFilterChanged = true;
            }
            else if (obj.Property is ObjectReferenceProperty)
            {
                mdl.RefreshOnFilterChanged = true;
            }
            e.Result = mdl;
        }
示例#9
0
        public static new void Call(Arebis.CodeGeneration.IGenerationHost host, IZetboxContext ctx, DataType implementor, Zetbox.App.Base.Method m, int index)
        {
            if (host == null) { throw new ArgumentNullException("host"); }
            string indexSuffix = index == 0 ? String.Empty : index.ToString();
            string eventName = "On" + m.Name + indexSuffix + "_" + implementor.Name;

            host.CallTemplate("ObjectClasses.InvokeServerMethod", ctx, implementor, m, index, indexSuffix, eventName);
        }
示例#10
0
 public static void HandleBlobChange(at.dasz.DocumentManagement.Document obj, MethodReturnEventArgs<Zetbox.App.Base.Blob> e, Zetbox.App.Base.Blob oldBlob, Zetbox.App.Base.Blob newBlob)
 {
     if (oldBlob != null && !obj.Revisions.Contains(oldBlob))
     {
         obj.Revisions.Add(oldBlob);
     }
     e.Result = newBlob;
 }
        public ValueCollectionProperty(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.Generator.Templates.Serialization.SerializationMembersList serializationList, Property prop)
            : base(_host)
        {
			this.ctx = ctx;
			this.serializationList = serializationList;
			this.prop = prop;

        }
示例#12
0
        /// <summary>
        /// Initializes a new instance of the WrappedZetboxCommand class.
        /// </summary>
        /// <param name="cmd">the command to wrap</param>
        public WrappedZetboxCommand(Zetbox.Client.Presentables.ICommandViewModel cmd)
            : base(cmd == null ? String.Empty : cmd.Label, typeof(WrappedZetboxCommand))
        {
            if (cmd == null) { throw new ArgumentNullException("cmd", "No command to wrap"); }

            _command = cmd;
            _command.CanExecuteChanged += (sender, args) => CommandManager.InvalidateRequerySuggested();
        }
示例#13
0
 public static void NotifyPreSave(Zetbox.App.Base.Method obj)
 {
     // TODO: replace with constraint
     if (!System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(obj.Name))
     {
         throw new ArgumentException(string.Format("Method Name {0} has some illegal chars", obj.Name));
     }
 }
示例#14
0
 public static void GetSummaryReport(Projekt obj, MethodReturnEventArgs<System.Object> e, string title, Zetbox.App.Base.DateTimeRange range)
 {
     using (var rpt = _rptFactory())
     {
         ProjectReport.Call(rpt);
         rpt.Open("ProjectReport.pdf");
     }
 }
示例#15
0
 public static void HandleBlobChange(ImportedFile obj, MethodReturnEventArgs<Zetbox.App.Base.Blob> e, Zetbox.App.Base.Blob oldBlob, Zetbox.App.Base.Blob newBlob)
 {
     if (oldBlob != null && newBlob != oldBlob)
     {
         throw new InvalidOperationException("Changing blob on imported files is not allowed");
     }
     e.Result = newBlob;
 }
示例#16
0
        public MethodCanExec(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.DataType dt, Zetbox.App.Base.Method m, string eventName)
            : base(_host)
        {
			this.ctx = ctx;
			this.dt = dt;
			this.m = m;
			this.eventName = eventName;

        }
示例#17
0
        public CalendarSelectionViewModel(IViewModelDependencies appCtx, IZetboxContext dataCtx, Zetbox.Client.Presentables.ViewModel parent, cal.CalendarBook calendar, bool isFavorite)
            : base(appCtx, dataCtx, parent)
        {
            if (calendar == null) throw new ArgumentNullException("calendar");

            this.Calendar = calendar;
            this._Selected = isFavorite;
            this._IsFavorite = isFavorite;
        }
示例#18
0
        public static void GetLabel(Zetbox.App.Base.Property obj, MethodReturnEventArgs<System.String> e)
        {
            e.Result = !string.IsNullOrEmpty(obj.Label) ? obj.Label : obj.Name;

            if (obj.Module == null || obj.ObjectClass == null)
                return;

            e.Result = _assets.GetString(obj.Module, ZetboxAssetKeys.ConstructBaseName(obj), ZetboxAssetKeys.ConstructLabelKey(obj), e.Result);
        }
        public EnumerationPropertyTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.Generator.Templates.Serialization.SerializationMembersList serializationList, EnumerationProperty prop, bool callGetterSetterEvents)
            : base(_host)
        {
			this.ctx = ctx;
			this.serializationList = serializationList;
			this.prop = prop;
			this.callGetterSetterEvents = callGetterSetterEvents;

        }
示例#20
0
        public ProjectFile(Arebis.CodeGeneration.IGenerationHost _host, Zetbox.API.IZetboxContext ctx, string projectGuid, List<string> fileNames, IEnumerable<ISchemaProvider> schemaProviders)
            : base(_host)
        {
			this.ctx = ctx;
			this.projectGuid = projectGuid;
			this.fileNames = fileNames;
			this.schemaProviders = schemaProviders;

        }
示例#21
0
        public static void ToString(Zetbox.App.Base.AccessControl obj, MethodReturnEventArgs<string> e)
        {
            e.Result = String.Format("{0} ({1}) {2}",
                obj.Name ?? string.Empty,
                obj.Rights != null ? obj.Rights.ToString() :  "None",
                obj.Description ?? string.Empty);

            ToStringHelper.FixupFloatingObjectsToString(obj, e);
        }
        public CollectionEntryListProperty(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.Generator.Templates.Serialization.SerializationMembersList serializationList, Relation rel, RelationEndRole endRole)
            : base(_host)
        {
			this.ctx = ctx;
			this.serializationList = serializationList;
			this.rel = rel;
			this.endRole = endRole;

        }
示例#23
0
        public static void preSet_Blob(Zetbox.App.GUI.Icon obj, PropertyPreSetterEventArgs<Zetbox.App.Base.Blob> e)
        {
            // Delete old blob
            if (e.OldValue != null && e.OldValue != e.NewValue)
            {
                obj.Context.Delete(e.OldValue);
            }

            e.Result = e.NewValue;
        }
示例#24
0
        public static void HandleBlobChange(at.dasz.DocumentManagement.DynamicFile obj, MethodReturnEventArgs<Zetbox.App.Base.Blob> e, Zetbox.App.Base.Blob oldBlob, Zetbox.App.Base.Blob newBlob)
        {
            // Delete old blob
            if (oldBlob != null && newBlob != oldBlob)
            {
                obj.Context.Delete(oldBlob);
            }

            e.Result = newBlob;
        }
示例#25
0
 public static void CreateMappingReport(Zetbox.App.SchemaMigration.SourceTable obj)
 {
     var fileName = _mdlFactory.GetDestinationFileNameFromUser("Migration Report " + obj.Name + ".pdf", "PDF|*.pdf");
     if (!string.IsNullOrEmpty(fileName))
     {
         var r = new SourceTableMappingReport();
         r.CreateReport(obj);
         r.Save(fileName);
         _fileOpener.ShellExecute(fileName);
     }
 }
示例#26
0
 public static void ToString(Zetbox.App.Base.NewGuidDefaultValue obj, MethodReturnEventArgs<string> e)
 {
     if (obj.Property != null)
     {
         e.Result = string.Format("{0} will be initialized with a new Guid", obj.Property.Name);
     }
     else
     {
         e.Result = "Initializes a property with a new Guid";
     }
 }
 public static void CreateFilterModel(Zetbox.App.GUI.DateRangeFilterConfiguration obj, MethodReturnEventArgs<IFilterModel> e)
 {
     e.Result = DateRangeFilterModel.Create(
         FrozenContext,
         obj.GetLabel(),
         FilterValueSource.FromProperty(obj.Property),
         obj.RequestedKind,
         obj.IsCurrentYearDefault ?? false,
         obj.IsCurrentQuaterDefault ?? false,
         obj.IsCurrentMonthDefault ?? false);
 }
示例#28
0
 public static void GetDataTypeString(DataType obj, Zetbox.API.MethodReturnEventArgs<string> e)
 {
     if (obj.Module == null)
     {
         e.Result = obj.Name;
     }
     else
     {
         e.Result = obj.Module.Namespace + "." + obj.Name;
     }
 }
 public static void ToString(NotNullableConstraint obj, Zetbox.API.MethodReturnEventArgs<string> e)
 {
     if (obj.ConstrainedProperty == null)
     {
         e.Result = String.Format("The ConstrainedProperty should not be NULL");
     }
     else
     {
         e.Result = String.Format("{0} should not be NULL", obj.ConstrainedProperty.Name);
     }
 }
示例#30
0
        public Method(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.DataType dt, Zetbox.App.Base.Method m, int index, string indexSuffix, string eventName)
            : base(_host)
        {
			this.ctx = ctx;
			this.dt = dt;
			this.m = m;
			this.index = index;
			this.indexSuffix = indexSuffix;
			this.eventName = eventName;

        }