public void Ajout(Marchandise marchandise) { if (_listeMarchandise.Any(it => it.Id == marchandise.Id)) { // it already exists, do something about it. } // add fonction with duplicate check for ID }
public async Task <ActionResult> DeleteConfirmed(int id) { Marchandise marchandise = await db.Marchandises.FindAsync(id); db.Marchandises.Remove(marchandise); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "MARCH_ID,NAT_MARCH_ID,MARCH_DESC,MARCH_PDS,MARCH_QTE,MARCH_TYPE,MARCH_VALEURO,MARCH_DOUANE,MARCH_OBS")] Marchandise marchandise) { if (ModelState.IsValid) { db.Entry(marchandise).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.NAT_MARCH_ID = new SelectList(db.NatureMarchandises, "NAT_MARCH_ID", "NAT_MARCH_LIBELLE", marchandise.NAT_MARCH_ID); return(View(marchandise)); }
// GET: Marchandises/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Marchandise marchandise = await db.Marchandises.FindAsync(id); if (marchandise == null) { return(HttpNotFound()); } return(View(marchandise)); }
// GET: Marchandises/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Marchandise marchandise = await db.Marchandises.FindAsync(id); if (marchandise == null) { return(HttpNotFound()); } ViewBag.NAT_MARCH_ID = new SelectList(db.NatureMarchandises, "NAT_MARCH_ID", "NAT_MARCH_LIBELLE", marchandise.NAT_MARCH_ID); return(View(marchandise)); }
public async Task <ActionResult> Edit([Bind(Include = "MARCH_ID,NAT_MARCH_ID,MARCH_DESC,MARCH_PDS,MARCH_QTE,MARCH_TYPE,MARCH_VALEURO,MARCH_DOUANE,MARCH_OBS")] Marchandise marchandise) { try { if (ModelState.IsValid) { db.Entry(marchandise).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } } catch (RetryLimitExceededException /* dex */) { ModelState.AddModelError(" ", "Unable to save changes. Try again, and if the problem persists see your system administrator"); } ViewBag.NAT_MARCH_ID = new SelectList(db.NatureMarchandises, "NAT_MARCH_ID", "NAT_MARCH_LIBELLE", marchandise.NAT_MARCH_ID); return(View(marchandise)); }
private void btnAddMarchandise_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtPoids.Text) || string.IsNullOrEmpty(txtVolume.Text)) { MessageBox.Show("Veuillez Remplir les Champs", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Marchandise mar = new Marchandise() { Poid = double.Parse(txtPoids.Text), Volume = double.Parse(txtVolume.Text), Cargaison = cargaisonSelect }; service.AddMarchandiseInGargaison(mar); MessageBox.Show("Marchandise Ajoutée avec Succes", "Information", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); txtPoids.Clear(); txtVolume.Clear(); cargaisonSelect.PoidsTotal = 0; cargaisonSelect.VolumeTotal = 0; loadDataGridView(); } }
public void AddMarchandiseInGargaison(Marchandise mar) { daoMar.add(mar); }
public Result GetPositionWithParcelNumber(string g) { string v = String.Format("select OTSID,OTSNUM,OTSREF,OTSDEPDTDEB,OTSPDS,OTSARRADR1,OTSARRUSRPAYINTER, OTSDEPTIENOM,OTSARRTIENOM,OTSDTLIM,OTSARRDTDEB,OTSARRUSRVILCP,OTSDEPUSRVILCP,OTSARRADR2, OTSDEPADR1 ,OTSDEPADR2 ,OTSDEPADR2,OTSDEPUSRVILLIB,OTSDEPUSRPAYINTER,OTSDIV1,OTSDIV3,OTSCOL,OTSLONG,OTSLIVHAYON,OTSMEMO from ORDRE as POS,ORDCOL as COL , QUAI,tOURNEEVILLE where POS.OTSID = COL.OTLOTSID AND COL.OTLNUMCB = '{0}' AND otsarrvilid*= TOUVILID AND OTSVPECODE*= QUAVTOCODE", g); SqlDataReader readerOrdre = new SqlCommand(v, GetConnection()).ExecuteReader(); try { if (readerOrdre != null && readerOrdre.HasRows) { while (readerOrdre.Read()) { DetailClient dClient = new DetailClient(); dClient.raison_sociale = readerOrdre["OTSDEPTIENOM"].ToString(); dClient.adresse = String.Format("{0} {1}", readerOrdre["OTSDEPADR1"], readerOrdre["OTSDEPADR2"]); dClient.code_postal = readerOrdre["OTSDEPUSRVILCP"].ToString(); dClient.ville = readerOrdre["OTSDEPUSRVILLIB"].ToString(); dClient.pays = readerOrdre["OTSDEPUSRPAYINTER"].ToString(); DetailClient aClient = new DetailClient { raison_sociale = readerOrdre["OTSARRTIENOM"].ToString(), adresse = String.Format("{0} {1} {2}", readerOrdre["OTSARRADR1"], readerOrdre["OTSARRADR2"], readerOrdre["OTSARRADR1"]), code_postal = readerOrdre["OTSARRUSRVILCP"].ToString(), ville = readerOrdre["OTSARRUSRPAYINTER"].ToString(), pays = readerOrdre["OTSARRUSRPAYINTER"].ToString() }; Arrivee a = new Arrivee(); a.date_livraison = (readerOrdre["OTSARRDTDEB"]).ToString(); a.imperatif_livraison = (readerOrdre["OTSDTLIM"]).ToString(); a.destinataire = aClient; Depart d = new Depart { date_chargement = (readerOrdre["OTSDEPDTDEB"]).ToString(), expediteur = dClient }; Marchandise m = new Marchandise(); m.palettes = new Palettes { facturees = Convert.ToInt32(readerOrdre["OTSDIV1"].ToString()), //coup_de_fourches = (int)readerOrdre["OTSDIV3"] }; m.nombre_colis = Convert.ToInt32(readerOrdre["OTSCOL"].ToString()); //m.metre_lineaire = (float)readerOrdre["OTSLONG"]; //isNUll m.poids = (double)readerOrdre["OTSPDS"]; m.hayon_tp = Convert.ToBoolean((readerOrdre["OTSLIVHAYON"].ToString()) == "" ? "false" : readerOrdre["OTSLIVHAYON"].ToString()); m.observations = readerOrdre["OTSMEMO"].ToString(); Result r = new Result(); r.numero_chrono = readerOrdre["OTSNUM"].ToString(); r.reference_interne = readerOrdre["OTSREF"].ToString(); r.depart = d; r.arrivee = a; r.marchandise = m; return(r); } } } catch (Exception ex) { Console.WriteLine(ex); return(null); } finally { readerOrdre.Close(); } return(null); }
public Result GetPositionWithPositionNumber(string g) { string v = String.Format("SELECT OTSID,OTSNUM,OTSREF,OTSDEPDTDEB,OTSPDS,OTSARRADR1,OTSARRUSRPAYINTER, OTSDEPTIENOM,OTSARRTIENOM,OTSDTLIM,OTSARRDTDEB,OTSARRUSRVILCP,OTSDEPUSRVILCP,OTSARRADR2, OTSDEPADR1 ,OTSDEPADR2 ,OTSDEPADR2,OTSDEPUSRVILLIB,OTSDEPUSRPAYINTER,OTSDIV1,OTSDIV3,OTSCOL,OTSLONG,OTSLIVHAYON,OTSMEMO FROM ORDRE WHERE OTSNUM = '{0}'", g); SqlDataReader readerOrdre = new SqlCommand(v, GetConnection()).ExecuteReader(); try { if (readerOrdre != null && readerOrdre.HasRows) { while (readerOrdre.Read()) { DetailClient dClient = new DetailClient(); dClient.raison_sociale = readerOrdre["OTSDEPTIENOM"] == null ? "" : readerOrdre["OTSDEPTIENOM"].ToString(); dClient.adresse = String.Format("{0} {1}", readerOrdre["OTSDEPADR1"] == null ? "" : readerOrdre["OTSDEPADR1"], readerOrdre["OTSDEPADR2"] == null ? "" : readerOrdre["OTSDEPADR2"]); dClient.code_postal = readerOrdre["OTSDEPUSRVILCP"] == null ? "" : readerOrdre["OTSDEPUSRVILCP"].ToString(); dClient.ville = readerOrdre["OTSDEPUSRVILLIB"] == null ? "" : readerOrdre["OTSDEPUSRVILLIB"].ToString(); dClient.pays = readerOrdre["OTSDEPUSRPAYINTER"] == null ? "" : readerOrdre["OTSDEPUSRPAYINTER"].ToString(); DetailClient aClient = new DetailClient { raison_sociale = readerOrdre["OTSARRTIENOM"] == null ? "" : readerOrdre["OTSARRTIENOM"].ToString(), adresse = String.Format("{0} {1} {2}", readerOrdre["OTSARRADR1"] == null ? "" : readerOrdre["OTSARRADR1"], readerOrdre["OTSARRADR2"] == null ? "" : readerOrdre["OTSARRADR2"], readerOrdre["OTSARRADR1"] == null ? "" : readerOrdre["OTSARRADR1"]), code_postal = readerOrdre["OTSARRUSRVILCP"] == null ? "" : readerOrdre["OTSARRUSRVILCP"].ToString(), ville = readerOrdre["OTSARRUSRPAYINTER"] == null ? "" : readerOrdre["OTSARRUSRPAYINTER"].ToString(), pays = readerOrdre["OTSARRUSRPAYINTER"] == null ? "" : readerOrdre["OTSARRUSRPAYINTER"].ToString() }; Arrivee a = new Arrivee(); a.date_livraison = readerOrdre["OTSARRDTDEB"] == null ? "" : readerOrdre["OTSARRDTDEB"].ToString(); a.imperatif_livraison = readerOrdre["OTSDTLIM"] == null ? "" : readerOrdre["OTSDTLIM"].ToString(); a.destinataire = aClient; Depart d = new Depart { date_chargement = readerOrdre["OTSDEPDTDEB"] == null ? "" : readerOrdre["OTSDEPDTDEB"].ToString(), expediteur = dClient }; Marchandise m = new Marchandise { palettes = new Palettes { facturees = readerOrdre["OTSDIV1"] == null ? 0 : Convert.ToInt32(readerOrdre["OTSDIV1"]), //coup_de_fourches = (int)readerOrdre["OTSDIV3"] }, nombre_colis = readerOrdre["OTSCOL"] == null ? 0 : Convert.ToInt32(readerOrdre["OTSCOL"]), //m.metre_lineaire = (float)readerOrdre["OTSLONG"]; //isNUll poids = readerOrdre["OTSPDS"] == null ? 0 : (double)readerOrdre["OTSPDS"], hayon_tp = readerOrdre["OTSLIVHAYON"] == System.DBNull.Value ? false : Convert.ToBoolean(readerOrdre["OTSLIVHAYON"]), observations = readerOrdre["OTSMEMO"] == null ? "" : readerOrdre["OTSMEMO"].ToString() }; Result r = new Result(); r.id = readerOrdre["OTSID"] == null ? 0 : Convert.ToInt32(readerOrdre["OTSID"]); r.numero_chrono = readerOrdre["OTSNUM"] == null ? "" : readerOrdre["OTSNUM"].ToString(); r.reference_interne = readerOrdre["OTSREF"] == null ? "" : readerOrdre["OTSREF"].ToString(); r.depart = d; r.arrivee = a; r.marchandise = m; return(r); } } } catch (Exception ex) { Console.WriteLine(ex); return(null); } finally { readerOrdre.Close(); } return(null); }
public List <Result> GetPositionWithCodeChauffeur(string g, string dateTime1, string dateTime2) { string v = String.Format("select OTSID,OTSNUM,OTSREF,OTSDEPDTDEB,OTSPDS,OTSARRADR1,OTSARRUSRPAYINTER, OTSDEPTIENOM,OTSARRTIENOM,OTSDTLIM,OTSARRDTDEB,OTSARRUSRVILCP,OTSDEPUSRVILCP,OTSARRADR2, OTSDEPADR1 ,OTSDEPADR2 ,OTSDEPADR2,OTSDEPUSRVILLIB,OTSDEPUSRPAYINTER,OTSDIV1,OTSDIV3,OTSCOL,OTSLONG,OTSLIVHAYON,OTSMEMO from ordre , ordpla, voyage where voyid=otpvoyid and otpotsid=otsid and OTPCHSALCODE='{0}' and VOYDEPDTDEB between '{1} 00:00:00' and '{2} 23:59:59'", g, dateTime1, dateTime2); SqlDataReader readerOrdre = new SqlCommand(v, GetConnection()).ExecuteReader(); try { if (readerOrdre != null && readerOrdre.HasRows) { List <Result> res = new List <Result>(); while (readerOrdre.Read()) { DetailClient dClient = new DetailClient(); dClient.raison_sociale = readerOrdre["OTSDEPTIENOM"].ToString(); dClient.adresse = String.Format("{0} {1}", readerOrdre["OTSDEPADR1"], readerOrdre["OTSDEPADR2"]); dClient.code_postal = readerOrdre["OTSDEPUSRVILCP"].ToString(); dClient.ville = readerOrdre["OTSDEPUSRVILLIB"].ToString(); dClient.pays = readerOrdre["OTSDEPUSRPAYINTER"].ToString(); DetailClient aClient = new DetailClient { raison_sociale = readerOrdre["OTSARRTIENOM"].ToString(), adresse = String.Format("{0} {1} {2}", readerOrdre["OTSARRADR1"], readerOrdre["OTSARRADR2"], readerOrdre["OTSARRADR1"]), code_postal = readerOrdre["OTSARRUSRVILCP"].ToString(), ville = readerOrdre["OTSARRUSRPAYINTER"].ToString(), pays = readerOrdre["OTSARRUSRPAYINTER"].ToString() }; Arrivee a = new Arrivee(); a.date_livraison = (readerOrdre["OTSARRDTDEB"]).ToString(); a.imperatif_livraison = (readerOrdre["OTSDTLIM"]).ToString(); a.destinataire = aClient; Depart d = new Depart { date_chargement = (readerOrdre["OTSDEPDTDEB"]).ToString(), expediteur = dClient }; Marchandise m = new Marchandise(); m.palettes = new Palettes { facturees = Convert.ToInt32(readerOrdre["OTSDIV1"].ToString()), //coup_de_fourches = (int)readerOrdre["OTSDIV3"] }; m.nombre_colis = Convert.ToInt32(readerOrdre["OTSCOL"].ToString()); //m.metre_lineaire = (float)readerOrdre["OTSLONG"]; //isNUll m.poids = (double)readerOrdre["OTSPDS"]; //m.hayon_tp = Convert.ToBoolean((readerOrdre["OTSLIVHAYON"].ToString()) == "" ? "false" : readerOrdre["OTSLIVHAYON"].ToString()); m.observations = readerOrdre["OTSMEMO"].ToString(); Result r = new Result(); r.numero_chrono = readerOrdre["OTSNUM"].ToString(); r.reference_interne = readerOrdre["OTSREF"].ToString(); r.depart = d; r.arrivee = a; r.marchandise = m; res.Add(r); } return(res); } } catch (Exception ex) { Console.WriteLine(ex); return(null); } finally { readerOrdre.Close(); } return(null); }
public void AddMarchandiseInGargaison(Marchandise mar) { }
public void AddMarchandiseInGargaison(Marchandise mar) { dao.Marchandise.Add(mar); dao.SaveChanges(); }
public void Ajout(Marchandise merchandise) { _listeMarchandise[merchandise.Id] = merchandise; }