public VolViewModel() { //On tente une connexion à la base de données, sinon on retourne un message d'erreur. try { int lastId = lastId = VolDAL.GetLastId(); Vol Vol = new Vol(lastId, 0, 0, 0, Convert.ToDateTime("01/01/2001 00:00:01"), Convert.ToDateTime("01/01/2001 00:00:01"), Convert.ToDateTime("02/02/2001 00:00:01"), Convert.ToDateTime("02/02/2001 00:00:01"), Convert.ToDecimal(00.00), Convert.ToDecimal(00.00), Convert.ToDecimal(00.00)); } catch { MessageBox.Show("Une erreur est survenue\nERREUR: Impossible de récupérer le dernier ID dans la base de données."); } try { ListeVols = new ObservableCollection <Vol>(); VolDAL.SelectVol(ListeVols); ListeAvions = new ObservableCollection <Avion>(); AvionDAL.SelectAvion(ListeAvions); ListeAeroportsDepart = new ObservableCollection <Aeroport>(); AeroportDAL.SelectAeroport(ListeAeroportsDepart); ListeAeroportsArrivee = new ObservableCollection <Aeroport>(); AeroportDAL.SelectAeroport(ListeAeroportsArrivee); } catch { MessageBox.Show("Une erreur est survenue\nERREUR: Impossible de récupérer la table [Vol] \nVérifiez la connexion à la base de données."); } }
private void BtnAddVol_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(LDTrajets.Text) || String.IsNullOrEmpty(LDAvion.Text) || String.IsNullOrEmpty(getDateD.Text) || String.IsNullOrEmpty(getDateA.Text) || String.IsNullOrEmpty(getHeureD.Text) || String.IsNullOrEmpty(getHeureA.Text)) { MessageBox.Show("Veuillez remplir tous les champs !"); } else { Vol UnVol = new Vol(); Avion RecupAvion = LDAvion.SelectedItem as Avion; UnVol.Nom_Trajet = LDTrajets.Text; UnVol.Id_Avion = RecupAvion.Id_Avion; UnVol.Date_Depart = getDateD.Text = getDateD.SelectedDate.Value.ToString("yyyy/MM/dd").Replace("/", "-"); UnVol.Date_Arrive = getDateA.Text = getDateA.SelectedDate.Value.ToString("yyyy/MM/dd").Replace("/", "-"); UnVol.Heure_Depart = getHeureD.Text = getHeureD.SelectedTime.Value.ToString("HH:mm:ss"); UnVol.Heure_Arrive = getHeureA.Text = getHeureA.SelectedTime.Value.ToString("HH:mm:ss"); VolDAL AjoutVol = new VolDAL(); AjoutVol.AjouterVol(UnVol); this.NavigationService.Navigate(new GestionVol()); } }
public ActionResult ProcedureProgrammer(string noVol, string date, string heure, string dureeVol) { Vol vol = new Vol(); vol.ProcedureDepartVol(noVol, date, heure, dureeVol); return(Json(new { Response = "Success" })); }
private Vol LoadImage(OpenFileDialog ofd) { Image image = Bitmap.FromFile(ofd.FileName); ImageToPredict.Image = image; var x = new Vol(224, 224, 3, 0.0f); Bitmap bmp = ResizeImage(ImageToPredict.Image, 224, 224); for (int i = 0; i < bmp.Width; i++) { for (int j = 0; j < bmp.Height; j++) { Color clr = bmp.GetPixel(i, j); //VGG16 required normalization float red = clr.R - 123.68f; float green = clr.G - 116.779f; float blue = clr.B - 103.939f; x.Set(i, j, 0, red); x.Set(i, j, 1, green); x.Set(i, j, 2, blue); } } return(x); }
public async Task <bool> EditVol(Vol vol) { bool isUpdateSuccess = false; try { var aeroportDepart = _context.Aeroports.FirstOrDefault(x => x.Id == vol.AeroportDepart.Id); var aeroportArrive = _context.Aeroports.FirstOrDefault(x => x.Id == vol.AeroportArrivee.Id); var avion = _context.Avions.FirstOrDefault(x => x.Id == vol.Avion.Id); vol.AeroportDepart = aeroportDepart; vol.AeroportArrivee = aeroportArrive; vol.Avion = avion; _context.Update(vol); await _context.SaveChangesAsync(); isUpdateSuccess = true; } catch (DbUpdateConcurrencyException) { //Add serilog for best Log exception if (!VolExists(vol.Id)) { isUpdateSuccess = false; } } return(isUpdateSuccess); }
public async Task <ActionResult <Vol> > PostVol(Vol vol) { _context.Vols.Add(vol); await _context.SaveChangesAsync(); return(CreatedAtAction("GetVol", new { id = vol.VolId }, vol)); }
public async Task<IHttpActionResult> PutVol(int id, Vol vol) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != vol.Id) { return BadRequest("valeur fausse"); } db.Entry<Vol>(vol).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VolExists(id)) { return NotFound(); } else { throw; } } return Ok(vol); }
public async Task <IActionResult> PutVol(int id, Vol vol) { if (id != vol.VolId) { return(BadRequest()); } _context.Entry(vol).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VolExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Edit(int?id, Vol vol) { if (id != vol.Id) { return(NotFound()); } foreach (var key in ModelState.Keys) { if (key.Split('.').Length >= 2) { ModelState[key].Errors.Clear(); ModelState[key].ValidationState = ModelValidationState.Valid; } } if (ModelState.IsValid) { if (await _volService.EditVol(vol)) { return(RedirectToAction(nameof(Index))); } } return(View(vol)); }
public string GetVols(string jour, string typevol) { DataSet t = VolDAO.FetchByType(typevol, jour); List <Vol> liste = Vol.LoadFromDataSet(t); string json = JsonConvert.SerializeObject(liste); return(json); }
public ActionResult DeleteConfirmed(int id) { Vol vol = db.vols.Find(id); db.vols.Remove(vol); db.SaveChanges(); return(RedirectToAction("Index")); }
private void sliderVerb_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { try { Vol.Invoke(sender, e); } catch { } }
// GET: Vol/Edit/5 public ActionResult Edit(int id, Vol volToEdit) { var listVol = GetVols(); return(View(listVol.Where(v => v.id == id).FirstOrDefault())); //return View(); }
//Fonction permettant de modifier un vol public void ModifierVol(Vol UnVol) { try { //Je récupère l'id du Trajet bdd.connection.Open(); MySqlCommand cmd = bdd.connection.CreateCommand(); cmd.CommandText = "SELECT id_Trajet FROM trajet WHERE nom_Trajet = @nomTrajet"; cmd.Parameters.AddWithValue("@nomTrajet", UnVol.Nom_Trajet); cmd.ExecuteNonQuery(); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { this.idTrajet = Convert.ToInt32(reader["id_Trajet"]); } reader.Close(); /* * MySqlCommand cmd3 = bdd.connection.CreateCommand(); * cmd3.CommandText = "SELECT id_Avion FROM avion join modele on avion.id_Modele = modele.id_Modele where modele.Libelle = @nomModele LIMIT 1"; * cmd3.Parameters.AddWithValue("@nomModele", UnVol.Modele_Avion); * cmd3.ExecuteNonQuery(); * MySqlDataReader reader3 = cmd3.ExecuteReader(); * while (reader3.Read()) * { * this.idAvion = Convert.ToInt32(reader3["id_Avion"]); * } * reader3.Close(); */ //J'insère en BDD MySqlCommand cmd4 = bdd.connection.CreateCommand(); cmd4.CommandText = "UPDATE vol set id_Trajet = @idTrajet, " + "id_Avion = @idAvion, " + "date_Depart = @dateD, " + "date_Arrive = @dateA, " + "heure_Depart = @heureD, " + "heure_Arrive = @heureA " + "WHERE id_Vol = @idVol"; cmd4.Parameters.AddWithValue("@idTrajet", this.idTrajet); cmd4.Parameters.AddWithValue("@idAvion", UnVol.Id_Avion); cmd4.Parameters.AddWithValue("@dateD", UnVol.Date_Depart); cmd4.Parameters.AddWithValue("@dateA", UnVol.Date_Arrive); cmd4.Parameters.AddWithValue("@heureD", UnVol.Heure_Depart); cmd4.Parameters.AddWithValue("@heureA", UnVol.Heure_Arrive); cmd4.Parameters.AddWithValue("@idVol", UnVol.Id_Du_Vol); cmd4.ExecuteNonQuery(); bdd.connection.Close(); } catch { } }
public Source() { Name = ""; Clip = new AudioClip[1]; Loop = false; ResetTime = true; Volume = new Vol(); Pitch = new AudioPitch(); }
public static VolunteerEntity toVolunteerEntity(this Vol vol) { return(new VolunteerEntity() { Id = vol.VolOwnId, Name = vol.VolNam, Surname = vol.VolSur, }); }
public void Post([FromBody] int hotelId, [FromBody] int volId, [FromBody] string nom, [FromBody] string prenom) { var volById = Vol.GetVolById(volId); var hotelById = Hotel.GetHotelById(hotelId); var voyage = new Voyage(volById, hotelById); voyage.nom = nom; voyage.prenom = prenom; FileReservation.EcrireFile(voyage); }
private void addVol(Vol newVol) { int newVolId = GetVols().OrderByDescending(v => v.id).First().id + 1; var newVolLine = "\r\n" + newVolId + "|" + newVol.name + "|" + newVol.aereport_Dep + "|" + newVol.coordonneesGPS_Dep + "|" + newVol.aereport_Des + "|" + newVol.coordonneesGPS_Des + "|" + newVol.consomation_Avion + "|" + newVol.effort_decolage; var filePath = HttpContext.Server.MapPath(@"~/App_Data/VolData.csv"); var oldFileText = System.IO.File.ReadAllText(filePath); var newFileText = oldFileText + newVolLine; System.IO.File.WriteAllText(filePath, newFileText); }
public async Task<IHttpActionResult> GetVol(int id) { Vol vol = await db.Vols.FindAsync(id); if (vol == null) { return NotFound(); } return Ok(vol); }
public ActionResult Edit([Bind(Include = "VolId,nomVol,siegePremiereClasse,siegeBusinessclass,siegeEconomyclass")] Vol vol) { if (ModelState.IsValid) { db.Entry(vol).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vol)); }
public void ExcelObjectCreation() { ObjHandle obj = new Vol(); object[,] range = new object[0, 0]; obj.Create("C", range); Assert.AreEqual("C:0", obj.ToStringWithCounter()); Assert.AreEqual("C", obj.ToString()); obj.FinishMod(); Assert.AreEqual("C:1", obj.ToStringWithCounter()); }
public void ExcelObjectCreation() { ExcelObject obj = new Vol(); object[,] range = new object[0, 0]; obj.CreateObject("C", range); Assert.AreEqual(obj.GetNameCounter(), "C:0"); Assert.AreEqual(obj.GetName(), "C"); obj.FinishMod(); Assert.AreEqual(obj.GetNameCounter(), "C:1"); }
private void cb_numero_SelectedIndexChanged(object sender, EventArgs e) { ov = DeclarationsGlobales.vols[cb_numero.SelectedIndex]; cb_pilote.SelectedItem = ov.Vpilote.Nom; cb_avion.SelectedItem = ov.Vavion.Numero.ToString() + " " + ov.Vavion.Marque.ToString() + " " + ov.Vavion.Type.ToString(); dateVol.Value = ov.DateVol; cb_villeDep.Text = ov.VilleDepart; cb_villeArr.Text = ov.VilleArrivee; txt_nbrVoy.Text = ov.NbrVoyageur.ToString(); txt_PrixBillet.Text = ov.PrixBillet.ToString(); }
public ActionResult Create([Bind(Include = "VolId,nomVol,siegePremiereClasse,siegeBusinessclass,siegeEconomyclass")] Vol vol) { if (ModelState.IsValid) { db.vols.Add(vol); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vol)); }
private void bt_valider_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled)) //Pour vérifier la validation de tous les controles { Pilote op = DeclarationsGlobales.pilotes[cb_pilote.SelectedIndex]; Avion oa = DeclarationsGlobales.avions[cb_avion.SelectedIndex]; ov = new Vol(op, oa, dateVol.Value, cb_villeDep.Text, cb_villeArr.Text, int.Parse(txt_nbrVoy.Text), int.Parse(txt_PrixBillet.Text)); DeclarationsGlobales.vols.Add(ov); MessageBox.Show("Ajout Réussit ", "Nouveau Vol", MessageBoxButtons.OK, MessageBoxIcon.Information); DeclarationsGlobales.viderTextBox(this); } }
public async Task<IHttpActionResult> PostVol(Vol vol) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Vols.Add(vol); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = vol.Id }, vol); }
private void LearnStep(Trainer trainer) { var batches_per_iteration = 100; var mod_skip_draw = 100; var smooth_loss = -1.0; var p = image; var W = (float)(CurrentImage.Width); var H = (float)(CurrentImage.Height); var loss = 0.0; var lossi = 0.0; var N = batches_per_iteration; Random random = new Random(); var v = new Vol(1, 1, 2, 0); for (var iters = 0; iters < trainer.batch_size; iters++) { for (var i = 0; i < N; i++) { // sample a coordinate var x = random.Next(0, CurrentImage.Width - 1); var y = random.Next(0, CurrentImage.Height - 1); var ix = (int)((W * y) + x) * 3; float[] r = new float[] { p[ix] / 255.0f, p[ix + 1] / 255.0f, p[ix + 2] / 255.0f }; // r g b v.W[0] = (x - W / 2) / W; v.W[1] = (y - H / 2) / H; var stats = trainer.Train(v, r); loss += stats.loss; lossi += 1; } } // label1.Text = loss.ToString(); loss /= lossi; if (counter == 0) { smooth_loss = loss; } else { smooth_loss = 0.99 * smooth_loss + 0.01 * loss; } this.Invoke(new DrawImageFunction(() => { ItLabel.Text = counter.ToString(); LossLabel.Text = smooth_loss.ToString(); })); }
public ActionResult Create(FormCollection collection, Vol newVol) { try { // TODO: Add insert logic here addVol(newVol); return(RedirectToAction("Index")); } catch { return(View()); } }
public static Vol ToVol(this VolunteerEntity volunteer, Vol vol = null) { if (vol == null) { vol = new Vol(); } vol.VolOwnId = volunteer.Id; vol.VolNam = volunteer.Name; vol.VolSur = volunteer.Surname; return(vol); }
public async Task<IHttpActionResult> DeleteVol(int id) { Vol vol = await db.Vols.FindAsync(id); if (vol == null) { return NotFound(); } db.Vols.Remove(vol); await db.SaveChangesAsync(); return Ok(vol); }
public JsonMtGOX() { high = new High(); low = new Low(); avg = new Avg(); vwap = new Vwap(); vol = new Vol(); lastlocal = new LastLocal(); lastorig = new LastOrig(); lastall = new LastAll(); last = new Last(); buy = new Buy(); sell = new Sell(); rootobject = new RootObject(); returnObject = new Return(); }
/// <summary> /// processaTRANSP /// </summary> /// <param name="nodeinfNFe"></param> private void processaTRANSP(XmlNode nodeinfNFe) { foreach (XmlNode noder in nodeinfNFe.ChildNodes) { switch (noder.LocalName.ToLower()) { case "modfrete": nfe.Transp.modFrete = (TpcnModalidadeFrete)this.readInt32(noder, TpcnResources.modFrete); break; case "transporta": { nfe.Transp.Transporta.CNPJ = this.readValue(noder, TpcnResources.CNPJ); nfe.Transp.Transporta.CPF = this.readValue(noder, TpcnResources.CPF); nfe.Transp.Transporta.xNome = this.readValue(noder, TpcnResources.xNome); nfe.Transp.Transporta.IE = this.readValue(noder, TpcnResources.IE); nfe.Transp.Transporta.xEnder = this.readValue(noder, TpcnResources.xEnder); nfe.Transp.Transporta.xMun = this.readValue(noder, TpcnResources.xMun); nfe.Transp.Transporta.UF = this.readValue(noder, TpcnResources.UF); } break; case "rettransp": { nfe.Transp.retTransp.vServ = this.readDouble(noder, TpcnResources.vServ); nfe.Transp.retTransp.vBCRet = this.readDouble(noder, TpcnResources.vBCRet); nfe.Transp.retTransp.pICMSRet = this.readDouble(noder, TpcnResources.pICMSRet); nfe.Transp.retTransp.vICMSRet = this.readDouble(noder, TpcnResources.vICMSRet); nfe.Transp.retTransp.CFOP = this.readValue(noder, TpcnResources.CFOP); nfe.Transp.retTransp.cMunFG = this.readInt32(noder, TpcnResources.cMunFG); } break; case "veictransp": { nfe.Transp.veicTransp.placa = this.readValue(noder, TpcnResources.placa); nfe.Transp.veicTransp.UF = this.readValue(noder, TpcnResources.UF); nfe.Transp.veicTransp.RNTC = this.readValue(noder, TpcnResources.RNTC); } break; case "reboque": { Reboque reboqueInfo = new Reboque(); reboqueInfo.placa = this.readValue(noder, TpcnResources.placa); reboqueInfo.UF = this.readValue(noder, TpcnResources.UF); reboqueInfo.RNTC = this.readValue(noder, TpcnResources.RNTC); nfe.Transp.Reboque.Add(reboqueInfo); } break; case "vol": { Vol volInfo = new Vol(); volInfo.qVol = this.readInt32(noder, TpcnResources.qVol); volInfo.esp = this.readValue(noder, TpcnResources.esp); volInfo.marca = this.readValue(noder, TpcnResources.marca); volInfo.nVol = this.readValue(noder, TpcnResources.nVol); volInfo.pesoL = this.readDouble(noder, TpcnResources.pesoL); volInfo.pesoB = this.readDouble(noder, TpcnResources.pesoB); foreach (XmlNode nodevollacre in ((XmlElement)noder).GetElementsByTagName("lacres")) { Lacres lacresInfo = new Lacres(); lacresInfo.nLacre = this.readValue(nodevollacre, TpcnResources.nLacre); volInfo.Lacres.Add(lacresInfo); } nfe.Transp.Vol.Add(volInfo); } break; case "vagao": nfe.Transp.vagao = this.readValue(noder, TpcnResources.vagao); break; case "balsa": nfe.Transp.balsa = this.readValue(noder, TpcnResources.balsa); break; } } }