private void SearchBtn_Click(object sender, EventArgs e) { #if true long did = 0; if (!Int64.TryParse(DocIDTB.Text, out did)) return; _info = DocumentInfo.Read(did); #else _info = new DocumentInfo { DocumentID = 818283, ClientName = "Some Client", CaseName = "Legal case file name here", DocType = "SPREADSHEET", DocDescription = "Accounts.xls", CheckedOut = DateTime.Now, CheckoutUser = "******", CheckoutLocation = @"[PBN1XA4625]:[C:\Users\cbrehaut_DEG\AppData\Local\FWBS\OMS\0\PBN1SQL4604\OMSDATA\Documents\799908.1.pdf]", CheckoutUserID = 25 }; #endif propertyGrid1.SelectedObject = _info; UpdateControls(); }
private void ReloadInfo() { if (_info == null || _info.DocumentID <= 0) return; _info = DocumentInfo.Read(_info.DocumentID); propertyGrid1.SelectedObject = _info; UpdateControls(); }
/// <summary> /// Convert an IDataReader instance's contents into a stream of DocumentInfo objects /// </summary> /// <param name="reader">IDataReader instance to convert</param> /// <returns>Enumeration of DocumentInfo</returns> public static IEnumerable<DocumentInfo> FromDataReader(IDataReader reader) { while (reader.Read()) { DocumentInfo res = null; try { if (UserChecks.IsAdmin) res = new UpatableDocumentInfo(); else res = new DocumentInfo(); res.DocumentID = reader.LongValue(0) ?? 0; res.ClientName = reader.StringValue(1); res.CaseName = reader.StringValue(2); res.DocType = reader.StringValue(3); res.DocDescription = reader.StringValue(4); res.CheckedOut = reader.DateTimeValue(5); res.CheckoutUser = reader.StringValue(6); res.CheckoutLocation = reader.StringValue(7); res.CheckoutUserID = reader.IntValue(8); } catch { } if (res == null) yield break; yield return res; } }