public override ServicesRegisterModel[] GetChilds(string parentpk, DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (parentpk != "") { builder.Append(" where FatherPK='" + parentpk + "'"); } builder.Append(" order by PK"); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count <= 0) { return null; } ServicesRegisterModel[] modelArray = new ServicesRegisterModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new ServicesRegisterModel(); modelArray[i] = this.GetModel(set.Tables[0].Rows[i], false, false, dbo); } return modelArray; }
public override ServicesRegisterModel[] GetEgality(bool bj_child, bool bj_tache, DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (base.Grade >= 0) { builder.Append(" where Grade='" + base.Grade + "'"); } else { if (base.PK == "") { throw new Exception("条件不足."); } builder.Append(" where Grade=(select Grade from gov_tc_db_ServicesRegister where PK='" + base.PK + "')"); } builder.Append(" order by PK"); DataSet set = dbo.BackDataSet(builder.ToString(), null); if (set.Tables[0].Rows.Count <= 0) { return null; } ServicesRegisterModel[] modelArray = new ServicesRegisterModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new ServicesRegisterModel(); modelArray[i] = this.GetModel(set.Tables[0].Rows[i], bj_child, bj_tache, dbo); } return modelArray; }
public override ServicesRegisterModel[] GetParents(DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (base.PKPath != "") { string[] strArray = base.PKPath.Split(new char[] { '|' }); string str = ""; for (int j = 0; j < strArray.Length; j++) { str = str + "'" + strArray[j] + "',"; } builder.Append(" where PK in (" + str.Substring(0, str.Length - 1) + ")"); } else { if (!(base.PK != "")) { throw new Exception("条件不足."); } string strSql = "select PKPath from gov_tc_db_ServicesRegister where PK='" + base.PK + "'"; DataSet set = dbo.BackDataSet(strSql, null); if (!(set.Tables[0].Rows[0][0].ToString() != "")) { throw new Exception("没有上级."); } string[] strArray2 = set.Tables[0].Rows[0][0].ToString().Split(new char[] { '|' }); string str3 = ""; for (int k = 0; k < strArray2.Length; k++) { str3 = str3 + "'" + strArray2[k] + "',"; } builder.Append(" where PK in (" + str3.Substring(0, str3.Length - 1) + ")"); } builder.Append(" order by PK"); DataSet set2 = dbo.BackDataSet(builder.ToString(), null); if (set2.Tables[0].Rows.Count <= 0) { return null; } ServicesRegisterModel[] modelArray = new ServicesRegisterModel[set2.Tables[0].Rows.Count]; for (int i = 0; i < set2.Tables[0].Rows.Count; i++) { modelArray[i] = new ServicesRegisterModel(); modelArray[i] = this.GetModel(set2.Tables[0].Rows[i], false, false, dbo); } return modelArray; }
public override ServicesRegisterModel[] GetModel(string strWhere, bool bj_child, bool bj_tache, DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetSql()); if (strWhere != "") { builder.Append(" where " + strWhere); } DataSet set = dbo.BackDataSet(builder.ToString(), null); ServicesRegisterModel[] modelArray = null; if (set.Tables[0].Rows.Count <= 0) { return null; } modelArray = new ServicesRegisterModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new ServicesRegisterModel(); modelArray[i] = this.GetModel(set.Tables[0].Rows[i], bj_child, bj_tache, dbo); } return modelArray; }