public int CompareTo(object obj) { CarShop shop = obj as CarShop; if (shop != null) { return(this.name.CompareTo(shop.name)); } else { throw new Exception("Stores are not identical!"); } }
private void ShopList_SelectedIndexChanged(object sender, EventArgs e) { try { this.current_shop = this.ShopList.SelectedItem as CarShop; this.CurrentShop.Text = this.current_shop.ToString(); this.EmployeeShow.Enabled = true; this.InitObjects(); } catch (Exception exc) { MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ShopCreateButton_Click(object sender, EventArgs e) { try { CarShop item = new CarShop(this.ShopName.Text, this.ShopAddress.Text, Convert.ToInt32(this.ShopDepAmount.Value), Convert.ToInt32(this.ShopAmountItems.Value) ); this.ShopList.Items.Add(item); this.ShopHide_Click(sender, e); } catch (Exception exc) { MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Form1() { InitializeComponent(); this.current_shop = null; this.ClientSize = new Size(290, 290); }