/// <summary> /// 得到一个对象实体 /// </summary> public SentialFactorTypeEntity GetModel(int SentialFactorTypeID) { StringBuilder strSql = new StringBuilder( ); strSql.Append("select top 1 SentialFactorTypeID,SentialFactorTypeName,SentialFactorTypeDescription from T_SentialFactorType "); strSql.Append(" where SentialFactorTypeID=@SentialFactorTypeID"); SqlParameter[] parameters = { new SqlParameter("@SentialFactorTypeID", SqlDbType.Int, 4) }; parameters[0].Value = SentialFactorTypeID; SentialFactorTypeEntity model = new SentialFactorTypeEntity( ); DataSet ds = SqlHelper.Query(SqlHelper.LocalSqlServer, strSql.ToString( ), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["SentialFactorTypeID"] != null && ds.Tables[0].Rows[0]["SentialFactorTypeID"].ToString( ) != "") { model.SentialFactorTypeID = int.Parse(ds.Tables[0].Rows[0]["SentialFactorTypeID"].ToString( )); } if (ds.Tables[0].Rows[0]["SentialFactorTypeName"] != null && ds.Tables[0].Rows[0]["SentialFactorTypeName"].ToString( ) != "") { model.SentialFactorTypeName = ds.Tables[0].Rows[0]["SentialFactorTypeName"].ToString( ); } if (ds.Tables[0].Rows[0]["SentialFactorTypeDescription"] != null && ds.Tables[0].Rows[0]["SentialFactorTypeDescription"].ToString( ) != "") { model.SentialFactorTypeDescription = ds.Tables[0].Rows[0]["SentialFactorTypeDescription"].ToString( ); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SentialFactorTypeEntity model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SentialFactorTypeEntity model) { return(dal.Add(model)); }