Exemplo n.º 1
0
        public ListOffersVM()
        {
            _offers = new ObservableCollection <DetailOfferVM>();
            List <Offer> listOffers = Manager.Instance.GetAllOffers();

            foreach (Offer o in listOffers)
            {
                _offers.Add(new DetailOfferVM(o));
            }
            if (_offers != null && _offers.Count > 0)
            {
                _selectedOffer = _offers.ElementAt(0);
            }


            _listStatuses = new ObservableCollection <Status>();
            List <Status> listStatuses = Manager.Instance.GetAllStatuses();

            foreach (Status stat in listStatuses)
            {
                _listStatuses.Add(stat);
            }
            _allOffers = new ObservableCollection <DetailOfferVM>(_offers);
            if (_listStatuses != null && _listStatuses.Count > 0)
            {
                _selectedStatus = _listStatuses.ElementAt(0);
            }
        }
Exemplo n.º 2
0
        public void AddOffer()
        {
            DetailOffer   addWindow = new DetailOffer();
            DetailOfferVM newOffer  = new DetailOfferVM(new Offer());

            addWindow.DataContext = newOffer;
            Window window = new Window
            {
                Title   = "My User Control Dialog",
                Content = addWindow
            };

            window.ShowDialog();
            Offer o = new Offer
            {
                Date        = newOffer.Date,
                Description = newOffer.Description,
                Responsible = newOffer.Responsible,
                Salary      = newOffer.Salary,
                Status      = newOffer.Status,
                StatusId    = newOffer.StatusId,
                Title       = newOffer.Title
            };

            Manager.Instance.AddOffer(o);
        }