private void ShowInfo(string id) { SFileSaveTypeBB fileSaveTypeBB = new SFileSaveTypeBB(); vSFileSaveTypeData model = new vSFileSaveTypeData(); try { model = fileSaveTypeBB.GetVModel(id); this.typeNo.Text = model.typeNo; this.typeDesc.Text = model.typeDesc; this.urlPath.Text = model.urlPath; this.absolutePath.Text = model.absolutePath; this.mark.Text = model.mark; } finally { fileSaveTypeBB.Dispose(); } }
/// <summary> /// �õ�һ����ͼmodel /// </summary> /// <param name="typeNo">����ֵ</param> /// <returns>model</returns> public vSFileSaveTypeData GetVModel(string typeNo) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from vSFileSaveType"); strSql.Append(" where typeNo = @typeNo "); SqlParameter[] parameters = { new SqlParameter("@typeNo", SqlDbType.NVarChar,20) }; parameters[0].Value = typeNo; vSFileSaveTypeData model = new vSFileSaveTypeData(); 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["typeNo"] != DBNull.Value) { model.typeNo = Convert.ToString(row["typeNo"]); } if (row["typeDesc"] != DBNull.Value) { model.typeDesc = Convert.ToString(row["typeDesc"]); } if (row["urlPath"] != DBNull.Value) { model.urlPath = Convert.ToString(row["urlPath"]); } if (row["absolutePath"] != DBNull.Value) { model.absolutePath = Convert.ToString(row["absolutePath"]); } if (row["isSys"] != DBNull.Value) { model.isSys = Convert.ToBoolean(row["isSys"]); } if (row["mark"] != DBNull.Value) { model.mark = Convert.ToString(row["mark"]); } if (row["updtEmpId"] != DBNull.Value) { model.updtEmpId = Convert.ToInt32(row["updtEmpId"]); } if (row["updtDt"] != DBNull.Value) { model.updtDt = Convert.ToString(row["updtDt"]); } if (row["updtEmpNm"] != DBNull.Value) { model.updtEmpNm = Convert.ToString(row["updtEmpNm"]); } return model; } else { return null; } }