public static void Run(clsAllDragons prDragon)
        {
            instance.cmbStance.DataSource = _stanceSource;
            instance.cmbFire.DataSource   = _fireSource;
            instance.cmbPoison.DataSource = _poisonSource;

            instance.SetDetails(prDragon);
        }
Exemplo n.º 2
0
        internal async static Task <string> DeleteDragonAsync(clsAllDragons prDragon)
        {
            using (HttpClient lcHttpClient = new HttpClient())
            {
                HttpResponseMessage lcRespMessage = await lcHttpClient.DeleteAsync
                                                        ($"http://localhost:60065/api/Data/DeleteDragon?DragonID={prDragon.DragonID}");

                return(await lcRespMessage.Content.ReadAsStringAsync());
            }
        }
Exemplo n.º 3
0
        private async void btnRemoveDragon_Click(object sender, EventArgs e)
        {
            clsAllDragons lcSelected = lstDragons.SelectedValue as clsAllDragons;

            if (lcSelected != null && MessageBox.Show("Are you sure? Deleting dragon may affect pending orders.", "Delete Dragon", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                MessageBox.Show(await ServiceClient.DeleteDragonAsync(lcSelected));
                refreshFormFromDB(_Breed.BreedName);
                UpdateList();
            }
        }
Exemplo n.º 4
0
        public void SetDetails(clsAllDragons prDragon)
        {
            _Dragon                 = prDragon;
            cmbTame.DataSource      = _tameSource;
            cmbAvailable.DataSource = _availableSource;
            cmbSex.DataSource       = _sexSource;
            cmbImage.DataSource     = _imageNameSource;

            updateForm();
            ShowDialog();
        }
Exemplo n.º 5
0
        private void btnAddDragon_Click(object sender, EventArgs e)
        {
            string        lcChoice = Convert.ToString(cmbDragonType.SelectedItem);
            clsAllDragons lcDragon = clsAllDragons.NewDragon(lcChoice, _Breed.BreedName, DateTime.Now);

            if (lcDragon != null)
            {
                frmDragon.DispatchDragonForm(lcDragon);
                if (!string.IsNullOrEmpty(lcDragon.Name))
                {
                    refreshFormFromDB(_Breed.BreedName);
                }
            }
            UpdateList();
        }
Exemplo n.º 6
0
        protected virtual void updateForm()
        {
            clsAllDragons lcDragon = (clsAllDragons)_Dragon;

            lblDate.Text              = _Dragon.DateEdited.ToString();
            lblIDNumber.Text          = _Dragon.DragonID.ToString();
            txtName.Text              = _Dragon.Name;
            txtAge.Text               = _Dragon.Age.ToString();
            cmbSex.SelectedItem       = _Dragon.Sex;
            txtSize.Text              = _Dragon.Size.ToString();
            txtPrice.Text             = _Dragon.Price.ToString();
            cmbTame.SelectedItem      = _Dragon.Tame;
            cmbAvailable.SelectedItem = _Dragon.Available;

            cmbImage.SelectedIndex = -1; // Temp - Images added later so some dragons done have one set, resets selection to start when editing old dragons, not needed otherwise
            cmbImage.SelectedItem  = _Dragon.Image;
            pbDragon.ImageLocation = _Dragon.Image;
        }
 internal static void Run(clsAllDragons prDragon)
 {
     instance.cmbFlight.DataSource = _flightSource;
     instance.SetDetails(prDragon);
 }
Exemplo n.º 8
0
 internal async static Task <string> UpdateDragonAsync(clsAllDragons prDragon)
 {
     return(await InsertOrUpdateAsync(prDragon, "http://localhost:60065/api/Data/PutDragon", "PUT"));
 }
Exemplo n.º 9
0
        public static void DispatchDragonForm(clsAllDragons prDragon)
        {
            char lcSpecies = prDragon.getChar();

            _DragonForm[lcSpecies].DynamicInvoke(prDragon);
        }