private void BtnDeactivateTag_Click(object sender, EventArgs e) { MasterForm master = (this.Parent.Parent as MasterForm); if (this.txtEditTagName.Tag != null) { if (DBTag.DeactivateTag(Int32.Parse(this.txtEditTagName.Tag.ToString()))) { master.SetStatus("Tag \"" + this.rbSelectedTag.Text + "\" has been deactivated successfully"); this.tlpTagsPanel.Controls.Remove(this.rbSelectedTag); } } else { master.SetStatus("Error! A tag must be selected"); } }
/// <summary> /// Gets a list of tags used data pulled from the database /// </summary> /// <returns>A list of tags</returns> public static BindingList <DBTag> GetTags() { BindingList <DBTag> tags = new BindingList <DBTag>(); string query = "SELECT * FROM tags WHERE isActive = 1 ORDER BY tagDescription ASC"; using (var conn = new SqlConnection(Properties.Settings.Default.Britannicus_DBConnectionString)) { var command = new SqlCommand(query, conn); conn.Open(); var reader = command.ExecuteReader(); while (reader.Read()) { DBTag temp = new DBTag((int)reader["tagID"], (string)reader["tagDescription"]); tags.Add(temp); } } return(tags); }
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); } } }
private void BtnAddTag_Click(object sender, EventArgs e) { MasterForm master = (this.Parent.Parent as MasterForm); try { string tagName = this.txtCreateTagName.Text.Trim(); string status = ""; if (tagExists(tagName)) { status = "A tag with this name already exists." + Environment.NewLine; } else if (String.IsNullOrEmpty(status = DBTag.Validate(tagName))) { object result = DBTag.InsertTag(tagName); if (result != null) { status = "Tag \"" + tagName + "\" has been added successfully" + Environment.NewLine; RadioButton rbTemp = new RadioButton() { Text = tagName, Tag = Int32.Parse(result.ToString()) }; rbTemp.CheckedChanged += Tag_CheckedChanged; this.tlpTagsPanel.Controls.Add(rbTemp); } } master.SetStatus(status); } catch (Exception ex) { master.SetStatus("Error! Failed to add tag: " + ex.Message); } }
private void BtnUpdateTag_Click(object sender, EventArgs e) { MasterForm master = (this.Parent.Parent as MasterForm); string tagName = this.txtEditTagName.Text.Trim(); try { string status = ""; if (this.txtEditTagName.Tag != null) { if (this.tagExists(tagName)) { status += "A tag with this name already exists." + Environment.NewLine; } else if (String.IsNullOrEmpty(status = DBTag.Validate(tagName))) { if (DBTag.UpdateTag(Int32.Parse(this.txtEditTagName.Tag.ToString()), tagName)) { status += "Tag \"" + this.rbSelectedTag.Text + "\" has been updated successfully" + Environment.NewLine; rbSelectedTag.Text = tagName; } } } else { status += "A tag must be selected." + Environment.NewLine; } master.SetStatus(status); } catch (Exception ex) { master.SetStatus("Error! Failed to update tag: " + ex.Message); } }
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); }
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); }
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; } } }
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); }
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); } } }
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(); } }
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); }