/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StoreLocalTag DataRowToModel(DataRow row) { Maticsoft.Model.StoreLocalTag model=new Maticsoft.Model.StoreLocalTag(); if (row != null) { if(row["KeyID"]!=null) { model.KeyID=row["KeyID"].ToString(); } if(row["LocalTagID"]!=null) { model.LocalTagID=row["LocalTagID"].ToString(); } if(row["LocalTagName"]!=null) { model.LocalTagName=row["LocalTagName"].ToString(); } if(row["BizID"]!=null) { model.BizID=row["BizID"].ToString(); } if(row["DistrictID"]!=null) { model.DistrictID=row["DistrictID"].ToString(); } if(row["BizType"]!=null && row["BizType"].ToString()!="") { model.BizType=int.Parse(row["BizType"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.StoreLocalTag GetModel(string KeyID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 KeyID,LocalTagID,LocalTagName,BizID,DistrictID,BizType from StoreLocalTag "); strSql.Append(" where KeyID=@KeyID "); SqlParameter[] parameters = { new SqlParameter("@KeyID", SqlDbType.NVarChar,50) }; parameters[0].Value = KeyID; Maticsoft.Model.StoreLocalTag model=new Maticsoft.Model.StoreLocalTag(); DataSet ds=ServerDbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }