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