Пример #1
0
        private void buttonSaveAsPdf_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = " Pdf files | *.pdf";
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                Document document = new Document(PageSize.A4.Rotate());
                try
                {
                    PdfWriter.GetInstance(document, new FileStream(saveFileDialog.FileName, FileMode.Create));
                    document.Open();
                    document.Add(new Paragraph(richTextBoxContentdisplayer.Text));
                    document.Close();
                    GlobalStaticVariablesAndMethods.CreateInfoMesssage(GlobalStaticVariablesAndMethods.FileavedAsPdfInfoMessage);
                }
                catch (Exception v)
                {
                    MessageBox.Show(v.Message);
                }
            }
        }
Пример #2
0
 private void buttonSaveQuizInSystem_Click(object sender, EventArgs e)
 {
     DatasetManager.saveQuizToDatabase();//save changes to database
     GlobalStaticVariablesAndMethods.isCurrentQuizTopicSaved = true;
     GlobalStaticVariablesAndMethods.CreateInfoMesssage(GlobalStaticVariablesAndMethods.ChangesSavedInfoMessage);
 }
Пример #3
0
        private void buttonSaved_Click(object sender, EventArgs e)
        {
            bool isChec = true, isOneChecked = false;
            int  index = 0;

            //befor saving changes .... lets checkfew things.
            foreach (CheckBox controls in _options)
            {
                if (controls.Checked)
                {
                    isChec = false;
                    index++;
                }
                if (index >= 2)
                {
                    isOneChecked = true;
                    break;
                }
            }

            if (CreateQuizParentWindow.QuestionsListFlowLoayoutPanel.Controls.Count == 0)
            {
                //this means no options are added
                GlobalStaticVariablesAndMethods.CreateErrorMessage(GlobalStaticVariablesAndMethods.NotAddedOptionsErrorMessage);
            }
            else if (isOneChecked)
            {
                //this means more than one check box are selected.
                GlobalStaticVariablesAndMethods.CreateErrorMessage(GlobalStaticVariablesAndMethods.MultipleOptionSelectedErrorMessage);
            }
            else if (isChec)
            {
                //this means no option from list is selected;
                GlobalStaticVariablesAndMethods.CreateErrorMessage(GlobalStaticVariablesAndMethods.UnSelectedErrorMessage);
            }

            else
            {
                //Here we will add question in current dataset

                //so we need to do 2 things here
                //1. generate a string having all options seprated with ';'

                String asnwers     = "";
                String rightAnswer = "";
                foreach (var controls in _options)
                {
                    if (controls is RadioButton)
                    {
                        RadioButton radioButton = controls as RadioButton;
                        //if options are true and false.
                        asnwers += radioButton.Text + GlobalStaticVariablesAndMethods.seperatorCharactor;
                        if (radioButton.Checked)
                        {
                            rightAnswer = radioButton.Text;
                        }
                    }
                    else
                    {
                        //if mcsqs
                        CheckBox checkBox = controls as CheckBox;
                        asnwers += checkBox.Text + GlobalStaticVariablesAndMethods.seperatorCharactor;
                        if (checkBox.Checked)
                        {
                            rightAnswer = checkBox.Text;
                        }
                    }
                }

                //Here we will update dataset.
                DatasetManager.upddateDataSet(richTextBoxListItemQuestion.Text, asnwers, rightAnswer, Int32.Parse(TableRowId));
                GlobalStaticVariablesAndMethods.CreateInfoMesssage(GlobalStaticVariablesAndMethods.ChangesSavedInDataseInfoMessage);
            }
        }