public Edit(Output output)
        {
            InitializeComponent();

            foreach (string fileNameReplacement in AttributeHelper.GetAttributeReplacements())
            {
                MenuItem item = new MenuItem();
                item.Header = new TextBlock()
                {
                    Text = fileNameReplacement
                };
                item.Tag    = fileNameReplacement;
                item.Click += FileNameReplacementItem_Click;
                FileNameReplacementList.Items.Add(item);
            }

            NameTextBox.Text        = output.Name;
            AccountNameTextBox.Text = output.AccountName;
            UserNameTextBox.Text    = output.UserName;
            PasswordBox.Password    = output.Password;
            FileNameTextBox.Text    = output.FileName;

            FileFormatComboBox.ItemsSource   = FileHelper.GetFileFormats();
            FileFormatComboBox.SelectedValue = output.FileFormatID;

            OpenItemInBrowserCheckBox.IsChecked = output.OpenItemInBrowser;

            NameTextBox.TextChanged             += ValidateData;
            AccountNameTextBox.TextChanged      += ValidateData;
            FileFormatComboBox.SelectionChanged += ValidateData;
            ValidateData(null, null);

            AccountNameTextBox.Focus();
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(AccountNameTextBox.Text))
            {
                AccountNameTextBox.SelectAll();
            }

            AccountNameTextBox.Focus(FocusState.Keyboard);
        }
Beispiel #3
0
        private void Button2_Click_1(object sender, EventArgs e)
        {
            if (DealerRadioButton.Checked)
            {
                if (string.IsNullOrWhiteSpace(UserIdMaskedTextBox.Text) || string.IsNullOrWhiteSpace(AccountNameTextBox.Text) || string.IsNullOrWhiteSpace(ContactNumMaskedTextBox.Text) || string.IsNullOrWhiteSpace(ShopAddressTextBox.Text) || string.IsNullOrWhiteSpace(DealerType.Text))
                {
                    MessageBox.Show("Enter All Fields");
                }
                else
                {
                    if (!IsImgUploaded)
                    {
                        p1.CreateAccountDealer(UserIdMaskedTextBox.Text, AccountNameTextBox.Text, ContactNumMaskedTextBox.Text, ShopAddressTextBox.Text, DateTime.Now.ToString("yyyy-MM-dd"), "Dealer", DealerType.Text);
                        UserIdMaskedTextBox.Clear();
                        AccountNameTextBox.Clear();
                        ContactNumMaskedTextBox.Clear();
                        ShopAddressTextBox.Clear();
                        DealerType.Text = "";
                        label7.ResetText();
                        pictureBox1.Image.Dispose();
                        pictureBox1.Image = pictureBox1.InitialImage;
                        SearchPanel.Show();
                        SearchPanel.BringToFront();
                    }
                    else
                    {
                        p1.CreateAccountDealer(UserIdMaskedTextBox.Text, AccountNameTextBox.Text, ContactNumMaskedTextBox.Text, ShopAddressTextBox.Text, DateTime.Now.ToString("yyyy-MM-dd"), "Dealer", o1.FileName, DealerType.Text);
                        UserIdMaskedTextBox.Clear();
                        AccountNameTextBox.Clear();
                        ContactNumMaskedTextBox.Clear();
                        ShopAddressTextBox.Clear();
                        DealerType.Text = "";
                        label7.ResetText();
                        pictureBox1.Image.Dispose();
                        pictureBox1.Image = pictureBox1.InitialImage;
                        SearchPanel.Show();
                        SearchPanel.BringToFront();
                    }
                }
            }
            if (CustomerRadioButton.Checked)
            {
                if (string.IsNullOrWhiteSpace(UserIdMaskedTextBox.Text) || string.IsNullOrWhiteSpace(AccountNameTextBox.Text) || string.IsNullOrWhiteSpace(ContactNumMaskedTextBox.Text) || string.IsNullOrWhiteSpace(ShopAddressTextBox.Text))
                {
                    MessageBox.Show("Enter All Fields");
                }
                else
                {
                    if (!IsImgUploaded)
                    {
                        p1.CreateAccountCustomer(UserIdMaskedTextBox.Text, AccountNameTextBox.Text, ContactNumMaskedTextBox.Text, ShopAddressTextBox.Text, DateTime.Now.ToString("yyyy-MM-dd"), "Customer");
                        CustomerContainer.BringToFront();
                        UserIdMaskedTextBox.Clear();
                        AccountNameTextBox.Clear();
                        ContactNumMaskedTextBox.Clear();
                        ShopAddressTextBox.Clear();

                        label7.ResetText();
                        pictureBox1.Image.Dispose();
                        pictureBox1.Image = pictureBox1.InitialImage;
                        SearchPanel.Show();
                        SearchPanel.BringToFront();
                    }
                    else
                    {
                        p1.CreateAccountCustomer(UserIdMaskedTextBox.Text, AccountNameTextBox.Text, ContactNumMaskedTextBox.Text, ShopAddressTextBox.Text, DateTime.Now.ToString("yyyy-MM-dd"), "Customer", o1.FileName);
                        CustomerContainer.BringToFront();
                        UserIdMaskedTextBox.Clear();
                        AccountNameTextBox.Clear();
                        ContactNumMaskedTextBox.Clear();
                        ShopAddressTextBox.Clear();

                        label7.ResetText();
                        pictureBox1.Image.Dispose();
                        pictureBox1.Image = pictureBox1.InitialImage;
                        SearchPanel.Show();
                        SearchPanel.BringToFront();
                    }
                }
            }
        }