private void refreshModulePanel(Gamme gammeSelectionne) { downPanel.Controls.Clear(); Button ajouterModuleButton = new Button(); ajouterModuleButton.ID = "ajouterModuleButton"; ajouterModuleButton.Text = "Ajouter un nouveau module"; ajouterModuleButton.Attributes["data-toggle"] = "modal"; ajouterModuleButton.Attributes["data-target"] = "#myModal"; ajouterModuleButton.CssClass = "btn btn-xs btn-primary"; AjaxControlToolkit.ModalPopupExtender buttonModalPopup = new AjaxControlToolkit.ModalPopupExtender(); buttonModalPopup.ID = "mpe"; buttonModalPopup.TargetControlID = ajouterModuleButton.ID; buttonModalPopup.PopupControlID = "ModalPanel"; buttonModalPopup.OkControlID = "OKButton"; ModalTypeModuleDropDownList.DataSource = moduleRepository.GetByGamme(gammeSelectionne); ModalTypeModuleDropDownList.DataTextField = "Nom"; ModalTypeModuleDropDownList.DataValueField = "Id"; ModalTypeModuleDropDownList.EnableViewState = true; ModalTypeModuleDropDownList.DataBind(); foreach (ModuleCompose module in produitSelectionne.ModeleDeGamme.Modules) { if (module.Module.Type == "0") { Panel panelModule = new Panel(); Label newModuleLabel = new Label(); newModuleLabel.Text = module.Identification; panelModule.Controls.Add(newModuleLabel); ImageButton deleteButton = new ImageButton(); deleteButton.ImageUrl = "Images/cancel-icon.png"; deleteButton.Height = 10; deleteButton.Width = 10; deleteButton.ID = module.Identification; deleteButton.Click += new ImageClickEventHandler(this.ImgBtnDeleteModule_Click); panelModule.Controls.Add(deleteButton); downPanel.Controls.Add(panelModule); } } Button confirmProduit = new Button(); confirmProduit.Text = "Terminer"; confirmProduit.CssClass = "btn btn-xs btn-primary"; confirmProduit.Click += new EventHandler(this.BtnConfirmProduct_Click); Panel pan = new Panel(); pan.Controls.Add(ajouterModuleButton); pan.Controls.Add(buttonModalPopup); pan.Controls.Add(confirmProduit); downPanel.Controls.Add(pan); }
public List <Finition> getByGamme(Gamme gamme) { List <Finition> dtos = new List <Finition>(); using (var db = new maderaEntities()) { var lierFinition = from a in db.FAIRE_PARTIE where a.GAMME_ID.Equals(gamme.Id) select a; foreach (var item in lierFinition) { var query = from a in db.FINITION where a.FINITION_ID.Equals(item.FINITION_ID) select a; Finition finition = new Finition(); finition.Id = query.First().FINITION_ID; finition.Nom = query.First().FINITION_NOM; finition.Description = query.First().FINITION_DESCRIPTION; finition.TypeFinition = typeFinitionRepository.GetOne(query.First().TYPE_FINITION_ID); var fichier = from a in db.FINITION_IMAGE where a.FINITION_ID.Equals(finition.Id) select a; if (fichier.Count() > 0) { finition.Image = fichierRepository.GetOne(fichier.First().FICHIER_ID); } dtos.Add(finition); } } return(dtos); }
private void listAllGamme() { SQLQuery = "SELECT * FROM gamme WHERE statut = 1"; conn.LiteCo.Open(); using (SQLiteCommand command = new SQLiteCommand(SQLQuery, conn.LiteCo)) { try { using (SQLiteDataReader reader = command.ExecuteReader()) { Trace.Write("#### GET GAMMES DATA #### \n"); while (reader.Read()) { Byte[] data = (Byte[])reader.GetValue(5); Gamme gamme = new Gamme ( reader.GetString(0), reader.GetInt32(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetBoolean(6), ToImage(data)); Listegamme.Add(gamme); } } Trace.WriteLine("#### GET GAMMES DATA SUCCESS ####"); } catch (SQLiteException ex) { Trace.WriteLine(" \n ################################################# ERREUR RECUPERATION GAMMES ################################################# \n" + ex.ToString() + "\n"); } } conn.LiteCo.Close(); }
public override async Task <U> Update <U, V>(int id, V entity) where U : class where V : class { var sourceEntity = await DpOrderContent.GetById(id); var updateEntity = BuildMapper <V, DtoOrderContentUpdate>().Map <DtoOrderContentUpdate>(entity); if (VerifyEntityUpdate(updateEntity.IdGamme, sourceEntity.IdGamme)) { await RollBackStock(sourceEntity, updateEntity); sourceEntity.IdGamme = (int)updateEntity.IdGamme; } if (VerifyEntityUpdate(updateEntity.IdOrder, sourceEntity.IdOrder)) { sourceEntity.IdOrder = (int)updateEntity.IdOrder; } if (VerifyEntityUpdate(updateEntity.Quantity, sourceEntity.Quantity)) { Gamme gamme = await BsGamme.GetById <Gamme>(sourceEntity.IdGamme); gamme.IdProducer = 1; int diffStock = sourceEntity.Quantity - (int)updateEntity.Quantity; await BsGamme.Update <DtoGamme, DtoGammeUpdate>(sourceEntity.IdGamme, new DtoGammeUpdate() { Stock = (gamme.Stock + diffStock) }); sourceEntity.Quantity = (int)updateEntity.Quantity; } return(await base.Update <U, OrderContent>(id, sourceEntity)); }
/// <summary> /// Méthode qui permet de récupérer une gamme par id/nom /// </summary> /// <param name="type">nom de la gamme recherchée</param> /// <returns></returns> private Gamme getGammebyNom(string nom) { Gamme gamme = new Gamme(); SQLQuery = "SELECT * FROM gamme WHERE nomGamme = @nom;"; using (SQLiteCommand command = new SQLiteCommand(SQLQuery, conn.LiteCo)) { command.Parameters.AddWithValue("@nom", nom); using (SQLiteDataReader reader = command.ExecuteReader()) { try { while (reader.Read()) { Byte[] data = (Byte[])reader.GetValue(5); gamme = new Gamme ( reader.GetString(0), reader.GetInt32(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetBoolean(6), ToImage(data)); } } catch (SQLiteException ex) { Trace.WriteLine(ex.ToString()); } return(gamme); } } }
protected void BtnSelectionGamme_Click(object sender, EventArgs e) { Button BtnSelectionGamme = (Button)sender; Gamme foundGamme = gammeRepository.GetOne(int.Parse(BtnSelectionGamme.ID)); Session["selectedGamme"] = foundGamme; Session["downPanelId"] = "panelModelDeGamme"; refreshModelGammePanel(foundGamme); }
public void Create(Gamme gamme) { _gammeRepository.Insert(gamme); _applicationTraceService.create(new ApplicationTrace { utilisateur = "", action = Parametres.Action.Creation.ToString(), description = "Création d'une gamme", }); }
public void Update(Gamme gamme) { _gammeRepository.Update(gamme); _applicationTraceService.create(new ApplicationTrace { utilisateur = "", action = Parametres.Action.Modification.ToString(), description = String.Format("Mise à jour d'un type d'une gamme gamme_id = {0}", gamme.id), }); }
public Gamme GetOne(int id) { Gamme dto = new Gamme(); using (var db = new maderaEntities()) { var query = from a in db.GAMME where a.GAMME_ID.Equals(id) select a; dto.Id = query.First().GAMME_ID; dto.Nom = query.First().GAMME_NOM; dto.Description = query.First().GAMME_DESCRIPTION; } return(dto); }
private void refreshModelGammePanel(Gamme selectedGamme) { downPanel.Controls.Clear(); foreach (ModeleDeGamme modeleDeGamme in modelGammeRepository.GetByGamme(selectedGamme)) { System.Diagnostics.Debug.WriteLine(modeleDeGamme.Id); Button myButtonModelGamme = new Button(); myButtonModelGamme.Text = modeleDeGamme.Nom; myButtonModelGamme.ID = "" + modeleDeGamme.Id; myButtonModelGamme.Click += new EventHandler(this.BtnSelectionModeleGamme_Click); myButtonModelGamme.CssClass = "btn btn-xs btn-primary"; Panel pan = new Panel(); pan.Controls.Add(myButtonModelGamme); downPanel.Controls.Add(pan); } }
public List <Module> GetByGamme(Gamme gamme) { List <Module> dtos = new List <Module>(); using (var db = new maderaEntities()) { var query = from a in db.EST_DISPONIBLE where a.GAMME_ID.Equals(gamme.Id) select a; foreach (var item in query) { Module module = GetOne(item.MODULE_ID); dtos.Add(module); } } return(dtos); }
public IActionResult Delete(int id) { BeerBDD beerBDD = new BeerBDD(); Beer beer = beerBDD.Get(id); CategorieBDD categorieBDD = new CategorieBDD(); Categorie categorie = categorieBDD.Get(beer.IdentifiantCategorie); GammeBDD gammeBDD = new GammeBDD(); Gamme gamme = gammeBDD.Get(beer.IdentifiantGamme); BeerDeleteViewModel model = new BeerDeleteViewModel(); model.Beer = beer; model.Categorie = categorie; model.Gamme = gamme; return(View(model)); }
public List <Gamme> getAll() { List <Gamme> gammes = new List <Gamme>(); using (var db = new maderaEntities()) { var query = from a in db.GAMME select a; foreach (var item in query) { Gamme dto = new Gamme(); dto.Id = (int)item.GAMME_ID; dto.Nom = item.GAMME_NOM; dto.Description = item.GAMME_DESCRIPTION; gammes.Add(dto); } } return(gammes); }
public List <ModeleDeGamme> GetByGamme(Gamme gamme) { List <ModeleDeGamme> dtos = new List <ModeleDeGamme>(); using (var db = new maderaEntities()) { var query = from a in db.MODELE_DE_GAMME where a.GAMME_ID.Equals(gamme.Id) select a; foreach (var item in query) { ModeleDeGamme dto = new ModeleDeGamme(); dto.Id = (int)item.MODELE_GAMME_ID; dto.Nom = item.MODELE_GAMME_NOM; dto.Description = item.MODELE_GAMME_DESCRIPTION; dto.EstParDefaut = item.EST_PAR_DEFAUT; dto.NbPieces = item.MODELE_GAMME_NB_PIECES; dto.Surface = item.MODELE_GAMME_SURFACE; dto.TypeModeleGamme = typeModeleGammeRepository.GetOne(item.TYPE_MODELE_GAMME_ID); dto.Gamme = gammeRepository.GetOne(item.GAMME_ID); var image = from a in db.MODELE_GAMME_IMAGE where a.MODELE_GAMME_ID.Equals(dto.Id) select a; if (image.Count() != 0) { //TODO : Plante quand il n'y a pas d'image dto.Image = fichierRepository.GetOne(image.First().FICHIER_ID); } var queryFinitions = from a in db.LIER_FINITION where a.MODELE_GAMME_ID.Equals(dto.Id) select a; List <Finition> finitions = new List <Finition>(); foreach (var itemFin in queryFinitions) { finitions.Add(finitionRepository.getOne(itemFin.FINITION_ID)); } dto.Finitions = finitions; dtos.Add(dto); } } return(dtos); }
public List <Gamme> ChargerGammes() { List <Gamme> list = new List <Gamme>(); if (OpenConnection() == false) { return(list); } string req = "SELECT gamme.id as gammeId, gamme.nom_gamme, gamme.famille_couverture, gamme.famille_isolant, gamme.famille_finition_exterieure, gamme.mode_conception_ossature, gamme.famille_gamme, unite_dusage.id as uniteUsageId, unite_dusage.description_unite_usage, unite_dusage.unite_unite_usage FROM gamme JOIN unite_dusage ON gamme.id_unite_dusage = unite_dusage.id"; MySqlCommand mySqlCommand = new MySqlCommand(req, mySqlConnection); MySqlDataReader reader = mySqlCommand.ExecuteReader(); while (reader.Read()) { Gamme gamme = new Gamme { id = reader.GetInt32("gammeId"), nom_gamme = reader.GetString("nom_gamme"), famille_couverture = reader.GetString("famille_couverture"), famille_isolant = reader.GetString("famille_isolant"), famille_finition_exterieure = reader.GetString("famille_finition_exterieure"), mode_conception_ossature = reader.GetString("mode_conception_ossature"), famille_gamme = reader.GetString("famille_gamme"), UniteDusage = new UniteDusage { id = reader.GetInt32("uniteUsageId"), description_unite_usage = reader.GetString("description_unite_usage"), unite_unite_usage = reader.GetString("unite_unite_usage"), } }; list.Add(gamme); } CloseConnection(); return(list); }
public GammeManager(Gamme gamme, Note start) { this.gamme = gamme; this.start = start; Init(); }
void comboGammes_SelectionChanged(object sender, SelectionChangedEventArgs e) { gamme = comboGammes.SelectedValue as Gamme; RemplirGuitare(); }
public ViewModelGamme(Gamme gamme) { Gamme = gamme; }