Пример #1
0
        public ReminderEmailsForm(int year)
        {
            AdReminderEmail.Schema.ToString();                      //Force static ctor
            Program.LoadTable <AdReminderEmail>();                  //Will load invites as a dependency
            InitializeComponent();

            this.year = year;
            Text      = "Melave Malka " + year + " Reminder Emails";

            listSearch.Properties.DataSource = bindingSource.DataSource = dataSource
                                                                              = Program.Table <MelaveMalkaInvitation>().Filter(mmi => mmi.Year == year && mmi.Person.EmailAddresses.Any());
            EditorRepository.PersonOwnedLookup.Apply(listSearch.Properties);

            gridView.ActiveFilterCriteria = new OperandProperty("AdAmount") == 0;
            new AdvancedColumnsBehavior("ad amounts", fieldNames: new[] { "AdAmount" }).Apply(gridView);

            CheckableGridController.Handle(colShouldEmail);

            razor = new TemplateService(new TemplateServiceConfiguration {
                Resolver = Resolver
            });
            resetSingle.Strings.AddRange(Resolver.Templates.ToArray());
            resetSelected.Strings.AddRange(Resolver.Templates.ToArray());
            previewAddressItem.EditValue = PreviewAddressEdit.DefaultAddress;               //It is impossible to have a non-default EditValue for a BarEditItem, so I apply the default manually.
        }
Пример #2
0
        // GET: GridDataUrl/FilterData
        public ActionResult Index(JArray filteredData)
        {
            FilteredTable filteredTable = new FilteredTable();

            filteredTable.FilterDataRowItem = FilterDataRowItemImplement;

            DataTable source = filteredTable.GetFilteredTable(filteredData);

            JArray ja = new JArray();

            foreach (DataRow row in source.Rows)
            {
                JObject jo = new JObject();
                jo.Add("Id", (int)row["Id"]);
                jo.Add("Name", row["Name"].ToString());
                jo.Add("Gender", (int)row["Gender"]);
                jo.Add("EntranceYear", (int)row["EntranceYear"]);
                jo.Add("AtSchool", (bool)row["AtSchool"]);
                jo.Add("Major", row["Major"].ToString());
                jo.Add("Group", (int)row["Group"]);

                ja.Add(jo);
            }


            return(Content(ja.ToString(Newtonsoft.Json.Formatting.None)));
        }
Пример #3
0
        public SeatingForm(int year)
        {
            //Load tables before DataMember is set in InitializeComponent
            //Invitations are required for validation
            Program.LoadTables(MelaveMalkaSeat.Schema, MelaveMalkaInvitation.Schema);

            InitializeComponent();
            this.year = year;
            Text = "Melave Malka " + year + " Seating Reservations";

            dataSource = Program.Table<MelaveMalkaSeat>().Filter(mms => mms.Year == year);
            grid.DataMember = null;
            grid.DataSource = searchLookup.Properties.DataSource = dataSource;

            Program.SuppressValidation(personSelector.Properties);

            EditorRepository.OptionalSeatEditor.Apply(addWomensSeats.Properties);
            EditorRepository.OptionalSeatEditor.Apply(addMensSeats.Properties);

            EditorRepository.PersonOwnedLookup.Apply(searchLookup.Properties);
            searchLookup.Properties.Columns.Add(new CustomColumn<MelaveMalkaSeat>(
                s => s.MensSeats == null ? "Not Sure" : s.MensSeats.Value.ToString(CultureInfo.CurrentCulture)
            ) { Caption = "Men's Seats", Width = 50 });
            searchLookup.Properties.Columns.Add(new CustomColumn<MelaveMalkaSeat>(
                s => s.WomensSeats == null ? "Not Sure" : s.WomensSeats.Value.ToString(CultureInfo.CurrentCulture)
            ) { Caption = "Women's Seats", Width = 50 });
        }
Пример #4
0
 public AdsGridForm(JournalPresentation jp)
 {
     InitializeComponent();
     journal = jp;
     Text = "Journal " + jp.Year + " Ads";
     grid.DataMember = null;
     grid.DataSource = datasource = Program.Table<JournalAd>().Filter(ad => ad.Year == journal.Year);
 }
Пример #5
0
        public void SetData(int newYear, FilteredTable<RaffleTicket> datasource)
        {
            if (datasource == null) throw new ArgumentNullException("datasource");
            if (datasource.Rows.Any(t => t.Year != newYear))
                throw new ArgumentException("Wrong year", "datasource");

            this.year = newYear;
            this.tickets = datasource;
        }
Пример #6
0
        private static IReactiveTable FilterFeedsForClientTable(ReactiveClientSession reactiveClientSession, IReactiveTable feedsAndClients)
        {
            var feedsForClients = new FilteredTable(feedsAndClients,
                                                    new DelegatePredicate1 <string>(
                                                        BrokerTableDefinition.BrokerClientColumns.ClientIpColumn,
                                                        ip => ip == reactiveClientSession.RemoteEndPoint.Address.ToString()));

            return(feedsForClients);
        }
        public ActionResult Grid1_FilterChanged(string[] Grid1_fields, JArray Grid1_filteredData)
        {
            FilteredTable filteredTable = new FilteredTable();

            filteredTable.FilterDataRowItem = FilterDataRowItemImplement;

            DataTable table = filteredTable.GetFilteredTable(Grid1_filteredData);

            UIHelper.Grid("Grid1").DataSource(table, Grid1_fields);

            UIHelper.Label("labResult").Text(String.Format("过滤参数:<pre>{0}</pre>", Grid1_filteredData.ToString(Newtonsoft.Json.Formatting.Indented)), encodeText: false);

            return(UIHelper.Result());
        }
Пример #8
0
        public void SetData(int newYear, FilteredTable <RaffleTicket> datasource)
        {
            if (datasource == null)
            {
                throw new ArgumentNullException("datasource");
            }
            if (datasource.Rows.Any(t => t.Year != newYear))
            {
                throw new ArgumentException("Wrong year", "datasource");
            }

            this.year    = newYear;
            this.tickets = datasource;
        }
Пример #9
0
        public ShalachManosForm(int year)
        {
            InitializeComponent();
            this.year = year;
            Text      = "Shalach Manos " + year;

            addPanel.Hide();
            grid.DataMember = null;

            pledges = Program.Table <Pledge>().Filter(p => p.Date.Year == year && p.Type == PledgeType);
            searchLookup.Properties.DataSource = grid.DataSource = pledges;
            EditorRepository.PersonOwnedLookup.Apply(searchLookup.Properties);

            ShowHideCheckGroup();
        }
Пример #10
0
        public TicketsForm(int year)
        {
            InitializeComponent();
            Text = year + " Tickets";

            tickets         = Program.Table <RaffleTicket>().Filter(t => t.Year == year);
            grid.DataMember = null;
            grid.DataSource = tickets;
            addPanel.SetData(year, tickets);

            tickets.RowAdded     += Tickets_RowAdded;
            tickets.ValueChanged += Tickets_ValueChanged;
            tickets.RowRemoved   += Tickets_RowRemoved;
            UpdateStats();
        }
Пример #11
0
        public TicketsForm(int year)
        {
            InitializeComponent();
            Text = year + " Tickets";

            tickets = Program.Table<RaffleTicket>().Filter(t => t.Year == year);
            grid.DataMember = null;
            grid.DataSource = tickets;
            addPanel.SetData(year, tickets);

            tickets.RowAdded += Tickets_RowAdded;
            tickets.ValueChanged += Tickets_ValueChanged;
            tickets.RowRemoved += Tickets_RowRemoved;
            UpdateStats();
        }
Пример #12
0
        public MainViewModel(IAccountBalanceDataService dataService)
        {
            _dataService = dataService;

            People   = new PeopleViewModel(_dataService.People);
            Accounts = new AccountsViewModel(_dataService.Accounts);

            _accountFilter = (FilteredTable)_dataService.AccountPeople.Filter(
                new DelegatePredicate1 <decimal>(AccountColumns.AccountBalance, b => b > BalanceBelowFilter));
            PersonAccounts = new PersonAccountsViewModel(_accountFilter, (IWritableReactiveTable)_dataService.Accounts);
            //            PeopleBindingList = new ReactiveBindingList(App.People);

            StartData = new DelegateCommand(() => _dataService.Start());
            StopData  = new DelegateCommand(() => _dataService.Stop());
        }
        public ShalachManosForm(int year)
        {
            InitializeComponent();
            this.year = year;
            Text = "Shalach Manos " + year;

            addPanel.Hide();
            grid.DataMember = null;

            pledges = Program.Table<Pledge>().Filter(p => p.Date.Year == year && p.Type == PledgeType);
            searchLookup.Properties.DataSource = grid.DataSource = pledges;
            EditorRepository.PersonOwnedLookup.Apply(searchLookup.Properties);

            ShowHideCheckGroup();
        }
Пример #14
0
        public InvitationsForm(int year)
        {
            Program.LoadTable<MelaveMalkaInvitation>();	//Before DataMember is set in InitializeComponent
            InitializeComponent();
            this.year = year;
            Text = "Melave Malka " + year + " Invitations";

            dataSource = Program.Table<MelaveMalkaInvitation>().Filter(mmi => mmi.Year == year);
            grid.DataMember = null;
            grid.DataSource = listSearch.Properties.DataSource = dataSource;

            EditorRepository.MelaveMalkaSourceEditor.Apply(source.Properties);
            EditorRepository.PersonOwnedLookup.Apply(listSearch.Properties);
            Program.SuppressValidation(personSelector.Properties);

            if (Names.MelaveMalkaSources.Contains(DefaultSource))
                source.Text = DefaultSource;
        }
Пример #15
0
        public SyncfusionTestViewModel(IAccountBalanceDataService dataService)
        {
            var table = dataService.AccountPeople;

            _accountFilter = (FilteredTable)table.Filter(
                new DelegatePredicate1 <decimal>(AccountColumns.AccountBalance, b => b > BalanceBelowFilter));
            _balanceSort = new SortedTable(_accountFilter);
            _balanceSort.SortBy(AccountColumns.AccountBalance, Comparer <decimal> .Default);
            SetTable(_balanceSort);

            _columnTypes = new Dictionary <string, Type>
            {
                { AccountColumns.AccountBalance, typeof(decimal) },
                { PersonColumns.IdNameColumn, typeof(string) },
                { PersonColumns.NameColumn, typeof(string) },
                { PersonAccountColumns.AccountDetails, typeof(string) }
            };
            Columns = new ObservableCollection <string>(_columnTypes.Keys);
        }
Пример #16
0
        public CallerList(int year)
        {
            Program.LoadTable<Caller>();
            InitializeComponent();
            this.Text = "Melave Malka " + year + " Callers";
            this.year = year;

            addCaller.Properties.DataSource = Program.Table<Person>();
            EditorRepository.PersonLookup.Apply(addCaller.Properties);

            grid.DataMember = null;
            grid.DataSource = dataSource = Program.Table<Caller>().Filter(c => c.Year == year);

            ToggleRowsBehavior.Instance.Apply(gridView);
            UpdateButtons();

            razor = new TemplateService(new TemplateServiceConfiguration { Resolver = Resolver });
            emailTemplateList.Strings.AddRange(Resolver.Templates.ToArray());
        }
Пример #17
0
        public InvitationsForm(int year)
        {
            Program.LoadTable <MelaveMalkaInvitation>();                //Before DataMember is set in InitializeComponent
            InitializeComponent();
            this.year = year;
            Text      = "Melave Malka " + year + " Invitations";

            dataSource      = Program.Table <MelaveMalkaInvitation>().Filter(mmi => mmi.Year == year);
            grid.DataMember = null;
            grid.DataSource = listSearch.Properties.DataSource = dataSource;

            EditorRepository.MelaveMalkaSourceEditor.Apply(source.Properties);
            EditorRepository.PersonOwnedLookup.Apply(listSearch.Properties);
            Program.SuppressValidation(personSelector.Properties);

            if (Names.MelaveMalkaSources.Contains(DefaultSource))
            {
                source.Text = DefaultSource;
            }
        }
Пример #18
0
        public CallerList(int year)
        {
            Program.LoadTable <Caller>();
            InitializeComponent();
            this.Text = "Melave Malka " + year + " Callers";
            this.year = year;

            addCaller.Properties.DataSource = Program.Table <Person>();
            EditorRepository.PersonLookup.Apply(addCaller.Properties);

            grid.DataMember = null;
            grid.DataSource = dataSource = Program.Table <Caller>().Filter(c => c.Year == year);

            ToggleRowsBehavior.Instance.Apply(gridView);
            UpdateButtons();

            razor = new TemplateService(new TemplateServiceConfiguration {
                Resolver = Resolver
            });
            emailTemplateList.Strings.AddRange(Resolver.Templates.ToArray());
        }
Пример #19
0
        public SeatingForm(int year)
        {
            Program.LoadTable <SeatingReservation>();               //Before setting DataMember
            InitializeComponent();

            loadingIconItem.EditValue = LoadingImage;
            colPledgeType.ColumnEdit  = SeatingInfo.PledgeTypeEdit;             //TODO: IEditorSettings?
            this.year = year;

            grid.DataMember = null;
            grid.DataSource = seats = Program.Table <SeatingReservation>().Filter(sr => sr.Pledge.Date.Year == year);

            Text = year.ToString(CultureInfo.CurrentCulture) + " Seating Reservations";
            colChartStatus.Visible = colChartStatus.OptionsColumn.ShowInCustomizationForm = false;

            Program.Table <Pledge>().ValueChanged             += Pledge_ValueChanged;
            Program.Table <SeatingReservation>().RowRemoved   += SeatingReservation_RowChanged;
            Program.Table <SeatingReservation>().ValueChanged += SeatingReservation_ValueChanged;
            Program.Table <SeatingReservation>().RowAdded     += SeatingReservation_RowChanged;

            UpdateTotals();
        }
Пример #20
0
        public SeatingForm(int year)
        {
            Program.LoadTable<SeatingReservation>();    //Before setting DataMember
            InitializeComponent();

            loadingIconItem.EditValue = LoadingImage;
            colPledgeType.ColumnEdit = SeatingInfo.PledgeTypeEdit;  //TODO: IEditorSettings?
            this.year = year;

            grid.DataMember = null;
            grid.DataSource = seats = Program.Table<SeatingReservation>().Filter(sr => sr.Pledge.Date.Year == year);

            Text = year.ToString(CultureInfo.CurrentCulture) + " Seating Reservations";
            colChartStatus.Visible = colChartStatus.OptionsColumn.ShowInCustomizationForm = false;

            Program.Table<Pledge>().ValueChanged += Pledge_ValueChanged;
            Program.Table<SeatingReservation>().RowRemoved += SeatingReservation_RowChanged;
            Program.Table<SeatingReservation>().ValueChanged += SeatingReservation_ValueChanged;
            Program.Table<SeatingReservation>().RowAdded += SeatingReservation_RowChanged;

            UpdateTotals();
        }
Пример #21
0
        public ReminderEmailsForm(int year)
        {
            AdReminderEmail.Schema.ToString();          //Force static ctor
            Program.LoadTable<AdReminderEmail>();       //Will load invites as a dependency
            InitializeComponent();

            Text = "Melave Malka " + year + " Reminder Emails";

            listSearch.Properties.DataSource = bindingSource.DataSource = dataSource
                = Program.Table<MelaveMalkaInvitation>().Filter(mmi => mmi.Year == year && mmi.Person.EmailAddresses.Any());
            EditorRepository.PersonOwnedLookup.Apply(listSearch.Properties);

            gridView.ActiveFilterCriteria = new OperandProperty("AdAmount") == 0;
            new AdvancedColumnsBehavior("ad amounts", fieldNames: new[] { "AdAmount" }).Apply(gridView);

            CheckableGridController.Handle(colShouldEmail);

            razor = new TemplateService(new TemplateServiceConfiguration { Resolver = Resolver });
            resetSingle.Strings.AddRange(Resolver.Templates.ToArray());
            resetSelected.Strings.AddRange(Resolver.Templates.ToArray());
            previewAddressItem.EditValue = PreviewAddressEdit.DefaultAddress;   //It is impossible to have a non-default EditValue for a BarEditItem, so I apply the default manually.
        }
Пример #22
0
        public CallListForm(int year)
        {
            Program.LoadTable<MelaveMalkaInvitation>();	//Includes Callers as a dependency
            InitializeComponent();

            this.year = year;
            Text = "Melave Malka " + year + " Call List";

            grid.DataMember = null;
            listSearch.Properties.DataSource = grid.DataSource = dataSource
                = Program.Table<MelaveMalkaInvitation>().Filter(mmi => mmi.Year == year);

            EditorRepository.PersonOwnedLookup.Apply(listSearch.Properties);

            gridView.ActiveFilterCriteria = new OperandProperty("AdAmount") == 0;
            new AdvancedColumnsBehavior("ad amounts", fieldNames: new[] { "AdAmount" }).Apply(gridView);
            CheckableGridController.Handle(colShouldCall);

            Program.Table<Caller>().RowAdded += CallersTable_Changed;
            Program.Table<Caller>().RowRemoved += CallersTable_Changed;
            BindCallerDropDown();
        }
Пример #23
0
        public CallListForm(int year)
        {
            Program.LoadTable <MelaveMalkaInvitation>();                //Includes Callers as a dependency
            InitializeComponent();

            this.year = year;
            Text      = "Melave Malka " + year + " Call List";

            grid.DataMember = null;
            listSearch.Properties.DataSource = grid.DataSource = dataSource
                                                                     = Program.Table <MelaveMalkaInvitation>().Filter(mmi => mmi.Year == year);

            EditorRepository.PersonOwnedLookup.Apply(listSearch.Properties);

            gridView.ActiveFilterCriteria = new OperandProperty("AdAmount") == 0;
            new AdvancedColumnsBehavior("ad amounts", fieldNames: new[] { "AdAmount" }).Apply(gridView);
            CheckableGridController.Handle(colShouldCall);

            Program.Table <Caller>().RowAdded   += CallersTable_Changed;
            Program.Table <Caller>().RowRemoved += CallersTable_Changed;
            BindCallerDropDown();
        }
Пример #24
0
        private void SetupFeedSubscription(IReactiveTable currenciesTable, IReactiveTableProcessor <IReactiveTable> encoder)
        {
            var endPoint           = new IPEndPoint(IPAddress.Loopback, (int)ServerPorts.BrokerFeedClients);
            var selectedCurrencies = new FilteredTable(
                currenciesTable,
                new DelegatePredicate1 <bool>(BrokerTableDefinition.BrokerClientColumns.ClientSide.Selected, selected => selected));

            var client = new ReactiveTableTcpClient <IReactiveTable>(encoder,
                                                                     selectedCurrencies,
                                                                     GetEncoderState(),
                                                                     endPoint);

            _ccyPairSubscriptionClient = client;
            try
            {
                client.Start();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Пример #25
0
        public SeatingForm(int year)
        {
            //Load tables before DataMember is set in InitializeComponent
            //Invitations are required for validation
            Program.LoadTables(MelaveMalkaSeat.Schema, MelaveMalkaInvitation.Schema);

            InitializeComponent();
            this.year = year;
            Text      = "Melave Malka " + year + " Seating Reservations";

            dataSource      = Program.Table <MelaveMalkaSeat>().Filter(mms => mms.Year == year);
            grid.DataMember = null;
            grid.DataSource = searchLookup.Properties.DataSource = dataSource;

            mensSeatsItem.Text   = MelaveMalkaSeat.MensSeatsCaption + ":";
            womensSeatsItem.Text = MelaveMalkaSeat.WomensSeatsCaption + ":";

            Program.SuppressValidation(personSelector.Properties);

            EditorRepository.OptionalSeatEditor.Apply(addWomensSeats.Properties);
            EditorRepository.OptionalSeatEditor.Apply(addMensSeats.Properties);

            EditorRepository.PersonOwnedLookup.Apply(searchLookup.Properties);
            searchLookup.Properties.Columns.Add(new CustomColumn <MelaveMalkaSeat>(
                                                    s => s.MensSeats == null ? "Not Sure" : s.MensSeats.Value.ToString(CultureInfo.CurrentCulture)
                                                    )
            {
                Caption = MelaveMalkaSeat.MensSeatsCaption, Width = 50
            });
            searchLookup.Properties.Columns.Add(new CustomColumn <MelaveMalkaSeat>(
                                                    s => s.WomensSeats == null ? "Not Sure" : s.WomensSeats.Value.ToString(CultureInfo.CurrentCulture)
                                                    )
            {
                Caption = MelaveMalkaSeat.WomensSeatsCaption, Width = 50
            });
        }
Пример #26
0
        void SetAd(AdShape newAd, bool force = false)
        {
            if (this.ad == newAd && !force) {
                CheckWarnings();
                return;
            }
            Focus();	// Commit any pending edits.
            DisposeDataSources();

            this.ad = newAd;
            layoutControl1.Visible = ad != null;
            if (ad == null) return;
            adsBindingSource.Position = adsBindingSource.IndexOf(ad.Row);
            adType.EditValue = ad.AdType;

            //Singularity's dependency parser cannot handle
            //external rows, so I can't use ad.Row inside of
            //the filter. However, I want to pick up changes
            //to the ad's ExternalId, so I use a function.
            Func<int> externalId = () => ad.Row.ExternalId;

            pledgesSource.DataSource = pledges = Program.Table<Pledge>().Filter(
                p => p.ExternalSource == "Journal " + journal.Year && p.ExternalId == externalId()
            );
            paymentsSource.DataSource = payments = Program.Table<Payment>().Filter(
                p => p.ExternalSource == "Journal " + journal.Year && p.ExternalId == externalId()
            );
            CheckWarnings();

            //I need to call BeginInvoke so that the new row gets painted first.
            pledges.RowAdded += delegate { BeginInvoke(new Action(pledgesView.BestFitColumns)); };
            payments.RowAdded += delegate { BeginInvoke(new Action(paymentsView.BestFitColumns)); };
        }
Пример #27
0
 static void VerifyFilteredTable <TRow>(FilteredTable <TRow> ft, Func <TRow, bool> filter) where TRow : Row
 {
     CollectionAssert.AreEqual((ICollection)ft.Rows, ft.Table.Rows.Where(r => filter((TRow)r)).ToArray());
 }
Пример #28
0
 public FilteredTableBinder(FilteredTable <TRow> ft) : base(ft)
 {
 }