예제 #1
0
        public List <Country> GetCountries()
        {
            var rept = new CountriesRepository();
            var hej  = rept.GetAllCountries();

            return(hej);
        }
예제 #2
0
        //Returnerar lista med länder
        public List <Country> getInfoOnSelectedCountry()
        {
            var c     = new CountriesRepository();
            var count = c.GetAllCountries();

            return(count);
        }
예제 #3
0
        public void SaveCountriesfromDBtoXML()
        {
            var countriesList = new List <Countries>();
            var list          = countryRep.GetAllCountries();

            foreach (var c in list)
            {
                var newc = new Countries
                {
                    CID         = c.CID,
                    Name        = c.Name,
                    Subsistence = c.Subsistence,
                    Currency    = c.Currency
                };
                countriesList.Add(newc);
                countryXML.Spara(countriesList, "Country.xml");
            }
        }
예제 #4
0
        public MainWindow()
        {
            InitializeComponent();
            PopulateCurrencyData();
            PopulateListViewUsers();
            PupulateListViewCountries();
            localHandeler.SaveCountriesfromDBtoXML();


            TbTotalKm.IsReadOnly = true;
            tbUserID.IsEnabled = false;
            tbUsername.IsEnabled = false;
            tbBoss.IsEnabled = false;
            notesLoading = notesHandler.LoadNotes("Notes.xml");
            tbNotes.Text = notesLoading.Note;
            var rep = new CountriesRepository();

            main = this;

            var hej = rep.GetAllCountries();


            foreach(var x in hej)
            {
                CbCountries.Items.Add(x.Name);       
            }

            try
            {
                _reportDraftLoading = reportHandler.LoadDraft("DraftReport.xml");
                TbTotalKm.Text = _reportDraftLoading.NumberOfKilometersDrivenInTotal.ToString();
                TbCarTripLengthKm.Text = _reportDraftLoading.KilometersDriven.ToString();
                tbDoneOnTrip.Text = _reportDraftLoading.Description;
                dpStartDate.Text = _reportDraftLoading.StartDate;
                dpEndDate.Text = _reportDraftLoading.EndDate;
                foreach (var kvitto in _reportDraftLoading.imagePathsList)
                {
                    listBoxReceipts.Items.Add(kvitto);
                }
                foreach (var dayinfo in _reportDraftLoading.daysSpentInCountry)
                {
                    listBoxDays.Items.Add(dayinfo);
                }
                
                
            }
            catch
            {
                MessageBox.Show("Det finns inget sparat utkast att ladda");
            }


        }
예제 #5
0
        public void uppdateCountry(string currname, string newname, string newcurr, int newsub)
        {
            var countryrep = new CountriesRepository();
            var list       = countryrep.GetAllCountries();
            var cid        = 1;

            foreach (var c in list)
            {
                if (c.Name == currname)
                {
                    cid = c.CID;
                }
            }


            CountriesRepository.UpdateCountry(cid, newname, newcurr, newsub);
        }
예제 #6
0
        public void AddNewCountry(string CountryName, string currency, int Sub)
        {
            var countryrep = new CountriesRepository();
            var check      = countryrep.GetAllCountries();


            try
            {
                var country = new Scrum.Data.Country()
                {
                    Name        = CountryName,
                    Currency    = currency,
                    Subsistence = Sub
                };

                countryrep.addCountry(country);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex + "#### Det har blivit fel, ProfileController, Register");
            }
        }