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); } }
public void Add(Ecole company) { using (StreamWriter sw = new StreamWriter(file.FullName, false)) { string json = JsonConvert.SerializeObject(company); sw.WriteLine(json); } }
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(); }
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(); }
public void Add(Ecole ecole) { var index = ecoles.IndexOf(ecole); if (index >= 0) { throw new DuplicateNameException("l'ecole existe deja"); } ecoles.Add(ecole); Save(); }
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(); }
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); }
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); }
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(); }
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(); }
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); } } }
public void Remove(Ecole ecole) { ecoles.Remove(ecole); Save(); }
public void Remove(Ecole ecole) { ecoles.Remove(ecole);// basé sur la méthode equals de product ie product.equal Save(); }
public void DeleteEcole(Ecole ecole) { }
public void Remove(Ecole ecole) { ecoles.Remove(ecole);//base sur Product.Equals redefini Save(); }
public void Remove(Ecole ecole) { EcoleDAO.ecoles.Remove(ecole); Save(); }