Exemple #1
0
        private void WindowInsertPart_OnLoaded(object sender, RoutedEventArgs e)
        {
            TextBoxPartNo.Focus();

            BindComboBoxBrand();
            BindComboBoxMachine();
        }
Exemple #2
0
        private void Clear()
        {
            TextBoxPartNo.Text            = "";
            TextBoxLocation.Text          = "";
            TextBoxTagName.Text           = "";
            TextBoxResolutionPartNo.Text  = "";
            TextBoxPartName.Text          = "";
            TextBoxPartNoOrignal.Text     = "";
            ComboBoxMachine.SelectedIndex = -1;
            ComboBoxBrand.SelectedIndex   = -1;

            TextBoxPartNo.Focus();
        }
Exemple #3
0
        private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
        {
            PartWithNotify newPart = new PartWithNotify();

            newPart.PartNo           = TextBoxPartNo.Text;
            newPart.Location         = TextBoxLocation.Text;
            newPart.TagName          = TextBoxTagName.Text;
            newPart.ResolutionPartNo = TextBoxResolutionPartNo.Text;
            newPart.PartName         = TextBoxPartName.Text;
            newPart.PartNoOrignal    = TextBoxPartNoOrignal.Text;

            if (ComboBoxMachine.SelectedIndex != -1)
            {
                newPart.MachineId   = (ComboBoxMachine.SelectedItem as Machine).MachineId;
                newPart.MachineName = (ComboBoxMachine.SelectedItem as Machine).MachineName;
            }

            if (ComboBoxBrand.SelectedIndex != -1)
            {
                newPart.BrandId   = (ComboBoxBrand.SelectedItem as Brand).BrandId;
                newPart.BrandName = (ComboBoxBrand.SelectedItem as Brand).BrandName;
            }

            var result = PartsCollection.AddNew(0, newPart);

            if (result)
            {
                ClearStatusbar();
                ShowMessageInStatusbar("New part added");
                Clear();
                TextBoxPartNo.Focus();
            }
            else
            {
                ClearStatusbar();
                ShowMessageInStatusbar("Failed");
            }
        }