Example #1
0
        internal IClient LoadClient(IPhone p)
        {
            ClientMapper          cm         = new ClientMapper(mapperHelper.context);
            List <IDataParameter> parameters = new List <IDataParameter>();

            parameters.Add(new SqlParameter("@id", p.code));

            using (IDataReader rd = mapperHelper.ExecuteReader("select nif from Phone where code=@id", parameters))
            {
                if (rd.Read())
                {
                    return(cm.Read(rd.IsDBNull(0) ? default : rd.GetInt32(0)));
                }
            }
            return(null);
        }
Example #2
0
        internal IClient LoadClient(IPortfolio p)
        {
            ClientMapper          cm         = new ClientMapper(mapperHelper.context);
            List <IDataParameter> parameters = new List <IDataParameter>();
            decimal nif = decimal.Parse(p.name.Split('_')[0]);

            parameters.Add(new SqlParameter("@id", nif));

            using (IDataReader rd = mapperHelper.ExecuteReader("select nif, ncc, name from Client where nif=@id", parameters))
            {
                if (rd.Read())
                {
                    return(cm.Read(rd.IsDBNull(0) ? default : rd.GetDecimal(0)));
                }
            }
            return(null);
        }
Example #3
0
 public ClientRepository(IContext ctx)
 {
     context = ctx;
     mapper  = new ClientMapper(ctx);
 }