public ReadTaskTab()
        {
            InitializeComponent();

            this.DonationBinding = new FormBinding("donation");
            this.DonationBinding.AddInstanceBinding(new PublicDonorNameBinding(this.DonorNameText, true));
            this.DonationBinding.AddBinding("amount", new MoneyFieldBinding(this.AmountText, readOnly: true, allowNull: false));
            this.DonationBinding.AddBinding("comment", new TextBoxBinding(this.CommentText, readOnly: true, nullable: false, longText: true));
            this.DonationBinding.AddBinding("modcomment", new TextBoxBinding(this.ModCommentText, readOnly: true, nullable: false, longText: true));
            this.DonationBinding.AddBinding("readstate", this.ReadStateBox, typeof(DonationReadState));
            this.DonationBinding.AddBinding("commentstate", this.CommentStateBox, typeof(DonationCommentState));
            this.DonationBinding.AddBinding("bidstate", this.BidStateBox, typeof(DonationBidState));

            this.DonationBinding.AddAssociatedControl(this.OpenDonorButton);
            this.DonationBinding.AddAssociatedControl(this.OpenDonationButton);
            this.DonationBinding.AddAssociatedControl(this.NextButton);

            this.MinimumAmountBinding = new MoneyFieldBinding(this.MinimumAmountText);
            this.MinimumMinutesBinding = new IntFieldBinding(this.MinimumMinutesText);
            this.ModeBinding = new ComboBoxBinding(this.ModeBox, typeof(ReadTaskVolumeMode));

            this.SearchBinding = new ListBinding<JObjectEntityDisplay>(this.TaskList, x => new JObjectFuncDisplay(x, DonationModels.DonationModel.DisplayConverter), "Display");
            this.SearchBinding.AddAssociatedControl(this.RefreshButton);
            this.SearchBinding.AddAssociatedControl(this.MinimumAmountText);
            this.SearchBinding.AddAssociatedControl(this.MinimumMinutesText);
            this.SearchBinding.AddAssociatedControl(this.ModeBox);

            this.MinimumAmountBinding.LoadField(DefaultMinimumAmount.ToString());
            this.MinimumMinutesBinding.LoadField(DefaultMinimumMinuteOffset.ToString());
            this.ModeBinding.LoadField(DefaultVolumeMode.ToString());

            this.SearchBinding.OnSelection += this.OnSelection;

            this.CurrentObject = null;
        }
        public ProcessDonationsTaskTab2()
        {
            InitializeComponent();

            this.DonationBinding = new FormBinding("donation");
            this.DonationBinding.AddBinding("donor", this.DonorSelector);
            this.DonationBinding.AddBinding("amount", new MoneyFieldBinding(this.AmountText, allowNull: false));
            this.DonationBinding.AddBinding("comment", new TextBoxBinding(this.CommentText, nullable: false, longText: true));
            this.DonationBinding.AddBinding("modcomment", new TextBoxBinding(this.ModCommentText, nullable: false, longText: true));
            this.DonationBinding.AddBinding("readstate", this.ReadStateBox, typeof(DonationReadState));
            this.DonationBinding.AddBinding("commentstate", this.CommentStateBox, typeof(DonationCommentState));
            this.DonationBinding.AddBinding("bidstate", this.BidStateBox, typeof(DonationBidState));

            this.DonationBinding.AddAssociatedControl(this.OpenDonorButton);
            this.DonationBinding.AddAssociatedControl(this.OpenDonationButton);
            this.DonationBinding.AddAssociatedControl(this.NextButton);

            this.ModeBinding = new ComboBoxBinding(this.ModeBox, typeof(ProcessDonationsMode));

            this.SearchBinding = new ListBinding<JObjectEntityDisplay>(this.TaskList, x => new JObjectFuncDisplay(x, DonationModels.DonationModel.DisplayConverter), "Display");
            this.SearchBinding.AddAssociatedControl(this.RefreshButton);
            this.SearchBinding.AddAssociatedControl(this.NextButton);
            this.SearchBinding.AddAssociatedControl(this.ModeBox);

            this.ModeBinding.LoadField(ProcessDonationsMode.BIDS.ToString());

            this.SearchBinding.OnSelection += this.OnSelection;

            this.CurrentObject = null;
        }
        public SearchPanel(EntityModel model, IEnumerable<string> searchFields)
        {
            this.InitializeComponent();

            this.Model = model;
            this.SearchFields = searchFields.ToArray();

            int currentFieldIndex = 2;

            this.FormBinding = new FormBinding(model.ModelName, searchForm: true);
            this.ListBinding = new ListBinding<JObjectEntityDisplay>(this.ResultsList, x => new JObjectFuncDisplay(x, model.DisplayConverter), "Display");

            foreach (string field in this.SearchFields)
            {
                SearchFieldModel searchField = this.Model.GetSearchField(field);
                FieldBinding binding = FieldBindingHelper.CreateBindingField(searchField.FieldType, fieldName: field);
                this.FormBinding.AddBinding(field, binding);
                ++this.SearchParamsTable.RowCount;
                this.SearchParamsTable.Controls.Add(new Label()
                {
                    Text = field.SymbolToNatural(),
                    Dock = DockStyle.Fill
                }, 0, currentFieldIndex);
                this.SearchParamsTable.Controls.Add(binding.BoundControl, 1, currentFieldIndex);
                binding.BoundControl.Dock = DockStyle.Fill;
                ++currentFieldIndex;
            }

            this.SearchButton = new Button()
            {
                Text = "Search",
                Dock = DockStyle.Fill,
            };

            ++this.SearchParamsTable.RowCount;
            this.SearchButton.Click += this.SearchButton_Click;
            this.SearchParamsTable.Controls.Add(this.SearchButton, 1, currentFieldIndex);
            this.BasicSearchButton.Click += this.BasicSearchButton_Click;

            this.FormBinding.AddAssociatedControl(this.SearchButton);
            this.FormBinding.AddAssociatedControl(this.BasicSearchButton);
            this.FormBinding.AddAssociatedControl(this.BasicSearchText);

            this.ListBinding.OnSelection += (selections) =>
            {
                if (this.OnSelect != null)
                    this.OnSelect.Invoke(this.GetSelections());
            };
        }
 public void AddForm(FormBinding form)
 {
     this.Access.AddForm(form);
 }
 public void AddForm(FormBinding formBinding)
 {
     FormBindings.Add(formBinding);
 }