// GET: PDCAs public ActionResult Index() { List <PDCA> temp = ServicePDCA.GetPDCAByPilote(User.Identity.Name); ApplicationUser user = ServiceUser.getUserWD(User.Identity.Name); Zone zone = ServiceZone.GetZoneBypliote(user.pilote); //checking if pilote already asked for a certifcation Semaine semaine = ServiceSemaine.getLastSemaineWD(); bool certificationasked = false; List <Audit> auditscertif = semaine.audits.Where(a => a.TypeAudit.Equals("Certification")).ToList <Audit>(); foreach (var item in auditscertif) { if (item.zone.PiloteZoneObli.PiloteId == user.pilote.PiloteId) { certificationasked = true; } if (item.zone.PiloteZoneOpti != null) { if (item.zone.PiloteZoneOpti.PiloteId == user.pilote.PiloteId) { certificationasked = true; } } } PilotepdcaViewModel PPVM = new PilotepdcaViewModel { pdcas = temp, zone = zone, pilote = user.pilote, certificationasked = certificationasked }; return(View(PPVM)); }
public Semaine GetLast() { var query = (from c in context.Semaines select c).ToList <Semaine>(); Semaine latest = query.MaxBy(s => s.SemaineId); return(latest); }
public ActionResult SemaineAdd(Semaine s) { if (ModelState.IsValid) { var sem = new Semaine(); sem.SemaineId = s.SemaineId; sem.libelle = s.libelle; sem.DateDebut = s.DateDebut; sem.DateFin = s.DateFin; if (s.SemaineId == 0) { serv.create(sem); } else { var sema = serv.getById(s.SemaineId); sema.libelle = s.libelle; sema.DateDebut = s.DateDebut; sema.DateFin = s.DateFin; serv.update(sem); } } return(View("Index")); }
private void Bt_prveviou_Click(object sender, EventArgs e) { semaine = semaine.GetPreviou(); TextView_semaine.Text = semaine.NumSemaine.ToString(); _NameFile = _PathFile.Replace("_SEM_", semaine.NumSemaine.ToString()); historique = new Historique(_NameFile); ListView_historique.Adapter = new Course_Adaptater(this, historique); }
public Historique(Semaine sem) { var namefilehistosem = NAMEFILE_HISTORIQUE.Replace("_SEM_", sem.NumSemaine.ToString()); NameFile = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), namefilehistosem); Sem = sem; load(); ToFiche(); }
static public void updateSemaine(Semaine semaine) { using (SemaineRepository semainerepo = new SemaineRepository()) { semainerepo.Update(semaine); semainerepo.Save(); semainerepo.context.Entry(semaine).State = EntityState.Detached; } }
public IList <Audit> GetLastWeekmissingauditsforUser(int auditeurid) { List <Audit> query = (from c in context.Audits select c).Include(o => o.zone).ToList <Audit>(); //Audit latest = query.MaxBy(i => i.semaine.SemaineId); Semaine latest = (from c in context.Semaines select c).FirstOrDefault <Semaine>(x => x.isCurrent == true); List <Audit> result = query.Where(item => (latest.SemaineId - 1 == item.semaine.SemaineId) && (item.auditeur.AuditeurId == auditeurid) && !item.isCompleted).ToList <Audit>(); return(result); }
// GET: Semaine public ActionResult Semaine(Semaine sem) { if (sem != null) { return(View(sem)); } else { return(View()); } }
public IList <Audit> GetLatestaudits() { List <Audit> query = (from c in context.Audits select c).Include(o => o.zone).ToList <Audit>(); if (query.Count == 0) { return(null); } // Audit latest = query.MaxBy(i => i.semaine.SemaineId); Semaine latest = (from c in context.Semaines select c).FirstOrDefault <Semaine>(x => x.isCurrent == true); List <Audit> result = (List <Audit>)query.Where(item => latest.SemaineId == item.semaine.SemaineId).ToList <Audit>(); return(result); }
void Ajouter() { try { Semaine sem = new Semaine(); int rowCount; if (idInscription == 0) { MessageBox.Show("Veuillez selectionner l'identité du membre d'abord"); } else { rowCount = dgTirage.Rows.Count; if (rowCount == 0) { idSemaine = sem.Nouveau(); num = num + 1; dgTirage.Rows.Add(num, idSemaine.ToString(), membreCombo.Text, idInscription); membreCombo.Items.Remove(membreCombo.Text); membreCombo.Text = ""; } else { idSemaine = idSemaine + 1; num = num + 1; dgTirage.Rows.Add(num, idSemaine.ToString(), membreCombo.Text, idInscription); membreCombo.Items.Remove(membreCombo.Text); membreCombo.Text = ""; } } } catch (Exception ex) { MessageBox.Show("L'erreur suivant est survenue : " + ex.Message); } }
void SaveDatas() { try { Semaine sem = new Semaine(); for (int i = 0; i < (dgTirage.Rows.Count); i++) { sem.Id = Convert.ToInt32(dgTirage[1, i].Value.ToString()); sem.RefInscrit = Convert.ToInt32(dgTirage[3, i].Value.ToString()); sem.Enregistrer(sem); } MessageBox.Show("Enregistrement reussie", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { throw; } }
//private string name = ""; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_historique); //Intent _PathFile = Intent.GetStringExtra("NameFile"); var data = Intent.GetBundleExtra("Data"); var numsem = data.GetInt("Semaine"); var numan = data.GetInt("Année"); semaine = new Semaine(numsem); _NameFile = _PathFile.Replace("_SEM_", numsem.ToString()); //historique = new Historique(_NameFile); historique = new Historique(semaine); //UI Button bt_prveviou = FindViewById <Button>(Resource.Id.button_previou); bt_prveviou.Click += Bt_prveviou_Click; bt_next = FindViewById <Button>(Resource.Id.button_next); bt_next.Click += Bt_next_Click; TextView_semaine = FindViewById <TextView>(Resource.Id.textView_Semaine); TextView_semaine.Text = semaine.NumSemaine.ToString(); //UI Barre de menu Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar_course); SetActionBar(toolbar); toolbar.InflateMenu(Resource.Menu.menu_historique); toolbar.NavigationOnClick += Toolbar_NavigationOnClick; toolbar.MenuItemClick += Toolbar_MenuItemClick; //UI liste des course ListView_historique = FindViewById <ListView>(Resource.Id.listView_course); ListView_historique.Adapter = new Course_Adaptater(this, historique); }
public void Assign() { Semaine semaineactuelle = ServiceSemaine.getLastSemaine(); if (!semaineactuelle.isCurrent) { semaineactuelle.isCurrent = true; ServiceSemaine.updateSemaine(semaineactuelle); } else { //Getting this week ready this is abdallah semaineactuelle = new Semaine(); semaineactuelle.isCurrent = true; semaineactuelle.Datedebut = DateTime.Now; semaineactuelle.Datefin = semaineactuelle.Datedebut.AddDays(6); ServiceSemaine.addSemaine(semaineactuelle); } List <Semaine> Allsemaines = ServiceSemaine.getAllsem(); Allsemaines = Allsemaines.Where(s => s.SemaineId != semaineactuelle.SemaineId).ToList(); foreach (var item in Allsemaines) { item.isCurrent = false; ServiceSemaine.updateSemaine(item); } //I'm going to get the number of "zones" and "auditeurs" //and make sure that I don't choose the same person twice //if there is an other zone to audit and there are auditeurs //that were not yet assigned to any zone //GG dude //modified by abdallah //PS!!!: if i forget to mention it directly always go through the services //see the Services folders and u will instantly get it //and encapsulate the repository inside a Using //so that the repository gets disposed of //thats very critical dude to get rid of the DbContext object //thats a nasty object man its messes every thing when it gets tangled with its own kind dude //They are Jhon Snows they are LONE WOLVES :p List <Zone> zones = ServiceZone.GetAllZones(); int numZones = zones.Count; //same here List <Auditeur> auditeurs = ServiceAuditeur.GetAllAuditeurs(); int numAuditeurs = auditeurs.Count; List <int> auditeursPris = new List <int>(numAuditeurs); for (int i = 0; i < numAuditeurs; i++) { auditeursPris.Add(0); } Random rand = new Random(); int r; int numAssignments = 0; for (int i = 0; i < numZones; i++) { if (numAssignments == numAuditeurs) { auditeursPris.Clear(); for (int j = 0; j < numAuditeurs; j++) { auditeursPris.Add(0); } numAssignments = 0; } r = rand.Next(0, numAuditeurs); while (auditeursPris[r] != 0 && numAssignments < numAuditeurs) { r = rand.Next(0, numAuditeurs); } numAssignments++; auditeursPris[r] = 1; //Adding Audits. this is abdallah Audit audittemp = new Audit(); audittemp.TypeAudit = "Regulier"; audittemp.semaine = semaineactuelle; audittemp.auditeur = auditeurs[r]; audittemp.zone = zones[i]; audittemp.AuditDay = semaineactuelle.Datedebut.AddDays(rand.Next(2, 6)); audittemp.isInProgress = false; audittemp.isCompleted = false; ServiceAudit.addAudit(audittemp); Console.WriteLine("l'auditeur " + auditeurs[r].Nom + " est affecté à la zone" + zones[i].NomZone); //Sending mail to Auditeur //ServiceEmail.sendEmail(auditeurs[r].Mail, "Information sur un prochain Audit", " La zone " + zones[i].NomZone + " sera auditée le jour J par l’auditeur " + auditeurs[r].Nom + " " + auditeurs[r].Prenom + ", merci de vous fixer l’heure de l’audit "); //sending mail To Audité aka pilote zone its not provided //ServiceEmail.sendEmail("no access to company emails", "Information sur un Audit cette semaine", " La zone " + zones[i].NomZone + " sera auditée le jour J par l’auditeur " + auditeurs[r].Nom + " " + auditeurs[r].Prenom + ", merci de vous fixer l’heure de l’audit "); } }
public static void InitialiseHoraire(Grid horaire, bool dejaFait) { DateTime dimanche = new DateTime(); for (int i = 1; i < 5; i++) { for (int c = 1; c < 9; c++) { Border temp = new Border { BorderBrush = Brushes.DarkGray, BorderThickness = new Thickness(1) }; Grid.SetColumn(temp, c); Grid.SetRow(temp, i); horaire.Children.Add(temp); } } switch (aujourdhuiP.DayOfWeek) { case DayOfWeek.Sunday: dimanche = aujourdhuiP; break; case DayOfWeek.Monday: dimanche = aujourdhuiP.AddDays(-1); break; case DayOfWeek.Tuesday: dimanche = aujourdhuiP.AddDays(-2); break; case DayOfWeek.Wednesday: dimanche = aujourdhuiP.AddDays(-3); break; case DayOfWeek.Thursday: dimanche = aujourdhuiP.AddDays(-4); break; case DayOfWeek.Friday: dimanche = aujourdhuiP.AddDays(-5); break; case DayOfWeek.Saturday: dimanche = aujourdhuiP.AddDays(-6); break; } if (dejaFait) { foreach (UIElement item in horaire.Children) { if (item is Label) { for (int i = 0; i < 7; i++) { if ((item as Label).Name == "L" + i.ToString()) { (item as Label).Content = dimanche.AddDays(i).Date.ToString("dd MMMM"); } Semaine.Add(dimanche.AddDays(i)); } } } } else { for (int i = 0; i < 7; i++) { Label temp = new Label { Content = dimanche.AddDays(i).Date.ToString("dd MMMM"), VerticalAlignment = VerticalAlignment.Bottom, Name = "L" + i.ToString() }; Grid.SetColumn(temp, i + 2); Grid.SetRow(temp, 1); Semaine.Add(dimanche.AddDays(i)); horaire.Children.Add(temp); } } }
public void Add(Semaine entity) { context.Semaines.Add(entity); }
public void Delete(Semaine entity) { context.Semaines.Remove(entity); }
public bool create(Semaine entity) { db.Semaines.Add(entity); return(db.SaveChanges() > 0); }
public void Update(Semaine entity) { context.Entry(entity).State = EntityState.Modified; }
public bool update(Semaine entity) { //var sem = db.Semaines.Where<Semaine>(x => x.SemaineId == entity.SemaineId).First(); db.SaveChanges(); return(true); }
/// <summary> /// /// </summary> /// <param name="savedInstanceState"></param> protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); CultureInfo.CurrentCulture = new CultureInfo("fr-FR"); // Initialisation dtjour = DateTime.Now.Date; semaine = new Semaine(dtjour); var s1 = NAMEFILE_HISTORIQUE.Replace("_SEM_", semaine.NumSemaine.ToString()); // backingFile_historique = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), s1); backingfile_coordonnées = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), NAMEFILE_COORDONNEES); Dialog_New_Coordonnée = new Dialog_New_Coordonnée(this, backingfile_coordonnées); // ResetHistorique(); Coordonnées_Data = new Coordonnées(backingfile_coordonnées); // xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); rootLayout = FindViewById(Resource.Id.root_layout); isGooglePlayServicesInstalled = IsGooglePlayServicesInstalled(); //UI barre de menu Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar_main); toolbar.NavigationOnClick += Toolbar_NavigationOnClick; toolbar.InflateMenu(Resource.Menu.navigation); toolbar.MenuItemClick += Toolbar_MenuItemClick; //Menu menu = FindViewById<Menu>(Resource.Id.navigation); //UI Bouton lancement de la course startandstop = FindViewById <Button>(Resource.Id.button_start); startandstop.Click += Startandstop_Click; startandstop.Text = ""; //UI Liste des étapes ListView_etapes = FindViewById <ListView>(Resource.Id.etape_listView); //UI Bonton Etape buttonetape = FindViewById <Button>(Resource.Id.button_etape); buttonetape.Click += Buttonetape_Click; //UI Date du jour datejour = FindViewById <TextView>(Resource.Id.datejour); string strdt = dtjour.ToString("dd-MM-yyyy"); datejour.Text = $"{dtjour.ToString("dddd, dd MMMM yyyy")} Sem:{semaine.NumSemaine.ToString()}"; var jour = dtjour.DayOfWeek; //ui heure textheure = FindViewById <TextView>(Resource.Id.heure); textheure.Text = dtjour.TimeOfDay.ToString(); //UI distance affichage dans fusedlocation textdistance = FindViewById <TextView>(Resource.Id.distance); //UI distance affichage dans fusedlocation textdistancecourse = FindViewById <TextView>(Resource.Id.distance_course); //UI Message textMessage = FindViewById <TextView>(Resource.Id.message); // UI to display location updates latitude2 = FindViewById <TextView>(Resource.Id.latitude2); longitude2 = FindViewById <TextView>(Resource.Id.longitude2); isRequestingLocationUpdates = false; if (isGooglePlayServicesInstalled) { locationRequest = new LocationRequest() .SetPriority(LocationRequest.PriorityHighAccuracy) .SetInterval(LOCATIONINTERVAL) .SetFastestInterval(FASTESTINTERVAL); locationCallback = new FusedLocationProviderCallback(this); fusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(this); } else { Snackbar.Make(rootLayout, Resource.String.missing_googleplayservices_terminating, Snackbar.LengthIndefinite) .SetAction(Resource.String.ok, delegate { FinishAndRemoveTask(); }) .Show(); } if (savedInstanceState != null) { var beep = 1; } InitializeBackgroundWorker(); InitialLocation(); backgroundLocation.RunWorkerAsync(numberToCompute); }