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