private void cboSearchName_SelectedIndexChanged(object sender, EventArgs e) { //search for single leaf by Leaf Name string srchId = cboSearchName.SelectedValue.ToString(); DTO.DocTree dtoLeaf; if (chkRestrictToTreeId.Checked) { dtoLeaf = DAL.get_Leaf_By_LeafId_By_TreeId(srchId, txtTreeId.Text); } else { dtoLeaf = DAL.get_Leaf_By_LeafId(srchId); } if (dtoLeaf.TreeId != null) { //got part/leaf name to edit, fill editable text boxes txtLeafId.Text = dtoLeaf.TreeId.ToString(); if (!string.IsNullOrEmpty(dtoLeaf.LeafViewed)) { chkLeafViewed.Checked = true; } else { chkLeafViewed.Checked = false; } cboLeafCategory.Text = dtoLeaf.LeafCategory; cboLeafSubCat.Text = dtoLeaf.LeafSubCategory; txtLeafLocation.Text = dtoLeaf.LeafLocation; cboLeafType.Text = dtoLeaf.LeafType; txtLeafComment.Text = dtoLeaf.LeafComment; txtLeafName.Text = dtoLeaf.LeafName; lblStat.Text = "NAME search completed. Ready."; } else { lblStat.Text = "Error NAME search, invalid Leaf from DB. Ready."; } }
private void dgvTreeList_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { string viewLeafId = dgvTreeList[12, e.RowIndex].Value.ToString(); editLeaf = DAL.get_Leaf_By_LeafId(viewLeafId); if (!string.IsNullOrEmpty(viewLeafId)) { txtLeafId.Text = editLeaf.LeafId.ToString(); if (!string.IsNullOrEmpty(editLeaf.LeafViewed)) { if (editLeaf.LeafViewed == "false") { chkLeafViewed.Checked = false; } else { chkLeafViewed.Checked = true; } } else { chkLeafViewed.Checked = false; } cboLeafCategory.Text = editLeaf.LeafCategory; cboLeafSubCat.Text = editLeaf.LeafSubCategory; txtLeafLocation.Text = editLeaf.LeafLocation; cboLeafType.Text = editLeaf.LeafType; txtLeafComment.Text = editLeaf.LeafComment; txtLeafName.Text = editLeaf.LeafName; } } catch (Exception ex) { string crap = "yup"; } }