public ChoiceEditPanel(MainForm owner, TrackerContext context)
            : base("choice", context, owner)
        {
            this.RootPanel = new TableLayoutPanel()
            {
                Dock = DockStyle.Fill,
                RowCount = 2,
                ColumnCount = 1,
                RowStyles =
                {
                    new RowStyle(SizeType.Percent, 60.0f),
                    new RowStyle(SizeType.Percent, 40.0f),
                },
                ColumnStyles =
                {
                    new ColumnStyle(SizeType.Percent, 100.0f),
                },
            };

            this.ChoiceForm = new EntityFormPanelConstruct("choice",
                new string[]
                {
                    "total",
                    "name",
                    "description",
                    "state",
                    "speedrun",
                },
                this.Context,
                this.Owner
            )
            {
                Dock = DockStyle.Fill,
            };

            this.OptionsTable = new EntityTablePanelConstruct("choiceoption",
                this.Owner, this.Context,
                new string[]
                {
                    "name",
                    "total",
                }
            )
            {
                Dock = DockStyle.Fill,
            };

            this.RootPanel.Controls.Add(this.ChoiceForm, 0, 0);
            this.RootPanel.Controls.Add(this.OptionsTable, 0, 1);
            this.Controls.Add(this.RootPanel);
        }
        public PrizeCategoryTab(MainForm owner, TrackerContext context)
            : base(owner, context, "prizecategory")
        {
            this.FormPanel = new EntityFormPanelConstruct("prizecategory",
                new string[] { "name" },
                this.Context,
                this.Owner)
                {
                    Dock = DockStyle.Fill,
                };

            this.SetPanel(this.FormPanel);
            this.AddForm(this.FormPanel.Binding);
        }
        public ChallengeEditPanel(MainForm owner, TrackerContext context)
            : base("choice", context, owner)
        {
            this.ChallengeForm = new EntityFormPanelConstruct("challenge",
                new string[]
                {
                    "total",
                    "name",
                    "description",
                    "goal",
                    "state",
                    "speedrun",
                },
                this.Context,
                this.Owner
            )
            {
                Dock = DockStyle.Fill,
            };

            this.Controls.Add(this.ChallengeForm);
        }
        public DonationEditPanel(MainForm owner, TrackerContext context)
            : base("donation", context, owner)
        {
            this.RootPanel = new TableLayoutPanel()
            {
                Dock = DockStyle.Fill,
                ColumnCount = 1,
                RowCount = 2,
                ColumnStyles =
                {
                    new ColumnStyle(SizeType.Percent, 100.0f),
                },
                RowStyles =
                {
                    new RowStyle(SizeType.Percent, 75.0f),
                    new RowStyle(SizeType.Percent, 25.0f),
                },
            };

            this.FormPanel = new EntityFormPanelConstruct("donation",
                new string[]
                {
                    //"domain",
                    //"domainId",
                    "timereceived",
                    "amount",
                    "donor",
                    "comment",
                    "modcomment",
                    "readstate",
                    "commentstate",
                    "bidstate",
                },
                this.Context,
                this.Owner
            )
            {
                Dock = DockStyle.Fill,
            };

            this.BidsPanel = new EntityTablePanelConstruct("donationbid", this.Owner, this.Context,
                new string[]
                {
                    "amount",
                    "target",
                }
            )
            {
                Dock = DockStyle.Fill,
                AddAllowed = true,
            };

            this.BidsPanel.Binding.AddModelMapping("choicebid",
                new Dictionary<string, string>()
                {
                    { "amount", "amount" },
                    { "option", "target" },
                });

            this.BidsPanel.Binding.AddModelMapping("challengebid",
                new Dictionary<string, string>()
                {
                    { "amount", "amount" },
                    { "challenge", "target" },
                });

            this.RootPanel.Controls.Add(this.FormPanel, 0, 0);
            this.RootPanel.Controls.Add(this.BidsPanel, 0, 1);
            this.Controls.Add(this.RootPanel);
        }
Exemplo n.º 5
0
        public PrizeTab(MainForm owner, TrackerContext context)
            : base(owner, context, "prize")
        {
            this.RootPanel = new TableLayoutPanel()
            {
                Dock = DockStyle.Fill,
                RowCount = 2,
                ColumnCount = 2,
                RowStyles =
                {
                    new RowStyle(SizeType.Percent, 100.0f),
                    new RowStyle(SizeType.AutoSize),
                },
                ColumnStyles =
                {
                    new ColumnStyle(SizeType.AutoSize),
                    new ColumnStyle(SizeType.Percent, 100.0f),
                },
            };

            this.PrizeForm = new EntityFormPanelConstruct(this.ModelName,
                new string[]
                {
                    "name",
                    "image",
                    "category",
                    "minimumbid",
                    "maximumbid",
                    "sumdonations",
                    "randomdraw",
                    "provided",
                    "description",
                    "winner",
                    "startrun",
                    "endrun",
                    "starttime",
                    "endtime",
                    "pin",
                }, this.Context, this.Owner)
                {
                    Dock = DockStyle.Fill,
                };

            this.DrawPrizeButton = new Button()
            {
                Text = "Draw Prize",
            };
            this.DrawPrizeButton.Click += (o, e) =>
            {
                this.RunPrizeDraw();
            };

            this.DrawResultsText = new TextBox()
            {
                ReadOnly = true,
                Dock = DockStyle.Fill,
            };

            this.RootPanel.Controls.Add(this.PrizeForm, 0, 0);
            this.RootPanel.SetColumnSpan(this.PrizeForm, 2);
            this.RootPanel.Controls.Add(this.DrawPrizeButton, 0, 1);
            this.RootPanel.Controls.Add(this.DrawResultsText, 1, 1);

            this.SetPanel(this.RootPanel);
            this.PrizeForm.Binding.AddAssociatedControl(this.DrawPrizeButton);
            this.AddForm(this.PrizeForm.Binding);
        }
        public DonorEditPanel(MainForm owner, TrackerContext context)
            : base("donor", context, owner)
        {
            this.RootPanel = new TableLayoutPanel()
            {
                Dock = DockStyle.Fill,
                ColumnCount = 1,
                RowCount = 3,
                RowStyles =
                {
                    new RowStyle(SizeType.AutoSize),
                    new RowStyle(SizeType.Percent, 66.0f),
                    new RowStyle(SizeType.Percent, 34.0f),
                }
            };

            this.DonorForm = new EntityFormPanelConstruct("donor",
                new string[]
                {
                    "firstname",
                    "lastname",
                    "alias",
                    "email",
                    "anonymous",
                }, this.Context, this.Owner
            )
            {
                Dock = DockStyle.Fill,
            };

            this.DonationTable = new EntityTablePanelConstruct("donation",
                this.Owner,
                this.Context,
                new string[]
                {
                    "domain",
                    "amount",
                    "comment",
                    "modcomment",
                    "timereceived",
                }
            )
            {
                Dock = DockStyle.Fill,
                AddAllowed = false, // maybe true...
            };

            this.PrizeTable = new EntityTablePanelConstruct("prize",
                this.Owner,
                this.Context,
                new string[]
                {
                    "name",
                    "provided",
                    "description",
                }
            )
            {
                Dock = DockStyle.Fill,
                AddAllowed = false,
            };

            this.PrizeTable.Binding.Context = this.Context;

            this.RootPanel.Controls.Add(this.DonorForm, 0, 0);
            this.RootPanel.Controls.Add(this.DonationTable, 0, 1);
            this.RootPanel.Controls.Add(this.PrizeTable, 0, 2);

            this.Controls.Add(this.RootPanel);
        }