Exemplo n.º 1
0
        private void btnAddCrop_Click(object sender, EventArgs e)
        {
            BusinessMetaLayer create = BusinessMetaLayer.instance();

            int    success;
            String cropName        = txtCropName.Text;
            String fertName        = txtFertName.Text;
            int    cultivationTime = Convert.ToInt32(this.txtCultTime.Text);
            int    fertFrequency   = Convert.ToInt32(this.txtFertFreq.Text);
            int    yieldValue      = Convert.ToInt32(this.txtYieldValue.Text);

            success = create.addCrop(txtCropName.Text, cultivationTime, fertFrequency, yieldValue, fertName);

            if (success == 1)
            {
                MessageBox.Show("Crop added");
                txtCropName.Clear();
                txtCultTime.Clear();
                txtFertFreq.Clear();
                txtYieldValue.Clear();
            }
            else
            {
                MessageBox.Show("An input is incorrect");
            }
        }