private static DonateProductEntity Get(string hospitalId, string unitId, string vendorId, string productId)
        {
            var sql = string.Format(@"select {0} from donate_product
where hospital_id=@p_hospital_id and unit_id=@p_unit_id and vendor_id=@p_vendor_id and product_id=@p_product_id", COLUMN);

            var db  = DatabaseFactory.CreateDatabase();
            var cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "p_hospital_id", DbType.String, hospitalId);
            db.AddInParameter(cmd, "p_unit_id", DbType.String, unitId);
            db.AddInParameter(cmd, "p_vendor_id", DbType.String, vendorId);
            db.AddInParameter(cmd, "p_product_id", DbType.String, productId);

            using (var reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    var entity = new DonateProductEntity();
                    entity.Init(reader);

                    return(entity);
                }
            }

            return(null);
        }
        public static void Get(string hospitalId, string unitId, string vendorId, string productId,
                               out DonateProductEntity donation, out IList <DonateProductItemEntity> items)
        {
            donation = Get(hospitalId, unitId, vendorId, productId);

            if (donation == null)
            {
                items = new List <DonateProductItemEntity>();
                return;
            }

            items = GetItems(donation.Id);
        }
Esempio n. 3
0
        public bool InsertProduct(ProfilModel pf)
        {
            DonateProductEntity dpe = new DonateProductEntity();

            dpe.IdUtilisateur  = pf.IdUser;
            dpe.IdAdresse      = pf.IdAdresse;
            dpe.Quantite       = pf.DonateProduct.Quantite;
            dpe.IdType         = pf.DonateProduct.IdType;
            dpe.NameProduct    = pf.DonateProduct.Nom;
            dpe.Bio            = pf.DonateProduct.Bio;
            dpe.DatePeremption = pf.DonateProduct.DatePeremption;
            dpe.Description    = pf.DonateProduct.Description;
            dpe.LabelEtat      = pf.DonateProduct.Etat;
            dpe.Pays           = pf.DonateProduct.Pays;
            dpe.NomMarque      = pf.DonateProduct.Marque;


            return(_donateProductRepo.Insert(dpe));
        }
Esempio n. 4
0
 public void Get(string hospitalId, string unitId, string vendorId, string productId,
                 out DonateProductEntity donation, out IList <DonateProductItemEntity> items)
 {
     DonateProductRepository.Get(hospitalId, unitId, vendorId, productId, out donation, out items);
 }