Exemple #1
0
        public FrmEditProductLine(ModelViewProductLine productLine, bool newProductLine)
        {
            InitializeComponent();
            _newProductLine = newProductLine;
            ProductLineOut  = productLine;
            var repositoryStock   = new RepositoryStock();
            var repositoryProduit = new RepositoryProduct();

            _editProductLinePresenter = new EditProductLinePresenterPage(this, repositoryStock, repositoryProduit);
            _editProductLinePresenter.Display();

            comboBoxStock.DisplayMember   = "Name";
            comboBoxStock.ValueMember     = "Name";
            comboBoxProduit.DataSource    = Products;
            comboBoxProduit.DisplayMember = "Name";
            comboBoxProduit.ValueMember   = "Name";

            if (!newProductLine)
            {
                comboBoxStock.DataSource = Stocks.Where(s => s.Name == productLine.Stock.Name).ToList();
                //comboBoxStock.SelectedValue = productLine.Stock.Name;
                comboBoxProduit.SelectedValue = productLine.Name;
                textEditQuantité.Text         = productLine.Quantity.ToString(CultureInfo.InvariantCulture);
            }
            else
            {
                comboBoxStock.DataSource = Stocks.OrderBy(s => s.Name).ToList();
            }

            IsProductLineModified = false;
        }
Exemple #2
0
 private void ModifyProductLine(ModelViewProductLine productLine)
 {
     if (gridViewProductLine == null)
     {
         return;
     }
     productLine = (ModelViewProductLine)gridViewProductLine.GetFocusedRow();
     EditProductLine(productLine, false);
 }
Exemple #3
0
        void EditProductLine(ModelViewProductLine productLine, bool newProductLine)
        {
            Cursor.Current = Cursors.WaitCursor;
            var form = new FrmEditProductLine(productLine, newProductLine);

            form.Location = new Point(OwnerForm.Left + (OwnerForm.Width - form.Width) / 2, OwnerForm.Top + (OwnerForm.Height - form.Height) / 2);
            form.ShowDialog();

            /*if (form.DialogResult == DialogResult.OK)
             * {
             *  var resultat=form.productLineOut;
             *
             * }*/
            Mail_Load(productLine, new EventArgs());
            Cursor.Current = Cursors.Default;
        }
Exemple #4
0
        void CreateProductLine()
        {
            var productLine = new ModelViewProductLine();

            EditProductLine(productLine, true);
        }