예제 #1
0
        private void deleteP_Click(object sender, EventArgs e)
        {
            if (bunifuCustomDataGrid2.SelectedCells.Count > 0)
            {
                SqlDataAdapter adapt = new SqlDataAdapter("select class_id from classrooms where class_name= '" + className + "' AND facilitator_id='" + Program.user_id + "' ", con);
                DataTable      dt    = new DataTable();
                adapt.Fill(dt);
                int ID = int.Parse(dt.Rows[0][0].ToString());//Getting the ID of The Classroom



                SqlDataAdapter add  = new SqlDataAdapter("select participant_id from participant where fullname= '" + participantName + "'", con);
                DataTable      data = new DataTable();
                add.Fill(data);
                int id = int.Parse(data.Rows[0][0].ToString());//Getting the ID of The Participant



                DialogResult result = Dialogue1.Show("Are You Sure?", "", "Ok", "Cancel");
                if (result == DialogResult.Yes)
                {
                    con.Open();


                    String query = "DELETE FROM classlist WHERE class_id= '" + ID + "' AND facilitator_id = '" + Program.user_id + "' AND participant_id= '" + id + "' ";

                    SqlDataAdapter sda = new SqlDataAdapter(query, con);

                    int m = sda.SelectCommand.ExecuteNonQuery();
                    con.Close();
                    if (m > 0)
                    {
                        Load_Class();
                        Load_Participant();
                        bunifuCustomDataGrid1.ClearSelection();
                        bunifuCustomDataGrid2.ClearSelection();

                        Dialogue.Show("Successfully Deleted!", "", "Ok", "Cancel");
                    }


                    else
                    {
                        Dialogue.Show("Fail to Delete!", "", "Ok", "Cancel");
                        Load_Class();
                        Load_Participant();
                        bunifuCustomDataGrid1.ClearSelection();
                        bunifuCustomDataGrid2.ClearSelection();
                    }
                }//end if result
            }

            else
            {
                Dialogue.Show("Nothing Selected", "", "Ok", "Cancel");
            }
        }
예제 #2
0
        private void bunifuFlatButton3_Click(object sender, EventArgs e)
        {
            try
            {
                if (bunifuCustomDataGrid1.SelectedRows.Count > 0)
                {
                    SqlDataAdapter sed = new SqlDataAdapter("select class_id from classrooms where class_name= '" + Class + "' ", con);
                    DataTable      det = new DataTable();
                    sed.Fill(det);
                    int id = Convert.ToInt32(det.Rows[0][0]);



                    DialogResult result = Dialogue1.Show("Are You Sure?", "", "Ok", "Cancel");
                    if (result == DialogResult.Yes)
                    {
                        con.Open();

                        String         q = "DELETE FROM grouplist WHERE group_id IN (select group_id from groups where group_name= '" + GroupName + "')";
                        SqlDataAdapter s = new SqlDataAdapter(q, con);
                        int            n = s.SelectCommand.ExecuteNonQuery();


                        String         query = "DELETE FROM groups WHERE group_name= '" + GroupName + "' AND class_id= '" + id + "' ";
                        SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                        int            m     = sda.SelectCommand.ExecuteNonQuery();
                        con.Close();
                        if (m > 0)
                        {
                            Load_Group();
                            bunifuCustomDataGrid1.ClearSelection();

                            Dialogue.Show("Successfully Deleted!", "", "Ok", "Cancel");
                        }

                        else
                        {
                            Load_Group();
                            Dialogue.Show("Fail to Delete!", "", "Ok", "Cancel");
                            bunifuCustomDataGrid1.ClearSelection();
                        }
                    }//end if result
                }

                else
                {
                    Dialogue.Show("Nothing Selected", "", "Ok", "Cancel");
                }
            }//try


            catch (Exception ex)
            {
                Dialogue.Show(" ' " + ex.Message.ToString() + "' ", "", "Ok", "Cancel");
            }
        }
예제 #3
0
 public static DialogResult Show(string Text, string Caption, string btnOK, string btnCancel)
 {
     MsgBox                        = new Dialogue1();
     MsgBox.label2.Text            = Text;
     MsgBox.bunifuFlatButton1.Text = btnOK;
     MsgBox.bunifuFlatButton2.Text = btnCancel;
     result                        = DialogResult.No;
     MsgBox.ShowDialog();
     return(result);
 }
예제 #4
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            SqlDataAdapter adapter = new SqlDataAdapter("select count(class_id) from classrooms where class_name= '" + ClassNameBox.Text + "' ", con);
            DataTable      dat     = new DataTable();

            adapter.Fill(dat);
            int Count = int.Parse(dat.Rows[0][0].ToString());

            if (string.IsNullOrWhiteSpace(ClassNameBox.Text) && ClassNameBox.Text.Length > 0 || ClassNameBox.Text == "")
            {
                Dialogue.Show("Invalid Input or Empty", "", "Ok", "Cancel");
            }//If End

            else if (Count != 0)
            {
                Dialogue.Show("Classroom Already Exist! Please use Other Name", "", "Ok", "Cancel");
            }


            else
            {
                DialogResult result = Dialogue1.Show("Are You Sure?", "", "Ok", "Cancel");
                if (result == DialogResult.Yes)
                {
                    SqlDataAdapter adapt = new SqlDataAdapter("select class_id from classrooms where class_name= '" + Cname + "'", con);
                    DataTable      dt    = new DataTable();
                    adapt.Fill(dt);
                    int ID = int.Parse(dt.Rows[0][0].ToString());//Getting the ID of The Classroom


                    con.Open();
                    String         query = "UPDATE classrooms SET class_name= '" + ClassNameBox.Text + " '  WHERE facilitator_id= '" + Program.user_id + "' AND class_id= '" + ID + "' ";
                    SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                    int            n     = sda.SelectCommand.ExecuteNonQuery();

                    con.Close();


                    CreateMyClassroom CC = (CreateMyClassroom)Application.OpenForms["CreateMyClassroom"];


                    CC.Load_Class();
                    CC.Load_Participant();



                    this.Close();
                }

                else
                {
                    Dialogue.Show("Fail to Update", "", "Ok", "Cancel");
                }
            }
        }
예제 #5
0
        private async void bunifuImageButton2_Click_1(object sender, EventArgs e)
        {
            await Task.Delay(100);

            DialogResult result = Dialogue1.Show("Are you sure you want to Exit?", "", "Ok", "Cancel");

            if (result == DialogResult.Yes)
            {
                Send("DISCONNECT");
            }
        }
예제 #6
0
        private void DeleteQuiz_Click(object sender, EventArgs e)
        {
            try
            {
                if (bunifuCustomDataGrid1.SelectedRows.Count > 0)
                {
                    SqlDataAdapter adapt = new SqlDataAdapter("select quiz_id from quizzes where quiz_title= '" + QuizName + "'", con);
                    DataTable      dt    = new DataTable();
                    adapt.Fill(dt);
                    int ID = int.Parse(dt.Rows[0][0].ToString());//Getting the ID of The Quiz


                    DialogResult result = Dialogue1.Show("Are You Sure?", "", "Ok", "Cancel");
                    if (result == DialogResult.Yes)
                    {
                        con.Open();

                        String         qer   = "DELETE FROM QuestionAnswers WHERE quiz_id= '" + ID + "' ";
                        String         query = "DELETE FROM quizzes WHERE quiz_id= '" + ID + "' AND facilitator_id = '" + Program.user_id + "' ";
                        SqlDataAdapter sad   = new SqlDataAdapter(qer, con);
                        SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                        int            n     = sad.SelectCommand.ExecuteNonQuery();
                        int            m     = sda.SelectCommand.ExecuteNonQuery();
                        con.Close();
                        if (n >= 0 && m > 0)
                        {
                            Load_Quiz();
                            bunifuCustomDataGrid1.ClearSelection();
                            search.Text = "";
                            Dialogue.Show("Successfully Deleted!", "", "Ok", "Cancel");
                        }

                        else
                        {
                            Dialogue.Show("Fail to Delete!", "", "Ok", "Cancel");

                            bunifuCustomDataGrid1.ClearSelection();
                        }
                    }//end if result
                }

                else
                {
                    Dialogue.Show("Nothing Selected", "", "Ok", "Cancel");
                }
            }//try


            catch (Exception ex)
            {
                //  Dialogue.Show(" ' " + ex.Message.ToString() + "' ", "", "Ok", "Cancel");
            }
        }
예제 #7
0
        private void buttonLogout_Click(object sender, EventArgs e)
        {
            DialogResult result = Dialogue1.Show("Are You Sure?", "", "Ok", "Cancel");

            if (result == DialogResult.Yes)
            {
                this.Hide();
                //   this.Close();  error nag loloop ning splash kaya unhandled

                ChooseUser cu = new ChooseUser();
                cu.Show();
            }
        }
예제 #8
0
        private void MyAccountEdit_Click(object sender, EventArgs e)
        {
            switch (MyAccountEdit.Text)
            {
            case "Edit":
            {
                fullname.Enabled    = true;
                username.Enabled    = true;
                password.Enabled    = true;
                MyAccountEdit.Text  = "Save";
                password.isPassword = false;
            }
            break;

            case "Save":
            {
                if (fullname.Text != "" && username.Text != "" && password.Text != "")
                {
                    DialogResult result = Dialogue1.Show("Are you sure ?", "", "Ok", "Cancel");
                    if (result == DialogResult.Yes)
                    {
                        fullname.Enabled   = false;
                        username.Enabled   = false;
                        password.Enabled   = false;
                        MyAccountEdit.Text = "Edit";



                        con.Open();
                        String         query = "UPDATE participant SET fullname= '" + fullname.Text + "', p_username='******', p_password = '******' WHERE participant_id= '" + Program.par_id + "' ";
                        SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                        int            n     = sda.SelectCommand.ExecuteNonQuery();

                        con.Close();

                        password.isPassword = true;

                        load_account();
                    }
                }

                else
                {
                    Dialogue.Show("Please Fill all Fields!", "", "Ok", "Cancel");
                }
            }
            break;
            }
        }
예제 #9
0
 private void MainMenu_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (closing)
     {
         DialogResult result = Dialogue1.Show("Are you sure you want to Exit?", "", "Ok", "Cancel");
         if (result == DialogResult.Yes)
         {
             Environment.Exit(0);
         }
         else
         {
             e.Cancel = true;
         }
     }
 }
        private void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            try
            {
                if (bunifuCustomDataGrid1.SelectedRows.Count > 0)
                {
                    DialogResult result = Dialogue1.Show("Are You Sure?", "", "Ok", "Cancel");
                    if (result == DialogResult.Yes)
                    {
                        con.Open();

                        String         q = "DELETE FROM grouplist WHERE participant_id=(select participant_id from participant where fullname= '" + ParticipantName + "')";
                        SqlDataAdapter s = new SqlDataAdapter(q, con);
                        int            n = s.SelectCommand.ExecuteNonQuery();


                        con.Close();
                        if (n > 0)
                        {
                            Load_Participant();
                            bunifuCustomDataGrid1.ClearSelection();

                            Dialogue.Show("Successfully Deleted!", "", "Ok", "Cancel");
                        }

                        else
                        {
                            Dialogue.Show("Fail to Delete!", "", "Ok", "Cancel");
                            bunifuCustomDataGrid1.ClearSelection();
                        }
                    }//end if result
                }

                else
                {
                    Dialogue.Show("Nothing Selected", "", "Ok", "Cancel");
                }
            }//try


            catch (Exception ex)
            {
                Dialogue.Show(" ' " + ex.Message.ToString() + "' ", "", "Ok", "Cancel");
            }
        }
예제 #11
0
        private void MyAccountEdit_Click(object sender, EventArgs e)
        {
            switch (MyAccountEdit.Text)
            {
            case "Edit":
            {
                pin.Enabled = true;

                MyAccountEdit.Text = "Save";
            }
            break;

            case "Save":
            {
                if (pin.Text != "")
                {
                    DialogResult result = Dialogue1.Show("Are you sure ?", "", "Ok", "Cancel");
                    if (result == DialogResult.Yes)
                    {
                        pin.Enabled = false;

                        MyAccountEdit.Text = "Edit";



                        con.Open();
                        String         query = "UPDATE SERVER SET PIN= '" + pin.Text + "' ";
                        SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                        int            n     = sda.SelectCommand.ExecuteNonQuery();

                        con.Close();

                        PIN();
                    }
                }

                else
                {
                    Dialogue.Show("Please Fill !", "", "Ok", "Cancel");
                }
            }
            break;
            }
        }
예제 #12
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            SqlDataAdapter sed = new SqlDataAdapter("select class_id from classrooms where class_name= '" + Cname + "' ", con);
            DataTable      det = new DataTable();

            sed.Fill(det);
            int id = Convert.ToInt32(det.Rows[0][0]);


            SqlDataAdapter adapt = new SqlDataAdapter("select count(group_id) from groups where group_name= '" + GroupNameBox.Text + "' AND class_id= '" + id + "'  ", con);
            DataTable      dat   = new DataTable();

            adapt.Fill(dat);
            int Count = int.Parse(dat.Rows[0][0].ToString());



            if (string.IsNullOrWhiteSpace(GroupNameBox.Text) && GroupNameBox.Text.Length > 0 || GroupNameBox.Text == "")
            {
                Dialogue.Show("Invalid Input or Empty", "", "Ok", "Cancel");
            }//If End

            else if (Count != 0)
            {
                Dialogue.Show("Group Already Exist! Please use Other Name", "", "Ok", "Cancel");
            }

            else
            {
                DialogResult result = Dialogue1.Show("Are You Sure?", "", "Ok", "Cancel");
                if (result == DialogResult.Yes)
                {
                    SqlDataAdapter adapter = new SqlDataAdapter("select group_id from groups where group_name= '" + Gname + "' AND class_id= '" + id + "' ", con);
                    DataTable      dt      = new DataTable();
                    adapter.Fill(dt);
                    int ID = int.Parse(dt.Rows[0][0].ToString());//Getting the ID of The Group


                    con.Open();
                    String         query = "UPDATE groups SET group_name= '" + GroupNameBox.Text + " '  WHERE group_id= '" + ID + "' ";
                    SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                    int            n     = sda.SelectCommand.ExecuteNonQuery();

                    con.Close();


                    ClassGroup CG = (ClassGroup)Application.OpenForms["ClassGroup"];


                    CG.Load_Group();


                    this.Close();
                }

                else
                {
                    Dialogue.Show("Fail to Update", "", "Ok", "Cancel");
                }
            }
        }
예제 #13
0
        private void deleteC_Click(object sender, EventArgs e)
        {
            try
            {
                if (bunifuCustomDataGrid1.SelectedCells.Count > 0)
                {
                    SqlDataAdapter adapt = new SqlDataAdapter("select class_id from classrooms where class_name= '" + className + "' AND facilitator_id='" + Program.user_id + "' ", con);
                    DataTable      dt    = new DataTable();
                    adapt.Fill(dt);
                    int ID = int.Parse(dt.Rows[0][0].ToString());//Getting the ID of The Classroom


                    DialogResult result = Dialogue1.Show("Are You Sure?", "", "Ok", "Cancel");
                    if (result == DialogResult.Yes)
                    {
                        con.Open();

                        String         qer   = "DELETE FROM classlist WHERE class_id= '" + ID + "' ";
                        String         qe    = "DELETE FROM grouplist WHERE group_id=(Select group_id from groups where class_id= '" + ID + "') ";
                        String         que   = "DELETE FROM groups WHERE class_id= '" + ID + "' ";
                        String         query = "DELETE FROM classrooms WHERE class_name= '" + className + "' AND facilitator_id = '" + Program.user_id + "' ";
                        SqlDataAdapter sad   = new SqlDataAdapter(qer, con);
                        SqlDataAdapter s     = new SqlDataAdapter(qe, con);
                        SqlDataAdapter d     = new SqlDataAdapter(que, con);
                        SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                        int            n     = sad.SelectCommand.ExecuteNonQuery();
                        int            o     = s.SelectCommand.ExecuteNonQuery();
                        int            p     = d.SelectCommand.ExecuteNonQuery();
                        int            m     = sda.SelectCommand.ExecuteNonQuery();
                        con.Close();
                        if (n >= 0 && m > 0)
                        {
                            Load_Class();
                            Load_Participant();
                            bunifuCustomDataGrid1.ClearSelection();
                            bunifuCustomDataGrid2.ClearSelection();



                            Dialogue.Show("Successfully Deleted!", "", "Ok", "Cancel");
                        }

                        else
                        {
                            Dialogue.Show("Fail to Delete!", "", "Ok", "Cancel");
                            Load_Class();
                            Load_Participant();
                            bunifuCustomDataGrid1.ClearSelection();
                            bunifuCustomDataGrid2.ClearSelection();
                        }
                    }//end if result
                }

                else
                {
                    Dialogue.Show("Nothing Selected", "", "Ok", "Cancel");
                }
            }//try


            catch (Exception ex)
            {
                Dialogue.Show(" ' " + ex.Message.ToString() + "' ", "", "Ok", "Cancel");
            }
        }