/// <summary> /// 接收从主界面传过来的资产编号, /// 并查出该资产的信息放在相应的控件中 /// </summary> private void load() { DataTable dt = EpMgr.GetOneMostInfo(this.Eqno); if (dt != null) { if (dt.Rows.Count != 0) { this.lblEqNo.Text = dt.Rows[0][0].ToString(); this.cbxType.Text = dt.Rows[0][1].ToString(); this.cbxEqName.Text = dt.Rows[0][2].ToString(); this.txtLable.Text = dt.Rows[0][3].ToString(); this.txtModle.Text = dt.Rows[0][4].ToString(); this.txtPluse.Text = dt.Rows[0][5].ToString(); this.nudNum.Value = decimal.Parse(dt.Rows[0][6].ToString()); this.cbxUnit.Text = dt.Rows[0][7].ToString(); this.txtPrice.Text = dt.Rows[0][8].ToString(); this.txtMaker.Text = dt.Rows[0][9].ToString(); this.dtpBirth.Value = DateTime.Parse(dt.Rows[0][10].ToString()); this.cbxAddType.Text = dt.Rows[0][11].ToString(); this.cbxKeepPlace.Text = dt.Rows[0][12].ToString(); this.cbxKeeper.Text = this._keeper; this.txtUsetime.Text = dt.Rows[0][14].ToString(); this.txtBooker.Text = dt.Rows[0][15].ToString(); this.dtpBookDate.Value = DateTime.Parse(dt.Rows[0][16].ToString()); //将查出来的相片放在图片框内 const int oleTypeStart = 20; const int oleTypeLength = 12; // MessageBox.Show(dt.Rows[0][16]) if (!(dt.Rows[0][17] is DBNull)) { byte[] imageBytes = (byte[])(dt.Rows[0][17]); if (imageBytes == null || imageBytes.Length == 0) { return; } MemoryStream photoStream; string type = System.Text.Encoding.ASCII.GetString(imageBytes, oleTypeStart, oleTypeLength); photoStream = new MemoryStream(imageBytes, 0, imageBytes.Length); this.picPhoto.Image = Image.FromStream(photoStream); } else { this.picPhoto.Image = imageList1.Images[0]; //如果没有图片,就将默认图片放在图片框内 } } } }
/// <summary> /// 加载资产的资料; /// </summary> private void LoadEqInfo() { DataTable dt = EpMgr.GetOneMostInfo(this._eqno); if (dt != null) { this.txtEqNO.Text = dt.Rows[0][0].ToString(); this.txtName.Text = dt.Rows[0][1].ToString(); this.txtType.Text = dt.Rows[0][2].ToString(); this.txtLabel.Text = dt.Rows[0][3].ToString(); this.txtModel.Text = dt.Rows[0][4].ToString(); this.txtPlus.Text = dt.Rows[0][5].ToString(); this.txtMaxNO.Text = this._max.ToString(); this.txtBooker.Text = this._user; } }
/// <summary> /// 初始化将要清理的资产信息 /// </summary> private void load() { DataTable dt = EpMgr.GetOneMostInfo(this._eqno); if (dt != null) { this.lblEqNo.Text = dt.Rows[0][0].ToString(); this.txttype.Text = dt.Rows[0][1].ToString(); this.txtName.Text = dt.Rows[0][2].ToString(); this.txtLable.Text = dt.Rows[0][3].ToString(); this.txtModle.Text = dt.Rows[0][4].ToString(); this.txtPluse.Text = dt.Rows[0][5].ToString(); this.txtTotal.Text = dt.Rows[0][6].ToString(); this.txtUnit.Text = dt.Rows[0][7].ToString(); this.txtPrice.Text = dt.Rows[0][8].ToString(); this.txtMaker.Text = dt.Rows[0][9].ToString(); this.dtpBirth.Value = DateTime.Parse(dt.Rows[0][10].ToString()); this.txtUsetime.Text = dt.Rows[0][14].ToString(); this.txtClear.Text = this._user; this.txtMax.Text = this._max.ToString(); } this.txtCount.Focus(); }