Exemplo n.º 1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Manufacturer oManufacturer = new Manufacturer();
                ucAddEditManufacturer oucAddEditManufacturer = new ucAddEditManufacturer(oManufacturer, false);
                winDialog oDialog = new winDialog(oucAddEditManufacturer)
                {
                    ShowInTaskbar = true,
                    WindowTitle = "Add a new Manufacturer",
                    Height = 170,
                    Width = 500
                };
                oDialog.ShowDialog();

                UpdateDataGrid();


            }
            catch (Exception)
            {

                MessageBox.Show("Can not open window to add manufacturer");
            }
        }
Exemplo n.º 2
0
        public List<Manufacturer> SelectAll()
        {
            try
            {
                List<Manufacturer> oManufacturerList = new List<Manufacturer>();

                Manufacturer oManufacturer = new Manufacturer();
                oManufacturer.Id = 1;
                oManufacturer.name = "Genuine";
                oManufacturerList.Add(oManufacturer);

                oManufacturer = new Manufacturer();
                oManufacturer.Id = 2;
                oManufacturer.name = "Japan";
                oManufacturerList.Add(oManufacturer);

                oManufacturer = new Manufacturer();
                oManufacturer.Id = 3;
                oManufacturer.name = "Others";
                oManufacturerList.Add(oManufacturer);

                oManufacturer = new Manufacturer();
                oManufacturer.Id = 4;
                oManufacturer.name = "Re-conditioned";
                oManufacturerList.Add(oManufacturer);

                return oManufacturerList;

            }
            catch (Exception)
            {
                
                throw;
            }
        }
        public ucAddEditManufacturer(Manufacturer oManufacturer, bool isEdit)
        {
            InitializeComponent();
            try
            {
                this.oManufacturer = oManufacturer;
                this.isEdit = isEdit;                
                if (isEdit)
                {
                    InitializeWindow();
                }

            }
            catch (Exception)
            {

                MessageBox.Show("Can not initialize add edit Manufacturer");
            }
        }