示例#1
0
        internal Hóspede LoadHóspede(HóspedeAtividade s)
        {
            HóspedeMapper         cm         = new HóspedeMapper(context);
            List <IDataParameter> parameters = new List <IDataParameter> {
                new SqlParameter("@nome", s.Nome_Atividade)
            };

            using (var rd = ExecuteReader("select nif_hóspede from HóspedeAtividade where nome_atividade=@nome", parameters))
            {
                int  key  = 0;
                bool read = rd.Read();
                if (read)
                {
                    key = Convert.ToInt32(rd.GetDecimal(0));
                }
                return(cm.Read(key));
            }
        }
示例#2
0
        protected override EstadaHóspede Map(IDataRecord record)
        {
            EstadaHóspede a           = new EstadaHóspede();
            int           nif_hóspede = Convert.ToInt32(record.GetDecimal(0));
            int           id_estada   = Convert.ToInt32(record.GetDecimal(1));


            HóspedeMapper extraMapper = new HóspedeMapper(context);

            a.Hóspede = extraMapper.Read(nif_hóspede);

            EstadaMapper estadaMapper = new EstadaMapper(context);

            a.Estada = estadaMapper.Read(id_estada);


            return(a);
        }
示例#3
0
        internal Hóspede LoadHóspede(Fatura s)
        {
            HóspedeMapper         cm         = new HóspedeMapper(context);
            List <IDataParameter> parameters = new List <IDataParameter> {
                new SqlParameter("@id", s.Id)
            };

            using (var rd = ExecuteReader("select nif_hóspede from Fatura where id=@id", parameters))
            {
                int  key  = 0;
                bool read = rd.Read();
                if (read)
                {
                    key = Convert.ToInt32(rd.GetDecimal(0));
                }
                return(cm.Read(key));
            }
        }