static ProcessEntity ProcessOperation_Plan(EntityOperationContext <ProcessEntity> args) { DateTime plan = TimeZoneManager.Now; if (ValueLineBox.Show(ref plan, "Choose planned date", "Please, choose the date you want the process to start", "Planned date", null, null, Window.GetWindow(args.SenderButton))) { return(((ProcessEntity)args.Entity).ToLite().ExecuteLite(ProcessOperation.Plan, plan)); } return(null); }
public static void Start() { if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod())) { Navigator.AddSettings(new List <EntitySettings> { new EntitySettings <EmployeeEntity>() { View = e => new Employee() }, new EntitySettings <TerritoryEntity>() { View = e => new Territory() }, new EntitySettings <RegionEntity>() { View = e => new Region() }, new EntitySettings <ProductEntity>() { View = e => new Product() }, new EntitySettings <CategoryEntity>() { View = e => new Category(), IsViewable = true }, new EntitySettings <SupplierEntity>() { View = e => new Supplier() }, new EntitySettings <CompanyEntity>() { View = e => new Company() }, new EntitySettings <PersonEntity>() { View = e => new Person() }, new EntitySettings <OrderEntity>() { View = e => new Order() }, }); QuerySettings.RegisterPropertyFormat((EmployeeEntity e) => e.Photo, b => { b.Converter = SouthwindConverters.ImageConverter; return(Fluent.GetDataTemplate(() => new Image { MaxHeight = 32.0, Stretch = Stretch.Uniform } .Bind(Image.SourceProperty, b) .Set(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.Linear))); }); //Photo QuerySettings.RegisterPropertyFormat((CategoryEntity e) => e.Picture, b => { b.Converter = SouthwindConverters.EmbeddedImageConverter; return(Fluent.GetDataTemplate(() => new Image { MaxHeight = 32.0, Stretch = Stretch.Uniform } .Bind(Image.SourceProperty, b) .Set(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.Linear))); }); //Picture Constructor.Register(ctx => new EmployeeEntity { Address = new AddressEmbedded() }); Constructor.Register(ctx => new PersonEntity { Address = new AddressEmbedded() }); Constructor.Register(ctx => new CompanyEntity { Address = new AddressEmbedded() }); Constructor.Register(ctx => new SupplierEntity { Address = new AddressEmbedded() }); OperationClient.AddSettings(new List <OperationSettings>() { new ConstructorOperationSettings <OrderEntity>(OrderOperation.Create) { Constructor = ctx => { var cust = Finder.Find <CustomerEntity>(); // could return null, but we let it continue return(OperationServer.Construct(OrderOperation.Create, cust)); }, }, new ContextualOperationSettings <ProductEntity>(OrderOperation.CreateOrderFromProducts) { Click = ctx => { var cust = Finder.Find <CustomerEntity>(); // could return null, but we let it continue var result = OperationServer.ConstructFromMany(ctx.Entities, OrderOperation.CreateOrderFromProducts, cust); Navigator.Navigate(result); }, }, new EntityOperationSettings <OrderEntity>(OrderOperation.SaveNew) { IsVisible = ctx => ctx.Entity.IsNew }, new EntityOperationSettings <OrderEntity>(OrderOperation.Save) { IsVisible = ctx => !ctx.Entity.IsNew }, new EntityOperationSettings <OrderEntity>(OrderOperation.Cancel) { ConfirmMessage = ctx => ((OrderEntity)ctx.Entity).State == OrderState.Shipped ? OrderMessage.CancelShippedOrder0.NiceToString(ctx.Entity) : null }, new EntityOperationSettings <OrderEntity>(OrderOperation.Ship) { Click = ctx => { DateTime shipDate = DateTime.Now; if (!ValueLineBox.Show(ref shipDate, labelText: DescriptionManager.NiceName((OrderEntity o) => o.ShippedDate), owner: Window.GetWindow(ctx.EntityControl))) { return(null); } try { return(ctx.Entity.Execute(OrderOperation.Ship, shipDate)); } catch (IntegrityCheckException e) { ctx.Entity.SetGraphErrors(e); throw e; } }, Contextual = { Click = ctx => { DateTime shipDate = DateTime.Now; if (!ValueLineBox.Show(ref shipDate, labelText: DescriptionManager.NiceName((OrderEntity o) => o.ShippedDate), owner: Window.GetWindow(ctx.SearchControl))) { return; } ctx.Entities.SingleEx().ExecuteLite(OrderOperation.Ship, shipDate); } } }, }); //NotDefined } }