private void ChangeAmount(decimal Amount)//newAmount) { MainWindowForm mainForm = (MainWindowForm)Application.OpenForms["MainWindowForm"]; //mainForm.ModifyBasket(basketDataObject, newAmount, productDataObject); mainForm.MoveProductsToFromBasket(basketDataObject.ProductID, Amount); }
private void AddBasket(decimal amount) { productDataObject.Amount -= amount; MainWindowForm mainForm = (MainWindowForm)Application.OpenForms["MainWindowForm"]; mainForm.AddBasket(productDataObject.ProductID, amount); MessageBox.Show("Dodano do koszyka."); }
private void removeProduct() { DialogResult dialogResult = MessageBox.Show("Czy jesteś pewny(a), że chcesz usunąć ten produkt z koszyka?", "", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { MainWindowForm mainForm = (MainWindowForm)Application.OpenForms["MainWindowForm"]; mainForm.RemoveBasket(basketDataObject, productDataObject); } }
private void AddBasket(decimal amount) { MainWindowForm mainForm = (MainWindowForm)Application.OpenForms["MainWindowForm"]; mainForm.AddBasket(productDataObject.ProductID, amount); amountLabel.Text = ProductAmountInforFormat(productDataObject.Amount, productDataObject.UnitType); productDataObject.Amount -= amount; SetBasketData(); MessageBox.Show("Dodano do koszyka."); }
private async void deleteButton_Click(object sender, EventArgs e) { if (MakeSure()) { InterfaceToDataBaseUserMethods Methods = new InterfaceToDataBaseUserMethods(); if (await Methods.DeleteUser(userData.UserID)) { MessageBox.Show("Bardzo nam przykro."); MainWindowForm mainForm = (MainWindowForm)Application.OpenForms["MainWindowForm"]; mainForm.Logout(); } else { MessageBox.Show("Jesteś ostatim administratorem, nie możesz usunąć swojego konta."); } } }
private async void SetBasketData() { MainWindowForm mainForm = (MainWindowForm)Application.OpenForms["MainWindowForm"]; inBasketLabel.Text = (await mainForm.GetBasketAmount(productDataObject.ProductID)).ToString(); }