public ActionResult SearchDocument(int idCategoriedocument, bool isSmartPhone, int offSet, int limit)
        {
            ObjDocument model = new ObjDocument();
            string      view  = "~/Views/Document/ListeDocuments.cshtml";

            try
            {
                // S'il s'agit d'un téléphone portable, on charge une vue spéciale
                if (isSmartPhone)
                {
                    view = "~/Views/Document/ListeDocumentsMobile.cshtml";
                    model.NombreDocumentsParLigne = 1;
                    model.NombreLignes            = 6;
                }
                else
                {
                    model.NombreDocumentsParLigne = 4;
                    model.NombreLignes            = 2;
                }

                using (DocumentDAL db = new DocumentDAL())
                {
                    model.ListeDocuments = db.getListeDocuments(idCategoriedocument, offSet, limit);
                }
            }
            catch (Exception e)
            {
                Commons.Logger.genererErreur(typeof(DocumentController), e.ToString());
                return(RedirectToAction("AfficherErreur", "Error", new { message = e.Message }));
            }

            return(PartialView(view, model));
        }
        /// <summary>
        /// Affichers the documents.
        /// </summary>
        /// <returns>The documents.</returns>
        /// <param name="idCategorieDocument">Identifier categorie document.</param>
        public ActionResult AfficherDocuments(int idCategorieDocument, bool?isMobilePhone)
        {
            ObjDocument model = new ObjDocument();

            model.idCategorieDocument = idCategorieDocument;
            string view = "~/Views/Document/Documents.cshtml";

            try
            {
                Business.StatBLL.ajouterStat("PageDocument");

                if (isMobilePhone == null || !isMobilePhone.Value)
                {
                    model.NombreDocumentsParLigne = 4;
                    model.NombreLignes            = 2;
                }
                else
                {
                    model.NombreDocumentsParLigne = 1;
                    model.NombreLignes            = 6;
                }

                using (DocumentDAL db = new DocumentDAL())
                {
                    // récupération de tous les documents
                    CategorieDocument Categorie = db.getCategorieDocumentById(idCategorieDocument);
                    model.LibelleCategorieDocument = Categorie.Libelle;
                    model.ElementCount             = db.getNombreDocumentsParCategorie(idCategorieDocument);
                }
            }
            catch (Exception e)
            {
                string strCategorieDocument = idCategorieDocument.ToString();
                Commons.Logger.genererErreur(typeof(DocumentController), "strCategorieDocument =" + strCategorieDocument + " : " + e.ToString());
                return(RedirectToAction("AfficherErreur", "Error", new { message = e.Message }));
            }
            return(View(view, model));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Affichers the documents.
        /// </summary>
        /// <returns>The documents.</returns>
        /// <param name="idCategorieDocument">Identifier categorie document.</param>
        public ActionResult AfficherDocuments(int idCategorieDocument)
        {
            ObjDocument model = new ObjDocument();

            model.NombreDocumentsParLigne = 4;
            try
            {
                Business.StatBLL.ajouterStat("PageDocument");
                using (DocumentDAL db = new DocumentDAL())
                {
                    // récupération de tous les documents
                    model.ListeDocuments = db.getListeDocuments(idCategorieDocument);
                    CategorieDocument Categorie = db.getCategorieDocumentById(idCategorieDocument);
                    model.LibelleCategorieDocument = Categorie.Libelle;
                }
            }
            catch (Exception e)
            {
                string strCategorieDocument = idCategorieDocument.ToString();
                Commons.Logger.genererErreur(typeof(DocumentController), "strCategorieDocument =" + strCategorieDocument + " : " + e.ToString());
                return(RedirectToAction("AfficherErreur", "Error", new { message = e.Message }));
            }
            return(View("~/Views/Document/Documents.cshtml", model));
        }
Exemplo n.º 4
0
        public static MeshData TestImport()
        {
            OpenFileDialog dialog = new OpenFileDialog()
            {
                Filter = "3d file|*.obj;*.stl"
            };

            if (dialog.ShowDialog() == true)
            {
                var          fileName = dialog.FileName;
                IMeshBuilder builder;
                if (Path.GetExtension(fileName).Contains("obj"))
                {
                    builder = ObjDocument.Open(fileName);
                }
                else
                {
                    builder = STLDocument.Open(fileName);
                }
                var meshData = builder.ConvertToMesh();
                return(meshData);
            }
            return(null);
        }