/// <summary> /// 得到一个对象实体 /// </summary> public ObservableCollection <Model.BPM_ProductTemplate> GetModelList(string ptID) { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select * from BPM_ProductTemplate "); strSql.Append(" where PtID=@PtID"); SqlParameter[] parameters = { new SqlParameter("@PtID", SqlDbType.VarChar, 100) }; parameters[0].Value = ptID; Model.BPM_ProductTemplate model = new Model.BPM_ProductTemplate(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { ObservableCollection <Model.BPM_ProductTemplate> tem = new ObservableCollection <Model.BPM_ProductTemplate>(); foreach (DataRow dr in ds.Tables[0].Rows) { tem.Add(DataRowToModel(dr)); } return(tem); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.BPM_ProductTemplate GetModel(decimal ID_Key) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from BPM_ProductTemplate "); strSql.Append(" where ID_Key=@ID_Key"); SqlParameter[] parameters = { new SqlParameter("@ID_Key", SqlDbType.Decimal) }; parameters[0].Value = ID_Key; Model.BPM_ProductTemplate model = new Model.BPM_ProductTemplate(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public Model.BPM_ProductTemplate GetModel(string ptID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from BPM_ProductTemplate "); strSql.Append(" where PtID=@PtID"); SqlParameter[] parameters = { new SqlParameter("@PtID", SqlDbType.VarChar, 100) }; parameters[0].Value = ptID; Model.BPM_ProductTemplate model = new Model.BPM_ProductTemplate(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.BPM_ProductTemplate model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public decimal Add(Model.BPM_ProductTemplate model) { return(dal.Add(model)); }