public FrmEditStock(ModelViewStock stock, bool newStock, string caption) { InitializeComponent(); //DictionaryHelper.InitDictionary(spellChecker1); var repositoryWilaya = new RepositoryWilaya(); var repositoryStock = new RepositoryStock(); _editStockPresenter = new EditStockPresenterPage(this, repositoryWilaya, repositoryStock); _editStockPresenter.Display(); comboBoxWilaya.DataSource = Wilayas.OrderBy(c => c.Code).ToList(); comboBoxWilaya.ValueMember = "Code"; comboBoxWilaya.DisplayMember = "Name"; comboBoxCommune.DataSource = Wilayas.First(w => w.Code == (int)comboBoxWilaya.SelectedValue).Communes.OrderBy(c => c.Name).ToList(); comboBoxCommune.DisplayMember = "Name"; comboBoxCommune.ValueMember = "Name"; if (!newStock) { IdStock = stock.Id; textEditNameStock.Text = stock.Nom; comboBoxWilaya.SelectedValue = stock.CodeWilaya; comboBoxCommune.SelectedValue = stock.Commune; textEditAdress.Text = stock.Adresse; GCLigneStock.DataSource = stock.ProductLine; } _newStock = newStock; IsStockModified = false; _sourceStock = stock; }
private void ModifyStock(ModelViewStock stock) { if (gridViewStock == null) { return; } stock = (ModelViewStock)gridViewStock.GetFocusedRow(); EditStock(stock, false, null); }
void EditStock(ModelViewStock stock, bool newStock, string caption) { Cursor.Current = Cursors.WaitCursor; var form = new FrmEditStock(stock, newStock, caption); form.Load += OnEditMailFormLoad; form.FormClosed += OnEditMailFormClosed; form.Location = new Point(OwnerForm.Left + (OwnerForm.Width - form.Width) / 2, OwnerForm.Top + (OwnerForm.Height - form.Height) / 2); form.ShowDialog(); Mail_Load(stock, new EventArgs()); Cursor.Current = Cursors.Default; }
public frmEditStock(ModelViewStock Stock, bool newStock, string caption) { InitializeComponent(); DictionaryHelper.InitDictionary(spellChecker1); var repositoryWilaya = new RepositoryWilaya(); var repositoryStock = new RepositoryStock(); _editStockPresenter = new EditStockPresenterPage(this, repositoryWilaya,repositoryStock); _editStockPresenter.Display(); comboBoxWilaya.DataSource = Wilayas.OrderBy(c => c.Code).ToList(); comboBoxWilaya.ValueMember = "Code"; comboBoxWilaya.DisplayMember = "Name"; comboBoxCommune.DataSource = Wilayas.First(w => w.Code == (int)comboBoxWilaya.SelectedValue).Communes.OrderBy(c => c.Name).ToList(); comboBoxCommune.DisplayMember = "Name"; this.newStock = newStock; DialogResult = DialogResult.Cancel; sourceStock = Stock;
private void DeleteStock() { DialogResult result = XtraMessageBox.Show(this, TagResources.DeleteQuestion, Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); if (result != DialogResult.Yes) { return; } if (gridViewStock == null) { return; } var idstock = (Guid)gridViewStock.GetFocusedRowCellValue("Id"); _repositoryStock.Remove(idstock); var stock = new ModelViewStock(); Mail_Load(stock, new EventArgs()); }
private void DeleteProductLine() { DialogResult result = XtraMessageBox.Show(this, TagResources.DeleteQuestion, Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); if (result != DialogResult.Yes) { return; } if (gridViewProductLine.RowCount == 0) { XtraMessageBox.Show(this, "Aucune ligne a supprimer", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var idProductLine = (Guid)gridViewProductLine.GetFocusedRowCellValue("Id"); _repositoryStock.RemovePl(idProductLine); var stock = new ModelViewStock(); Mail_Load(stock, new EventArgs()); }
void CreateStock() { var stock = new ModelViewStock(); EditStock(stock, true, null); }