コード例 #1
0
        private void goBack_Click(object sender, RoutedEventArgs e)
        {
            EventsDB ev = new EventsDB();

            this.Hide();
            ev.Show();
        }
コード例 #2
0
ファイル: eveMakeIt.xaml.cs プロジェクト: ACE-VSIT/Ace-Reg
        private void createEvent()
        {
            sqLite = new SQLiteConnection(dbConString);

            if (MessageBox.Show("Create this event?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
            {
                MessageBox.Show("Process Terminated");
            }

            else
            {
                eveTable      = createEventBox.Text;
                approvalTable = eveTable + "_approval";

                if (!(string.IsNullOrWhiteSpace(eveTable)))
                {
                    try
                    {
                        sqLite.Open();

                        string        Q             = "CREATE TABLE '" + eveTable + "'(EID TEXT PRIMARY KEY, Name TEXT, RollNo TEXT, College TEXT, Course TEXT, Semester_Section TEXT, Prize TEXT)";
                        SQLiteCommand createCommand = new SQLiteCommand(Q, sqLite);
                        createCommand.ExecuteNonQuery();

                        Q             = "CREATE TABLE '" + approvalTable + "'(EID TEXT PRIMARY KEY, Name TEXT, Prize TEXT, Status TEXT, SeatNo TEXT UNIQUE)";
                        createCommand = new SQLiteCommand(Q, sqLite);
                        createCommand.ExecuteNonQuery();

                        MessageBox.Show("Event Creation Success!");
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message);
                    }

                    finally
                    {
                        EventsDB ev = new EventsDB();
                        sqLite.Close();
                        this.Hide();
                        ev.Show();
                    }
                }

                else
                {
                    MessageBox.Show("White space not allowed");
                }
            }
        }
コード例 #3
0
ファイル: ShowEvents.xaml.cs プロジェクト: ACE-VSIT/Ace-Reg
        private void desEvbut_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Destroy selected event?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
            {
                MessageBox.Show("Process Terminated");
            }

            else
            {
                if (test == true)
                {
                    sqLite  = new SQLiteConnection(dbConString);
                    apTable = selectedTable + "_approval";
                    try
                    {
                        sqLite.Open();
                        Query = "DROP TABLE '" + selectedTable + "'";
                        SQLiteCommand createCommand = new SQLiteCommand(Query, sqLite);
                        createCommand.ExecuteNonQuery();

                        Query         = "DROP TABLE '" + apTable + "'";
                        createCommand = new SQLiteCommand(Query, sqLite);
                        createCommand.ExecuteNonQuery();

                        MessageBox.Show("Event has been eliminated");
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message);
                    }

                    finally
                    {
                        EventsDB db = new EventsDB();
                        sqLite.Close();
                        this.Hide();
                        db.Show();
                    }
                }

                else
                {
                    MessageBox.Show("You shall NOT pass!");
                }
            }
        }
コード例 #4
0
        private void updateData_Click(object sender, RoutedEventArgs e)
        {
            sqLite = new SQLiteConnection(dbConString);


            if (MessageBox.Show("Update Status?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
            {
                MessageBox.Show("Updation Process Canceled");
            }

            else
            {
                try
                {
                    sqLite.Open();

                    Query = "UPDATE '" + apTable + "'SET Status = '" + statusCheck.IsChecked.ToString() + "' WHERE EID='" + personSelected.Text + "' OR NAME = '" + personSelected.Text + "' ";
                    SQLiteCommand createCommand = new SQLiteCommand(Query, sqLite);
                    createCommand.ExecuteNonQuery();


                    Query         = "UPDATE '" + apTable + "' SET SeatNo = '" + seatNum.Text + "' WHERE EID='" + personSelected.Text + "' OR NAME = '" + personSelected.Text + "' ";
                    createCommand = new SQLiteCommand(Query, sqLite);
                    createCommand.ExecuteNonQuery();

                    MessageBox.Show("Record Updated");
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }

                finally
                {
                    EventsDB e1 = new EventsDB();
                    sqLite.Close();
                    this.Hide();
                    e1.Show();
                }
            }
        }
コード例 #5
0
ファイル: InsertEvent.xaml.cs プロジェクト: ACE-VSIT/Ace-Reg
        private void subButton_Click(object sender, RoutedEventArgs e)
        {
            SQLiteConnection sqLite = new SQLiteConnection(dbConString);

            ID = selectedTable.Substring(0, 3).ToUpper() + "-" + ID.ToUpper();

            if (prizeBox.Text.Equals(null) || nameBox.Text.Equals(null) || courseBox.Equals(null) || rollBox.Equals(null) || semBox.Equals(null) || collBox.Equals(null))
            {
                MessageBox.Show("Fill all the details");
            }
            else
            {
                try
                {
                    approvalTable = selectedTable + "_approval";

                    sqLite.Open();
                    string        Query         = "INSERT INTO '" + selectedTable + "'(EID, Name, RollNo, College, Course, Semester_Section, Prize) values('" + ID + "', '" + this.nameBox.Text + "', '" + rollBox.Text + "',  '" + collBox.Text + "',  '" + courseBox.Text + "',  '" + semBox.Text + "', '" + prizeBox.Text + "' )";
                    SQLiteCommand createCommand = new SQLiteCommand(Query, sqLite);
                    createCommand.ExecuteNonQuery();

                    Query         = "INSERT INTO '" + approvalTable + "'(EID, Name, Prize) values('" + ID + "', '" + this.nameBox.Text + "', '" + prizeBox.Text + "')";
                    createCommand = new SQLiteCommand(Query, sqLite);
                    createCommand.ExecuteNonQuery();

                    MessageBox.Show("New Record Inserted");
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }

                finally
                {
                    EventsDB ev = new EventsDB();
                    sqLite.Close();
                    this.Hide();
                    ev.Show();
                }
            }
        }