Exemple #1
0
        /// <summary>
        /// Gets all information about locations from the database
        /// </summary>
        /// <returns>a list of found locations</returns>
        public List <tblLocation> GetAllLocations()
        {
            ReadWriteFile      rwf  = new ReadWriteFile();
            List <tblLocation> list = new List <tblLocation>();

            try
            {
                using (WorkerContext context = new WorkerContext())
                {
                    list = (from x in context.tblLocations select x).OrderBy(x => x.LocationAddress).ToList();

                    // If the location list is empty
                    if (!list.Any())
                    {
                        rwf.ReadLocationFromFile(list);
                    }

                    return(list);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception" + ex.Message.ToString());
                return(null);
            }
        }