コード例 #1
0
        private void bbiSauvegarderFermer_ItemClick(object sender, ItemClickEventArgs e)
        {
            IsProductLineModified = false;

            if (_newProductLine)
            {
                _editProductLinePresenter.Write(comboBoxStock.SelectedItem as Stock, comboBoxProduit.SelectedItem as Product,
                                                Convert.ToInt32(textEditQuantité.EditValue.ToString()));
                MessageBox.Show(Resources.succesAdd);
            }
            else
            {
                var productLineModif = new ProductLine
                {
                    id       = ProductLineOut.Id,
                    Product  = comboBoxProduit.SelectedItem as Product,
                    Quantity = Convert.ToInt32(textEditQuantité.EditValue.ToString())
                };

                var repositoryStock = new RepositoryStock();
                repositoryStock.Save(comboBoxStock.SelectedItem as Stock, productLineModif);
                MessageBox.Show(Resources.succesUpdate);
            }

            Close();
        }
コード例 #2
0
        public void CanCreateStock()
        {
            const string stock2  = "stock2";
            var          wilaya  = new RepositoryWilaya().FindAll().First(w => w.Name == "Tlemcen");
            var          commune = new RepositoryWilaya().FindAll().First(w => w.Name == "Tlemcen").Communes.First(com => com.Name == "Tlemcen");
            const string adresse = "S3 lot Sekkal el Kiffane";
            var          stock   = FactoryStock.CreateStock(stock2, wilaya, commune, adresse);
            var          rs      = new RepositoryStock();

            rs.Save(stock);
            rs.Remove(stock);
        }
コード例 #3
0
        private void FrmEditProductLine_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (IsProductLineModified)
            {
                DialogResult result = XtraMessageBox.Show(this, TagResources.SaveBeforeClose, Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);

                if (result == DialogResult.Yes)
                {
                    if (_newProductLine)
                    {
                        _editProductLinePresenter.Write(comboBoxStock.SelectedItem as Stock, comboBoxProduit.SelectedItem as Product,
                                                        Convert.ToInt32(textEditQuantité.EditValue.ToString()));
                        MessageBox.Show(Resources.succesAdd);
                    }
                    else
                    {
                        var productLineModif = new ProductLine
                        {
                            id       = ProductLineOut.Id,
                            Product  = comboBoxProduit.SelectedItem as Product,
                            Quantity = Convert.ToInt32(textEditQuantité.EditValue.ToString())
                        };

                        var repositoryStock = new RepositoryStock();
                        repositoryStock.Save(comboBoxStock.SelectedItem as Stock, productLineModif);
                        MessageBox.Show(Resources.succesUpdate);
                    }

                    IsProductLineModified = false;
                }

                if (result == DialogResult.Cancel)
                {
                    e.Cancel = true;
                }
            }
        }