using System; namespace MALDFG_LIBRARY { public static class Utils { public static bool IsBetween(this DateTime dt, DateTime start, DateTime end) { return dt >= start && dt <= end; } public static bool EnregistrerFichier() { return true; } public static double pourcentage(double Montant, double taux) { return (Montant * (taux / 100)); } public static String Statut(int valeur) { String[] myArray = new string[] { "En attente", "Valider", "Commptablite", "Payer", "Rejeter" }; return myArray[valeur]; } //public static bool EnregistrementFichier() //{ // if (Files.Count > 0) // { // var file = Files[0]; // if (file != null && file.ContentLength > 0) // { // //extension de fichier // string[] validFileTypes = { "pdf", "png", "jpg", "jpeg", "PDF", "PNG", "JPG", "JPEG" }; // string ext = Path.GetExtension(file.FileName); // bool isValidFile = false; // for (int i = 0; i < validFileTypes.Length; i++) // { // if (ext == "." + validFileTypes[i]) // { // isValidFile = true; // break; // } // } // try // { // Random aleatoire = new Random(); // int chiffrealeatoire = aleatoire.Next(100, 999); // String nomdufichier = "PHAR" + chiffrealeatoire + DateTime.Now.ToString("ddMMyyHHmmss"); // var path = Path.Combine(Server.MapPath("/MALDFGASSURANCE/Fichier/FichierPharmacie"), nomdufichier); // } // catch (DirectoryNotFoundException ex) // { // return false; // } // } // } // return false; //} } }