Пример #1
0
        public FrmEditSector(ModelViewSecteur secteur, bool newSecteur)
        {
            InitializeComponent();
            //DictionaryHelper.InitDictionary(spellChecker1);
            var repositoryWilaya       = new RepositoryWilaya();
            var repositoryAgentTerrain = new RepositoryAgentTerrain();
            var repositorySecteur      = new RepositorySector();
            var repositoryClient       = new RepositoryClient();

            _editSecteurPresenter = new EditSectorPresenterPage(this, repositoryWilaya, repositoryAgentTerrain, repositorySecteur, repositoryClient);
            _editSecteurPresenter.Display();

            comboBoxClients.DataSource    = Clients.OrderBy(cl => cl.Name).ToList();
            comboBoxClients.DisplayMember = "Name";
            comboBoxClients.ValueMember   = "Name";
            comboBoxWilaya.DataSource     = Wilayas.OrderBy(c => c.Code).ToList();
            comboBoxWilaya.ValueMember    = "Code";
            comboBoxCommune.DataSource    = Wilayas.First(w => w.Code == (int)comboBoxWilaya.SelectedValue).Communes.OrderBy(c => c.Name).ToList();
            comboBoxCommune.DisplayMember = "Name";
            comboBoxCommune.ValueMember   = "Name";

            if (!newSecteur)
            {
                IdSecteur = secteur.Id;
                textEditNameSector.Text       = secteur.Name;
                comboBoxWilaya.SelectedValue  = secteur.CodeWilaya;
                comboBoxCommune.SelectedValue = secteur.Commune;
            }

            _newSecteur      = newSecteur;
            IsSectorModified = false;
            SourceSecteur    = secteur;

            GCAgentTerrain.DataSource = AgentTerrains;
        }
Пример #2
0
        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;
        }
Пример #3
0
 private void comboBoxWilaya_SelectedIndexChanged(object sender, EventArgs e)
 {
     comboBoxWilaya.ValueMember = "Code";
     comboBoxCommune.DataSource = Wilayas.First(w => w.Code == (int)comboBoxWilaya.SelectedValue).Communes.OrderBy(c => c.Name).ToList();
     IsSectorModified           = true;
 }