/// <summary> /// 得到一个对象实体 /// </summary> public CardCenter.Entity.Para_BZ DataRowToModel(DataRow row) { CardCenter.Entity.Para_BZ model = new CardCenter.Entity.Para_BZ(); if (row != null) { if (row["BZ_Value"] != null) { model.BZ_Value = row["BZ_Value"].ToString(); } if (row["BZ_Name"] != null) { model.BZ_Name = row["BZ_Name"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(CardCenter.Entity.Para_BZ model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Para_BZ set "); strSql.Append("BZ_Name=@BZ_Name"); strSql.Append(" where BZ_Value=@BZ_Value "); SqlParameter[] parameters = { new SqlParameter("@BZ_Name", SqlDbType.NVarChar, 64), new SqlParameter("@BZ_Value", SqlDbType.NVarChar, 3) }; parameters[0].Value = model.BZ_Name; parameters[1].Value = model.BZ_Value; TranHelper.AddTran(strSql, parameters); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(CardCenter.Entity.Para_BZ model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Para_BZ("); strSql.Append("BZ_Value,BZ_Name)"); strSql.Append(" values ("); strSql.Append("@BZ_Value,@BZ_Name)"); SqlParameter[] parameters = { new SqlParameter("@BZ_Value", SqlDbType.NVarChar, 3), new SqlParameter("@BZ_Name", SqlDbType.NVarChar, 64) }; parameters[0].Value = model.BZ_Value; parameters[1].Value = model.BZ_Name; TranHelper.AddTran(strSql, parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public CardCenter.Entity.Para_BZ GetModel(string BZ_Value) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 BZ_Value,BZ_Name from Para_BZ "); strSql.Append(" where BZ_Value=@BZ_Value "); SqlParameter[] parameters = { new SqlParameter("@BZ_Value", SqlDbType.NVarChar, 3) }; parameters[0].Value = BZ_Value; CardCenter.Entity.Para_BZ model = new CardCenter.Entity.Para_BZ(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }