Exemplo n.º 1
0
 public Export_to_Pdf()
 {
     InitializeComponent();
     //Create object for pdf.
     document = new PdfDocument();
     page = document.AddPage();
     gfx = XGraphics.FromPdfPage(page);
     //Set by default values.
     font = new XFont("Arial", 12, XFontStyle.Regular);
     header_font = new XFont("Arial", 12, XFontStyle.Regular);
     page.Size = PageSize.A4;
     page.Orientation = PageOrientation.Portrait;
     //////////////////////////////////////////////////////////////////////
     //Create a fake questionanire to test the print process to pdf.
     if (questionaire != null)
     {
         List<Question> question_list = new List<Question>();
         List<Answer> answer_list = new List<Answer>();
         Answer ans = new Answer();
         ans.Answer_descr = "einai to dsfgdsfgsd";
         answer_list.Add(ans);
         answer_list.Add(ans);
         answer_list.Add(ans);
         Question quest = new Question() { AnswerList = answer_list };
         quest.Question_descr = "H ekfoonisi tis erotisis aytis einai blablbalbablbalblab";
         for (int i = 0; i < 10; i++)
         {
             question_list.Add(quest);
         }
     questionaire = new Quastionnaire.Model.Questionaire() { Questionaire_descr = "sdfsakdfjdflshsadflkjashflasdfkh", QuestionList = question_list };
     }
     //////////////////////////////////////////////////////////////////////
 }
Exemplo n.º 2
0
        private void btClear_Questionaire_Click(object sender, RoutedEventArgs e)
        {
            lblQuestionaire_Description_msg.Visibility = Visibility.Hidden;
            tbDate_Questionaire.Text = "";
            tbOwner_Questionaire.Text = "";
            tbQuestionaire_Description.Text = "";

            selected_Questionaire = null;
        }
Exemplo n.º 3
0
 //Constructor passing the Questionaire object to create athe pdf.
 public Export_to_Pdf(Quastionnaire.Model.Questionaire questionaire)
     : this()
 {
     this.questionaire = questionaire;
 }
Exemplo n.º 4
0
        private void lvQuestionaire_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Questionaire questionaire = (Questionaire)lvQuestionaire.SelectedItem;

            if (questionaire == null)
                return;

            selected_Questionaire = questionaire;

            Debug.WriteLine("******************" + selected_Questionaire.Questionaire_descr + "***********");
            Debug.WriteLine("******************" + selected_Questionaire.QuestionList.Count + "***********");
            Debug.WriteLine("******************" + selected_Questionaire.Account.Username + "***********");

            //Load Questions Table
            lvQuestionaire_Question.ItemsSource = selected_Questionaire.QuestionList;
        }
Exemplo n.º 5
0
        private void btEdit_Questionaire_Click(object sender, RoutedEventArgs e)
        {
            lblQuestionaire_Description_msg.Visibility = Visibility.Hidden;

            if (selected_Questionaire == null)
            {
                MessageBox.Show("Select Questionaire First", "Confirmation");
                return;
            }
             if (selected_Questionaire.Account.Username != CurrentUserInfo.USERNAME)
            {
                MessageBox.Show("Now Alloed is Not Yours", "Confirmation");
                return;
            }

            string description = tbQuestionaire_Description.Text;

            Questionaire questionaire = new Questionaire() { Id = selected_Questionaire.Id,Date = DateTime.Now, Questionaire_descr = description, Account = CurrentUserInfo.CURENT_ACCOUNT };

            IQuestionaireDao questionaireDao = new QuestionaireDaoImpl();
            questionaireDao.updateQuestionaire(questionaire);

            listQuestionaire.Remove(selected_Questionaire);
            listQuestionaire.Add(questionaire);
            lvQuestionaire.ItemsSource = null;
            lvQuestionaire.ItemsSource = listQuestionaire;

            selected_Questionaire = null;
            MessageBox.Show("Edited");
        }
Exemplo n.º 6
0
        private void btDelete_Questionaire_Click(object sender, RoutedEventArgs e)
        {
            lblQuestionaire_Description_msg.Visibility = Visibility.Hidden;

            if (selected_Questionaire == null)
            {
                MessageBox.Show("Select Questionaire First", "Confirmation");
                return;
            }
            if (selected_Questionaire.Account.Username != CurrentUserInfo.USERNAME)
            {
                MessageBox.Show("Now Alloed is Not Yours", "Confirmation");
                return;
            }

            IQuestionaireDao questionaireDao = new QuestionaireDaoImpl();
            questionaireDao.deleteQuestionaire(selected_Questionaire);

            listQuestionaire.Remove(selected_Questionaire);
            lvQuestionaire.ItemsSource = null;
            lvQuestionaire.ItemsSource = listQuestionaire;

            selected_Questionaire = null;
            MessageBox.Show("Deleted");
        }
Exemplo n.º 7
0
        //Table
        private void lvQuestionaire_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Questionaire questionaire = (Questionaire)lvQuestionaire.SelectedItem;

            if (questionaire == null)
                return;

            selected_Questionaire = questionaire;

            tbOwner_Questionaire.Text = selected_Questionaire.Account.Username;
            tbDate_Questionaire.Text = selected_Questionaire.Date.ToString();
            tbQuestionaire_Description.Text = selected_Questionaire.Questionaire_descr;
        }
Exemplo n.º 8
0
        //ToolBar
        private void btSave_Questionaire_Click(object sender, RoutedEventArgs e)
        {
            lblQuestionaire_Description_msg.Visibility = Visibility.Hidden;

            string description = tbQuestionaire_Description.Text;

            if (String.IsNullOrEmpty(description))
            {
                lblQuestionaire_Description_msg.Visibility = Visibility.Visible;
                lblQuestionaire_Description_msg.Foreground = Brushes.Red;
                lblQuestionaire_Description_msg.Content = "Empty";
                MessageBox.Show("Empty");
                return;
            }

            Questionaire questionaire = new Questionaire() {Date = DateTime.Now , Questionaire_descr = description , HasQuestions = false , Account  = CurrentUserInfo.CURENT_ACCOUNT};

            IQuestionaireDao questionaireDao = new QuestionaireDaoImpl();
            questionaireDao.saveQuestionaire(questionaire);

            listQuestionaire.Add(questionaire);
            lvQuestionaire.ItemsSource = null;
            lvQuestionaire.ItemsSource = listQuestionaire;

            selected_Questionaire = null;
            MessageBox.Show("Saved");
        }