private void createPrizeButton_Click(object sender, EventArgs e)
        {
            //TODO atentie la validate-ul asta -periculos
            if (!ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();



                /*
                 * placeNameValue.Text = "";
                 * placeNumberValue.Text = "";
                 * prizeAmountValue.Text = "0";
                 * prizePercentageValue.Text = "0";*/
            }
            else
            {
                MessageBox.Show("Please check in again.");
            }
        }
Пример #2
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(placeNameValue.Text,
                                                  placeNumberValue.Text,
                                                  prizeAmountValue.Text,
                                                  prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(model);

                // call the parent of this form (who called this form) and pass the PrizeModel instance created with user input
                callingForm.PrizeComplete(model);

                MessageBox.Show($"{model.PlaceNumber}, {model.PlaceName}, {model.PrizeAmount}, {model.PrizePercentage}", "result", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Close();

                //placeNameValue.Text = "";
                //placeNumberValue.Text = "";
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check it and try again", "Invalid form", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                var prize = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);

                prize = GlobalConfig.Connection.CreatePrize(prize);

                callingForm.PrizeComplete(prize);

                this.Close();

                //placeNameValue.Text = string.Empty;
                //placeNumberValue.Text = string.Empty;
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show("Invalid input. Please, try again", "Exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #4
0
        private void CreatePrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    PlaceNameTextbox.Text,
                    PlaceNumberTextbox.Text,
                    PrizeAmountTextBox.Text,
                    PrizePercentageTextbox.Text);

                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();

                //PlaceNameTextbox.Text = "";
                //PlaceNumberTextbox.Text = "";
                //PrizeAmountTextBox.Text = "0";
                //PrizePercentageTextbox.Text = "0";
            }
            else
            {
                MessageBox.Show("Invalid entry");
            }
        }
Пример #5
0
        private void btnCreatePrize_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    txtPlaceName.Text,
                    txtPlaceNumber.Text,
                    txtPrizeAmount.Text,
                    txtPrizePercentage.Text);

                IDataConnection tournamentRepo = SqlFactory.CreateTournamentRepo();
                tournamentRepo.CreatePrize(model);


                //GlobalConfig.Connection.CreatePrize(model);
                callingForm.PrizeComplete(model);
                Close();

                //txtPlaceName.Text = "";
                //txtPlaceNumber.Text = "";
                //txtPrizeAmount.Text = "0";
                //txtPrizePercentage.Text = "0";

                //TODO - comment this out
                MessageBox.Show("everything is awesome");
            }
            else
            {
                //TODO - comment this out
                MessageBox.Show("invalid information");
            }
        }
Пример #6
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                // Create model
                PrizeModel prize = new PrizeModel()
                {
                    PlaceName       = placeNameValue.Text,
                    PlaceNumber     = int.Parse(placeNumberValue.Text),
                    PrizeAmount     = decimal.Parse(prizeAmountValue.Text),
                    PrizePercentage = double.Parse(prizePercentageValue.Text)
                };

                GlobalConfig.Connection.CreatePrize(prize);

                callingForm.PrizeComplete(prize);
                this.Close();

                // Set fields default values
                placeNameValue.Text       = "";
                placeNumberValue.Text     = "";
                prizeAmountValue.Text     = "0";
                prizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information.");
            }
        }
Пример #7
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (FormIsValid())
            {
                PrizeModel model = new PrizeModel
                                   (
                    placeNameTextBox.Text,
                    placeNumberTextBox.Text,
                    prizeAmountTextBox.Text,
                    prizePercentageTextBox.Text
                                   );

                // Even though this method returns a PrizeModel
                // I don't have to put it into a variable, I just
                // have the option if I need it.
                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();

                //placeNameTextBox.Text = "";
                //placeNumberTextBox.Text = "";
                //prizeAmountTextBox.Text = "0";
                //prizePercentageTextBox.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check it and try again.");
            }
        }
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                // can try TryParse or: create a constructor in PrizeModel
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();

                // reset to default values after
                // the data has been entered and validated.
                //placeNameValue.Text = "";
                //placeNumberValue.Text = "";
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }

            else
            {
                MessageBox.Show("This form has invalid information! \nPlease check it and try again.");
            }
        }
Пример #9
0
        private void CreatePrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            //!!!!If Validation returns true, declare a variable 'model' by an instantiation of the Class "PrizeModel"
            {
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text
                    );

                //!!!!Pass the object (instance) into the method 'CreatePrize'
                //that was inherited by the 'Connection' Read-Write property from the 'IDataConnection' Interface

                GlobalConfig.Connection.CreatePrize(model);

                //Initialization of the PrizeForm after user inpunts being submitted
                callingForm.PrizeComplete(model);
                this.Close();
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please, check it and try again.");
            }
        }
Пример #10
0
        private void BtnUnesiNagradu_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                NagradaModel model = new NagradaModel
                                         (textBoxImeNagrade.Text,
                                         textBoxBrojNagrade.Text,
                                         textBoxKolicina.Text,
                                         textBoxPostotakNagrade.Text);

                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                //textBoxImeNagrade.Text = "";
                // textBoxBrojNagrade.Text = "";
                //textBoxKolicina.Text = "0";
                //textBoxPostotakNagrade.Text = "0";
                this.Close();
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please chech it and try again! ");
            }
        }
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);


                GlobalConfig.Connection.CreatePrize(model);
                //foreach (IDataConnection db in GlobalConfig.Connections) //when it was a list
                //{
                //    db.CreatePrize(model);
                //}
                callingForm.PrizeComplete(model);

                this.Close();

                //we don't need the following, because we will close our form at this point
                //placeNameValue.Text = "";
                //placeNumberValue.Text = "";
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check it and try again.");
            }
        }
Пример #12
0
        private void buttonCreatePrize_Click(object sender, EventArgs e)
        {
            if (IsFormValid())
            {
                var prizeModel = new PrizeModel(
                    textBoxPlaceName.Text,
                    textBoxPlaceNumber.Text,
                    textBoxPrizeAmount.Text,
                    textBoxPrizePercentage.Text);


                GlobalConfig.Connections.CreatePrize(prizeModel);

                callingForm.PrizeComplete(prizeModel);

                this.Close();

                //textBoxPlaceName.Text = "";
                //textBoxPlaceNumber.Text = "";
                //textBoxPrizeAmount.Text = "0";
                //textBoxPrizePercentage.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check it and try again.");
            }
        }
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);

                //save to each of the data stores


                GlobalConfig.Connection.CreatePrize(model);
                callingForm.PrizeComplete(model);
                this.Close();

                //Clear out the form values after saving to db
                //placeNameValue.Text = "";
                //placeNumberValue.Text = "";
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information!");
            }
        }
        private void createPrizebutton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(

                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(model);

                //Pass back the already created and vallidated form back from the caller.
                callingForm.PrizeComplete(model);

                MessageBox.Show("Prize created successfully!", "Prize created", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CleanFormFields();

                this.Close();
            }
            else
            {
                MessageBox.Show("An error ocurr during the attempt to save the prize.\nReview the information and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #15
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(placeNameValue.Text, placeNumberValue.Text, prizeAmountValue.Text, prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();

                //placeNameValue.Text = string.Empty;
                //placeNumberValue.Text = string.Empty;
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show(Prize_Resource.InvalidInformation,
                                Prize_Resource.InvalidCaption,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text
                    );

                GlobalConfig.Connection.CreatePrize(model);

                // Sending the model back
                callingForm.PrizeComplete(model);

                this.Close();

                /*model.PlaceName = placeNameValue.Text;
                 * model.PlaceNumber = placeNumberValue.Text;*/
            }
            else
            {
                MessageBox.Show("This form is invalid");
            }
        }
Пример #17
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(model); // Model goes into the method, got id filled and returned the same model instance

                // We can pass out the model to a class, who called us, who implements IPrizeRequester, such as CreateTournamentForm class
                callingForm.PrizeComplete(model);

                this.Close();
                //Form is closed therefore reset these values is not needed
                //placeNameValue.Text = "";
                //placeNumberValue.Text = "";
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check it and try again.");
            }
        }
        private void CreatePrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(placeNameTextBox.Text,
                                                  placeNumberTextBox.Text,
                                                  prizeAmountTextBox.Text,
                                                  prizePercentageTextBox.Text);


                GlobalConfig.Connection.CreatePrize(model); // To assign the return of this method is not necessary because it's a Reference Type
                //Whoever call this method it's like "Here is the model you asked for".

                callingForm.PrizeComplete(model); //Method responsible for data transportation?


                this.Close();


                //Cleaning up the form

                //placeNameTextBox.Text = "";
                //placeNumberTextBox.Text = "";
                //prizeAmountTextBox.Text = "0";
                //prizePercentageTextBox.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check them and try again.");
            }
        }
Пример #19
0
        private void BtnCreatePrize_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                Prize model = new Prize(txtPlaceName.Text,
                                        txtPlaceNumber.Text,
                                        txtPrizeAmount.Text,
                                        txtPrizePercentage.Text);

                model = GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();

                /*txtPlaceName.Text = "";
                 * txtPlaceNumber.Text = "";
                 * txtPrizeAmount.Text = "0";
                 * txtPrizePercentage.Text = "0";*/
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check it and try again.");
            }
        }
Пример #20
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(placeNameValue.Text,
                                                  placeNumberValue.Text,
                                                  prizeAmountValue.Text,
                                                  prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(model);
                callingForm.PrizeComplete(model);

                // Closing form instead of clearing all the fields
                this.Close();

                // Optional: Clearing the form once the create prize task was successful.
                //placeNameValue.Text = "";
                //placeNumberValue.Text = "";
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }
            else
            {
                // Error for invalid entries.
                MessageBox.Show("This form has invalid information. Please Check and try again.");
            }
        }
        private void PrizeCreateButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    PlaceNumberValue.Text,
                    PlaceNameValue.Text,
                    PrizeAmountValue.Text,
                    PrizePercentageValue.Text
                    );
                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);
                this.Close();

                //PlaceNumberValue.Text = "";
                //PlaceNameValue.Text = "";
                //PrizeAmountValue.Text = "0";
                //PrizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show("Le formulaire contient des informations invalide, merci de réessayer après correction");
            }
        }
        private void CreatePrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();

                //placeNameValue.Text = "";
                //placeNumberValue.Text = "";
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check it and try again. ");
            }
        }
Пример #23
0
        private void saveTeamButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentValue.Text
                    );

                // Pass prize data to Database AND update model with Id
                GlobalConfig.Connection.CreatePrize(model);

                // Pass the model back to the calling object's PrizeComplete method
                callingForm.PrizeComplete(model);

                // Close the prize form
                this.Close();
            }

            else
            {
                MessageBox.Show("This form has invalid information.  Please check and try again.");
            }
        }
Пример #24
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                Prize model = new Prize(placeNumberValue.Text, placeNameValue.Text, prizeAmountValue.Text, prizePercentageValue.Text);

                /*foreach (IDataConnection dc in GlobalConfig.Connections)
                 * {
                 *  dc.CreatePrize(model);
                 * }*/
                GlobalConfig.Connections.CreatePrize(model);
                //Prize prize = new Prize { PlaceName = placeNameValue.Text };

                placeNumberValue.Text     = "";
                placeNameValue.Text       = "";
                prizeAmountValue.Text     = "0";
                prizePercentageValue.Text = "0";
                MessageBox.Show("Data updated");
                receiver.PrizeComplete(model);
                //CreateTournament formHelp = new CreateTournament();
                //formHelp.UpdatePrizesListbox();
                this.Close();
            }
            else
            {
                MessageBox.Show("Invalid data");
            }
        }
        private void CreatePrizebutton_Click(object sender, EventArgs e)
        {
            if (ValaditForm())
            {
                PrizeModel model = new PrizeModel(
                    PlaceNmaeTextBox.Text,
                    PlaceNumberextBox.Text,
                    PrizeAmountTextBox.Text,
                    PrizePrecntageTextBox.Text);

                GlobalConfig.Connaction.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();

                //PlaceNmaeTextBox.Text = "";
                //    PlaceNumberextBox.Text = "";
                //    PrizeAmountTextBox.Text = "0";
                //    PrizePrecntageTextBox.Text = "0";
            }
            else
            {
                MessageBox.Show("this form has invaild info chack again ");
            }
        }
Пример #26
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    placeNameTextbox.Text,
                    placeNumberTextbox.Text,
                    prizeAmountTextbox.Text,
                    prizePercentageTextbox.Text);


                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();

                //Clearing out the from previous inputs.Reseting the form every time we make a successfull input.
                //placeNameTextbox.Text = "";
                //placeNumberTextbox.Text = "";
                //prizeAmountTextbox.Text = "0";
                //prizePercentageTextbox.Text = "0";
            }
            else
            {
                MessageBox.Show("This form has invalid information! Please check it and try again.");
            }
        }
Пример #27
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    placeNameValue.Text,
                    placeNumberValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);
                this.Close();

                //placeNameValue.Text = "";
                //placeNumberValue.Text = "";
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
            }
            else
            {
                MessageBox.Show("Ha habido un problema");
            }
        }
Пример #28
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateUserInput())
            {
                PrizeModel pm = new PrizeModel(placeNumberValue.Text, placeNameValue.Text, prizeAmountValue.Text, prizePercentageValue.Text);

                GlobalConfig.Connection.CreatePrize(pm);

                calledForm.PrizeComplete(pm);
                this.Close();
            }
        }
Пример #29
0
        private void CreatePrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(
                    PlaceNameValue.Text,
                    placeNumberValueTextBox.Text,
                    PrizeAmountValue.Text,
                    PrizePercentage.Text);


                GlobalConfig.Connection.CreatePrize(model);
                callingForm.PrizeComplete(model);

                this.Close(); //Close the prize form

                //PlaceNameValue.Text = "";
                //placeNumberValueTextBox.Text = "";
                //PrizeAmountValue.Text = "0";
                //PrizePercentage.Text = "0";
            }


            else
            {
                MessageBox.Show("This form has invalid information. Please check it and try again");
            }



            /* if(ValidateForm())
             * {
             *   PrizeModel model = new PrizeModel(
             *   PlaceNameTextbox.Text,
             *   placeNumberValueTextBox.Text,
             *   PrizeAmountValue.Text,
             *   PrizePercentage.Text);
             *
             *
             *
             *
             *   PlaceNameTextbox.Text = "";
             *   placeNumberValueTextBox.Text = "";
             *   PrizeAmountValue.Text = "0";
             *   PrizePercentage.Text = "0";
             *     GlobalConfig.Connection.CreatePrize(model);
             * }
             * else
             * {
             *   MessageBox.Show("This form has invalid information. Please check it and try again");
             * }*/
        }
Пример #30
0
        private void CreatePrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                PrizeModel model = new PrizeModel(PlaceNameValue.Text, PlaceNumberValue.Text, AmountValue.Text, PercentageValue.Text);

                model = GlobalConfig.Connection.CreatePrize(model);

                callingForm.PrizeComplete(model);

                this.Close();
            }
        }