/// <summary> /// /// </summary> /// <param name="firstAndLastName"></param> /// <returns></returns> public static Student GetStudentByFullName(string firstAndLastName) { using (var db = new Ef()) { return(db.Student.SingleOrDefault(s => s.FirstName + s.LastName == firstAndLastName)); } }
/// <summary> /// Renvoi la List de Tous les Annee Scolaires /// </summary> /// <returns>Une Dictionaire</returns> public Dictionary <string, string> GetAllAnneeScolaires() { using (var db = new Ef()) { return(db.AnneeScolaire.OrderBy(a => a.DateDebut).ToDictionary(a => a.Name, a => a.AnneeScolaireGuid.ToString())); } }
private static Guid GetCoursAnneeScolaireGuid(Guid coursGuid) { using (var db = new Ef()) { return(db.PeriodeScolaire.Find(db.Cours.Find(coursGuid).PeriodeScolaireGuid)?.AnneeScolaireGuid ?? GetCurrentAnneeScolaireGuid); } }
private void GetCLASSES_COUNT() { using (var db = new Ef()) { ClassesCount = db.Classe.Count(c => c.FiliereGuid == FiliereGuid); } }
/// <summary> /// /// </summary> /// <param name="inscriptionGuid"></param> /// <returns></returns> public Inscription GetInscriptionById(Guid inscriptionGuid) { using (var db = new Ef()) { return(db.Inscription.Find(inscriptionGuid)); } }
/// <summary> /// Renvoi les matieres Enregistrees pour cette classe /// </summary> /// <param name="classeId"></param> /// <returns></returns> public List <Matiere> GetClassMatieres(Guid classeId) { using (var db = new Ef()) { return(db.Matiere.Where(m => m.ClasseGuid == classeId).ToList()); } }
/// <summary> /// /// </summary> /// <returns></returns> public List <Classe> GetAllClasse() { using (var db = new Ef()) { return(db.Classe.ToList()); } }
private void GetSTAFF_COUNT( ) { using (var db = new Ef()) { StaffCount = string.IsNullOrEmpty(DepartementName) ? db.Staff.Count(s => string.IsNullOrEmpty(s.Departement)) : db.Staff.Count(s => s.Departement == DepartementName); } }
/// <summary> /// /// </summary> /// <param name="depName"></param> /// <returns></returns> public List <Staff> GetDepStaffs(string depName = null) { using (var db = new Ef()) { return(depName == null?db.Staff.Where(s => string.IsNullOrEmpty(s.Departement)).OrderBy(s => s.LastName).ToList() : db.Staff.Where(s => s.Departement == depName).OrderBy(s => s.LastName).ToList()); } }
/// <summary> /// Modifier Un Parametre /// </summary> /// <returns></returns> public bool SetSetting(Guid userProfileId, Settings mySetting, string newValue) { using (var db = new Ef()) { //var firstOrDefault = db.Setting.FirstOrDefault(s => s.UserProfileId == userProfileId && s.SettingNum == (int)mySetting); //if (firstOrDefault != null) //{ // firstOrDefault.SettingValue = newValue; //} //else //{ // var newSetting = new Setting // { // SettingId = Guid.NewGuid(), // UserProfileId = userProfileId, // SettingNum = (int)mySetting, // SettingValue = newValue // }; // AddSetting(newSetting); //} return(db.SaveChanges() > 0); } }
/// <summary> /// Retourne les Informations d'une Journee Avec la liste de ses Cours /// </summary> /// <param name="classId">ID de la Classe</param> /// <param name="scheduleDate"> Date De la Journee</param> public DayCoursCards(Guid classId, DateTime scheduleDate) { DayCours = new List <CoursCard> (); DayName = scheduleDate.DayOfWeek.ToString().ToUpper(); DayColor = scheduleDate == DateTime.Today ? "Green" : "#25A0DA"; // "Beige"; //"#25A0DA"; DayDate = scheduleDate; using (var db = new Ef()) { var myCours = db.Cours.Where(c => c.ClasseGuid == classId && c.StartDate <= scheduleDate && c.EndDate >= scheduleDate).OrderBy(c => c.StartTime); foreach (var cr in myCours) { var dayNum = (int)scheduleDate.DayOfWeek; if (cr.RecurrenceDays.Contains(dayNum.ToString())) { DayCours.Add(new CoursCard(cr, scheduleDate)); } } } }
/// <summary> /// /// </summary> /// <returns></returns> public List <Matiere> GetAllMatieres() { using (var db = new Ef()) { return(db.Matiere.ToList()); } }
/// <summary> /// /// </summary> /// <param name="matiereId"></param> /// <returns></returns> public bool MatiereExist(Guid matiereId) { using (var db = new Ef()) { return(db.Matiere.Find(matiereId) != null); } }
/// <summary> /// /// </summary> /// <returns></returns> public IEnumerable GetAllMatieresNames() { using (var db = new Ef()) { return(db.Matiere.Select(m => m.Name).ToList()); } }
/// <summary> /// /// </summary> /// <param name="classeId"></param> /// <returns></returns> public string GetClasseName(Guid classeId) { using (var db = new Ef()) { return(db.Classe.Find(classeId).Name); } }
/// <summary> /// /// </summary> /// <param name="staffGuid"></param> /// <returns></returns> public string GetStaffFullName(Guid staffGuid) { using (var db = new Ef()) { return(db.Staff.Find(staffGuid).FullName); } }
/// <summary> /// /// </summary> /// <param name="classeId"></param> /// <returns></returns> public bool ClasseExist(string classeId) { using (var db = new Ef()) { return(db.Classe.Find(classeId) != null); } }
/// <summary> /// /// </summary> /// <param name="staffId"></param> /// <returns></returns> public string GetStaffFullName(string staffId) { using (var db = new Ef()) { return(db.Staff.First(s => s.StaffId == staffId).FullName); } }
/// <summary> /// /// </summary> /// <param name="classeId"></param> /// <returns></returns> public Classe GetClasseById(Guid classeId) { using (var db = new Ef()) { return(db.Classe.Find(classeId)); } }
/// <summary> /// /// </summary> /// <param name="staffId"></param> /// <returns></returns> public bool StaffIdExist(string staffId) { using (var db = new Ef()) { return(db.Staff.Any(s => s.StaffId == staffId)); } }
/// <summary> /// Return La Valeur du Paramettre System /// </summary> /// <param name="systemSetting"></param> /// <returns></returns> public object GetMatrixSetting(MatrixSettings systemSetting) { using (var db = new Ef()) { if (db.SystemSetting.Find(MatrixConstants.SystemGuid()) == null) { db.SystemSetting.Add(new MatrixSetting()); } switch (systemSetting) { case MatrixSettings.CurrentAnneeScolaire: return(db.SystemSetting.Find(MatrixConstants.SystemGuid()).CurrentAnneeScolaireGuid); case MatrixSettings.CurrentPerodeScolaire: return(db.SystemSetting.Find(MatrixConstants.SystemGuid()).CurrentPeriodeScolaireGuid); case MatrixSettings.EtablissementName: return(db.SystemSetting.Find(MatrixConstants.SystemGuid()).EtablissementName); case MatrixSettings.EtablissementFax: return(db.SystemSetting.Find(MatrixConstants.SystemGuid()).EtablissementFax); case MatrixSettings.EtablissementLogo: return(db.SystemSetting.Find(MatrixConstants.SystemGuid()).EtablissementLogo); default: return(null); } } }
/// <summary> /// /// </summary> /// <param name="staffGuid"></param> /// <returns></returns> public Staff GetStaffByGuid(Guid staffGuid) { using (var db = new Ef()) { return(db.Staff.Find(staffGuid)); } }
/// <summary> /// Verifier si ce ID est Deja Utilisee /// </summary> /// <param name="insId"></param> /// <returns></returns> public bool InscExist(string insId) { using (var db = new Ef()) { return(db.Inscription.Any(i => i.InscriptionId == insId)); } }
/// <summary> /// /// </summary> /// <returns></returns> public List <Staff> GetAllStaffs() { using (var db = new Ef()) { return(db.Staff.ToList()); } }
/// <summary> /// Return true si l'Etudiant est Inscrit /// </summary> /// <returns>True or False</returns> public bool IsStudentInsc(Guid studentGuid, Guid currentAnneeScolaireGuid) { using (var db = new Ef()) { return(db.Inscription.Any(i => i.AnneeScolaireGuid == currentAnneeScolaireGuid && i.StudentGuid == studentGuid)); } }
private void ResolveData(DateTime coursDay, Guid matiereGuid, Guid staffGuid) { using (var db = new Ef()) { var m = db.Matiere.Find(matiereGuid); MatiereName = m.Name.Substring(0, 1).ToUpper() + m.Name.Substring(1).ToLower(); Couleur = m.Couleur; StaffFullName = db.Staff.Find(staffGuid).FullName; } if (coursDay < DateTime.Today) { ForeColor = "Gray"; } else if (coursDay == DateTime.Today) { if (EndTime < DateTime.Now.TimeOfDay) { ForeColor = "Gray"; } if (StartTime <= DateTime.Now.TimeOfDay && EndTime >= DateTime.Now.TimeOfDay) { ForeColor = "Red"; } } }
private static Guid GetCoursStaffGuid(Guid coursGuid) { using (var db = new Ef()) { return(db.Cours.Find(coursGuid).StaffGuid); } }
/// <summary> /// Constructeur /// </summary> public StudentCard(Student currentStudent, AnneeScolaire currentAnneeScolaire) { StudentGuid = currentStudent.StudentGuid; Title = currentStudent.Title; Firstname = currentStudent.FirstName; Lastname = currentStudent.LastName; PhotoIdentity = currentStudent.PhotoIdentity; PhoneNumber = currentStudent.PhoneNumber; EmailAdress = currentStudent.EmailAdress; HomeAdress = currentStudent.HomeAdress; using (var db = new Ef()) { var currentInscription = db.Inscription.First(i => i.AnneeScolaireGuid == currentAnneeScolaire.AnneeScolaireGuid); if (currentInscription != null) { var currentClasse = db.Classe.Find(currentInscription.ClasseGuid); CurrentClasseLevel = currentClasse.Name; CurrentFiliere = db.Filiere.Find(currentClasse.FiliereGuid).Name; } else { CurrentClasseLevel = "Non Inscrit"; CurrentFiliere = "Non Inscrit"; } } }
private static Matiere GetMatiereById(Guid matiereId) { using (var db = new Ef()) { return(db.Matiere.Find(matiereId)); } }
/// <summary> /// /// </summary> /// <param name="studentGuid"></param> /// <returns></returns> public Student GetStudentByGuid(Guid studentGuid) { using (var db = new Ef()) { return(db.Student.Find(studentGuid)); } }