private void DataScheduleMtn_Loaded(object sender, RoutedEventArgs e)
        {
            var rslt = (from x in DatabaseConnectionHandler.GetInstance().MaintenanceSchedule
                        select new
            {
                MaintenanceId = x.MaintenanceScheduleId,
                AttractionId = x.AttractionId,
                AttractionName = x.AttractionName,
                Date = x.MaintenanceDate,
                StartTime = x.MaintenaceStartTime,
                EndTime = x.MaintenanceEndTime
            }).ToList();

            DataScheduleMtn.ItemsSource = rslt;
        }
Пример #2
0
        private void btnSearchAtt_Click(object sender, RoutedEventArgs e)
        {
            int id   = Int32.Parse(tbReqAttId.Text);
            var rslt = (from x in DatabaseConnectionHandler.GetInstance().RequestAttraction.Where(x => x.ReqAttId == id)
                        select new
            {
                x.ReqAttName,
                x.ReqAttDescription
            }).ToList();

            foreach (var item in rslt)
            {
                lbNameAtt.Content = item.ReqAttName;
                lbDescAtt.Content = item.ReqAttDescription;
            }
        }
Пример #3
0
        public void DatabaseReadNewspaper()
        {
            SQLiteConnection connection = DatabaseConnectionHandler.Invoke();

            Newspaper np = connection.QueryFirst <Newspaper>("select * from newpaper where id=" + _testingID);

            Assert.AreEqual(np.id, _testingID);
            Assert.AreEqual(np.s_header, _testingNewspaper.s_header);
            Assert.AreEqual(np.s_description, _testingNewspaper.s_description);
            Assert.AreEqual(np.i_source_id, _testingNewspaper.i_source_id);
            Assert.AreEqual(np.s_full_text, _testingNewspaper.s_full_text);
            Assert.AreEqual(np.s_link, _testingNewspaper.s_link);
            Assert.AreEqual(np.s_date, _testingNewspaper.s_date);

            connection.Execute("delete from newpaper where id=" + _testingID);
        }
Пример #4
0
        private void btnSearchRide_Click(object sender, RoutedEventArgs e)
        {
            int id   = Int32.Parse(tbRideId.Text);
            var rslt = (from x in DatabaseConnectionHandler.GetInstance().Ride.Where(x => x.RideId == id)
                        select new
            {
                x.RideName, x.RideDescription, x.RideHowToWork,
                x.RideKind, x.RideSafetyInformation
            }).ToList();

            foreach (var item in rslt)
            {
                tbNameRide.Text    = item.RideName;
                tbDescRide.Text    = item.RideDescription;
                tbHowWorkRide.Text = item.RideHowToWork;
                tbSafetyRide.Text  = item.RideSafetyInformation;
                cbKindRide.Text    = item.RideKind;
            }
        }
Пример #5
0
        private void btnfinishCons_Click(object sender, RoutedEventArgs e)
        {
            int  id = Int32.Parse(tbReqRideId.Text);
            Ride rd = DatabaseConnectionHandler.GetInstance().Ride.Where(x => x.RideId == id).FirstOrDefault();

            if (rd.RideStatus.Contains("Add"))
            {
                rd.RideStatus = "Active";
            }
            else if (rd.RideStatus.Contains("Upd"))
            {
                rd.RideStatus = "Active";
            }
            else if (rd.RideStatus.Contains("Rem"))
            {
                rd.RideStatus = "Remove";
            }
            DatabaseConnectionHandler.GetInstance().SaveChanges();
            MessageBox.Show("Finish Construction");
        }
Пример #6
0
        public void DatabaseWriteNewspaper()
        {
            SQLiteConnection connection = DatabaseConnectionHandler.Invoke();

            connection.Execute("delete from newpaper where id=" + _testingID);

            Newspaper np = new Newspaper();

            np.id            = _testingID;
            np.s_header      = "test header";
            np.s_description = "test description";
            np.i_source_id   = 1083;
            np.s_full_text   = "test full text";
            np.s_link        = "test link";
            np.s_date        = "01.01.1999 20:21:34";

            _testingNewspaper = np;

            DataBase.SaveNewspaper(np);

            Assert.AreEqual(0, 0);
        }
Пример #7
0
        private void btnSearchAtt_Click(object sender, RoutedEventArgs e)
        {
            int id   = Int32.Parse(tbAttId.Text);
            var rslt = (from x in DatabaseConnectionHandler.GetInstance().Attraction.Where(x => x.AttractionId == id)
                        select new
            {
                x.AttractionName,
                x.AttractionDescription,
                x.AttractionHowToWork,
                x.AttractionWhoParticipant,
                x.AttractionStartDateLaunch
            }).ToList();

            foreach (var item in rslt)
            {
                tbNameAtt.Text            = item.AttractionName;
                tbDescAtt.Text            = item.AttractionDescription;
                tbHowWorkRAtt.Text        = item.AttractionHowToWork;
                tbWhoPart.Text            = item.AttractionWhoParticipant;
                dpDateLaunch.SelectedDate = item.AttractionStartDateLaunch;
            }
        }
        // Method used to retrieve last unique ID from tables
        private static string getLastUniqueID(string table, string uniqueId)
        {
            string lastUniqueKey = null;

            System.Data.DataSet dataset = new System.Data.DataSet();
            if ((table != null) && (uniqueId != null))
            {
                string queryString = "SELECT TOP 1 " + uniqueId + " FROM " + table + " ORDER BY " + uniqueId + " DESC";
                try
                {
                    dataset = DatabaseConnectionHandler.executeSelectQuery(queryString, null);

                    if (dataset != null)
                    {
                        foreach (System.Data.DataRow row in dataset.Tables[0].Rows)
                        {
                            lastUniqueKey = row[uniqueId.ToUpper()].ToString();
                        }
                    }
                }
                catch (Exception ex) { Console.WriteLine(ex.Message); }
            }
            return(lastUniqueKey);
        }
        private void dataListTable_Loaded(object sender, RoutedEventArgs e)
        {
            var rslt = DatabaseConnectionHandler.GetInstance().NumberTable.ToList();

            dataListTable.ItemsSource = rslt;
        }