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; }
private void ModifyProductLine(ModelViewProductLine productLine) { if (gridViewProductLine == null) { return; } productLine = (ModelViewProductLine)gridViewProductLine.GetFocusedRow(); EditProductLine(productLine, false); }
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; }
void CreateProductLine() { var productLine = new ModelViewProductLine(); EditProductLine(productLine, true); }