Esempio n. 1
0
        private void discardChangesBtn_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure you want to discard your changes?",
                                                "Cancel making changes",
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                main_screen open_screen = new main_screen(currentUser);
                this.Close();
                open_screen.Show();
            }
        }
Esempio n. 2
0
        private void saveChangesBtn_Click_1(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure you want to save your changes?",
                                                "Save changes",
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)

            {
                if (newGroup.group_name == currentGroup.group_name)
                {
                    moveGroup = false;
                }

                group.changeGroupScout(currentGroup, newGroup, scoutToBeEdited, moveGroup);

                int scoutId = scoutToBeEdited.scoutID;

                using (var ctx = new SALAHContext())
                {
                    var result = ctx.Scouts.SingleOrDefault(s => s.scoutID == scoutId);
                    if (result != null)
                    {
                        result.firstName           = firstNameTxtbx.Text;
                        result.secondName          = secondNameTxtBx.Text;
                        result.Address             = GetNewAddress();
                        result.dateOfBirth         = DOBPicker.Value.ToString();
                        result.healthInfo          = healthTxtBx.Text;
                        result.parentEmail         = pEmailTxtBx.Text;
                        result.parentEmergencyNumb = pContactNumTxtBx.Text;
                        result.parentFirstName     = pFirstNameTxtBx.Text;
                        result.parentSecondName    = pSecondNameTxtBx.Text;
                    }

                    ctx.SaveChanges();
                    ctx.Dispose();
                }

                main_screen open_screen = new main_screen(currentUser);
                this.Close();
                open_screen.Show();
            }
            return;
        }