private void txtPID_TextChanged(object sender, EventArgs e) { if (this.txtPID.Text == null || this.txtPID.Text.Length <= 0) { return; } else { DocumentInfo info = this.ctl.GetSpecifiedDocumentInfo(this.txtPID.Text); try { this.dateTimePicker1.Value = DateTime.Parse(info.CREATE_DATE); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } this.txtComment.Text = info.COMMENT; this.txtTag.Text = info.TAG_ID; this.txtPosition.Text = string.Format("{0}档案室{1}档案柜{2}层", info.ROOM_ID, info.CABINET_ID, info.FLOOR); DocumentBorrowInfo bInfo = this.ctlBorrow.GetDocumentBorrowInfo(this.txtPID.Text); this.txtBorrower.Text = bInfo.BORROWER_ID; if (this.txtBorrower.Text != null && this.txtBorrower.Text.Length > 0) { this.button1.Text = "归还"; this.borrowORreturn = false; } else { this.button1.Text = "借阅"; this.borrowORreturn = true; } this.txtBorrowComment.Text = bInfo.COMMENT; } }
public DocumentBorrowInfo GetDocumentBorrowInfo(string DOCUMENT_ID) { DocumentBorrowInfo info = new DocumentBorrowInfo(); DataSet ds = null; try { ds = SQLiteHelper.ExecuteDataSet( ConfigManager.GetDBConnectString(ConfigManager.GetCurrentDBType()), sqlSelectGetBorrowInfo, new object[1] { DOCUMENT_ID }); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; info.DOCUMENT_ID = dr["DOCUMENT_ID"].ToString(); info.TAG_ID = dr["TAG_ID"].ToString(); info.COMMENT = dr["COMMENT"].ToString(); info.CREATE_DATE = dr["CREATE_DATE"].ToString(); info.BORROWER_ID = dr["BORROWER_ID"].ToString(); } } } } catch (System.Exception ex) { MessageBox.Show("查询数据库时出现错误:" + ex.Message); } return(info); }