Ejemplo n.º 1
0
        /// <summary>
        /// Ajout d'un support
        /// </summary>
        /// <param name="s">support à ajouter</param>
        /// <returns></returns>
        public List<Support> AjouterSupport(Support s)
        {

            SupportDAO supportDAO = new SupportDAO();
            supportDAO.InsertSupport(s);
            return supportDAO.ObtenirListeSupports();

        }
Ejemplo n.º 2
0
 public FilmViewModel()
 {
     ListeProprietaire = new List<Proprietaire>();
     LeFilm = new Film();
     LeProprietaire = new Proprietaire();
     ListeSupports = new List<Support>();
     LeSupport = new Support();
     EstSouhait = false;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Modification d'un support
        /// </summary>
        /// <param name="s">support à modifier</param>
        /// <returns></returns>
        public List<Support> MettreAJourSupport(Support s)
        {

            SupportDAO supportDAO = new SupportDAO();

            supportDAO.UpdateSupport(s);

            return supportDAO.ObtenirListeSupports();

        }
Ejemplo n.º 4
0
 public FilmViewModel()
 {
     ListeProprietaire = new List<Proprietaire>();
     LeFilm = new Film();
     LeProprietaire = new Proprietaire();
     ListeSupports = new List<Support>();
     LeSupport = new Support();
     OldSupport = new Support();
     EstSouhait = false;
     DateAcquisition = DateTime.Now;
     Lexemplaire = new Exemplaire();
     Etat = new EtatMedia();
 }
Ejemplo n.º 5
0
        public ActionResult Create(Support pSupport)
        {
            try
            {
                GestionnaireSupports gestionnaireSupports = new GestionnaireSupports();
                DataManager.ListeSupports = gestionnaireSupports.AjouterSupport(pSupport);

                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                HandleErrorInfo error = new HandleErrorInfo(ex, "Support", "Create");
                return View("Error", error);
            }
        }
Ejemplo n.º 6
0
        public ActionResult Edit(Support pSupport)
        {
            try
            {
                foreach (string inputTagName in Request.Files)
                {
                    HttpPostedFileBase file = Request.Files[inputTagName];
                    //if (file.ContentLength > 0)
                    //{
                    //    string filePath = Path.Combine(HttpContext.Server.MapPath("../Uploads")
                    //            , Path.GetFileName(file.FileName));
                    //    file.SaveAs(filePath);
                    //}

                    byte[] buffer = new byte[file.ContentLength];
                    file.InputStream.Read(buffer, 0, file.ContentLength);

                    //ImageElement image = ImageElement.FromBinary(byteArray);

                    pSupport.Icone = buffer;
                }

                if (Session["ContentStreamSupport"] != null)
                {
                    pSupport.Icone = (byte[])Session["ContentStreamSupport"];
                }

                GestionnaireSupports gestionnaireSupports = new GestionnaireSupports();
                DataManager.ListeSupports = gestionnaireSupports.MettreAJourSupport(pSupport);

                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                HandleErrorInfo error = new HandleErrorInfo(ex, "Support", "Edit");
                return View("Error", error);
            }
        }
Ejemplo n.º 7
0
        public ActionResult Upload(HttpPostedFileBase file, Support pSupport)
        {

            if (file != null && file.ContentLength > 0)
            {
                Session["ContentLengthSupport"] = file.ContentLength;
                Session["ContentTypeSupport"] = file.ContentType;
                byte[] b = new byte[file.ContentLength];
                file.InputStream.Read(b, 0, file.ContentLength);
                Session["ContentStreamSupport"] = b;

            }

            return RedirectToAction("Edit", new { pCode = pSupport.Code });
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="pTypeMedia">pTypeMedia</param>
        public MediaViewModel(Constantes.EnumTypeMedia pTypeMedia) : this()
        {
            TypeMedia = pTypeMedia;

            switch (pTypeMedia)
            {
                case Constantes.EnumTypeMedia.TOUT:
                    break;
                case Constantes.EnumTypeMedia.FILM:
                    LeFilm = new Film();
                    LeSupport = new Support();
                    OldSupport = new Support();
                    break;
                case Constantes.EnumTypeMedia.SERIE:
                    LaSerie = new Serie();
                    LeSupport = new Support();
                    OldSupport = new Support();
                    break;
                case Constantes.EnumTypeMedia.JEU:
                    LeJeu = new Jeu();
                    break;
                default:
                    break;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// UpdateSupport
        /// </summary>
        /// <returns>Liste supports</returns>
        public int UpdateSupport(Support s)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterDML(REQUETE_MODIFICATION_SUPPORT, false, s.Code, s.Libelle, s.Icone);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// InsertSupport
        /// </summary>
        /// <returns>Liste supports</returns>
        public int InsertSupport(Support s)
        {
            CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION);

            return maDataSource.ExecuterDML(REQUETE_AJOUTER_SUPPORT, false, s.Code, s.Libelle);
        }