コード例 #1
0
        private void InventoryScreen_ParentChanged(object sender, EventArgs e)
        {
            if (this.Parent != null)
            {
                MasterForm master = (this.Parent.Parent as MasterForm);
                master.AcceptButton = btnUpdateItem;
                master.CancelButton = (master.Controls.Find("btnBack", true)[0] as Button);

                try
                {
                    DBControlHelper.PopulateWithControls <DBTag, CheckBox>(this.tlpTagSelection, DBTag.GetTags(), "Description", "ID");
                    foreach (CheckBox c in this.tlpTagSelection.Controls)
                    {
                        c.CheckedChanged += Tag_CheckedChanged;
                    }
                }
                catch (Exception ex)
                {
                    master.SetStatus("Error! Failed to load tags: " + ex.Message);
                }

                this.UpdateItems();
                this.ShowItems();
            }
        }
コード例 #2
0
        private void DisplayCollectors()
        {
            try
            {
                BindingList <DBCollector> filteredCollectors = DBControlHelper.GetFilteredCollectors(this.collectors,
                                                                                                     this.txtSearchCollectorName.Text, this.mtxtCollectorSearchPhoneNumber.Text);
                this.dgvCollectors.DataSource        = filteredCollectors;
                this.cbxSelectedCollector.DataSource = filteredCollectors;

                //Setup the datagridview
                this.dgvCollectors.Columns["CollectorID"].HeaderText   = "Collector ID";
                this.dgvCollectors.Columns["CollectorType"].HeaderText = "Type";
                this.dgvCollectors.Columns["CollectorTypeID"].Visible  = false;
                this.dgvCollectors.Columns["FirstName"].Visible        = false;
                this.dgvCollectors.Columns["LastName"].Visible         = false;
                this.dgvCollectors.Columns["PhoneNumber"].HeaderText   = "Phone Number";
                this.dgvCollectors.Columns["ComboBoxDisplay"].Visible  = false;

                //Setup the selected collector combobox
                this.cbxSelectedCollector.DisplayMember = "ComboBoxDisplay";
                this.cbxSelectedCollector.ValueMember   = "CollectorID";
            }
            catch (Exception ex)
            {
                (this.Parent.Parent as MasterForm).SetStatus("Failed to display collectors: " + ex.Message);
            }
        }
コード例 #3
0
        private void DisplayPeriodicals()
        {
            try
            {
                BindingList <DBPeriodical> filteredPeriodicals = DBControlHelper.GetFilteredItemsAndUpdateQuantity(this.periodicals, this.txtSearch.Text, new List <int>(), Cart.Invoice.Transactions);
                this.dgvItems.DataSource        = filteredPeriodicals;
                this.cbxSelectedItem.DataSource = filteredPeriodicals;

                //Setup combobox
                this.cbxSelectedItem.DisplayMember = "ComboBoxDisplay";
                this.cbxSelectedItem.ValueMember   = "PeriodicalID";

                //Setup datagridview
                this.dgvItems.Columns["PeriodicalID"].HeaderText  = "Periodical ID";
                this.dgvItems.Columns["ConditionType"].HeaderText = "Condition";
                this.dgvItems.Columns["GenreName"].HeaderText     = "Genre";
                this.dgvItems.Columns["CompanyName"].HeaderText   = "Company";
                this.dgvItems.Columns["PublishDate"].HeaderText   = "Publish Date";
                this.dgvItems.Columns["ComboBoxDisplay"].Visible  = false;
                this.dgvItems.Columns["ShowDiscount"].Visible     = false;
            }
            catch (Exception ex)
            {
                (this.Parent.Parent as MasterForm).SetStatus("Failed to display periodicals: " + ex.Message);
            }
        }
コード例 #4
0
        private void FilterCollectors()
        {
            BindingList <DBCollector> filteredCollectors = DBControlHelper.GetFilteredCollectors(this.collectors,
                                                                                                 this.txtSearchName.Text, this.mtxtPhoneNumber.Text);

            this.dgvCollectors.DataSource        = filteredCollectors;
            this.cbxSelectedCollector.DataSource = filteredCollectors;
        }
コード例 #5
0
        private void ShowCollector()
        {
            int         collectorID   = (int)this.nudCollectorId.Value;
            DBCollector tempCollector = DBCollector.GetCollectorById(collectorID);

            this.txtFirstName.Text     = tempCollector.FirstName;
            this.txtLastName.Text      = tempCollector.LastName;
            this.mtxtPhoneNumber.Text  = tempCollector.PhoneNumber;
            this.cbxType.SelectedValue = tempCollector.CollectorTypeID;

            //Check the checkboxes of tags which this collector is interested in
            DBControlHelper.CheckControlsWithValues(this.tlpTagsBookSelection, DBCollector.GetInterestsOfType(collectorID, 1));
            DBControlHelper.CheckControlsWithValues(this.tlpTagsMapSelection, DBCollector.GetInterestsOfType(collectorID, 2));
            DBControlHelper.CheckControlsWithValues(this.tlpTagsPeriodicalSelection, DBCollector.GetInterestsOfType(collectorID, 3));
        }
コード例 #6
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            MasterForm master = (this.Parent.Parent as MasterForm);

            try
            {
                //Input data gathered here to improve readability and centralize any processing
                //that needs to be done before insertion
                string firstName       = this.txtFirstNameInput.Text.Trim();
                string lastName        = this.txtLastNameInput.Text.Trim();
                string phoneNumber     = this.mtxtPhoneNumberInput.Text.Trim();
                int    collectorTypeID = (int)this.cbxTypeInput.SelectedValue;

                string status = "";

                if (String.IsNullOrEmpty(status = DBCollector.Validate(firstName, lastName, phoneNumber)))
                {
                    object insertedID = DBCollector.InsertCollector(collectorTypeID, firstName, lastName, phoneNumber);

                    if (insertedID != null)
                    {
                        status = "Collector " + firstName + " " + lastName + " has been added." + Environment.NewLine;

                        List <int> bookTagValues = DBControlHelper.GetValuesFromCheckedControls(this.tlpBookTagsSelection);
                        if (bookTagValues.Count > 0 && DBCollector.InsertInterests((int)insertedID, 1, bookTagValues))
                        {
                            status += "Book interests added." + Environment.NewLine;
                        }
                        List <int> mapTagValues = DBControlHelper.GetValuesFromCheckedControls(this.tlpMapTagsSelection);
                        if (mapTagValues.Count > 0 && DBCollector.InsertInterests((int)insertedID, 2, mapTagValues))
                        {
                            status += "Map interests added." + Environment.NewLine;
                        }
                        List <int> periodicalTagValues = DBControlHelper.GetValuesFromCheckedControls(this.tlpPeriodicalTagsSelection);
                        if (periodicalTagValues.Count > 0 && DBCollector.InsertInterests((int)insertedID, 3, periodicalTagValues))
                        {
                            status += "Periodical interests added." + Environment.NewLine;
                        }
                    }
                }

                master.SetStatus(status);
            }
            catch (Exception ex)
            {
                master.SetStatus("Error! Add failed: " + ex.Message);
            }
        }
コード例 #7
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            MasterForm master = (this.Parent.Parent as MasterForm);

            try
            {
                //Input data gathered here to improve readability and centralize any processing
                //that needs to be done before insertion
                int    collectorID     = (int)nudCollectorId.Value;
                string firstName       = txtFirstName.Text.Trim();
                string lastName        = txtLastName.Text.Trim();
                int    collectorTypeID = (int)cbxType.SelectedValue;
                string phoneNumber     = mtxtPhoneNumber.Text.Trim();

                string status = "";

                if (String.IsNullOrEmpty(status = DBCollector.Validate(firstName, lastName, phoneNumber)))
                {
                    if (DBCollector.UpdateCollector(collectorID, collectorTypeID, firstName, lastName, phoneNumber))
                    {
                        status = "Collector " + firstName + " " + lastName + " has been saved." + Environment.NewLine;
                    }
                }

                if (DBCollector.UpdateInterests(collectorID, 1, DBControlHelper.GetValuesFromCheckedControls(this.tlpTagsBookSelection)))
                {
                    status += "Book interests have been updated." + Environment.NewLine;
                }
                if (DBCollector.UpdateInterests(collectorID, 2, DBControlHelper.GetValuesFromCheckedControls(this.tlpTagsMapSelection)))
                {
                    status += "Map interests have been updated." + Environment.NewLine;
                }
                if (DBCollector.UpdateInterests(collectorID, 3, DBControlHelper.GetValuesFromCheckedControls(this.tlpTagsPeriodicalSelection)))
                {
                    status += "Periodical interests have been updated." + Environment.NewLine;
                }

                master.SetStatus(status);
            }
            catch (Exception ex)
            {
                master.SetStatus("Error! Save failed: " + ex.Message);
            }
        }
コード例 #8
0
        private void AddItemScreen_ParentChanged(object sender, EventArgs e)
        {
            if (this.Parent != null)
            {
                MasterForm master = (this.Parent.Parent as MasterForm);
                master.AcceptButton = btnAdd;
                master.CancelButton = (master.Controls.Find("btnBack", true)[0] as Button);

                this.tags = DBTag.GetTags();
                try
                {
                    DBControlHelper.PopulateWithControls <DBTag, CheckBox>(this.tlpTagSelection, this.tags, "Description", "ID");
                }
                catch (Exception ex)
                {
                    master.SetStatus("Error! Failed to load tags: " + ex.Message);
                }
            }
        }
コード例 #9
0
        private void UpdateCollectorScreen_ParentChanged(object sender, EventArgs e)
        {
            if (this.Parent != null)
            {
                MasterForm master = (this.Parent.Parent as MasterForm);
                master.AcceptButton = btnUpdate;
                master.CancelButton = (master.Controls.Find("btnBack", true)[0] as Button);

                try
                {
                    DBControlHelper.PopulateWithControls <DBTag, CheckBox>(tlpTagsBookSelection, DBTag.GetTags(), "Description", "ID", DBCollector.GetInterestsOfType((int)nudCollectorId.Value, 1));
                    DBControlHelper.PopulateWithControls <DBTag, CheckBox>(tlpTagsMapSelection, DBTag.GetTags(), "Description", "ID", DBCollector.GetInterestsOfType((int)nudCollectorId.Value, 2));
                    DBControlHelper.PopulateWithControls <DBTag, CheckBox>(tlpTagsPeriodicalSelection, DBTag.GetTags(), "Description", "ID", DBCollector.GetInterestsOfType((int)nudCollectorId.Value, 3));
                }
                catch (Exception ex)
                {
                    master.SetStatus("Error! Failed to load tags: " + ex.Message);
                }
            }
        }
コード例 #10
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            MasterForm master = (this.Parent.Parent as MasterForm);

            try
            {
                //Input data gathered here to improve readability and centralize any processing
                //that needs to be done before insertion
                int      itemID        = (int)this.nudItemID.Value;
                decimal  price         = this.nudPrice.Value;
                string   publisher     = this.txtPublisher.Text.Trim();
                string   title         = this.txtTitle.Text.Trim();
                string   authorFirst   = this.txtAuthorFirst.Text.Trim();
                string   authorLast    = this.txtAuthorLast.Text.Trim();
                string   location      = this.txtLocation.Text.Trim();
                string   companyName   = this.txtCompanyName.Text.Trim();
                DateTime publishDate   = this.dtpPublishDate.Value;
                int      year          = (int)this.nudYear.Value;
                int      genreID       = (int)this.cbxGenre.SelectedValue;
                int      conditionID   = this.tkbCondition.Value;
                int      quantity      = (int)this.nudQuantity.Value;
                int      edition       = (int)this.nudEdition.Value;
                decimal  discountPrice = this.nudDiscountPrice.Value;
                DateTime discountFrom  = this.dtpDiscountFrom.Value;
                DateTime discountTo    = this.dtpDiscountTo.Value;

                string status = "";

                switch (cbxItemType.SelectedValue)
                {
                case 1:
                    if (String.IsNullOrEmpty(status = DBBook.Validate(price, title, authorFirst, authorLast, publisher, publishDate)))
                    {
                        if (DBBook.UpdateBook(itemID, title, price, edition, genreID, authorFirst, authorLast, publisher, publishDate,
                                              conditionID, quantity))
                        {
                            status = "Book " + title + " has been saved." + Environment.NewLine;
                        }
                    }
                    break;

                case 2:
                    if (String.IsNullOrEmpty(status = DBMap.Validate(price, location, year, publisher)))
                    {
                        if (DBMap.UpdateMap(itemID, location, price, edition, publisher, year, conditionID, quantity))
                        {
                            status = "Map " + location + " has been saved." + Environment.NewLine;
                        }
                    }
                    break;

                case 3:
                    if (String.IsNullOrEmpty(status = DBPeriodical.Validate(price, title, companyName, publishDate)))
                    {
                        if (DBPeriodical.UpdatePeriodical(itemID, title, price, edition, companyName, genreID, publishDate, conditionID,
                                                          quantity))
                        {
                            status = "Periodical " + title + " has been saved." + Environment.NewLine;
                        }
                    }
                    break;
                }

                if (quantity < Cart.Invoice.GetQuantityBeingSold(itemID))
                {
                    status += "Quantity cannot be less than the amount of the item currently being sold" + Environment.NewLine;
                }
                else
                {
                    for (var i = 0; i < Cart.Invoice.Transactions.Count; i++)
                    {
                        if (Cart.Invoice.Transactions[i].ItemID == itemID)
                        {
                            Cart.Invoice.Transactions[i].SetItemStock(quantity);
                        }
                    }
                }

                if (DBItem.UpdateItemTags(itemID, DBControlHelper.GetValuesFromCheckedControls(this.tlpTagSelection)))
                {
                    status += "Item tags have been saved." + Environment.NewLine;
                }

                if (this.chkSetupDiscountTitle.Checked)
                {
                    string discountError = DBItemDiscount.Validate(discountPrice, discountFrom, discountTo);
                    if (String.IsNullOrEmpty(discountError))
                    {
                        if (DBItem.SaveDiscount(itemID, discountPrice, discountFrom, discountTo))
                        {
                            status += "Discount has been saved." + Environment.NewLine;
                        }
                    }
                    else
                    {
                        status += discountError;
                    }
                }

                master.SetStatus(status);
            }
            catch (Exception ex)
            {
                master.SetStatus("Error! Update failed: " + ex.Message);
            }
        }
コード例 #11
0
        public InventoryScreen(Screen backScreen) : base("Inventory", backScreen, 1, 2, 3)
        {
            this.tlpSearchBar         = new System.Windows.Forms.TableLayoutPanel();
            this.tlpEditOptions       = new System.Windows.Forms.TableLayoutPanel();
            this.lblEditOptionsPrompt = new System.Windows.Forms.Label();
            this.btnAddItem           = new System.Windows.Forms.Button();
            this.btnDeactivateItem    = new System.Windows.Forms.Button();
            this.btnUpdateItem        = new System.Windows.Forms.Button();
            this.btnSellSelectedItem  = new System.Windows.Forms.Button();
            this.dgvItems             = new System.Windows.Forms.DataGridView();
            this.rbnPeriodical        = new System.Windows.Forms.RadioButton();
            this.rbnBook                = new System.Windows.Forms.RadioButton();
            this.tlpItemTypes           = new System.Windows.Forms.TableLayoutPanel();
            this.rbnMap                 = new System.Windows.Forms.RadioButton();
            this.tlpSearch              = new System.Windows.Forms.TableLayoutPanel();
            this.lblSearchByTitlePrompt = new System.Windows.Forms.Label();
            this.lblSelectedItemPrompt  = new System.Windows.Forms.Label();
            this.txtSearch              = new System.Windows.Forms.TextBox();
            this.cbxSelectedItem        = new System.Windows.Forms.ComboBox();
            this.tlpTags                = new System.Windows.Forms.TableLayoutPanel();
            this.lblTagSelectPrompt     = new System.Windows.Forms.Label();
            this.tlpTagSelection        = new System.Windows.Forms.TableLayoutPanel();
            //
            // tlpSearchBar
            //
            this.tlpSearchBar.AutoSize    = true;
            this.tlpSearchBar.BackColor   = System.Drawing.Color.White;
            this.tlpSearchBar.ColumnCount = 1;
            this.tlpSearchBar.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tlpSearchBar.Controls.Add(this.tlpItemTypes, 0, 1);
            this.tlpSearchBar.Controls.Add(this.tlpSearch, 0, 0);
            this.tlpSearchBar.Controls.Add(this.tlpTags, 0, 2);
            this.tlpSearchBar.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpSearchBar.Padding  = new System.Windows.Forms.Padding(10);
            this.tlpSearchBar.RowCount = 3;
            this.tlpSearchBar.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpSearchBar.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpSearchBar.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpSearchBar.TabIndex = 0;
            //
            // tlpEditOptions
            //
            this.tlpEditOptions.AutoSize    = true;
            this.tlpEditOptions.BackColor   = System.Drawing.Color.White;
            this.tlpEditOptions.ColumnCount = 7;
            this.tlpEditOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F));
            this.tlpEditOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpEditOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpEditOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpEditOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpEditOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpEditOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F));
            this.tlpEditOptions.Controls.Add(this.lblEditOptionsPrompt, 1, 0);
            this.tlpEditOptions.Controls.Add(this.btnAddItem, 2, 0);
            this.tlpEditOptions.Controls.Add(this.btnDeactivateItem, 3, 0);
            this.tlpEditOptions.Controls.Add(this.btnUpdateItem, 4, 0);
            this.tlpEditOptions.Controls.Add(this.btnSellSelectedItem, 5, 0);
            this.tlpEditOptions.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpEditOptions.RowCount = 1;
            this.tlpEditOptions.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tlpEditOptions.Padding  = new System.Windows.Forms.Padding(10, 10, 10, 10);
            this.tlpEditOptions.TabIndex = 1;
            //
            // lblEditOptionsPrompt
            //
            this.lblEditOptionsPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblEditOptionsPrompt.AutoSize = true;
            //this.lblEditOptionsPrompt.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblEditOptionsPrompt.TabIndex = 1;
            this.lblEditOptionsPrompt.Text     = "Edit Options";
            //
            // btnAddItem
            //
            this.btnAddItem.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.btnAddItem.AutoSize  = true;
            this.btnAddItem.TabIndex  = 2;
            this.btnAddItem.Text      = "Add Item";
            this.btnAddItem.Click    += BtnAddItem_Click;
            this.btnAddItem.BackColor = DefaultBackColor;
            this.btnAddItem.Margin    = new System.Windows.Forms.Padding(10, 5, 10, 5);
            //
            // btnRemoveItem
            //
            this.btnDeactivateItem.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.btnDeactivateItem.AutoSize  = true;
            this.btnDeactivateItem.TabIndex  = 2;
            this.btnDeactivateItem.Text      = "Deactivate Item";
            this.btnDeactivateItem.BackColor = DefaultBackColor;
            this.btnDeactivateItem.Margin    = new System.Windows.Forms.Padding(10, 5, 10, 5);
            this.btnDeactivateItem.Click    += BtnRemoveItem_Click;
            //
            // btnUpdateItem
            //
            this.btnUpdateItem.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.btnUpdateItem.AutoSize  = true;
            this.btnUpdateItem.TabIndex  = 3;
            this.btnUpdateItem.Text      = "Update Item";
            this.btnUpdateItem.BackColor = DefaultBackColor;
            this.btnUpdateItem.Click    += BtnUpdateItem_Click;
            this.btnUpdateItem.Margin    = new System.Windows.Forms.Padding(10, 5, 10, 5);
            //
            // btnSellSelectedItem
            //
            this.btnSellSelectedItem.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.btnSellSelectedItem.AutoSize  = true;
            this.btnSellSelectedItem.TabIndex  = 4;
            this.btnSellSelectedItem.Text      = "Sell Selected Item";
            this.btnSellSelectedItem.BackColor = DefaultBackColor;
            this.btnSellSelectedItem.Click    += BtnSellSelectedItem_Click;
            this.btnSellSelectedItem.Margin    = new System.Windows.Forms.Padding(10, 5, 10, 5);
            //
            // dgvItems
            //
            this.dgvItems.AutoSizeColumnsMode         = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            this.dgvItems.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvItems.Dock                    = System.Windows.Forms.DockStyle.Fill;
            this.dgvItems.TabIndex                = 2;
            this.dgvItems.ReadOnly                = true;
            this.dgvItems.SelectionMode           = DataGridViewSelectionMode.FullRowSelect;
            this.dgvItems.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            this.dgvItems.RowHeadersVisible       = false;
            //
            // panel
            //
            this.ColumnCount = 1;
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.Controls.Add(this.tlpEditOptions, 0, 0);
            this.Controls.Add(this.tlpSearchBar, 0, 1);
            this.Controls.Add(this.dgvItems, 0, 2);
            this.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.RowCount = 3;
            this.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.TabIndex       = 0;
            this.ParentChanged += InventoryScreen_ParentChanged;
            //this.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //
            // rbnPeriodical
            //
            this.rbnPeriodical.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.rbnPeriodical.AutoSize = true;
            this.rbnPeriodical.TabIndex = 6;
            this.rbnPeriodical.TabStop  = true;
            this.rbnPeriodical.Text     = "Periodicals";
            this.rbnPeriodical.UseVisualStyleBackColor = true;
            this.rbnPeriodical.CheckedChanged         += ItemType_CheckedChanged;
            //
            // rbnBook
            //
            this.rbnBook.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.rbnBook.AutoSize = true;
            this.rbnBook.TabIndex = 7;
            this.rbnBook.TabStop  = true;
            this.rbnBook.Text     = "Books";
            this.rbnBook.UseVisualStyleBackColor = true;
            this.rbnBook.Checked         = true;
            this.rbnBook.CheckedChanged += ItemType_CheckedChanged;

            //
            // tlpItemTypes
            //
            this.tlpItemTypes.AutoSize    = true;
            this.tlpItemTypes.ColumnCount = 4;
            this.tlpItemTypes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.tlpItemTypes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.tlpItemTypes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.tlpItemTypes.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tlpItemTypes.Controls.Add(this.rbnMap, 2, 0);
            this.tlpItemTypes.Controls.Add(this.rbnBook, 0, 0);
            this.tlpItemTypes.Controls.Add(this.rbnPeriodical, 1, 0);
            this.tlpItemTypes.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpItemTypes.RowCount = 1;
            this.tlpItemTypes.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpItemTypes.TabIndex = 8;
            //
            // rbnMap
            //
            this.rbnMap.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.rbnMap.AutoSize = true;
            this.rbnMap.TabIndex = 8;
            this.rbnMap.TabStop  = true;
            this.rbnMap.Text     = "Maps";
            this.rbnMap.UseVisualStyleBackColor = true;
            this.rbnMap.CheckedChanged         += ItemType_CheckedChanged;
            //
            // tlpSearchPanel
            //
            this.tlpSearch.Anchor      = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.tlpSearch.AutoSize    = true;
            this.tlpSearch.ColumnCount = 4;
            this.tlpSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tlpSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tlpSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tlpSearch.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tlpSearch.Controls.Add(this.lblSearchByTitlePrompt, 0, 0);
            this.tlpSearch.Controls.Add(this.lblSelectedItemPrompt, 2, 0);
            this.tlpSearch.Controls.Add(this.txtSearch, 1, 0);
            this.tlpSearch.Controls.Add(this.cbxSelectedItem, 3, 0);
            this.tlpSearch.RowCount = 1;
            this.tlpSearch.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpSearch.TabIndex = 9;
            //
            // lblSearchByTitlePrompt
            //
            this.lblSearchByTitlePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblSearchByTitlePrompt.AutoSize = true;
            //this.lblSearchByTitlePrompt.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblSearchByTitlePrompt.TabIndex = 0;
            this.lblSearchByTitlePrompt.Text     = "Search by Title:";
            //
            // lblSelectedItemPrompt
            //
            this.lblSelectedItemPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblSelectedItemPrompt.AutoSize = true;
            //this.lblSelectedItemPrompt.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblSelectedItemPrompt.TabIndex = 1;
            this.lblSelectedItemPrompt.Text     = "Selected Item:";
            //
            // txtSearchByTitleInput
            //
            this.txtSearch.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtSearch.TabIndex     = 2;
            this.txtSearch.MaxLength    = DBControlHelper.MaximumTitleLength;
            this.txtSearch.TextChanged += Search_TextChanged;
            //
            // cbxSelectedItemInput
            //
            this.cbxSelectedItem.Anchor            = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.cbxSelectedItem.FormattingEnabled = true;
            this.cbxSelectedItem.TabIndex          = 3;
            this.cbxSelectedItem.DropDownStyle     = ComboBoxStyle.DropDownList;
            //
            // tlpTagPanel
            //
            this.tlpTags.AutoSize    = true;
            this.tlpTags.ColumnCount = 1;
            this.tlpTags.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tlpTags.Controls.Add(this.lblTagSelectPrompt, 0, 0);
            this.tlpTags.Controls.Add(this.tlpTagSelection, 0, 1);
            this.tlpTags.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpTags.RowCount = 2;
            this.tlpTags.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpTags.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpTags.TabIndex  = 10;
            this.tlpTags.BackColor = Screen.PrimaryColor;
            //
            // lblTagSelectPrompt
            //
            this.lblTagSelectPrompt.Anchor   = System.Windows.Forms.AnchorStyles.None;
            this.lblTagSelectPrompt.AutoSize = true;
            //this.lblTagSelectPrompt.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblTagSelectPrompt.TabIndex = 0;
            this.lblTagSelectPrompt.Text     = "Tag";
            //
            // tlpTagSelection
            //
            this.tlpTagSelection.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                                 | System.Windows.Forms.AnchorStyles.Left)
                                                                                | System.Windows.Forms.AnchorStyles.Right)));
            this.tlpTagSelection.AutoScroll  = true;
            this.tlpTagSelection.Dock        = DockStyle.Fill;
            this.tlpTagSelection.ColumnCount = 6;
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            this.tlpTagSelection.TabIndex  = 1;
            this.tlpTagSelection.BackColor = System.Drawing.Color.White;
            DBControlHelper.PopulateWithControls <DBTag, CheckBox>(this.tlpTagSelection, DBTag.GetTags(), "Description", "ID");
            foreach (CheckBox c in this.tlpTagSelection.Controls)
            {
                c.CheckedChanged += Tag_CheckedChanged;
            }

            this.SetFontSizes(this.Controls);
        }
コード例 #12
0
        public AddItemScreen(Screen backScreen) : base("Add Item", backScreen, 1, 2)
        {
            //DB Classes
            this.conditions = DBCondition.GetConditions();
            this.tags       = DBTag.GetTags();

            this.tlpForm              = new System.Windows.Forms.TableLayoutPanel();
            this.lblItemTypePrompt    = new System.Windows.Forms.Label();
            this.cbxItemType          = new System.Windows.Forms.ComboBox();
            this.lblQuantityPrompt    = new System.Windows.Forms.Label();
            this.lblPricePrompt       = new System.Windows.Forms.Label();
            this.lblConditionPrompt   = new System.Windows.Forms.Label();
            this.lblPublishDatePrompt = new System.Windows.Forms.Label();
            this.lblFormTitle         = new System.Windows.Forms.Label();
            this.nudQuantity          = new System.Windows.Forms.NumericUpDown();
            this.nudPrice             = new System.Windows.Forms.NumericUpDown();
            this.tkbCondition         = new System.Windows.Forms.TrackBar();
            this.tlpConditionPanel    = new System.Windows.Forms.TableLayoutPanel();
            this.lblMinCondition      = new System.Windows.Forms.Label();
            this.lblMaxCondition      = new System.Windows.Forms.Label();
            this.lblSelectedCondition = new System.Windows.Forms.Label();
            this.dtpPublishDate       = new System.Windows.Forms.DateTimePicker();
            this.tlpTags              = new System.Windows.Forms.TableLayoutPanel();
            this.lblTagsPrompt        = new System.Windows.Forms.Label();
            this.tlpTagSelection      = new System.Windows.Forms.TableLayoutPanel();
            this.btnAdd           = new System.Windows.Forms.Button();
            this.nudEdition       = new NumericUpDown();
            this.lblEditionPrompt = new Label();

            this.ColumnCount = 1;
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.Controls.Add(this.tlpForm, 0, 0);
            this.Controls.Add(this.btnAdd, 0, 1);
            this.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.RowCount = 2;
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.TabIndex       = 0;
            this.ParentChanged += AddItemScreen_ParentChanged;
            //
            // tlpForm
            //
            this.tlpForm.ColumnCount = 7;
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 22.52252F));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.AutoSize));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 22.52252F));
            this.tlpForm.Controls.Add(this.lblPublishDatePrompt, 4, 5);
            this.tlpForm.Controls.Add(this.lblConditionPrompt, 1, 6);
            this.tlpForm.Controls.Add(this.lblPricePrompt, 1, 3);
            this.tlpForm.Controls.Add(this.lblQuantityPrompt, 1, 2);
            this.tlpForm.Controls.Add(this.lblItemTypePrompt, 1, 1);
            this.tlpForm.Controls.Add(this.cbxItemType, 2, 1);
            this.tlpForm.Controls.Add(this.lblFormTitle, 0, 0);
            this.tlpForm.SetColumnSpan(this.lblFormTitle, 7);
            this.tlpForm.Controls.Add(this.nudQuantity, 2, 2);
            this.tlpForm.Controls.Add(this.nudPrice, 2, 3);
            this.tlpForm.Controls.Add(this.tlpConditionPanel, 2, 6);
            this.tlpForm.SetColumnSpan(this.tlpConditionPanel, 4);
            this.tlpForm.Controls.Add(this.dtpPublishDate, 5, 5);
            this.tlpForm.Controls.Add(this.tlpTags, 1, 7);
            this.tlpForm.Controls.Add(this.nudEdition, 2, 4);
            this.tlpForm.Controls.Add(this.lblEditionPrompt, 1, 4);
            this.tlpForm.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpForm.RowCount = 8;
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F));
            this.tlpForm.TabIndex  = 0;
            this.tlpForm.BackColor = System.Drawing.Color.White;

            //Book
            this.lblTitlePrompt                = new System.Windows.Forms.Label();
            this.lblTitlePrompt.Anchor         = System.Windows.Forms.AnchorStyles.Right;
            this.lblTitlePrompt.AutoSize       = true;
            this.lblTitlePrompt.TabIndex       = 6;
            this.lblTitlePrompt.Text           = "Title:";
            this.lblAuthorFirstPrompt          = new System.Windows.Forms.Label();
            this.lblAuthorFirstPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblAuthorFirstPrompt.AutoSize = true;
            this.lblAuthorFirstPrompt.TabIndex = 7;
            this.lblAuthorFirstPrompt.Text     = "Author First:";
            this.lblAuthorLastPrompt           = new System.Windows.Forms.Label();
            this.lblAuthorLastPrompt.Anchor    = System.Windows.Forms.AnchorStyles.Right;
            this.lblAuthorLastPrompt.AutoSize  = true;
            this.lblAuthorLastPrompt.TabIndex  = 7;
            this.lblAuthorLastPrompt.Text      = "Author Last:";
            this.lblPublisherPrompt            = new System.Windows.Forms.Label();
            this.lblPublisherPrompt.Anchor     = System.Windows.Forms.AnchorStyles.Right;
            this.lblPublisherPrompt.AutoSize   = true;
            this.lblPublisherPrompt.TabIndex   = 8;
            this.lblPublisherPrompt.Text       = "Publisher:";
            this.lblGenrePrompt                = new System.Windows.Forms.Label();
            this.lblGenrePrompt.Anchor         = System.Windows.Forms.AnchorStyles.Right;
            this.lblGenrePrompt.AutoSize       = true;
            this.lblGenrePrompt.TabIndex       = 9;
            this.lblGenrePrompt.Text           = "Genre:";
            this.txtTitle                   = new System.Windows.Forms.TextBox();
            this.txtTitle.Anchor            = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTitle.TabIndex          = 13;
            this.txtTitle.MaxLength         = DBControlHelper.MaximumTitleLength;
            this.txtAuthorFirst             = new System.Windows.Forms.TextBox();
            this.txtAuthorFirst.Anchor      = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtAuthorFirst.TabIndex    = 14;
            this.txtAuthorFirst.MaxLength   = DBControlHelper.MaximumFirstNameLength;
            this.txtAuthorLast              = new System.Windows.Forms.TextBox();
            this.txtAuthorLast.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtAuthorLast.TabIndex     = 14;
            this.txtAuthorLast.MaxLength    = DBControlHelper.MaximumLastNameLength;
            this.txtPublisher               = new System.Windows.Forms.TextBox();
            this.txtPublisher.Anchor        = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtPublisher.TabIndex      = 15;
            this.txtPublisher.MaxLength     = DBControlHelper.MaximumPublisherLength;
            this.cbxGenre                   = new System.Windows.Forms.ComboBox();
            this.cbxGenre.Anchor            = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.cbxGenre.FormattingEnabled = true;
            this.cbxGenre.TabIndex          = 16;
            this.cbxGenre.DataSource        = DBGenre.getGenres();
            this.cbxGenre.DisplayMember     = "Name";
            this.cbxGenre.ValueMember       = "ID";
            this.cbxGenre.DropDownStyle     = ComboBoxStyle.DropDownList;
            this.tlpForm.Controls.Add(this.txtTitle, 5, 1);
            this.tlpForm.Controls.Add(this.txtAuthorFirst, 5, 2);
            this.tlpForm.Controls.Add(this.txtAuthorLast, 5, 3);
            this.tlpForm.Controls.Add(this.txtPublisher, 5, 4);
            this.tlpForm.Controls.Add(this.cbxGenre, 2, 5);
            this.tlpForm.Controls.Add(this.lblGenrePrompt, 1, 5);
            this.tlpForm.Controls.Add(this.lblPublisherPrompt, 4, 4);
            this.tlpForm.Controls.Add(this.lblAuthorFirstPrompt, 4, 2);
            this.tlpForm.Controls.Add(this.lblAuthorLastPrompt, 4, 3);
            this.tlpForm.Controls.Add(this.lblTitlePrompt, 4, 1);

            //Map
            this.lblLocationPrompt          = new Label();
            this.lblLocationPrompt.AutoSize = true;
            this.lblLocationPrompt.Text     = "Location:";
            this.lblLocationPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblLocationPrompt.Visible  = false;
            this.txtLocation            = new TextBox();
            this.txtLocation.Anchor     = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtLocation.Visible    = false;
            this.txtLocation.MaxLength  = DBControlHelper.MaximumLocationLength;
            this.lblYearPrompt          = new Label();
            this.lblYearPrompt.AutoSize = true;
            this.lblYearPrompt.Text     = "Year:";
            this.lblYearPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblYearPrompt.Visible  = false;
            this.nudYear         = new NumericUpDown();
            this.nudYear.Anchor  = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.nudYear.Visible = false;
            this.nudYear.Minimum = 1200;
            this.nudYear.Maximum = DateTime.Now.Year;
            this.tlpForm.Controls.Add(this.lblLocationPrompt, 4, 1);
            this.tlpForm.Controls.Add(this.txtLocation, 5, 1);
            this.tlpForm.Controls.Add(this.lblYearPrompt, 4, 2);
            this.tlpForm.Controls.Add(this.nudYear, 5, 2);

            //Periodical
            this.lblCompanyNamePrompt          = new Label();
            this.lblCompanyNamePrompt.AutoSize = true;
            this.lblCompanyNamePrompt.Text     = "Company Name:";
            this.lblCompanyNamePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblCompanyNamePrompt.Visible  = false;
            this.txtCompanyName           = new TextBox();
            this.txtCompanyName.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtCompanyName.Visible   = false;
            this.txtCompanyName.MaxLength = DBControlHelper.MaximumCompanyNameLength;
            this.tlpForm.Controls.Add(this.lblCompanyNamePrompt, 4, 1);
            this.tlpForm.Controls.Add(this.txtCompanyName, 5, 1);

            //lblEditionPrompt
            this.lblEditionPrompt.Text     = "Edition:";
            this.lblEditionPrompt.Anchor   = AnchorStyles.Right;
            this.lblEditionPrompt.AutoSize = true;

            //nudEdition
            this.nudEdition.Value  = 1;
            this.nudEdition.Anchor = AnchorStyles.Left | AnchorStyles.Right;

            //
            // lblItemTypePrompt
            //
            this.lblItemTypePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblItemTypePrompt.AutoSize = true;
            this.lblItemTypePrompt.TabIndex = 0;
            this.lblItemTypePrompt.Text     = "Type:";
            //
            // cbxItemType
            //
            this.cbxItemType.Anchor                = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.cbxItemType.FormattingEnabled     = true;
            this.cbxItemType.TabIndex              = 1;
            this.cbxItemType.DataSource            = DBItemType.GetItemTypes();
            this.cbxItemType.ValueMember           = "ID";
            this.cbxItemType.DisplayMember         = "Name";
            this.cbxItemType.DropDownStyle         = ComboBoxStyle.DropDownList;
            this.cbxItemType.SelectedIndexChanged += CbxItemType_SelectedIndexChanged;
            //
            // lblQuantityPrompt
            //
            this.lblQuantityPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblQuantityPrompt.AutoSize = true;
            this.lblQuantityPrompt.TabIndex = 2;
            this.lblQuantityPrompt.Text     = "Quantity:";
            //
            // lblPricePrompt
            //
            this.lblPricePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblPricePrompt.AutoSize = true;
            this.lblPricePrompt.TabIndex = 3;
            this.lblPricePrompt.Text     = "Price:";
            //
            // lblConditionPrompt
            //
            this.lblConditionPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblConditionPrompt.AutoSize = true;
            this.lblConditionPrompt.TabIndex = 4;
            this.lblConditionPrompt.Text     = "Condition:";
            //
            // lblPublishDatePrompt
            //
            this.lblPublishDatePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblPublishDatePrompt.AutoSize = true;
            this.lblPublishDatePrompt.TabIndex = 5;
            this.lblPublishDatePrompt.Text     = "Publish Date:";
            //
            // lblFormTitle
            //
            this.lblFormTitle.Anchor    = System.Windows.Forms.AnchorStyles.Left | AnchorStyles.Right;
            this.lblFormTitle.TabIndex  = 10;
            this.lblFormTitle.Text      = "Basic Information";
            this.lblFormTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            this.lblFormTitle.BackColor = Screen.PrimaryColor;
            //
            // nudQuantity
            //
            this.nudQuantity.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.nudQuantity.TabIndex = 11;
            //
            // nudPrice
            //
            this.nudPrice.Anchor             = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.nudPrice.DecimalPlaces      = 2;
            this.nudPrice.TabIndex           = 12;
            this.nudPrice.ThousandsSeparator = true;
            //
            // tkbCondition
            //
            this.tkbCondition.Anchor        = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.tkbCondition.TabIndex      = 17;
            this.tkbCondition.ValueChanged += TkbCondition_ValueChanged;
            this.tkbCondition.Minimum       = 1;
            this.tkbCondition.Maximum       = this.conditions.Count;
            this.tkbCondition.Value         = (int)Math.Round((double)((this.conditions.Count - 1) / 2));
            //
            // tlpConditionPanel
            //
            this.tlpConditionPanel.ColumnCount = 3;
            this.tlpConditionPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tlpConditionPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tlpConditionPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tlpConditionPanel.Controls.Add(this.tkbCondition, 0, 1);
            this.tlpConditionPanel.Controls.Add(this.lblMinCondition, 0, 2);
            this.tlpConditionPanel.Controls.Add(this.lblMaxCondition, 2, 2);
            this.tlpConditionPanel.Controls.Add(this.lblSelectedCondition, 0, 0);
            this.tlpConditionPanel.SetColumnSpan(this.tkbCondition, 3);
            this.tlpConditionPanel.SetColumnSpan(this.lblSelectedCondition, 3);
            this.tlpConditionPanel.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpConditionPanel.RowCount = 3;
            this.tlpConditionPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpConditionPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpConditionPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpConditionPanel.TabIndex = 18;
            this.tlpConditionPanel.AutoSize = true;
            //
            // lblMaxCondition
            //
            this.lblMinCondition.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblMinCondition.AutoSize  = true;
            this.lblMinCondition.TabIndex  = 18;
            this.lblMinCondition.Text      = this.conditions.First().Type;
            this.lblMinCondition.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            //
            // lblMinCondition
            //
            this.lblMaxCondition.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblMaxCondition.AutoSize  = true;
            this.lblMaxCondition.TabIndex  = 19;
            this.lblMaxCondition.Text      = this.conditions.Last().Type;
            this.lblMaxCondition.TextAlign = System.Drawing.ContentAlignment.TopRight;
            //
            // lblSelectedCondition
            //
            this.lblSelectedCondition.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblSelectedCondition.AutoSize = true;
            this.tlpConditionPanel.SetColumnSpan(this.lblSelectedCondition, 3);
            this.lblSelectedCondition.TabIndex  = 20;
            this.lblSelectedCondition.Text      = this.conditions[tkbCondition.Value - 1].Type;
            this.lblSelectedCondition.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            //
            // dtpPublishDate
            //
            this.dtpPublishDate.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.dtpPublishDate.TabIndex = 19;
            //
            // tlpTags
            //
            this.tlpTags.ColumnCount = 1;
            this.tlpForm.SetColumnSpan(this.tlpTags, 5);
            this.tlpTags.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tlpTags.Controls.Add(this.lblTagsPrompt, 0, 0);
            this.tlpTags.Controls.Add(this.tlpTagSelection, 0, 1);
            this.tlpTags.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpTags.RowCount = 2;
            this.tlpTags.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpTags.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tlpTags.TabIndex  = 20;
            this.tlpTags.BackColor = Screen.PrimaryColor;
            this.tlpTags.Margin    = new Padding(0, 5, 0, 15);
            //
            // lblTagsPrompt
            //
            this.lblTagsPrompt.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblTagsPrompt.AutoSize  = true;
            this.lblTagsPrompt.TabIndex  = 0;
            this.lblTagsPrompt.Text      = "Tags";
            this.lblTagsPrompt.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            //
            // pnlTagSelection
            //
            this.tlpTagSelection.AutoScroll  = true;
            this.tlpTagSelection.Dock        = System.Windows.Forms.DockStyle.Fill;
            this.tlpTagSelection.TabIndex    = 1;
            this.tlpTagSelection.BackColor   = System.Drawing.Color.White;
            this.tlpTagSelection.ColumnCount = 4;
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.tlpTagSelection.HorizontalScroll.Enabled = false;
            DBControlHelper.PopulateWithControls <DBTag, CheckBox>(this.tlpTagSelection, DBTag.GetTags(), "Description", "ID");
            //
            // btnAdd
            //
            this.btnAdd.Anchor   = System.Windows.Forms.AnchorStyles.None;
            this.btnAdd.AutoSize = true;
            this.btnAdd.Size     = new System.Drawing.Size(200, 32);
            this.btnAdd.TabIndex = 1;
            this.btnAdd.Text     = "Add";
            this.btnAdd.UseVisualStyleBackColor = true;
            this.btnAdd.BackColor = DefaultBackColor;
            this.btnAdd.Click    += BtnAdd_Click;

            this.SetFontSizes(this.Controls);
        }
コード例 #13
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            MasterForm master = (this.Parent.Parent as MasterForm);

            try
            {
                //Input data gathered here to improve readability and centralize any processing
                //that needs to be done before insertion
                decimal  price       = this.nudPrice.Value;
                string   publisher   = this.txtPublisher.Text.Trim();
                string   title       = this.txtTitle.Text.Trim();
                string   authorFirst = this.txtAuthorFirst.Text.Trim();
                string   authorLast  = this.txtAuthorLast.Text.Trim();
                string   location    = this.txtLocation.Text.Trim();
                string   companyName = this.txtCompanyName.Text.Trim();
                DateTime publishDate = this.dtpPublishDate.Value;
                int      year        = (int)this.nudYear.Value;
                int      genreID     = (int)this.cbxGenre.SelectedValue;
                int      conditionID = this.tkbCondition.Value;
                int      quantity    = (int)this.nudQuantity.Value;
                int      edition     = (int)this.nudEdition.Value;

                object insertedID = null;
                string status     = "";

                switch (this.cbxItemType.SelectedValue)
                {
                case 1:
                    if (String.IsNullOrEmpty(status = DBBook.Validate(price, title, authorFirst, authorLast, publisher, publishDate)))
                    {
                        insertedID = DBBook.InsertBook(title, price, edition, genreID, authorFirst, authorLast, publisher,
                                                       publishDate, conditionID, quantity);

                        if (insertedID != null)
                        {
                            status = "Book " + title + " has been added successfully";
                        }
                    }

                    break;

                case 2:
                    if (String.IsNullOrEmpty(status = DBMap.Validate(price, location, year, publisher)))
                    {
                        insertedID = DBMap.InsertMap(location, price, edition, publisher, year, conditionID, quantity);

                        if (insertedID != null)
                        {
                            status = "Map " + location + " has been added successfully";
                        }
                    }

                    break;

                case 3:
                    if (String.IsNullOrEmpty(status = DBPeriodical.Validate(price, title, companyName, publishDate)))
                    {
                        insertedID = DBPeriodical.InsertPeriodical(title, price, edition, companyName, genreID, publishDate,
                                                                   conditionID, quantity);

                        if (insertedID != null)
                        {
                            status = "Periodical " + title + " has been added successfully";
                        }
                    }

                    break;
                }

                if (insertedID != null)
                {
                    List <int> tagValues = DBControlHelper.GetValuesFromCheckedControls(this.tlpTagSelection);
                    if (tagValues.Count > 0 && DBItem.InsertItemTags((int)insertedID, tagValues))
                    {
                        status += Environment.NewLine + "Item tags added.";
                    }
                }

                master.SetStatus(status);
            }
            catch (Exception ex)
            {
                master.SetStatus("Error! Failed to add item: " + ex.Message);
            }
        }
コード例 #14
0
 /// <summary>
 /// Filters through a list of items and returns a new list with items that have a similar description
 /// to the passed value and updates the quantity of items to reflect transactions in the cart
 /// </summary>
 /// <typeparam name="T">The type of item to search. Either a book, periodical, or map</typeparam>
 /// <param name="items">The list of items to filter through</param>
 /// <param name="description">The description to look for</param>
 /// <param name="transactions">The transactions to update the item quantity based off</param>
 /// <returns></returns>
 public static BindingList <T> GetFilteredItems <T>(BindingList <T> items, string description, List <int> tagIds) where T : DBItem
 {
     return(DBControlHelper.GetFilteredItemsAndUpdateQuantity <T>(items, description, tagIds, new BindingList <DBTransaction>()));
 }
コード例 #15
0
        public void ShowItem()
        {
            int itemTypeID = DBItem.GetDBItemTypeOfId((int)nudItemID.Value);

            cbxItemType.SelectedValue = itemTypeID;
            DBItem tempItem = null;

            switch (itemTypeID)
            {
            case 1:
                tempItem = DBBook.GetBookOfId((int)nudItemID.Value);
                DBBook tempBook = (tempItem as DBBook);
                this.txtTitle.Text          = tempBook.Title;
                this.txtAuthorFirst.Text    = tempBook.GetAuthorFirst();
                this.txtAuthorLast.Text     = tempBook.GetAuthorLast();
                this.cbxGenre.SelectedValue = tempBook.GetGenreID();
                this.txtPublisher.Text      = tempBook.Publisher;
                this.dtpPublishDate.Value   = tempBook.PublishDate;
                break;

            case 2:
                tempItem = DBMap.GetMapOfId((int)nudItemID.Value);
                DBMap tempMap = (tempItem as DBMap);
                this.txtPublisher.Text = tempMap.Publisher;
                this.txtLocation.Text  = tempMap.Location;
                this.nudYear.Value     = tempMap.Year;
                break;

            case 3:
                tempItem = DBPeriodical.GetPeriodicalOfId((int)nudItemID.Value);
                DBPeriodical tempPeriodical = (tempItem as DBPeriodical);
                this.txtTitle.Text          = tempPeriodical.Title;
                this.cbxGenre.SelectedValue = tempPeriodical.GetGenreID();
                this.txtCompanyName.Text    = tempPeriodical.CompanyName;
                this.dtpPublishDate.Value   = tempPeriodical.PublishDate;
                break;
            }

            if (tempItem != null)
            {
                this.tkbCondition.Value = tempItem.GetConditionID();
                this.nudQuantity.Value  = tempItem.GetQuantity();

                try
                {
                    DBControlHelper.PopulateWithControls <DBTag, CheckBox>(this.tlpTagSelection, DBTag.GetTags(), "Description", "ID", tempItem.GetTags());
                }
                catch (Exception ex)
                {
                    (this.Parent.Parent as MasterForm).SetStatus("Error! Failed to load tags: " + ex.Message);
                }

                this.nudPrice.Value = tempItem.GetRegularPrice();

                //Show the discount
                if (tempItem.HasDiscount())
                {
                    this.nudDiscountPrice.Value        = tempItem.GetDiscount().Amount;
                    this.dtpDiscountFrom.Value         = tempItem.GetDiscount().StartDate;
                    this.dtpDiscountTo.Value           = tempItem.GetDiscount().EndDate;
                    this.chkSetupDiscountTitle.Checked = true;
                }
                else
                {
                    this.nudDiscountPrice.Value = 0;
                    this.dtpDiscountFrom.ResetText();
                    this.dtpDiscountTo.ResetText();
                    this.chkSetupDiscountTitle.Checked = false;
                }
            }
        }
コード例 #16
0
        public EditTagsScreen(Screen backScreen) : base("Edit Tags", backScreen, 1, 2)
        {
            #region Init
            this.Dock        = DockStyle.Fill;
            this.BackColor   = Color.Transparent;
            this.ColumnCount = 2;
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 45F));
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 55F));
            this.RowCount = 2;
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 70F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F));
            this.ParentChanged += EditTagsScreen_ParentChanged;
            #endregion

            #region Controls
            TableLayoutPanel tlpMainTagsPanel = new TableLayoutPanel();
            tlpMainTagsPanel.Dock        = DockStyle.Fill;
            tlpMainTagsPanel.ColumnCount = 1;
            tlpMainTagsPanel.RowCount    = 2;
            tlpMainTagsPanel.BackColor   = Screen.PrimaryColor;
            tlpTagsPanel             = new TableLayoutPanel();
            tlpTagsPanel.Dock        = DockStyle.Fill;
            tlpTagsPanel.ColumnCount = 6;
            tlpTagsPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            tlpTagsPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            tlpTagsPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            tlpTagsPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            tlpTagsPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            tlpTagsPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            tlpTagsPanel.BackColor = Color.White;

            tlpTagsPanel.Margin     = new Padding(10, 10, 10, 10);
            tlpTagsPanel.AutoScroll = true;

            Label lblMainTagsTitle = new Label();
            lblMainTagsTitle.Text = "Tags";
            tlpMainTagsPanel.Controls.Add(lblMainTagsTitle, 0, 0);
            tlpMainTagsPanel.SetColumnSpan(lblMainTagsTitle, 2);
            lblMainTagsTitle.Dock   = DockStyle.Fill;
            lblMainTagsTitle.Anchor = AnchorStyles.Left & AnchorStyles.Right;

            DBControlHelper.PopulateWithControls <DBTag, RadioButton>(tlpTagsPanel, DBTag.GetTags(), "Description", "ID");
            foreach (Control c in tlpTagsPanel.Controls)
            {
                if (c is RadioButton)
                {
                    (c as RadioButton).CheckedChanged += Tag_CheckedChanged;
                }
            }
            tlpMainTagsPanel.Controls.Add(tlpTagsPanel, 0, 1);

            TableLayoutPanel tlpCreateTag = new TableLayoutPanel();
            tlpCreateTag.Dock        = DockStyle.Fill;
            tlpCreateTag.BackColor   = Color.White;
            tlpCreateTag.Margin      = new Padding(10, 10, 10, 10);
            tlpCreateTag.ColumnCount = 3;
            tlpCreateTag.RowCount    = 2;
            tlpCreateTag.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
            tlpCreateTag.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpCreateTag.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
            tlpCreateTag.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpCreateTag.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpCreateTag.Padding = new Padding(10, 10, 10, 10);

            Label lblCreateTagPrompt = new Label();
            lblCreateTagPrompt.Text = "Create New Tag";
            tlpCreateTag.Controls.Add(lblCreateTagPrompt, 0, 0);
            tlpCreateTag.SetColumnSpan(lblCreateTagPrompt, 3);
            lblCreateTagPrompt.Dock   = DockStyle.Fill;
            lblCreateTagPrompt.Anchor = AnchorStyles.Left & AnchorStyles.Right;

            Label lblCreateTagNamePrompt = new Label();
            lblCreateTagNamePrompt.Text   = "Tag Name:";
            lblCreateTagNamePrompt.Dock   = DockStyle.None;
            lblCreateTagNamePrompt.Anchor = AnchorStyles.Right;

            txtCreateTagName           = new TextBox();
            txtCreateTagName.Dock      = DockStyle.None;
            txtCreateTagName.Anchor    = AnchorStyles.Left | AnchorStyles.Right;
            txtCreateTagName.MaxLength = DBControlHelper.MaximumTagNameLength;
            tlpCreateTag.Controls.Add(txtCreateTagName, 1, 1);

            Button btnAddTag = new Button();
            btnAddTag.Text      = "Add";
            btnAddTag.Anchor    = AnchorStyles.Left | AnchorStyles.Right;
            btnAddTag.AutoSize  = true;
            btnAddTag.Margin    = new Padding(10, 0, 0, 0);
            btnAddTag.Click    += BtnAddTag_Click;
            btnAddTag.BackColor = DefaultBackColor;
            tlpCreateTag.Controls.Add(btnAddTag, 2, 1);

            TableLayoutPanel tlpEditTag = new TableLayoutPanel();
            tlpEditTag.Dock        = DockStyle.Fill;
            tlpEditTag.BackColor   = Color.White;
            tlpEditTag.Margin      = new Padding(10, 10, 10, 10);
            tlpEditTag.ColumnCount = 4;
            tlpEditTag.RowCount    = 2;
            tlpEditTag.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
            tlpEditTag.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40F));
            tlpEditTag.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            tlpEditTag.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            tlpEditTag.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpEditTag.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpEditTag.Padding = new Padding(10, 10, 10, 10);

            Label lblEditTagPrompt = new Label();
            lblEditTagPrompt.Text = "Edit Selected Tag";
            tlpEditTag.Controls.Add(lblEditTagPrompt, 0, 0);
            tlpEditTag.SetColumnSpan(lblEditTagPrompt, 4);
            lblEditTagPrompt.Dock   = DockStyle.Fill;
            lblEditTagPrompt.Anchor = AnchorStyles.Left & AnchorStyles.Right;

            Label lblEditTagNamePrompt = new Label();
            lblEditTagNamePrompt.Text   = "Tag Name:";
            lblEditTagNamePrompt.Dock   = DockStyle.None;
            lblEditTagNamePrompt.Anchor = AnchorStyles.Right;

            txtEditTagName           = new TextBox();
            txtEditTagName.Dock      = DockStyle.None;
            txtEditTagName.Anchor    = AnchorStyles.Left | AnchorStyles.Right;
            txtEditTagName.MaxLength = DBControlHelper.MaximumTagNameLength;
            tlpEditTag.Controls.Add(txtEditTagName, 1, 1);

            btnUpdateTag           = new Button();
            btnUpdateTag.Text      = "Update";
            btnUpdateTag.Anchor    = AnchorStyles.Left | AnchorStyles.Right;
            btnUpdateTag.AutoSize  = true;
            btnUpdateTag.Margin    = new Padding(10, 0, 0, 0);
            btnUpdateTag.Click    += BtnUpdateTag_Click;
            btnUpdateTag.BackColor = DefaultBackColor;
            tlpEditTag.Controls.Add(btnUpdateTag, 2, 1);

            Button btnDeactivateTag = new Button();
            btnDeactivateTag.Text      = "Deactivate";
            btnDeactivateTag.Anchor    = AnchorStyles.Left | AnchorStyles.Right;
            btnDeactivateTag.AutoSize  = true;
            btnDeactivateTag.BackColor = DefaultBackColor;
            btnDeactivateTag.Click    += BtnDeactivateTag_Click;
            tlpEditTag.Controls.Add(btnDeactivateTag, 3, 1);

            tlpCreateTag.Controls.Add(lblCreateTagNamePrompt, 0, 1);
            tlpEditTag.Controls.Add(lblEditTagNamePrompt, 0, 1);

            this.Controls.Add(tlpMainTagsPanel, 0, 0);
            this.SetColumnSpan(tlpMainTagsPanel, 2);
            this.Controls.Add(tlpCreateTag, 0, 1);
            this.Controls.Add(tlpEditTag, 1, 1);
            #endregion

            this.SetFontSizes(this.Controls);
        }
コード例 #17
0
        private void ShowItems()
        {
            if (rbnBook.Checked)
            {
                try
                {
                    BindingList <DBBook> filteredBooks = DBControlHelper.GetFilteredItems(this.books, this.txtSearch.Text, DBControlHelper.GetValuesFromCheckedControls(this.tlpTagSelection));
                    this.dgvItems.DataSource        = filteredBooks;
                    this.cbxSelectedItem.DataSource = filteredBooks;

                    //Setup combobox
                    this.cbxSelectedItem.DisplayMember = "ComboBoxDisplay";
                    this.cbxSelectedItem.ValueMember   = "BookID";

                    //Setup datagridview
                    this.dgvItems.Columns["BookID"].HeaderText        = "Book ID";
                    this.dgvItems.Columns["GenreName"].HeaderText     = "Genre";
                    this.dgvItems.Columns["PublishDate"].HeaderText   = "Publish Date";
                    this.dgvItems.Columns["ConditionType"].HeaderText = "Condition";
                    this.dgvItems.Columns["ComboBoxDisplay"].Visible  = false;
                    this.dgvItems.Columns["ShowDiscount"].Visible     = false;
                    this.lblSearchByTitlePrompt.Text = "Search by Title:";
                }
                catch (Exception ex)
                {
                    (this.Parent.Parent as MasterForm).SetStatus("Failed to show books: " + ex.Message);
                }
            }
            else if (rbnMap.Checked)
            {
                try
                {
                    BindingList <DBMap> filteredMaps = DBControlHelper.GetFilteredItems(this.maps, this.txtSearch.Text, DBControlHelper.GetValuesFromCheckedControls(this.tlpTagSelection));
                    this.dgvItems.DataSource        = filteredMaps;
                    this.cbxSelectedItem.DataSource = filteredMaps;

                    //Setup combobox
                    this.cbxSelectedItem.DisplayMember = "ComboBoxDisplay";
                    this.cbxSelectedItem.ValueMember   = "MapID";

                    //Setup datagridview
                    this.dgvItems.Columns["MapID"].HeaderText         = "Map ID";
                    this.dgvItems.Columns["ConditionType"].HeaderText = "Condition";
                    this.dgvItems.Columns["ComboBoxDisplay"].Visible  = false;
                    this.dgvItems.Columns["ShowDiscount"].Visible     = false;
                    this.lblSearchByTitlePrompt.Text = "Search by Location:";
                }
                catch (Exception ex)
                {
                    (this.Parent.Parent as MasterForm).SetStatus("Failed to show maps: " + ex.Message);
                }
            }
            else if (rbnPeriodical.Checked)
            {
                try
                {
                    BindingList <DBPeriodical> filteredPeriodicals = DBControlHelper.GetFilteredItems(this.periodicals, this.txtSearch.Text, DBControlHelper.GetValuesFromCheckedControls(this.tlpTagSelection));
                    this.dgvItems.DataSource        = filteredPeriodicals;
                    this.cbxSelectedItem.DataSource = filteredPeriodicals;

                    //Setup datagridview
                    this.dgvItems.Columns["PeriodicalID"].HeaderText  = "Periodical ID";
                    this.dgvItems.Columns["ConditionType"].HeaderText = "Condition";
                    this.dgvItems.Columns["GenreName"].HeaderText     = "Genre";
                    this.dgvItems.Columns["CompanyName"].HeaderText   = "Company";
                    this.dgvItems.Columns["PublishDate"].HeaderText   = "Publish Date";
                    this.dgvItems.Columns["ComboBoxDisplay"].Visible  = false;
                    this.dgvItems.Columns["ShowDiscount"].Visible     = false;
                    this.lblSearchByTitlePrompt.Text = "Search by Title:";

                    //Setup combobox
                    this.cbxSelectedItem.DisplayMember = "ComboBoxDisplay";
                    this.cbxSelectedItem.ValueMember   = "PeriodicalID";
                }
                catch (Exception ex)
                {
                    (this.Parent.Parent as MasterForm).SetStatus("Failed to show periodicals: " + ex.Message);
                }
            }
        }
コード例 #18
0
        public UpdateItemScreen(Screen backScreen) : base("Update Item", backScreen, 1, 2)
        {
            this.tlpForm                = new System.Windows.Forms.TableLayoutPanel();
            this.tlpConditionPanel      = new System.Windows.Forms.TableLayoutPanel();
            this.tkbCondition           = new System.Windows.Forms.TrackBar();
            this.lblMinCondition        = new System.Windows.Forms.Label();
            this.lblMaxCondition        = new System.Windows.Forms.Label();
            this.lblSelectedCondition   = new System.Windows.Forms.Label();
            this.tlpTags                = new System.Windows.Forms.TableLayoutPanel();
            this.lblTagsPrompt          = new System.Windows.Forms.Label();
            this.tlpTagSelection        = new System.Windows.Forms.TableLayoutPanel();
            this.lblPricePrompt         = new System.Windows.Forms.Label();
            this.nudPrice               = new System.Windows.Forms.NumericUpDown();
            this.lblQuantityPrompt      = new System.Windows.Forms.Label();
            this.nudQuantity            = new System.Windows.Forms.NumericUpDown();
            this.lblItemTypePrompt      = new System.Windows.Forms.Label();
            this.cbxItemType            = new System.Windows.Forms.ComboBox();
            this.lblItemIdPrompt        = new System.Windows.Forms.Label();
            this.nudItemID              = new System.Windows.Forms.NumericUpDown();
            this.lblFormTitle           = new System.Windows.Forms.Label();
            this.lblConditionPrompt     = new System.Windows.Forms.Label();
            this.lblPublishDatePrompt   = new System.Windows.Forms.Label();
            this.dtpPublishDate         = new System.Windows.Forms.DateTimePicker();
            this.tlpDiscountPanel       = new System.Windows.Forms.TableLayoutPanel();
            this.lblDateFrom            = new System.Windows.Forms.Label();
            this.dtpDiscountFrom        = new System.Windows.Forms.DateTimePicker();
            this.lblDateTo              = new System.Windows.Forms.Label();
            this.dtpDiscountTo          = new System.Windows.Forms.DateTimePicker();
            this.chkSetupDiscountTitle  = new System.Windows.Forms.CheckBox();
            this.btnEndDiscount         = new System.Windows.Forms.Button();
            this.lblDiscountPricePrompt = new System.Windows.Forms.Label();
            this.nudDiscountPrice       = new System.Windows.Forms.NumericUpDown();
            this.tlpButtons             = new System.Windows.Forms.TableLayoutPanel();
            this.btnDeactivate          = new System.Windows.Forms.Button();
            this.btnUpdate              = new System.Windows.Forms.Button();
            this.nudEdition             = new NumericUpDown();
            this.lblEditionPrompt       = new Label();

            //
            // tlpForm
            //
            this.tlpForm.BackColor   = System.Drawing.Color.White;
            this.tlpForm.ColumnCount = 7;
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 22.52252F));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.AutoSize));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5F));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
            this.tlpForm.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 22.52252F));
            this.tlpForm.Controls.Add(this.tlpConditionPanel, 2, 7);
            this.tlpForm.Controls.Add(this.tlpTags, 1, 8);
            this.tlpForm.Controls.Add(this.lblPricePrompt, 1, 4);
            this.tlpForm.Controls.Add(this.nudPrice, 2, 4);
            this.tlpForm.Controls.Add(this.lblQuantityPrompt, 1, 3);
            this.tlpForm.Controls.Add(this.nudQuantity, 2, 3);
            this.tlpForm.Controls.Add(this.lblItemTypePrompt, 1, 2);
            this.tlpForm.Controls.Add(this.cbxItemType, 2, 2);
            this.tlpForm.Controls.Add(this.lblItemIdPrompt, 1, 1);
            this.tlpForm.Controls.Add(this.nudItemID, 2, 1);
            this.tlpForm.Controls.Add(this.lblFormTitle, 0, 0);
            this.tlpForm.Controls.Add(this.lblConditionPrompt, 1, 7);
            this.tlpForm.Controls.Add(this.lblPublishDatePrompt, 1, 6);
            this.tlpForm.Controls.Add(this.dtpPublishDate, 2, 6);
            this.tlpForm.Controls.Add(this.nudEdition, 2, 5);
            this.tlpForm.Controls.Add(this.lblEditionPrompt, 1, 5);
            this.tlpForm.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpForm.RowCount = 9;
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.737864F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.737864F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.737864F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.737864F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.737864F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.737864F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.737864F));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpForm.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 38.83496F));
            this.tlpForm.TabIndex = 0;

            //Book
            this.lblTitlePrompt                = new System.Windows.Forms.Label();
            this.lblTitlePrompt.Anchor         = System.Windows.Forms.AnchorStyles.Right;
            this.lblTitlePrompt.AutoSize       = true;
            this.lblTitlePrompt.TabIndex       = 6;
            this.lblTitlePrompt.Text           = "Title:";
            this.lblAuthorFirstPrompt          = new System.Windows.Forms.Label();
            this.lblAuthorFirstPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblAuthorFirstPrompt.AutoSize = true;
            this.lblAuthorFirstPrompt.TabIndex = 7;
            this.lblAuthorFirstPrompt.Text     = "Author First:";
            this.lblAuthorLastPrompt           = new System.Windows.Forms.Label();
            this.lblAuthorLastPrompt.Anchor    = System.Windows.Forms.AnchorStyles.Right;
            this.lblAuthorLastPrompt.AutoSize  = true;
            this.lblAuthorLastPrompt.TabIndex  = 7;
            this.lblAuthorLastPrompt.Text      = "Author Last:";
            this.lblPublisherPrompt            = new System.Windows.Forms.Label();
            this.lblPublisherPrompt.Anchor     = System.Windows.Forms.AnchorStyles.Right;
            this.lblPublisherPrompt.AutoSize   = true;
            this.lblPublisherPrompt.TabIndex   = 8;
            this.lblPublisherPrompt.Text       = "Publisher:";
            this.lblGenrePrompt                = new System.Windows.Forms.Label();
            this.lblGenrePrompt.Anchor         = System.Windows.Forms.AnchorStyles.Right;
            this.lblGenrePrompt.AutoSize       = true;
            this.lblGenrePrompt.TabIndex       = 9;
            this.lblGenrePrompt.Text           = "Genre:";
            this.txtTitle                   = new System.Windows.Forms.TextBox();
            this.txtTitle.Anchor            = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtTitle.TabIndex          = 13;
            this.txtTitle.MaxLength         = DBControlHelper.MaximumTitleLength;
            this.txtAuthorFirst             = new System.Windows.Forms.TextBox();
            this.txtAuthorFirst.Anchor      = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtAuthorFirst.TabIndex    = 14;
            this.txtAuthorFirst.MaxLength   = DBControlHelper.MaximumFirstNameLength;
            this.txtAuthorLast              = new System.Windows.Forms.TextBox();
            this.txtAuthorLast.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtAuthorLast.TabIndex     = 14;
            this.txtAuthorLast.MaxLength    = DBControlHelper.MaximumLastNameLength;
            this.txtPublisher               = new System.Windows.Forms.TextBox();
            this.txtPublisher.Anchor        = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtPublisher.TabIndex      = 15;
            this.txtPublisher.MaxLength     = DBControlHelper.MaximumPublisherLength;
            this.cbxGenre                   = new System.Windows.Forms.ComboBox();
            this.cbxGenre.Anchor            = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.cbxGenre.FormattingEnabled = true;
            this.cbxGenre.TabIndex          = 16;
            this.cbxGenre.DataSource        = this.genres;
            this.cbxGenre.ValueMember       = "ID";
            this.cbxGenre.DisplayMember     = "Name";
            this.cbxGenre.DropDownStyle     = ComboBoxStyle.DropDownList;
            this.tlpForm.Controls.Add(this.txtTitle, 5, 1);
            this.tlpForm.Controls.Add(this.txtAuthorFirst, 5, 2);
            this.tlpForm.Controls.Add(this.txtAuthorLast, 5, 3);
            this.tlpForm.Controls.Add(this.txtPublisher, 5, 4);
            this.tlpForm.Controls.Add(this.cbxGenre, 5, 5);
            this.tlpForm.Controls.Add(this.lblGenrePrompt, 4, 5);
            this.tlpForm.Controls.Add(this.lblPublisherPrompt, 4, 4);
            this.tlpForm.Controls.Add(this.lblAuthorFirstPrompt, 4, 2);
            this.tlpForm.Controls.Add(this.lblAuthorLastPrompt, 4, 3);
            this.tlpForm.Controls.Add(this.lblTitlePrompt, 4, 1);

            //Map
            this.lblLocationPrompt          = new Label();
            this.lblLocationPrompt.AutoSize = true;
            this.lblLocationPrompt.Text     = "Location:";
            this.lblLocationPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblLocationPrompt.Visible  = false;
            this.txtLocation            = new TextBox();
            this.txtLocation.Anchor     = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtLocation.Visible    = false;
            this.txtLocation.MaxLength  = DBControlHelper.MaximumLocationLength;
            this.lblYearPrompt          = new Label();
            this.lblYearPrompt.AutoSize = true;
            this.lblYearPrompt.Text     = "Year:";
            this.lblYearPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblYearPrompt.Visible  = false;
            this.nudYear         = new NumericUpDown();
            this.nudYear.Anchor  = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.nudYear.Visible = false;
            this.nudYear.Minimum = 1200;
            this.nudYear.Maximum = DateTime.Now.Year;
            this.tlpForm.Controls.Add(this.lblLocationPrompt, 4, 1);
            this.tlpForm.Controls.Add(this.txtLocation, 5, 1);
            this.tlpForm.Controls.Add(this.lblYearPrompt, 4, 2);
            this.tlpForm.Controls.Add(this.nudYear, 5, 2);

            //Periodical
            this.lblCompanyNamePrompt          = new Label();
            this.lblCompanyNamePrompt.AutoSize = true;
            this.lblCompanyNamePrompt.Text     = "Company Name:";
            this.lblCompanyNamePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblCompanyNamePrompt.Visible  = false;
            this.txtCompanyName           = new TextBox();
            this.txtCompanyName.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.txtCompanyName.Visible   = false;
            this.txtCompanyName.MaxLength = DBControlHelper.MaximumCompanyNameLength;
            this.tlpForm.Controls.Add(this.lblCompanyNamePrompt, 4, 1);
            this.tlpForm.Controls.Add(this.txtCompanyName, 5, 1);

            //lblEditionPrompt
            this.lblEditionPrompt.Text     = "Edition:";
            this.lblEditionPrompt.Anchor   = AnchorStyles.Right;
            this.lblEditionPrompt.AutoSize = true;

            //nudEdition
            this.nudEdition.Value  = 1;
            this.nudEdition.Anchor = AnchorStyles.Left | AnchorStyles.Right;

            //
            // tlpConditionPanel
            //
            this.tlpConditionPanel.ColumnCount = 2;
            this.tlpForm.SetColumnSpan(this.tlpConditionPanel, 4);
            this.tlpConditionPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tlpConditionPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tlpConditionPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.tlpConditionPanel.Controls.Add(this.tkbCondition, 0, 1);
            this.tlpConditionPanel.Controls.Add(this.lblMinCondition, 0, 2);
            this.tlpConditionPanel.Controls.Add(this.lblMaxCondition, 1, 2);
            this.tlpConditionPanel.Controls.Add(this.lblSelectedCondition, 0, 0);
            this.tlpConditionPanel.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpConditionPanel.RowCount = 3;
            this.tlpConditionPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpConditionPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpConditionPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            this.tlpConditionPanel.TabIndex = 18;
            this.tlpConditionPanel.AutoSize = true;
            //
            // tkbCondition
            //
            this.tkbCondition.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.tlpConditionPanel.SetColumnSpan(this.tkbCondition, 3);
            this.tkbCondition.TabIndex      = 17;
            this.tkbCondition.Value         = 5;
            this.tkbCondition.Minimum       = 1;
            this.tkbCondition.Maximum       = this.conditions.Count;
            this.tkbCondition.Value         = (int)Math.Round((double)((this.conditions.Count - 1) / 2));
            this.tkbCondition.ValueChanged += TkbCondition_ValueChanged;
            //
            // lblMinCondition
            //
            this.lblMinCondition.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblMinCondition.AutoSize  = true;
            this.lblMinCondition.TabIndex  = 18;
            this.lblMinCondition.Text      = this.conditions.First().Type;
            this.lblMinCondition.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            //
            // lblMaxCondition
            //
            this.lblMaxCondition.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblMaxCondition.AutoSize  = true;
            this.lblMaxCondition.TabIndex  = 19;
            this.lblMaxCondition.Text      = this.conditions.Last().Type;
            this.lblMaxCondition.TextAlign = System.Drawing.ContentAlignment.TopRight;
            //
            // lblSelectedCondition
            //
            this.lblSelectedCondition.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblSelectedCondition.AutoSize = true;
            this.tlpConditionPanel.SetColumnSpan(this.lblSelectedCondition, 3);
            this.lblSelectedCondition.TabIndex  = 20;
            this.lblSelectedCondition.Text      = this.conditions[tkbCondition.Value - 1].Type;
            this.lblSelectedCondition.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            //
            // tlpTags
            //
            this.tlpTags.BackColor   = Screen.PrimaryColor;
            this.tlpTags.ColumnCount = 1;
            this.tlpForm.SetColumnSpan(this.tlpTags, 5);
            this.tlpTags.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tlpTags.Controls.Add(this.lblTagsPrompt, 0, 0);
            this.tlpTags.Controls.Add(this.tlpTagSelection, 0, 1);
            this.tlpTags.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpTags.RowCount = 2;
            this.tlpTags.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpTags.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.tlpTags.TabIndex = 20;
            //
            // lblTagsPrompt
            //
            this.lblTagsPrompt.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblTagsPrompt.AutoSize  = true;
            this.lblTagsPrompt.TabIndex  = 0;
            this.lblTagsPrompt.Text      = "Tags";
            this.lblTagsPrompt.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            //
            // pnlTagSelection
            //
            this.tlpTagSelection.AutoScroll  = true;
            this.tlpTagSelection.BackColor   = System.Drawing.Color.White;
            this.tlpTagSelection.Dock        = System.Windows.Forms.DockStyle.Fill;
            this.tlpTagSelection.TabIndex    = 1;
            this.tlpTagSelection.ColumnCount = 3;
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            this.tlpTagSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.8F));
            this.tlpTagSelection.HorizontalScroll.Enabled = false;
            DBControlHelper.PopulateWithControls <DBTag, CheckBox>(this.tlpTagSelection, DBTag.GetTags(), "Description", "ID");
            //
            // lblPricePrompt
            //
            this.lblPricePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblPricePrompt.AutoSize = true;
            this.lblPricePrompt.TabIndex = 3;
            this.lblPricePrompt.Text     = "Price:";
            //
            // nudPrice
            //
            this.nudPrice.Anchor             = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.nudPrice.DecimalPlaces      = 2;
            this.nudPrice.TabIndex           = 12;
            this.nudPrice.ThousandsSeparator = true;
            //
            // lblQuantityPrompt
            //
            this.lblQuantityPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblQuantityPrompt.AutoSize = true;
            this.lblQuantityPrompt.TabIndex = 2;
            this.lblQuantityPrompt.Text     = "Quantity:";
            //
            // nudQuantity
            //
            this.nudQuantity.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.nudQuantity.TabIndex = 11;
            //
            // lblItemTypePrompt
            //
            this.lblItemTypePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblItemTypePrompt.AutoSize = true;
            this.lblItemTypePrompt.TabIndex = 0;
            this.lblItemTypePrompt.Text     = "Type:";
            //
            // cbxItemType
            //
            this.cbxItemType.Anchor                = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.cbxItemType.FormattingEnabled     = true;
            this.cbxItemType.TabIndex              = 1;
            this.cbxItemType.DataSource            = itemTypes;
            this.cbxItemType.ValueMember           = "ID";
            this.cbxItemType.DisplayMember         = "Name";
            this.cbxItemType.Enabled               = false;
            this.cbxItemType.DropDownStyle         = ComboBoxStyle.DropDownList;
            this.cbxItemType.SelectedValueChanged += CbxItemType_SelectedValueChanged;
            //
            // lblGenrePrompt
            //
            this.lblGenrePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblGenrePrompt.AutoSize = true;
            this.lblGenrePrompt.TabIndex = 9;
            this.lblGenrePrompt.Text     = "Genre:";
            //
            // lblItemIdPrompt
            //
            this.lblItemIdPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblItemIdPrompt.AutoSize = true;
            this.lblItemIdPrompt.TabIndex = 21;
            this.lblItemIdPrompt.Text     = "Item ID:";
            //
            // lblItemId
            //
            this.nudItemID.Anchor        = System.Windows.Forms.AnchorStyles.Left;
            this.nudItemID.AutoSize      = true;
            this.nudItemID.TabIndex      = 22;
            this.nudItemID.Value         = 1;
            this.nudItemID.Minimum       = 1;
            this.nudItemID.ValueChanged += NudItemID_ValueChanged;
            //
            // lblFormTitle
            //
            this.lblFormTitle.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblFormTitle.AutoSize = true;
            this.tlpForm.SetColumnSpan(this.lblFormTitle, 7);
            this.lblFormTitle.TabIndex  = 10;
            this.lblFormTitle.Text      = "Basic Information";
            this.lblFormTitle.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.lblFormTitle.BackColor = Screen.PrimaryColor;
            //
            // lblConditionPrompt
            //
            this.lblConditionPrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblConditionPrompt.AutoSize = true;
            this.lblConditionPrompt.TabIndex = 4;
            this.lblConditionPrompt.Text     = "Condition:";
            //
            // lblPublishDatePrompt
            //
            this.lblPublishDatePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblPublishDatePrompt.AutoSize = true;
            this.lblPublishDatePrompt.TabIndex = 5;
            this.lblPublishDatePrompt.Text     = "Publish Date:";
            //
            // dtpPublishDate
            //
            this.dtpPublishDate.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.dtpPublishDate.TabIndex = 19;
            //
            // panel
            //
            this.BackColor   = System.Drawing.Color.Transparent;
            this.ColumnCount = 1;
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            this.Controls.Add(this.tlpForm, 0, 0);
            this.Controls.Add(this.tlpDiscountPanel, 0, 1);
            this.Controls.Add(this.tlpButtons, 0, 2);
            this.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.RowCount = 3;
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 72.72727F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 18.18182F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.090909F));
            this.TabIndex       = 0;
            this.ParentChanged += UpdateItemScreen_ParentChanged;
            //this.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            //
            // tlpDiscountPanel
            //
            this.tlpDiscountPanel.BackColor   = System.Drawing.Color.White;
            this.tlpDiscountPanel.ColumnCount = 5;
            this.tlpDiscountPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 31.57895F));
            this.tlpDiscountPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 21.05263F));
            this.tlpDiscountPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.tlpDiscountPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 21.05263F));
            this.tlpDiscountPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 26.31579F));
            this.tlpDiscountPanel.Controls.Add(this.lblDateFrom, 0, 2);
            this.tlpDiscountPanel.Controls.Add(this.dtpDiscountFrom, 1, 2);
            this.tlpDiscountPanel.Controls.Add(this.lblDateTo, 2, 2);
            this.tlpDiscountPanel.Controls.Add(this.dtpDiscountTo, 3, 2);
            this.tlpDiscountPanel.Controls.Add(this.chkSetupDiscountTitle, 0, 0);
            this.tlpDiscountPanel.Controls.Add(this.btnEndDiscount, 4, 2);
            this.tlpDiscountPanel.Controls.Add(this.lblDiscountPricePrompt, 0, 1);
            this.tlpDiscountPanel.Controls.Add(this.nudDiscountPrice, 1, 1);
            this.tlpDiscountPanel.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpDiscountPanel.RowCount = 3;
            this.tlpDiscountPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
            this.tlpDiscountPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpDiscountPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpDiscountPanel.TabIndex = 2;
            //
            // lblDateFrom
            //
            this.lblDateFrom.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblDateFrom.AutoSize = true;
            this.lblDateFrom.TabIndex = 2;
            this.lblDateFrom.Text     = "From";
            //
            // dtpDiscountFrom
            //
            this.dtpDiscountFrom.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.dtpDiscountFrom.TabIndex = 20;
            //
            // lblDateTo
            //
            this.lblDateTo.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.lblDateTo.AutoSize  = true;
            this.lblDateTo.TabIndex  = 21;
            this.lblDateTo.Text      = "to";
            this.lblDateTo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            //
            // dtpDiscountTo
            //
            this.dtpDiscountTo.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.dtpDiscountTo.TabIndex = 22;
            //
            // lblSetupDiscountTitle
            //
            //this.chkSetupDiscountTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.chkSetupDiscountTitle.Dock     = DockStyle.None;
            this.chkSetupDiscountTitle.Anchor   = AnchorStyles.None;
            this.chkSetupDiscountTitle.AutoSize = true;
            this.tlpDiscountPanel.SetColumnSpan(this.chkSetupDiscountTitle, 6);
            this.chkSetupDiscountTitle.TabIndex        = 0;
            this.chkSetupDiscountTitle.Text            = "Setup Discount";
            this.chkSetupDiscountTitle.TextAlign       = System.Drawing.ContentAlignment.BottomCenter;
            this.chkSetupDiscountTitle.BackColor       = Screen.PrimaryColor;
            this.chkSetupDiscountTitle.CheckAlign      = System.Drawing.ContentAlignment.MiddleRight;
            this.chkSetupDiscountTitle.Checked         = true;
            this.chkSetupDiscountTitle.CheckedChanged += ChkSetupDiscountTitle_CheckedChanged;
            //
            // btnEndDiscount
            //
            this.btnEndDiscount.Anchor    = System.Windows.Forms.AnchorStyles.Left;
            this.btnEndDiscount.AutoSize  = true;
            this.btnEndDiscount.BackColor = System.Drawing.SystemColors.Control;
            this.btnEndDiscount.TabIndex  = 24;
            this.btnEndDiscount.Text      = "End Prematurely";
            this.btnEndDiscount.UseVisualStyleBackColor = false;
            this.btnEndDiscount.Click += BtnEndDiscount_Click;
            //
            // lblDiscountPricePrompt
            //
            this.lblDiscountPricePrompt.Anchor   = System.Windows.Forms.AnchorStyles.Right;
            this.lblDiscountPricePrompt.AutoSize = true;
            this.lblDiscountPricePrompt.TabIndex = 1;
            this.lblDiscountPricePrompt.Text     = "Discount Price:";
            //
            // nudDiscountPrice
            //
            this.nudDiscountPrice.Anchor             = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            this.nudDiscountPrice.DecimalPlaces      = 2;
            this.nudDiscountPrice.TabIndex           = 23;
            this.nudDiscountPrice.ThousandsSeparator = true;
            //
            // tlpButtons
            //
            this.tlpButtons.ColumnCount = 2;
            this.tlpButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpButtons.Controls.Add(this.btnDeactivate, 1, 0);
            this.tlpButtons.Controls.Add(this.btnUpdate, 0, 0);
            this.tlpButtons.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.tlpButtons.RowCount = 1;
            this.tlpButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpButtons.TabIndex = 3;
            //
            // btnRemoveFromInventory
            //
            this.btnDeactivate.Anchor    = System.Windows.Forms.AnchorStyles.Left;
            this.btnDeactivate.AutoSize  = true;
            this.btnDeactivate.BackColor = System.Drawing.SystemColors.Control;
            this.btnDeactivate.TabIndex  = 1;
            this.btnDeactivate.Text      = "Deactivate";
            this.btnDeactivate.UseVisualStyleBackColor = false;
            this.btnDeactivate.Size   = new System.Drawing.Size(250, 33);
            this.btnDeactivate.Click += BtnDeactivate_Click;
            //
            // btnUpdate
            //
            this.btnUpdate.Anchor    = System.Windows.Forms.AnchorStyles.Right;
            this.btnUpdate.AutoSize  = true;
            this.btnUpdate.BackColor = System.Drawing.SystemColors.Control;
            this.btnUpdate.Size      = new System.Drawing.Size(250, 33);
            this.btnUpdate.TabIndex  = 0;
            this.btnUpdate.Text      = "Update";
            this.btnUpdate.UseVisualStyleBackColor = false;
            this.btnUpdate.Click += BtnUpdate_Click;

            this.SetFontSizes(this.Controls);
        }
コード例 #19
0
        public AddCollectorScreen(Screen backScreen) : base("Add Collector", backScreen, 1, 2, 3)
        {
            #region Init Screen
            this.Dock        = DockStyle.Fill;
            this.ColumnCount = 1;
            this.RowCount    = 3;
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 45F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
            this.ParentChanged += AddCollectorScreen_ParentChanged;
            #endregion

            #region Collector Panel
            TableLayoutPanel tlpCollector = new TableLayoutPanel();
            tlpCollector.Dock        = DockStyle.Fill;
            tlpCollector.BackColor   = Color.White;
            tlpCollector.Margin      = new Padding(0, 10, 0, 20);
            tlpCollector.ColumnCount = 2;
            tlpCollector.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 45F));
            tlpCollector.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 55F));
            tlpCollector.RowCount = 8;
            tlpCollector.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
            tlpCollector.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
            tlpCollector.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
            tlpCollector.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
            tlpCollector.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
            tlpCollector.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
            tlpCollector.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));

            Label lblFirstNamePrompt = new Label();
            lblFirstNamePrompt.Text      = "First Name:";
            lblFirstNamePrompt.Dock      = DockStyle.None;
            lblFirstNamePrompt.Anchor    = AnchorStyles.Right;
            lblFirstNamePrompt.TextAlign = ContentAlignment.MiddleRight;
            lblFirstNamePrompt.AutoSize  = true;
            //lblFirstNamePrompt.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            tlpCollector.Controls.Add(lblFirstNamePrompt, 0, 1);

            txtFirstNameInput        = new TextBox();
            txtFirstNameInput.Anchor = AnchorStyles.Left;
            //txtFirstNameInput.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtFirstNameInput.Width     = 150;
            txtFirstNameInput.MaxLength = DBControlHelper.MaximumFirstNameLength;
            tlpCollector.Controls.Add(txtFirstNameInput, 1, 1);

            Label lblLastNamePrompt = new Label();
            lblLastNamePrompt.Text      = "Last Name:";
            lblLastNamePrompt.Dock      = DockStyle.None;
            lblLastNamePrompt.Anchor    = AnchorStyles.Right;
            lblLastNamePrompt.TextAlign = ContentAlignment.MiddleRight;
            lblLastNamePrompt.AutoSize  = true;
            //lblLastNamePrompt.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            tlpCollector.Controls.Add(lblLastNamePrompt, 0, 2);

            txtLastNameInput        = new TextBox();
            txtLastNameInput.Anchor = AnchorStyles.Left;
            //txtLastNameInput.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            txtLastNameInput.Width     = 150;
            txtLastNameInput.MaxLength = DBControlHelper.MaximumLastNameLength;
            tlpCollector.Controls.Add(txtLastNameInput, 1, 2);

            Label lblPhoneNumberPrompt = new Label();
            lblPhoneNumberPrompt.Text      = "Phone Number:";
            lblPhoneNumberPrompt.Dock      = DockStyle.None;
            lblPhoneNumberPrompt.Anchor    = AnchorStyles.Right;
            lblPhoneNumberPrompt.TextAlign = ContentAlignment.MiddleRight;
            lblPhoneNumberPrompt.AutoSize  = true;
            //lblPhoneNumberPrompt.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            tlpCollector.Controls.Add(lblPhoneNumberPrompt, 0, 3);

            mtxtPhoneNumberInput                = new MaskedTextBox();
            mtxtPhoneNumberInput.Anchor         = AnchorStyles.Left;
            mtxtPhoneNumberInput.Width          = 150;
            mtxtPhoneNumberInput.Mask           = "(000) 000-0000";
            mtxtPhoneNumberInput.TabIndex       = 5;
            mtxtPhoneNumberInput.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
            //mtxtPhoneNumberInput.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            tlpCollector.Controls.Add(mtxtPhoneNumberInput, 1, 3);

            Label lblTypePrompt = new Label();
            lblTypePrompt.Text      = "Type:";
            lblTypePrompt.Dock      = DockStyle.None;
            lblTypePrompt.Anchor    = AnchorStyles.Right;
            lblTypePrompt.TextAlign = ContentAlignment.MiddleRight;
            lblTypePrompt.AutoSize  = true;
            //lblTypePrompt.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            tlpCollector.Controls.Add(lblTypePrompt, 0, 4);

            cbxTypeInput               = new ComboBox();
            cbxTypeInput.DataSource    = DBCollectorType.GetCollectorTypes();
            cbxTypeInput.DisplayMember = "Name";
            cbxTypeInput.ValueMember   = "ID";
            cbxTypeInput.Anchor        = AnchorStyles.Left;
            //cbxTypeInput.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            cbxTypeInput.Width         = 150;
            cbxTypeInput.DropDownStyle = ComboBoxStyle.DropDownList;
            tlpCollector.Controls.Add(cbxTypeInput, 1, 4);
            #endregion

            #region Interests Panel
            //Holds the "interests" title, and all the different types of tag selections
            TableLayoutPanel tlpInterests = new TableLayoutPanel();
            tlpInterests.Dock = DockStyle.Fill;
            //tlpInterests.BackColor = Color.White;
            tlpInterests.BackColor   = Screen.PrimaryColor;
            tlpInterests.ColumnCount = 3;
            tlpInterests.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3F));
            tlpInterests.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3F));
            tlpInterests.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.3F));
            tlpInterests.RowCount = 2;
            tlpInterests.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            tlpInterests.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            tlpInterests.Margin = new Padding(0, 0, 0, 10);

            //The main title
            Label lblInterestsTitle = new Label();
            lblInterestsTitle.Text = "Interests";
            //lblInterestsTitle.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lblInterestsTitle.Margin    = new Padding(0, 0, 0, 25);
            lblInterestsTitle.Dock      = DockStyle.None;
            lblInterestsTitle.TextAlign = ContentAlignment.MiddleCenter;
            lblInterestsTitle.Anchor    = AnchorStyles.Left | AnchorStyles.Right;


            #region Book Tags Panel
            //The main panel holding both the tags selection and the title
            TableLayoutPanel tlpBookTags = new TableLayoutPanel();
            tlpBookTags.Dock        = DockStyle.Fill;
            tlpBookTags.BackColor   = Color.White;
            tlpBookTags.ColumnCount = 1;
            tlpBookTags.RowCount    = 2;
            tlpBookTags.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            tlpBookTags.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));

            //The title above the tag selection
            Label lblBookTagsTitle = new Label();
            lblBookTagsTitle.Text = "Books";
            //tagsTypeTitle.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lblBookTagsTitle.Dock   = DockStyle.Fill;
            lblBookTagsTitle.Anchor = AnchorStyles.Left & AnchorStyles.Right;

            //The panel holding the tags to select from
            tlpBookTagsSelection             = new TableLayoutPanel();
            tlpBookTagsSelection.Dock        = DockStyle.Fill;
            tlpBookTagsSelection.ColumnCount = 2;
            tlpBookTagsSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpBookTagsSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpBookTagsSelection.BackColor  = Color.White;
            tlpBookTagsSelection.Margin     = new Padding(10, 10, 10, 10);
            tlpBookTagsSelection.AutoScroll = true;

            //Populate the tags selection with test data
            DBControlHelper.PopulateWithControls <DBTag, CheckBox>(tlpBookTagsSelection, tagList, "Description", "ID");

            //Add the controls to the parent panel
            tlpBookTags.Controls.Add(lblBookTagsTitle, 0, 0);
            tlpBookTags.Controls.Add(tlpBookTagsSelection, 0, 1);
            #endregion

            #region Periodicals Tags Panel
            //The main panel holding both the tags selection and the title
            TableLayoutPanel tlpPeriodicalTags = new TableLayoutPanel();
            tlpPeriodicalTags.Dock        = DockStyle.Fill;
            tlpPeriodicalTags.BackColor   = Color.White;
            tlpPeriodicalTags.ColumnCount = 1;
            tlpPeriodicalTags.RowCount    = 2;
            tlpPeriodicalTags.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            tlpPeriodicalTags.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));

            //The title above the tag selection
            Label lblPeriodicalTagsTitle = new Label();
            lblPeriodicalTagsTitle.Text = "Periodicals";
            //tagsPeriodicalTitle.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lblPeriodicalTagsTitle.Dock   = DockStyle.Fill;
            lblPeriodicalTagsTitle.Anchor = AnchorStyles.Left & AnchorStyles.Right;

            //The panel holding the tags to select from
            tlpPeriodicalTagsSelection             = new TableLayoutPanel();
            tlpPeriodicalTagsSelection.Dock        = DockStyle.Fill;
            tlpPeriodicalTagsSelection.ColumnCount = 2;
            tlpPeriodicalTagsSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpPeriodicalTagsSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpPeriodicalTagsSelection.BackColor  = Color.White;
            tlpPeriodicalTagsSelection.Margin     = new Padding(10, 10, 10, 10);
            tlpPeriodicalTagsSelection.AutoScroll = true;

            //Populate the tags selection with test data
            DBControlHelper.PopulateWithControls <DBTag, CheckBox>(tlpPeriodicalTagsSelection, tagList, "Description", "ID");

            //Add the controls to the parent panel
            tlpPeriodicalTags.Controls.Add(lblPeriodicalTagsTitle, 0, 0);
            tlpPeriodicalTags.Controls.Add(tlpPeriodicalTagsSelection, 0, 1);
            #endregion

            #region Maps Tags Panel
            //The main panel holding both the tags selection and the title
            TableLayoutPanel tlpMapTagsPanel = new TableLayoutPanel();
            tlpMapTagsPanel.Dock        = DockStyle.Fill;
            tlpMapTagsPanel.BackColor   = Color.White;
            tlpMapTagsPanel.ColumnCount = 1;
            tlpMapTagsPanel.RowCount    = 2;
            tlpMapTagsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            tlpMapTagsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));

            //The title above the tag selection
            Label lblMapTagsTitle = new Label();
            lblMapTagsTitle.Text = "Maps";
            //tagsMapTitle.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lblMapTagsTitle.Dock   = DockStyle.Fill;
            lblMapTagsTitle.Anchor = AnchorStyles.Left & AnchorStyles.Right;

            //The panel holding the tags to select from
            tlpMapTagsSelection             = new TableLayoutPanel();
            tlpMapTagsSelection.Dock        = DockStyle.Fill;
            tlpMapTagsSelection.ColumnCount = 2;
            tlpMapTagsSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpMapTagsSelection.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpMapTagsSelection.BackColor  = Color.White;
            tlpMapTagsSelection.Margin     = new Padding(10, 10, 10, 10);
            tlpMapTagsSelection.AutoScroll = true;

            //Populate the tags selection with test data
            DBControlHelper.PopulateWithControls <DBTag, CheckBox>(tlpMapTagsSelection, tagList, "Description", "ID");

            //Add the controls to the parent panel
            tlpMapTagsPanel.Controls.Add(lblMapTagsTitle, 0, 0);
            tlpMapTagsPanel.Controls.Add(tlpMapTagsSelection, 0, 1);
            #endregion

            tlpInterests.Controls.Add(lblInterestsTitle, 1, 0);
            //tlpInterests.SetColumnSpan(lblInterestsTitle, 3);
            tlpInterests.Controls.Add(tlpBookTags, 0, 1);
            tlpInterests.Controls.Add(tlpPeriodicalTags, 1, 1);
            tlpInterests.Controls.Add(tlpMapTagsPanel, 2, 1);
            #endregion

            #region Bottom Buttons Panel
            TableLayoutPanel tlpButtons = new TableLayoutPanel();
            tlpButtons.Dock        = DockStyle.Fill;
            tlpButtons.ColumnCount = 1;
            tlpButtons.RowCount    = 1;
            tlpButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));

            btnAdd      = new Button();
            btnAdd.Text = "Add";
            btnAdd.Dock = DockStyle.None;
            //btnAdd.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            btnAdd.Size      = new Size(250, 30);
            btnAdd.Anchor    = AnchorStyles.None;
            btnAdd.BackColor = DefaultBackColor;
            btnAdd.Click    += BtnAdd_Click;

            tlpButtons.Controls.Add(btnAdd, 0, 0);
            #endregion

            this.Controls.Add(tlpCollector, 0, 0);
            this.Controls.Add(tlpInterests, 0, 1);
            this.Controls.Add(tlpButtons, 0, 2);

            this.SetFontSizes(this.Controls);
        }