public override ServicesConnectionModel[] GetModel(string strWhere, DB_OPT dbo) { StringBuilder builder = new StringBuilder(); builder.Append("select PK,OperationPK,ServicePK,Name,ServiceStep,CompanyPK,BranchPK,ConnectionTypePK,FatherPK,ConnectionPath,Grade,IsHasBaby,TopLevelConnectionPK,IfTax,IfFee,IfLast,Memo from gov_tc_db_ServicesConnection "); if (strWhere != "") { builder.Append(" where " + strWhere); } DataSet set = dbo.BackDataSet(builder.ToString(), null); ServicesConnectionModel[] modelArray = null; if (set.Tables[0].Rows.Count <= 0) { return null; } modelArray = new ServicesConnectionModel[set.Tables[0].Rows.Count]; for (int i = 0; i < set.Tables[0].Rows.Count; i++) { modelArray[i] = new ServicesConnectionModel(); modelArray[i] = this.GetModel(set.Tables[0].Rows[i]); } return modelArray; }
private ServicesConnectionModel GetModel(DataRow dr) { ServicesConnectionModel model = new ServicesConnectionModel { PK = dr["PK"].ToString(), OperationPK = dr["OperationPK"].ToString(), ServicePK = dr["ServicePK"].ToString(), Name = dr["Name"].ToString() }; if (dr["ServiceStep"].ToString() != "") { model.ServiceStep = int.Parse(dr["ServiceStep"].ToString()); } model.CompanyPK = dr["CompanyPK"].ToString(); model.BranchPK = dr["BranchPK"].ToString(); model.ConnectionTypePK = dr["ConnectionTypePK"].ToString(); model.FatherPK = dr["FatherPK"].ToString(); model.ConnectionPath = dr["ConnectionPath"].ToString(); if (dr["Grade"].ToString() != "") { model.Grade = int.Parse(dr["Grade"].ToString()); } model.IsHasBaby = dr["IsHasBaby"].ToString(); model.TopLevelConnectionPK = dr["TopLevelConnectionPK"].ToString(); model.IfTax = dr["IfTax"].ToString(); model.IfFee = dr["IfFee"].ToString(); model.IfLast = dr["IfLast"].ToString(); model.Memo = dr["Memo"].ToString(); return model; }