Beispiel #1
0
        public Dialog_Brand()
        {
            InitializeComponent();
            this.Size = new Size(500, 400);
            // Initialise the ListView
            ListViewBasic.Columns.Add("RefBrand");
            ListViewBasic.Columns.Add("Name");

            ControllerManagement.RefreshListViewBrand();
        }
Beispiel #2
0
        protected override void ListViewBasic_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.F5)
            {
                ControllerManagement.RefreshListViewBrand();
                MessageBox.Show("List view refreshed !");
            }

            base.ListViewBasic_KeyDown(sender, e);
        }
Beispiel #3
0
        protected override void Delete()
        {
            if (ListViewBasic.SelectedItems.Count != 0)
            {
                // Get RefBrand from the ListView
                int RefBrand = int.Parse(ListViewBasic.SelectedItems[0].Text);

                if (ControllerManagement.DeleteBrand(RefBrand))
                {
                    ControllerManagement.RefreshListViewBrand();
                    MessageBox.Show("Succesfully deleted the brand !");
                }
                else
                {
                    MessageBox.Show("Error : Fail to delete the brand ! ");
                }
            }
            else
            {
                MessageBox.Show("Error : Choose a brand before trying  to delete it !");
            }
        }
        private void BtnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (Dialog_Basic.ModifyOrAdd == 0)
                {
                    int    RefBrand  = int.Parse(TextRefBrand.Text);
                    string BrandName = TextBox.Text;

                    if (!ControllerManagement.ModifyBrand(RefBrand, BrandName))
                    {
                        MessageBox.Show("Fail to modify the brand ! ");
                    }
                    else
                    {
                        if (MessageBox.Show("Successfully modified the brand !") == DialogResult.OK)
                        {
                            Close();
                        }
                    }
                }
                else if (Dialog_Basic.ModifyOrAdd == 1)
                {
                    ControllerManagement.AddBrand(TextBox.Text);

                    if (MessageBox.Show("Successfully added the brand !") == DialogResult.OK)
                    {
                        Close();
                    }
                }

                ControllerManagement.RefreshListViewBrand();
                ControllerFurniture.RefreshListView(-1);
            }
            catch (Exception Exception)
            {
                MessageBox.Show("Error during the operation ! " + Exception.Message);
            }
        }
Beispiel #5
0
        protected override void ListViewBasic_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            base.ListViewBasic_ColumnClick(sender, e);

            ControllerManagement.RefreshListViewBrand();
        }