Exemplo n.º 1
0
        public void afficherDetail(plateforme p)
        {
            var categplat = new Categorie(RequeteSql.srchCategorie(p.codeCateg).First());

            rTxtDesc.Text = p.descPlate;
            rTxtInfoSup.Text = p.infoSupPlate;
            txtCartemere.Text = p.carteMerePlate;
            txtCode.Text = p.codePlate;
            txtCPU.Text = p.cpuPlate;
            txtID.Text = p.idPlate.ToString();
            txtNom.Text = p.nomPlate;
            txtRam.Text = p.ramPlate;
            txtStockage.Text = p.stockage;

            foreach (var item in cboxCateg.Items)
            {
                if (((Categorie)item).codeCateg == categplat.codeCateg)
                {
                    cboxCateg.SelectedItem = item;
                    break;
                }
            }

            foreach (var item in p.lstSysExpPlate)
            {
                ajoutSysExpDetails(item);
            }
        }
Exemplo n.º 2
0
 public List<Categorie> rechercher(string chaine)
 {
     List<Categorie> lstCat = new List<Categorie>();
     foreach (var c in rCategSQL.srchCategorieAll(chaine))
     {
         Categorie cat = new Categorie(c);
         lstCat.Add(cat);
     }
     return lstCat;
 }
Exemplo n.º 3
0
 public frmDetCateg(Categorie C)
 {
     categSelect = C;
     InitializeComponent();
     this.PositionBtn(194);
     ctrlCateg = new ctrlCategorie();
     this.btnEnregistrer.Click += new EventHandler(enregistrer);
     this.btnCopier.Click += new EventHandler(btnCopier_Click);
     annuler = true;
 }
Exemplo n.º 4
0
        public void enregistrer(object sender,EventArgs e)
        {
            Categorie enregistrement = new Categorie();
            bool resulVerif;
            DialogResult resultEnrg;

            enregistrement.codeCateg = txtCode.Text.Trim();
            enregistrement.descCateg = txtDesc.Text.Trim();
            enregistrement.comCateg = rtxtCommentaire.Text.Trim();

            resulVerif = ctrlCateg.verifier(enregistrement, categSelect);

            if (categSelect == null && ((string)Tag) != "Copie" )
            {

                if (resulVerif)
                {
                    resultEnrg = MessageBox.Show("Voulez-vous vraiment enregister?", "Enregistrement", MessageBoxButtons.YesNo);
                    if (resultEnrg == DialogResult.Yes)
                    {
                        ctrlCateg.modifier(enregistrement);
                        this.Close();
                    }

                }
                else
                {
                    MessageBox.Show("Veuillez remplir les champs correctement.", "Erreur", MessageBoxButtons.OK);
                }
            }
            else
            {
                if (!ctrlCateg.testExiste(enregistrement.codeCateg) && txtCode.Text.Trim().Length != 0)
                {
                    resultEnrg = MessageBox.Show("Voulez-vous vraiment enregister?", "Enregistrement", MessageBoxButtons.YesNo);
                    if (resultEnrg == DialogResult.Yes)
                    {
                        ctrlCateg.ajouter(enregistrement);
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Une categorie avec ce code existe deja ou le code est trop court.", "Erreur", MessageBoxButtons.OK);
                }
            }
        }
Exemplo n.º 5
0
        public static void addCateg(Categorie settings)
        {
            var add = new tblCategorie();

            add.CodeCategorie = settings.codeCateg;
            add.ComCategorie = settings.comCateg;
            add.DescCategorie = settings.descCateg;

            db.tblCategorie.Add(add);

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 6
0
        public static void setCateg(Categorie settings)
        {
            var r =
                (from categ in db.tblCategorie
                 where categ.CodeCategorie == settings.codeCateg
                 select categ).First();

            r.CodeCategorie = settings.codeCateg;
            r.ComCategorie = settings.comCateg;
            r.DescCategorie = settings.descCateg;

            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 7
0
        private void btnCopier_Click(object sender, EventArgs e)
        {
            Categorie info = new Categorie();
            frmDetCateg formOuvert;

            info.comCateg = rtxtCommentaire.Text;
            info.descCateg = txtDesc.Text;

            formOuvert = new frmDetCateg(info);
            formOuvert.Tag = "Copie";
            formOuvert.remplirChamp();
            formOuvert.btnCopier.Enabled = false;
            formOuvert.btnSupprimer.Enabled = false;
            formOuvert.btnActiverModif.Enabled = false;
            formOuvert.ShowDialog();
            if (annuler == false)
            {
                this.Close();
            }
            formOuvert.Closed += (s, args) => this.Close();
        }
Exemplo n.º 8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="code">a = ajouter, m = modifier</param>
        public void modifierChamp(string code)
        {
            if (code == "a")
            {
                this.btnActiverModif.Visible = false;
                categSelect = null;
            }
            else
            {
                this.txtCode.Enabled = false;
                this.txtDesc.Enabled = false;
                this.rtxtCommentaire.Enabled = false;
                this.btnCopier.Enabled = true;
                this.btnEnregistrer.Enabled = false;

                remplirChamp();
            }
        }
Exemplo n.º 9
0
        private void modifierCateg()
        {
            var frmDetails = new frmDetCateg(lvlAcces);
            Categorie categSelect = new Categorie();
            int index = gridCateg.SelectedRows[0].Index;

            categSelect.codeCateg = (string)gridCateg.Rows[index].Cells[0].Value;
            categSelect.descCateg = (string)gridCateg.Rows[index].Cells[1].Value;
            categSelect.comCateg = (string)gridCateg.Rows[index].Cells[2].Value;

            frmDetails.categSelect = categSelect;
            frmDetails.modifierChamp("m");

            frmDetails.ShowDialog();
            update();
            if (frmDetails.categSelect != null)
            {
                int R = gestionCateg.RowsById(frmDetails.categSelect.codeCateg, gridCateg);
                gridCateg.Rows[R].Cells[0].Selected = true;
                gridCateg.Rows[R].Selected = true;
                Ligne = R;
            }
        }
Exemplo n.º 10
0
        private void modifierCateg()
        {
            var frmDetails = new frmDetCateg();
            Categorie categSelect = new Categorie();
            int index = gridCateg.SelectedRows[0].Index;

            categSelect.codeCateg = (string)gridCateg.Rows[index].Cells[0].Value;
            categSelect.descCateg = (string)gridCateg.Rows[index].Cells[1].Value;
            categSelect.comCateg = (string)gridCateg.Rows[index].Cells[2].Value;

            frmDetails.categSelect = categSelect;
            frmDetails.modifierChamp("m");

            frmDetails.ShowDialog();
            update();
        }