private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgItems.SelectedItem != null)
                {
                    PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem;

                    ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail, true);

                    winDialog oDialog = new winDialog(oucAddEditPartsDetail)
                    {
                        ShowInTaskbar = true,
                        WindowTitle   = "Edit Parts",
                        Height        = 240,
                        Width         = 560
                    };
                    oDialog.ShowDialog();

                    dtgItems.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a parts");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Can not add parts");
            }
        }
        private void btnAddPartsDetail_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PartsDetail oPartsDetail = new PartsDetail();

                ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail, false);

                winDialog oDialog = new winDialog(oucAddEditPartsDetail)
                {
                    ShowInTaskbar = true,
                    WindowTitle   = "Add a new Parts",
                    Height        = 240,
                    Width         = 560
                };
                oDialog.ShowDialog();

                dtgItems.Items.Refresh();
            }
            catch (Exception)
            {
                MessageBox.Show("Can not add parts");
            }
        }
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dtgItems.SelectedItem != null)
                {
                    PartsDetail oPartsDetail = (PartsDetail)dtgItems.SelectedItem;

                    ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail, true);

                    winDialog oDialog = new winDialog(oucAddEditPartsDetail)
                    {
                        ShowInTaskbar = true,
                        WindowTitle = "Edit Parts",
                        Height = 240,
                        Width = 560
                    };
                    oDialog.ShowDialog();

                    dtgItems.Items.Refresh();
                }
                else
                {
                    MessageBox.Show("Please select a parts");
                }

            }
            catch (Exception)
            {

                MessageBox.Show("Can not add parts");
            }
        }
        private void btnAddPartsDetail_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PartsDetail oPartsDetail = new PartsDetail();

                ucAddEditPartsDetail oucAddEditPartsDetail = new ucAddEditPartsDetail(oPartsDetail,false);

                winDialog oDialog = new winDialog(oucAddEditPartsDetail)
                {
                    ShowInTaskbar = true,
                    WindowTitle = "Add a new Parts",
                    Height = 240,
                    Width = 560
                };
                oDialog.ShowDialog();

                dtgItems.Items.Refresh();

            }
            catch (Exception)
            {

                MessageBox.Show("Can not add parts");
            }
        }