Example #1
0
        private void CreateRegister()
        {
            if (KtextTittle.Value == "")
            {
                KtextTittle.IsWrong();
                return;
            }

            if (fileName != "" && fileOriginPath != "")
            {
                DatabaseClass.Document videoToAdd = new DatabaseClass.Document
                {
                    Title = KtextTittle.Value,
                    Url   = fileName
                };

                try
                {
                    videoToAdd.Insert(fileOriginPath);
                    //fatherForm.SearchData();
                    //Dispose();
                }
                catch (Exception err)
                {
                    //throw;
                    MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                }
            }
        }
        private void UpdateCurrentQuestion()
        {
            if (currentQuestion != null)
            {
                if (KtextTittle.Value == "")
                {
                    KtextTittle.IsWrong();
                    return;
                }

                if (KtextText.Value == "")
                {
                    KtextText.IsWrong();
                    return;
                }

                currentQuestion.Tittle       = KtextTittle.Value;
                currentQuestion.QuestionText = KtextText.Value;

                currentQuestion.ArrayOfPosiblesQuestions = new String[] { qst_1.Value, qst_2.Value, qst_3.Value, qst_4.Value };

                currentQuestion.CorrectQuestionNumber = GetSelectedIndex();

                currentQuestion.Update();


                FATHER_FORM.SearchData();
                this.Dispose();
            }
        }
        //CreateNewQuestion

        private void CreateNewQuestion()
        {
            if (currentQuestion == null)
            {
                if (KtextTittle.Value == "")
                {
                    KtextTittle.IsWrong();
                    return;
                }

                if (KtextText.Value == "")
                {
                    KtextText.IsWrong();
                    return;
                }

                currentQuestion              = new Question();
                currentQuestion.Tittle       = KtextTittle.Value;
                currentQuestion.QuestionText = KtextText.Value;

                currentQuestion.ArrayOfPosiblesQuestions = new String[] { qst_1.Value, qst_2.Value, qst_3.Value, qst_4.Value };

                currentQuestion.CorrectQuestionNumber = GetSelectedIndex();

                currentQuestion.Insert();

                currentQuestion = null;

                KtextText.Value = KtextTittle.Value = "";

                qst_1.Value      = qst_2.Value = qst_3.Value = qst_4.Value = "Posible respuesta";
                qst_1.IsSelected = qst_2.IsSelected = qst_3.IsSelected = qst_4.IsSelected = false;

                FATHER_FORM.SearchData();
                this.Dispose();
            }
        }
Example #4
0
        private void UpdateRegister()
        {
            if (KtextTittle.Value == "")
            {
                KtextTittle.IsWrong();
                return;
            }

            if (fileName != "" && fileOriginPath != "")
            {
                DatabaseClass.Document videoToAdd = new DatabaseClass.Document(oldDocument.Id);
                videoToAdd.Title = KtextTittle.Value;
                videoToAdd.Url   = fileName;

                try
                {
                    videoToAdd.Update(oldDocument.Url, fileOriginPath);
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                }
            }
        }