Ejemplo n.º 1
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     if (!frmMain.Instance.mainContainer.Controls.ContainsKey("ucVente"))
     {
         ucVente uc = new ucVente();
         uc.Dock = DockStyle.Fill;
         frmMain.Instance.mainContainer.Controls.Add(uc);
     }
     frmMain.Instance.BtnBack.Visible = true;
     frmMain.Instance.mainContainer.Controls["ucVente"].BringToFront();
 }
Ejemplo n.º 2
0
        private void btnAddVente_Click(object sender, EventArgs e)
        {
            if (Stock == null)
            {
                return;
            }
            Vente v = new Vente
            {
                MontantVente = decimal.Parse(PrixTextBox.Text),
                DateVente    = DateTime.Now
            };

            if ((v = frmMain.Instance.Vente.AddVente(v, frmMain.Instance.Session)) != null)
            {
                Medicament m = frmMain.Instance.Medicament.GetMedicamentByLibelle(medicamentComboBox.Text);
                if (m != null)
                {
                    VenteMedi vm = new VenteMedi
                    {
                        NumVente           = v.NumVente,
                        CodeMedicament     = m.CodeMedicament,
                        QuantiteMedicament = quantityTrackBar.Value
                    };
                    if ((vm = frmMain.Instance.VenteMedi.AddVenteMedi(vm, Stock, frmMain.Instance.Session)) != null)
                    {
                        MetroFramework.MetroMessageBox.Show(this, "La vente a ete ajouter", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        if (!frmMain.Instance.mainContainer.Controls.ContainsKey("ucVente"))
                        {
                            ucVente uc = new ucVente();
                            uc.Dock = DockStyle.Fill;
                            frmMain.Instance.mainContainer.Controls.Add(uc);
                        }

                        medicamentComboBox.Items.Clear();
                        stockComboBox.Items.Clear();
                        quantityTrackBar.Value           = 1;
                        quantityTrackBar.Enabled         = false;
                        btnAddVente.Enabled              = false;
                        PrixTextBox.Enabled              = false;
                        frmMain.Instance.BtnBack.Visible = true;
                        frmMain.Instance.mainContainer.Controls["ucVente"].BringToFront();
                        ucVente.Instance.Actualiser(frmMain.Instance.VenteMedi.GetAll().ToList());
                        LoadData(frmMain.Instance.Medicament.GetAll().ToList());
                        OnAdd();
                    }
                }
            }
            else
            {
                MetroFramework.MetroMessageBox.Show(this, "Vente null", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }