예제 #1
0
        public void CreateEcole(Ecole oldEcole, Ecole newEcole)
        {
            string filename = null;

            if (!string.IsNullOrEmpty(newEcole.Logo))
            {
                string ext = Path.GetExtension(newEcole.Logo);
                filename = Guid.NewGuid().ToString() + ext;
                FileInfo fileSource = new FileInfo(newEcole.Logo);
                string   filePath   = Path.Combine(dbFolder, "logo", filename);
                FileInfo fileDest   = new FileInfo(filePath);
                if (!fileDest.Directory.Exists)
                {
                    fileDest.Directory.Create();
                }
                fileSource.CopyTo(fileDest.FullName);
            }
            newEcole.Logo = filename;
            //ecoleRepo.Add(newEcole);

            if (!string.IsNullOrEmpty(oldEcole.Logo))
            {
                File.Delete(oldEcole.Logo);
            }
        }
예제 #2
0
 public void Add(Ecole company)
 {
     using (StreamWriter sw = new StreamWriter(file.FullName, false))
     {
         string json = JsonConvert.SerializeObject(company);
         sw.WriteLine(json);
     }
 }
예제 #3
0
 public void Add(Ecole ecole)
 {
     var index = ecoles.IndexOf(ecole);
     if (index >= 0)
         throw new DuplicateNameException("This school reference already exists !");
     ecoles.Add(ecole);
     Save();
 }
예제 #4
0
        public void Add(Ecole ecole)
        {
            var index = ecoles.IndexOf(ecole);

            if (index >= 0)
            {
                throw new DuplicateNameException("This student matricule already exists !");
            }
            ecoles.Add(ecole);
            Save();
        }
예제 #5
0
        public void Add(Ecole ecole)
        {
            var index = ecoles.IndexOf(ecole);

            if (index >= 0)
            {
                throw new DuplicateNameException("l'ecole existe deja");
            }
            ecoles.Add(ecole);
            Save();
        }
예제 #6
0
 public void Set(Ecole oldEcole, Ecole newEcole)
 {
     var oldIndex = ecoles.IndexOf(oldEcole);
     var newIndex = ecoles.IndexOf(newEcole);
     if (oldIndex < 0)
         throw new KeyNotFoundException("The school doesn't exists !");
     if (newIndex >= 0 && oldIndex != newIndex)
         throw new DuplicateNameException("This school reference already exists !");
     ecoles[oldIndex] = newEcole;
     Save();
 }
예제 #7
0
        public Ecole GetEcole()
        {
            Ecole ecole = ecoleRepo.Get();

            if (ecole != null)
            {
                if (!string.IsNullOrEmpty(ecole.Logo))
                {
                    ecole.Logo = Path.Combine(dbFolder, "logo", ecole.Logo);
                }
            }
            return(ecole);
        }
예제 #8
0
파일: EcoleBLO.cs 프로젝트: emmambang/CC01
        public Ecole GetEcole()
        {
            Ecole ecole = ecoleRepo.Get();

            if (ecole != null)
            {
                if (!string.IsNullOrEmpty(ecole.Logo.ToString()))
                {
                    ecole.Logo = new byte[] { Byte.Parse(Path.Combine(dbFolder, "logo", ecole.Logo.ToString())) }
                }
            }
            ;
            return(ecole);
        }
예제 #9
0
        public void Set(Ecole oldecole, Ecole newecole)
        {
            var oldindex = ecoles.IndexOf(oldecole);
            var newindex = ecoles.IndexOf(newecole);

            if (oldindex < 0)
            {
                throw new KeyNotFoundException("l'ecole existe deja ");
            }
            if (newindex >= 0 && oldindex != newindex)
            {
                throw new DuplicateNameException("le email existe deja");
            }
            ecoles[oldindex] = newecole;
            Save();
        }
예제 #10
0
        public void Set(Ecole oldEcole, Ecole newEcole)
        {
            var oldIndex = ecoles.IndexOf(oldEcole);
            var newIndex = ecoles.IndexOf(newEcole);

            if (oldIndex < 0)
            {
                throw new KeyNotFoundException("School name doesn't exists !");
            }

            if (newIndex > 0 && newIndex != oldIndex)
            {
                throw new DuplicateNameException("this school already exists !");
            }

            ecoles[oldIndex] = newEcole;
            Save();
        }
예제 #11
0
 public EcoleDAO(string dbFolder)
 {
     this.dbFolder = dbFolder;
     file          = new FileInfo(Path.Combine(this.dbFolder, FILE_NAME));
     if (!file.Directory.Exists)
     {
         file.Directory.Create();
     }
     if (!file.Exists)
     {
         file.Create().Close();
         file.Refresh();
     }
     if (file.Length > 0)
     {
         using (StreamReader sr = new StreamReader(file.FullName))
         {
             string json = sr.ReadToEnd();
             ecole = JsonConvert.DeserializeObject <Ecole>(json);
         }
     }
 }
예제 #12
0
 public void Remove(Ecole ecole)
 {
     ecoles.Remove(ecole);
     Save();
 }
예제 #13
0
 public void Remove(Ecole ecole)
 {
     ecoles.Remove(ecole);// basé sur la méthode equals de product ie product.equal
     Save();
 }
예제 #14
0
 public void DeleteEcole(Ecole ecole)
 {
 }
예제 #15
0
 public void Remove(Ecole ecole)
 {
     ecoles.Remove(ecole);//base sur Product.Equals redefini
     Save();
 }
예제 #16
0
파일: Ecole.DAO.cs 프로젝트: MANIASSON/CC01
 public void Remove(Ecole ecole)
 {
     EcoleDAO.ecoles.Remove(ecole);
     Save();
 }