Ejemplo n.º 1
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            FAQEntry faqentry     = ((FrameworkElement)sender).DataContext as FAQEntry;
            Update   updateWindow = new Update(faqentry, this);

            updateWindow.Show();
        }
Ejemplo n.º 2
0
        public Update(FAQEntry faqentry, FAQEntries.List parentWindow)
        {
            InitializeComponent();
            listWindow = parentWindow;
            entry      = faqentry;


            txtQuestion.Text = entry.Question;
            txtAnswer.Text   = entry.Answer;
        }
Ejemplo n.º 3
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            FAQEntry faqentry = ((FrameworkElement)sender).DataContext as FAQEntry;

            if (MessageBox.Show(" Do you want to Delete FAQ entry for" + faqentry.Question +
                                " in" + faqentry.Answer + " ?", " Are you Sure?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                var op = FAQEntryBLL.Delete(faqentry);

                if (op.Code.ToLower() == "ok")
                {
                    ShowData();
                    MessageBox.Show(op.Message.FirstOrDefault());
                    this.Close();
                }
                else
                {
                    MessageBox.Show(op.Message.FirstOrDefault());
                }
            }
        }
Ejemplo n.º 4
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtQuestion.Text))
            {
                MessageBox.Show("Please Enter a Question for the FAQ Entry");
                return;
            }
            ;

            if (string.IsNullOrEmpty(txtAnswer.Text))
            {
                MessageBox.Show("Please Enter an Answer for the FAQ Entry");
                return;
            }
            ;


            FAQEntry entry = new FAQEntry();

            entry.Question = txtQuestion.Text;
            entry.Answer   = txtAnswer.Text;
            entry.Id       = Guid.NewGuid();

            var op = FAQEntryBLL.Create(entry);

            if (op.Code.ToLower() == "ok")
            {
                listWindow.ShowData();
                MessageBox.Show(op.Message.FirstOrDefault());
                this.Close();
            }
            else
            {
                MessageBox.Show(op.Message.FirstOrDefault());
            }
        }