示例#1
0
        internal ICollection <IPhone> LoadPhones(IClient c)
        {
            List <IPhone> lst = new List <IPhone>();

            PhoneMapper           pm         = new PhoneMapper(mapperHelper.context);
            List <IDataParameter> parameters = new List <IDataParameter>();

            parameters.Add(new SqlParameter("@nif", c.nif));
            using (IDataReader rd = mapperHelper.ExecuteReader("select phoneid from phoneclient where nif=@nif", parameters))
            {
                while (rd.Read())
                {
                    lst.Add(pm.Read(rd.IsDBNull(0) ? default : rd.GetInt32(0)));
                }
            }
            return(lst);
        }
示例#2
0
 public PhoneRepository(IContext ctx)
 {
     context = ctx;
     mapper  = new PhoneMapper(ctx);
 }