protected void BTNADDArch_Click(object sender, EventArgs e)
        {
            if (TitreArch.Value != "" || textArea.Value != "" || EmpPc.Value != "" || index.Value != "" || selectTypeAroo.SelectedValue != "")
            {
                String stringidF = Request.QueryString["idFichier"];
                int    idF;
                idF = Int32.Parse(stringidF);

                String   titreAr     = TitreArch.Value;
                String   description = textArea.InnerHtml;
                DateTime day         = DateTime.Now;
                int      idType      = 0;
                Int32.TryParse(selectTypeAroo.SelectedValue, out idType);
                Fichier f = new ActionsFichier().getFichierById(idF);

                f.Nom              = titreAr;
                f.Description      = description;
                f.dateModification = day;
                f.index            = index.Value;
                f.emplacementPC    = EmpPc.Value;
                f.idType           = Int32.Parse(selectTypeAroo.SelectedValue);
                f.type             = new ActionsType().getTypeById(f.idType);
                new ActionsFichier().modifier(f);
                if (f.type.DUAselon == "DateDerniereMod")
                {
                    new ActionsFichier().modifierSelonHangFire(f);
                }
                String indexmsg = "le fichier :" + f.Nom + " a ete bien modifier, index :" + f.index + "";
                Response.Redirect("./Calendrier.aspx?indexmsg=" + indexmsg);
            }
            else
            {
                erreur.InnerHtml = "veuillez remplir tous les champs";
            }
        }
예제 #2
0
 public static string searchArchives(String search)
 {
     if (search != "")
     {
         List <Fichier> fichiers = new ActionsFichier().rechercheGenerale(search);
         String         s        = "";
         s += generatebtnRetour();
         foreach (var f in fichiers)
         {
             if (f.sortFinalComm == 1)
             {
                 s += CalendrierAdmin.GenerateArchive(f);
             }
         }
         if (s == "")
         {
             s = "Aucun Archive trouve";
         }
         return(s);
     }
     else
     {
         String s = "Veuillez entrer un type a rechercher,un nom ou l'index que vous avez creer";
         return(s);
     }
 }
        public static String searchArchives(String search, String typeS)
        {
            String      s = "";
            Utilisateur u;

            u = new ActionsUtilisateur().rechercheUtilisateurParId(idUser);
            if (typeS == "2")
            {
                List <Fichier> fichiers = new ActionsFichier().rechercheGSelonUser(search, u);

                foreach (var f in fichiers)
                {
                    s += GenerateArchive(f, u);
                }
            }
            else if (typeS == "1")
            {
                List <Fichier> fichiers = new ActionsFichier().rechercheGenerale(search);

                foreach (var f in fichiers)
                {
                    s += GenerateArchive(f, u);
                }
            }
            if (s == "")
            {
                s = "<h1 style=\"color:white\" > aucun fichier trouve</h1>";
            }
            return(s);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["idUser"] == null && Session["privillege"] != "Admin")
     {
         Response.Redirect("./Authentification.aspx");
     }
     if (!IsPostBack)
     {
         ActionsFichier actionsFichier = new ActionsFichier();
         int            id             = 0;
         Int32.TryParse(Request.QueryString["idFichier"], out id);
         Fichier f = actionsFichier.getFichierById(id);
         TitreArch.Value               = f.Nom;
         EmpPc.Value                   = f.emplacementPC;
         index.Value                   = f.index;
         ArchiveUpload.Enabled         = false;
         textArea.InnerHtml            = f.Description;
         selectTypeAroo.DataSource     = new ActionsType().ListerTypes();
         selectTypeAroo.DataTextField  = "nomType";
         selectTypeAroo.DataValueField = "idType";
         selectTypeAroo.DataBind();
         selectTypeAroo.SelectedValue = f.idType + "";
         selectTypeAroo.Enabled       = false;
     }
 }
        public static String afficherArchive(String idArch)
        {
            Utilisateur u = new ActionsUtilisateur().rechercheUtilisateurParId(idUser);
            Fichier     f = new ActionsFichier().getFichierById(Int32.Parse(idArch));
            String      s = GenerateArchive(f, u);

            return(s);
        }
        public static String afficherArchive(String idArch)
        {
            ActionsFichier ActsFich = new ActionsFichier();
            Fichier        f        = ActsFich.getFichierById(Int32.Parse(idArch));
            String         s        = GenerateArchive(f);

            return(s);
        }
        public static String commArchivage(String idF)
        {
            ActionsFichier act  = new ActionsFichier();
            HangFireUtil   hang = new HangFireUtil(act);
            Fichier        f    = act.getFichierById(Int32.Parse(idF));

            f.commArch = 1;
            act.modifier(f);
            f.type = new ActionsType().getTypeById(f.idType);
            if (f.type.DUAselon == "DateAjout")
            {
                f.dateSuppression = f.dateAjout.AddDays(f.type.duree);
                act.modifier(f);
                if (f.type.action == "Destruction")
                {
                    hang.DestructionSelonAjout(f);
                }
                else if (f.type.action == "Conservation")
                {
                    hang.ConservationSelonAjout(f);
                }
            }
            else if (f.type.DUAselon == "DateDernierAcces")
            {
                if (f.type.action == "Destruction")
                {
                    hang.DestructionSelonDernerAcces(f);
                }
                else if (f.type.action == "Conservation")
                {
                    hang.ConservationSelonDernerAcces(f);
                }
            }

            Historique h = new Historique();

            h.textHistorique = "les regles de conservation sont applique pour l archive " + f.Nom;
            h.IdFichier      = f.idFichier;
            h.date           = DateTime.Now;
            new ActionsHistorique().ajouterHistorique(h);

            if (f.sortFinalComm == 0)
            {
                return(RetentionArchives.ArchiveInfoGenerateur(f));
            }
            else if (f.sortFinalComm == 1)
            {
                return(RetentionArchives.ArchiveInfoGenerateur(f));
            }
            else
            {
                return("verifiez votre connection");
            }
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String  idFile = Request.QueryString["idFile"];
            Fichier f      = new ActionsFichier().getFichierById(Int32.Parse(idFile));

            Response.ContentType = "application/octet-stream";
            Response.AppendHeader("Content-Disposition", "attachment; filename=archive-" + f.idFichier + f.extention);
            Response.TransmitFile(Server.MapPath("~/Archives/archive-" + f.idFichier + f.extention));
            Response.End();
            //Response.End();
            //ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
        }
예제 #9
0
        public static string getArchiveInfo(String idArch)
        {
            ActionsFichier actsF     = new ActionsFichier();
            int            idArchive = 0;

            Int32.TryParse(idArch, out idArchive);
            Fichier f = actsF.getFichierById(idArchive);

            f.dateDernierAcces = DateTime.Now;

            if (f.commArch == 1)
            {
                if (f.sortFinalComm == 0)
                {
                    f.type = new ActionsType().getTypeById(f.idType);
                    if (f.type.DUAselon == "DateDernierAcces")
                    {
                        if (f.type.action == "Destruction")
                        {
                            new HangFireUtil(actsF).DestructionSelonDernerAcces(f);
                        }
                        else if (f.type.action == "Conservation")
                        {
                            new HangFireUtil(actsF).ConservationSelonDernerAcces(f);
                        }
                    }
                }
            }
            Historique h = new Historique();

            h.textHistorique = "L archive " + f.Nom + " de type " + f.type.nomType + " a étè accede";
            h.IdFichier      = f.idFichier;
            h.date           = DateTime.Now;
            new ActionsHistorique().ajouterHistorique(h);

            actsF.modifier(f);
            if (f.sortFinalComm == 0)
            {
                return(ArchiveInfoGenerateur(f));
            }
            else if (f.sortFinalComm == 1)
            {
                return(ArchiveInfoGenerateur(f));
            }
            else
            {
                return("verifiez votre connection");
            }
        }
예제 #10
0
        protected void BTNADDArch_Click(object sender, EventArgs e)
        {
            if (TitreArch.Value != "" || textArea.InnerHtml != "" || EmpPc.Value != "" || index.Value != "" || selectTypeAroo.SelectedValue != "" ||
                ArchiveUpload.HasFile)
            {
                String ext = System.IO.Path.GetExtension(ArchiveUpload.FileName);
                if (ext == ".pdf" || ext == ".docx" || ext == ".png")
                {
                    idU = Int32.Parse(Session["idUser"].ToString());
                    Utilisateur u           = new ActionsUtilisateur().rechercheUtilisateurParId(idU);
                    String      titreAr     = TitreArch.Value;
                    String      description = textArea.InnerHtml;
                    DateTime    day         = DateTime.Now;
                    int         idType      = 0;
                    Int32.TryParse(selectTypeAroo.SelectedValue, out idType);
                    Fichier f = new Fichier();
                    f.Nom              = titreAr;
                    f.Description      = description;
                    f.dateAjout        = day;
                    f.extention        = ext;
                    f.dateModification = day;
                    f.dateDernierAcces = day;
                    f.index            = index.Value;
                    f.emplacementPC    = EmpPc.Value;
                    f.dateSuppression  = day;
                    ActionsType actionsType = new ActionsType();
                    f.idType = idType;
                    f.type   = actionsType.getTypeById(idType);
                    int id = new ActionsFichier().ajouterParUser(u, f);
                    f.idFichier = id;
                    f.chemain   = Server.MapPath("~/Archives/" + "archive-" + id + ".pdf");
                    new ActionsFichier().modifier(f);
                    ArchiveUpload.SaveAs(Server.MapPath("~/Archives/" + "archive-" + id + ".pdf"));

                    String indexmsg = "index du archive ajoute est : " + f.index + "";

                    Response.Redirect("./Calendrier.aspx?indexmsg=" + indexmsg);
                }
                else
                {
                    erreur.InnerHtml = "Le fichier doit etre format pdf,img,docx seulement";
                }
            }
            else
            {
                erreur.InnerHtml = "veuillez remplir tous les champs";
            }
        }
        public static string searchArchives(String search)
        {
            List <Fichier> fichiers = new ActionsFichier().rechercheGenerale(search);
            String         s        = "";

            foreach (var f in fichiers)
            {
                if (f.sortFinalComm == 0)
                {
                    s += GenerateArchive(f);
                }
            }
            if (s == "")
            {
                s = "Aucun Fichier trouve";
            }
            return(s);
        }
예제 #12
0
        public static String getArchives(String idtype)
        {
            int type = 0;

            Int32.TryParse(idtype, out type);
            String         s        = "";
            List <Fichier> fichiers = new ActionsFichier().listerFichiersArchive();

            s += generatebtnRetour();
            foreach (var f in fichiers)
            {
                if (f.idType == type)
                {
                    s += CalendrierAdmin.GenerateArchive(f);
                }
            }
            return(s);
        }
        public static string DeleteArchive(String idArch, String date)
        {
            int idF = 0;

            Int32.TryParse(idArch, out idF);
            new ActionsFichier().supprimerF(idF);

            //
            String         s     = "";
            List <Fichier> listF = new ActionsFichier().listerFichiersParDate(date);

            foreach (var f in listF)
            {
                if (f.sortFinalComm == 0)
                {
                    s += GenerateArchive(f);
                }
            }

            return(s);
        }
        protected void BTNADDArch_Click(object sender, EventArgs e)
        {
            if (TitreArch.Value != "" || textArea.InnerHtml != "" || EmpPc.Value != "" || index.Value != "" || selectTypeAroo.SelectedValue != "")
            {
                Fichier f = new Fichier();



                String   titreAr     = TitreArch.Value;
                String   description = textArea.InnerHtml;
                DateTime day         = DateTime.Now;
                int      idType      = 0;
                Int32.TryParse(selectTypeAroo.SelectedValue, out idType);

                f.Nom              = titreAr;
                f.Description      = description;
                f.dateAjout        = day;
                f.dateModification = day;
                f.dateDernierAcces = day;
                f.index            = index.Value;
                f.emplacementPC    = EmpPc.Value;
                f.dateSuppression  = day;
                if (CKRC.Checked)
                {
                    f.commArch = 0;
                }
                else
                {
                    f.commArch = 1;
                }
                ActionsType actionsType = new ActionsType();
                f.type = actionsType.getTypeById(idType);
                int id = new ActionsFichier().ajouterF(f);
                f.idFichier = id;
                if (!CKCE.Checked)
                {
                    String ext = System.IO.Path.GetExtension(ArchiveUpload.FileName);
                    f.extention = ext;
                    if (ext == ".pdf" || ext == ".doc" || ext == ".png")
                    {
                        f.chemain = Server.MapPath("~/Archives/" + "archive-" + id + ".pdf");
                        ArchiveUpload.SaveAs(Server.MapPath("~/Archives/" + "archive-" + id + ".pdf"));
                    }
                    else
                    {
                        erreur.InnerHtml = "veuillez remplir tous les champs";
                        Response.Redirect("./AjouterArchiveAdmin.aspx");
                    }
                }
                new ActionsFichier().modifier(f);


                String indexmsg = "index du archive ajoute est : " + f.index + "";

                Response.Redirect("./CalendrierAdmin.aspx?indexmsg=" + indexmsg);
            }
            else
            {
                erreur.InnerHtml = "veuillez remplir tous les champs";
            }
        }
        public static String getArchives(String date, String typeD, String typeS)
        {
            String         s = "";
            ActionsFichier actionsFichier = new ActionsFichier();
            List <Fichier> listF;

            if (typeS == "1")//tous
            {
                listF = actionsFichier.listerFichiersParDate(date);
                if (typeD == "1")// selon date ajout
                {
                    foreach (var f in listF)
                    {
                        String dato = f.dateAjout.ToString("yyyy/MM/dd");

                        if (dato == date)
                        {
                            if (f.sortFinalComm == 0)
                            {
                                s += CalendrierAdmin.GenerateArchive(f);
                            }
                        }
                    }
                }
                else if (typeD == "2")
                {
                    foreach (var f in listF)
                    {
                        String dato = f.dateDernierAcces.ToString("yyyy/MM/dd");
                        if (dato == date)
                        {
                            if (f.sortFinalComm == 0)
                            {
                                s += CalendrierAdmin.GenerateArchive(f);
                            }
                        }
                    }
                }
                else if (typeD == "3")
                {
                    foreach (var f in listF)
                    {
                        String dato = f.dateModification.ToString("yyyy/MM/dd");
                        if (dato == date)
                        {
                            if (f.sortFinalComm == 0)
                            {
                                s += CalendrierAdmin.GenerateArchive(f);
                            }
                        }
                    }
                }
                else if (typeD == "4")
                {
                    foreach (var f in listF)
                    {
                        if (f.dateSuppression.ToString() == date)
                        {
                            if (f.sortFinalComm == 0)
                            {
                                s += CalendrierAdmin.GenerateArchive(f);
                            }
                        }
                    }
                }
                return(s);
            }

            if (s == "")
            {
                s = "<h1>rien trouve</h1>";
            }
            return(s);
        }
 public HangFireUtil(ActionsFichier actionsFichier)
 {
     this.actionsFichier      = actionsFichier;
     this.actionsNotification = ActionsNotification.getInstance();
 }
        //lister les archive de l utilisateur u
        public static String listerParuserDate(String typeD, Utilisateur u, String date)
        {
            String         s = "";
            ActionsFichier actionsFichier = new ActionsFichier();
            List <Fichier> listF          = actionsFichier.listerParUser(u);

            if (typeD == "1")
            {
                foreach (var f in listF)
                {
                    String dato = f.dateAjout.ToString("yyyy/MM/dd");

                    if (dato == date)
                    {
                        if (f.sortFinalComm == 0)
                        {
                            s += Calendrier.GenerateArchive(f, u);
                        }
                    }
                }
            }
            else if (typeD == "2")
            {
                foreach (var f in listF)
                {
                    String dato = f.dateDernierAcces.ToString("yyyy/MM/dd");
                    if (dato == date)
                    {
                        if (f.sortFinalComm == 0)
                        {
                            s += Calendrier.GenerateArchive(f, u);
                        }
                    }
                }
            }
            else if (typeD == "3")
            {
                foreach (var f in listF)
                {
                    String dato = f.dateModification.ToString("yyyy/MM/dd");
                    if (dato == date)
                    {
                        if (f.sortFinalComm == 0)
                        {
                            s += Calendrier.GenerateArchive(f, u);
                        }
                    }
                }
            }
            else if (typeD == "4")
            {
                foreach (var f in listF)
                {
                    if (f.dateSuppression.ToString() == date)
                    {
                        if (f.sortFinalComm == 0)
                        {
                            s += Calendrier.GenerateArchive(f, u);
                        }
                    }
                }
            }
            return(s);
        }