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)); }
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); } } }