Example #1
0
 public IceCreamDatabaseForm()
 {
     InitializeComponent();
     DatabaseWorker.updateStoreListBox(StoreListBox);
     DatabaseWorker.updateMakersListBox(makersListBox);
     DatabaseWorker.updateIceCreamListBox(IceCreamListBox);
     DatabaseWorker.updateSellersListBox(sellersListBox);
     DatabaseWorker.updateSellingListBox(sellingListBox);
 }
Example #2
0
        private void StoreUpdateButton_Click(object sender, EventArgs e)
        {
            try
            {
                string keyText = DatabaseWorker.getWordFromListBox(StoreListBox, 0);

                using (var db = new IceCreamContext())
                {
                    var updateStore = (from store in db.IceCreamStores
                                       where store.Address == keyText
                                       select store).First();

                    string updateInfo = "update IceCreamStores set Adress='" + AddressTextBox.Text + "',WorkingHours='" + workingHoursTextBox.Text
                                        + "' where Adress='" + updateStore.Address + "';";
                    DatabaseWorker.ConnectionSQL(updateInfo);
                    DatabaseWorker.updateStoreListBox(StoreListBox);
                }
            }
            catch (Exception ex)
            {
                storeErrorLabel.Text = ex.Message;
            }
        }