/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { LCustTagBB custTagBB = new LCustTagBB(); vLCustTagData model = new vLCustTagData(); try { model = custTagBB.GetVModel(id); this.id.Text = model.id.ToString(); this.custNo.Text = model.custNo; this.materialNo.Text = model.materialNo; this.bigTagFileId.Text = model.bigTagFileId.ToString(); this.smallTagFileId.Text = model.smallTagFileId.ToString(); } finally { custTagBB.Dispose(); } }
/// <summary> /// 得到一个视图model /// </summary> /// <param name="id">主键值</param> /// <returns>model</returns> public vLCustTagData GetVModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append(@"select id,custNo,materialNo,bigTagFileId,smallTagFileId,isDel,isrtEmpId,isrtDt,updtEmpId,updtDt,custNm, materialDesc,isrtEmpNm,updtEmpNm,bigTagSql,smallTagSql,eachPrintBigTagNum,eachPrintSmallTagNum,unit,units,bigTagId_304, smallTagId_304,bigTagId_316,smallTagId_316,bigTagNm_304,smallTagNm_304,bigTagNm_316,smallTagNm_316 from vLCustTag"); strSql.Append(" where id = @id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int) }; parameters[0].Value = id; vLCustTagData model = new vLCustTagData(); DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { DataRow row = ds.Tables[0].Rows[0]; if (row["id"] != DBNull.Value) { model.id = Convert.ToInt32(row["id"]); } if (row["custNo"] != DBNull.Value) { model.custNo = Convert.ToString(row["custNo"]); } if (row["materialNo"] != DBNull.Value) { model.materialNo = Convert.ToString(row["materialNo"]); } if (row["bigTagFileId"] != DBNull.Value) { model.bigTagFileId = Convert.ToInt32(row["bigTagFileId"]); } if (row["smallTagFileId"] != DBNull.Value) { model.smallTagFileId = Convert.ToInt32(row["smallTagFileId"]); } if (row["isDel"] != DBNull.Value) { model.isDel = Convert.ToBoolean(row["isDel"]); } if (row["isrtEmpId"] != DBNull.Value) { model.isrtEmpId = Convert.ToInt32(row["isrtEmpId"]); } if (row["isrtDt"] != DBNull.Value) { model.isrtDt = Convert.ToString(row["isrtDt"]); } if (row["updtEmpId"] != DBNull.Value) { model.updtEmpId = Convert.ToInt32(row["updtEmpId"]); } if (row["updtDt"] != DBNull.Value) { model.updtDt = Convert.ToString(row["updtDt"]); } if (row["custNm"] != DBNull.Value) { model.custNm = Convert.ToString(row["custNm"]); } if (row["materialDesc"] != DBNull.Value) { model.materialDesc = Convert.ToString(row["materialDesc"]); } if (row["isrtEmpNm"] != DBNull.Value) { model.isrtEmpNm = Convert.ToString(row["isrtEmpNm"]); } if (row["updtEmpNm"] != DBNull.Value) { model.updtEmpNm = Convert.ToString(row["updtEmpNm"]); } if (row["bigTagSql"] != DBNull.Value) { model.bigTagSql = Convert.ToString(row["bigTagSql"]); } if (row["smallTagSql"] != DBNull.Value) { model.smallTagSql = Convert.ToString(row["smallTagSql"]); } if (row["eachPrintBigTagNum"] != DBNull.Value) { model.eachPrintBigTagNum = Convert.ToInt32(row["eachPrintBigTagNum"]); } if (row["eachPrintSmallTagNum"] != DBNull.Value) { model.eachPrintSmallTagNum = Convert.ToInt32(row["eachPrintSmallTagNum"]); } if (row["unit"] != DBNull.Value) { model.unit = Convert.ToString(row["unit"]); } if (row["units"] != DBNull.Value) { model.units = Convert.ToString(row["units"]); } if (row["bigTagId_304"] != DBNull.Value) { model.bigTagId_304 = Convert.ToInt32(row["bigTagId_304"]); } if (row["smallTagId_304"] != DBNull.Value) { model.smallTagId_304 = Convert.ToInt32(row["smallTagId_304"]); } if (row["bigTagId_316"] != DBNull.Value) { model.bigTagId_316 = Convert.ToInt32(row["bigTagId_316"]); } if (row["smallTagId_316"] != DBNull.Value) { model.smallTagId_316 = Convert.ToInt32(row["smallTagId_316"]); } if (row["bigTagNm_304"] != DBNull.Value) { model.bigTagNm_304 = Convert.ToString(row["bigTagNm_304"]); } if (row["smallTagNm_304"] != DBNull.Value) { model.smallTagNm_304 = Convert.ToString(row["smallTagNm_304"]); } if (row["bigTagNm_316"] != DBNull.Value) { model.bigTagNm_316 = Convert.ToString(row["bigTagNm_316"]); } if (row["smallTagNm_316"] != DBNull.Value) { model.smallTagNm_316 = Convert.ToString(row["smallTagNm_316"]); } return model; } else { return null; } }
/// <summary> /// 展示数据 /// </summary> /// <param name="id">记录Id</param> private void ShowInfo(int id) { LCustTagBB custTagBB = new LCustTagBB(); vLCustTagData model = new vLCustTagData(); SFileBB fileBB = new SFileBB(); try { model = custTagBB.GetVModel(id); this.hidCustNo.Value = model.custNo; this.hidMaterialNo.Value = model.materialNo; this.bigSQL.Text = model.bigTagSql; this.smallSQL.Text = model.smallTagSql; SFileData smdtata = fileBB.GetModel(model.smallTagFileId); if (smdtata != null) { this.smallfileNm.InnerHtml = "<a href='" + smdtata.absolutPath + smdtata.preFileNm + "' >" + smdtata.preFileNm + "</a>"; } SFileData bgdata = fileBB.GetModel(model.bigTagFileId); if (bgdata != null) { this.bigfileNm.InnerHtml = "<a href='" + bgdata.absolutPath + bgdata.preFileNm + "' >" + bgdata.preFileNm + "</a>"; } this.custNm.Text = model.custNm; this.materialNm.Text = model.materialDesc; this.bigTagFileId.Value = model.bigTagFileId.ToString(); this.smallTagFileId.Value = model.smallTagFileId.ToString(); this.tbEachPrintBigTagNum.Text = model.eachPrintBigTagNum.ToString(); this.tbEachPrintSmallTagNum.Text = model.eachPrintSmallTagNum.ToString(); this.tbUnit.Text = model.unit; this.tbUnits.Text = model.units; } finally { custTagBB.Dispose(); fileBB.Dispose(); } }