Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("PkMateriels,FkMaterielsTypes,Identifiant,DateAchat")] Materiels materiels)
        {
            if (id != materiels.PkMateriels)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(materiels);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaterielsExists(materiels.PkMateriels))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FkMaterielsTypes"] = new SelectList(_context.IxMaterielsTypes, "PkIxMaterielsTypes", "FkMaterielsTypesNavigation.MaterielType", materiels.FkMaterielsTypes);
            return(View(materiels));
        }
Пример #2
0
        //*****************************************************************************
        //****************************Chargement formulaire****************************
        //*****************************************************************************

        private void frm_retrait_usager_Load(object sender, EventArgs e)
        {
            //Création listView du materiel
            alimenter_ListView();

            //Chargement de la liste du materiel dans datagridview
            MaterielsList = new Materiels();
            alimenter_Datagrid();
        }
Пример #3
0
 public static void Flush(ObservableCollection <Materiel> list, Action <Exception> completed)
 {
     try
     {
         Materiels.Flush(list);
         completed(null);
     }
     catch (Exception e)
     {
         completed(e);
     }
 }
Пример #4
0
 public static void GetFilteredMateriel(Action <ObservableCollection <Materiel>, Exception> completed, int SelectedClient, int SelectedSite)
 {
     try
     {
         ObservableCollection <Materiel> filteredmateriels = Materiels.GetFilteredMateriel(SelectedClient, SelectedSite);
         completed(filteredmateriels, null);
     }
     catch (Exception e)
     {
         completed(null, e);
     }
 }
Пример #5
0
 public static void GetMateriels(Action <ObservableCollection <Materiel>, Exception> completed)
 {
     try
     {
         ObservableCollection <Materiel> materiels = Materiels.GetMateriel();
         completed(materiels, null);
     }
     catch (Exception e)
     {
         completed(null, e);
     }
 }
Пример #6
0
        public async Task <IActionResult> Create([Bind("PkMateriels,FkMaterielsTypes,Identifiant,DateAchat")] Materiels materiels)
        {
            if (ModelState.IsValid)
            {
                _context.Add(materiels);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FkMaterielsTypes"] = new SelectList(_context.IxMaterielsTypes, "PkIxMaterielsTypes", "PkIxMaterielsTypes", materiels.FkMaterielsTypes);
            return(View(materiels));
        }
Пример #7
0
        //*****************************************************************************
        //******************************Sélection matériel*****************************
        //*****************************************************************************
        #region Sélection matériel

        private void LSTVW_materiel_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Si SELECTION : materiel existe dans la base de données
            if (LSTVW_materiel.SelectedIndices != null)
            {
                // Récupération de l'intitulé de l'image
                string famille = LSTVW_materiel.SelectedItems[0].Text;
                // Recherche dans la base de données des familles concernées
                Materiels Listefamille = new Materiels();
                Listefamille = MaterielsList.Recherche_parFAMILLE(famille);

                if (Listefamille != null)
                {
                    //Comptabilisation nombre de matériel appartenant à la même famille
                    int nb_type = Listefamille.Count;
                    //Import des informations liées aux matériels concernés pour l'affichage des données
                    //DonnesMateriel = (Materiel)LSTVW_materiel.SelectedItems[];

                    // Affichage détail et pavé numéric
                    #region Visibilité détails matériel / pavé numéric
                    PNL_info_materiel.Visible = true;
                    PNL_pave_numeric.Visible  = true;
                    TXTBX_qte_retrait.Text    = "";
                    BTN_valider.Enabled       = false;
                    // Affichage titre du materiel
                    LBL_titre_materiel.Text = famille;
                    #endregion


                    // Si famille présente une fois alors affichage sans type
                    if (nb_type == 1)
                    {
                        MessageBox.Show("1 type de matériel");

                        //Affichage simple des données du matériel
                        #region Affichage quantité stock
                        TXTBX_qte_courant_stock.Text = DonnesMateriel.Quantité.ToString();
                        #endregion
                    }

                    // Si famille présente plusieurs fois
                    else if (nb_type > 1)
                    {
                        MessageBox.Show(nb_type.ToString());

                        // Affichage des boutons radios
                        #region Gestion des radios boutons
                        if (nb_type == 2)
                        {
                            RADIO_type_materiel1.Visible = true;
                            RADIO_type_materiel1.Text    = DonnesMateriel.TypeMateriel;
                            RADIO_type_materiel2.Visible = true;
                            RADIO_type_materiel2.Text    = DonnesMateriel.TypeMateriel;

                            if (nb_type == 3)
                            {
                                RADIO_type_materiel3.Visible = true;
                                RADIO_type_materiel3.Text    = DonnesMateriel.TypeMateriel;

                                if (nb_type == 4)
                                {
                                    RADIO_type_materiel4.Visible = true;
                                    RADIO_type_materiel4.Text    = DonnesMateriel.TypeMateriel;

                                    if (nb_type == 5)
                                    {
                                        RADIO_type_materiel5.Visible = true;
                                        RADIO_type_materiel5.Text    = DonnesMateriel.TypeMateriel;
                                    }
                                }
                            }
                        }
                        #endregion
                    }

                    // si pas de famille
                    else
                    {
                        MessageBox.Show("La base de données ne parvient pas à retrouver ce materiel");

                        //// Dissimile détail et pavé numéric
                        //#region Visibilité détails matériel / pavé numéric
                        //PNL_info_materiel.Visible = false;
                        //PNL_pave_numeric.Visible = false;
                        //#endregion
                    }
                }
            }
        }