コード例 #1
0
ファイル: VENTE_DETAILS.cs プロジェクト: ABDFath/GESTACAJOU
 public static List<VENTE_DETAILS> GetListByVente(int idVente,int idChargement)
 {
     List<VENTE_DETAILS> _list = new List<VENTE_DETAILS>();
     SqlDataReader dr = null;
     VENTE_DETAILS var = null;
     SqlParameter id_vente = new SqlParameter("@ID_VENTE", idVente);
     SqlParameter id_chargement = new SqlParameter("@ID_CHARGEMENT", idChargement);
     try
     {
         dr = SqlHelper.ExecuteReader(Connexion.Cnx,
        "SPGETLIST_VENTE_DETAILSBY_VENTE", id_vente, id_chargement);
         while (dr.Read())
         {
             var = new VENTE_DETAILS();
             var.SetId(dr.GetInt32(dr.GetOrdinal("ID_AUTO")));
             var.ID_VENTE = dr.GetInt32(dr.GetOrdinal("ID_VENTE"));
             var.ID_CHARGEMENT = dr.GetInt32(dr.GetOrdinal("ID_CHARGEMENT"));
             var.PRIX_UNITAIRE = dr.GetInt32(dr.GetOrdinal("PRIX_UNITAIRE"));
             var.QTE = dr.GetInt32(dr.GetOrdinal("QTE"));
             var.TOTAL = dr.GetInt32(dr.GetOrdinal("TOTAL"));
             var.SetCHARGERMENT(dr.GetString(dr.GetOrdinal("CHARGERMENT")));
             _list.Add(var);
         }
         return _list;
     }
     catch (SqlException ex)
     {
         throw ex;
     }
     finally
     {
         dr.Close();
     }
 }
コード例 #2
0
        public ActionResult Delete(Vente_Details VenteDetailsToDel)
        {
            int id = Int32.Parse(RouteData.Values["id"].ToString());

            if (!ModelState.IsValid)
                return View();

            try
            {
                VENTE_DETAILS _venteDetails = new VENTE_DETAILS();
                _venteDetails.SetId(id);
                _venteDetails.Delete();
                return RedirectToAction("../VenteDetails/Index");//reafficher l liste
            }
            catch
            {
                return View();
            }
        }
コード例 #3
0
ファイル: VENTE_DETAILS.cs プロジェクト: ABDFath/GESTACAJOU
		public static List<VENTE_DETAILS> GetList()
		{
				List<VENTE_DETAILS> _list= new List<VENTE_DETAILS>();
				SqlDataReader dr = null;
				VENTE_DETAILS var = null;
				SqlParameter id_auto=new SqlParameter ("@ID_AUTO","0");
			try
			{
                dr = SqlHelper.ExecuteReader(Connexion.Cnx,
				"SPGETLIST_VENTE_DETAILS" ,id_auto);
				while (dr.Read())
				{
				var=new VENTE_DETAILS();
						var.SetId(dr.GetInt32(dr.GetOrdinal("ID_AUTO")));
						var.ID_VENTE = dr.GetInt32(dr.GetOrdinal("ID_VENTE"));
						var.ID_CHARGEMENT = dr.GetInt32(dr.GetOrdinal("ID_CHARGEMENT"));
						var.PRIX_UNITAIRE = dr.GetInt32(dr.GetOrdinal("PRIX_UNITAIRE"));
						var.QTE = dr.GetInt32(dr.GetOrdinal("QTE"));
						var.TOTAL = dr.GetInt32(dr.GetOrdinal("TOTAL"));
				_list.Add(var);
				}
			return _list;
			}
			catch (SqlException ex)
			{
				throw ex;
			}
			finally
			{
				dr.Close();
			}
		}
コード例 #4
0
        public ActionResult Edit(Vente_Details ventesDetails)
        {
            int id = Int32.Parse(RouteData.Values["id"].ToString());

            if (!ModelState.IsValid)
                return View();

            try
            {
                VENTE_DETAILS _venteDetails = new VENTE_DETAILS();
                _venteDetails.TOTAL = ventesDetails.TOTAL;
                _venteDetails.PRIX_UNITAIRE = ventesDetails.PRIX_UNITAIRE;
                _venteDetails.QTE = ventesDetails.QTE;
                _venteDetails.ID_VENTE = ventesDetails.ID_VENTE;
                _venteDetails.ID_CHARGEMENT = ventesDetails.ID_CHARGEMENT;
                _venteDetails.SetId(id);
                _venteDetails.Save();
                return RedirectToAction("../VenteDetails/Index");
            }
            catch
            {
                return View();
            }

        }