Ejemplo n.º 1
0
        protected override void OnStart()
        {
            base.OnStart();

            _score = _bootstrap.GetController(ControllerTypes.Score) as ScoreController;

            _questions = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
            _questions.OnNewQuestionReady += QuestionDone;
            _questions.OnQuestionsOver    += NoMoreQuestions;

            _timeController = _bootstrap.GetController(ControllerTypes.Time) as TimeController;
            if (_timeController != null)
            {
                _timeController.GameTimeout += TimeOut;
            }

            if (SaveToRegistry)
            {
                _registry = _bootstrap.GetController(ControllerTypes.Register) as RegisterController;
            }

            _sfx = _bootstrap.GetController(ControllerTypes.SoundSFX) as SFXController;

            _answers = new Dictionary <int, int>();
        }
 /// <summary>
 /// Recreates the datasource and binds it to the table.
 /// </summary>
 public void ReloadData()
 {
     _data = new QuestionsData(_category);
     _questionsTableSource = new QuestionsTableSource(_data, this);
     TableView.Source = _questionsTableSource;
     TableView.ReloadData();
 }
Ejemplo n.º 3
0
        public override void PrepareGame()
        {
            if (GenerateFromModel)
            {
                GenereateAssociationFromModel();
                return;
            }

            if (_questionsData == null)
            {
                _questionsData = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
            }

            _questionsData.NextQuestion();


            if (_associationObjectsContents.Count == 0)
            {
                RandomizeAssociationObjects();
            }
            else
            {
                RandomizeAssociationObjectsContents();
            }

            base.PrepareGame();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Recreates the datasource and binds it to the table.
 /// </summary>
 public void ReloadData()
 {
     _data = new QuestionsData(_category);
     _questionsTableSource = new QuestionsTableSource(_data, this);
     TableView.Source      = _questionsTableSource;
     TableView.ReloadData();
 }
Ejemplo n.º 5
0
        protected override void OnStart()
        {
            base.OnStart();

            _questionsData = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
            _questionsData.OnNewQuestionReady += SetText;
        }
Ejemplo n.º 6
0
        protected override void OnStart()
        {
            base.OnStart();
            _questions = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;

            _questions.OnQuestionsOver += Show;
        }
Ejemplo n.º 7
0
        public void PrepareGame(int questionIndex)
        {
            if (GenerateFromModel)
            {
                GenereateAssociationFromModel();
                return;
            }

            if (_questionsData == null)
            {
                _questionsData = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
            }

            _qType = questionIndex;
            _questionsData.ActualQuestion = questionIndex;



            if (_associationObjectsContents.Count == 0)
            {
                RandomizeAssociationObjects();
            }
            else
            {
                RandomizeAssociationObjectsContents();
            }

            base.PrepareGame();
        }
        protected override void OnStart()
        {
            base.OnStart();

            _quizController        = _controller as QuizController;
            _quizController.Reset += ResetQuestions;

            _questions = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
        }
    protected void SubmitQuestion_Click(object sender, EventArgs e)
    {
        UserBO ob = new UserBO();

        clsBLL obj = new clsBLL();

        if (QuestionBox.Text == null || QuestionBox.Text == "" || Option1Box.Text == "" || Option1Box.Text == null || Option2Box.Text == "" || Option2Box.Text == null || Option3Box.Text == "" || Option3Box.Text == null || Option4Box.Text == "" || Option4Box.Text == null)
        {
            Response.Write("<script>alert('Some values aren missing in the required field');</script>");
            Server.Transfer("AdminAddCourseQuestions.aspx");
        }

        ob.coursecode = CourseCodeDropList.Text;

        ob.qno = obj.QuestionnumberfinderBLL(ob.coursecode) + 1;

        ob.question = QuestionBox.Text;
        ob.option1  = Option1Box.Text;
        ob.option2  = Option2Box.Text;
        ob.option3  = Option3Box.Text;
        ob.option4  = Option4Box.Text;
        ob.questAns = CorrectOptionDropList.Text;


        int m = obj.InsertQuestionBLL(ob);

        if (m == 1)
        {
            statuslabel.Text = "inserted";
            QuestionBox.Text = "";
            Option1Box.Text  = "";
            Option2Box.Text  = "";
            Option3Box.Text  = "";
            Option4Box.Text  = "";
        }
        else
        {
            statuslabel.Text = "can't insert";
        }



        using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["userdataConnectionString"].ConnectionString.ToString()))
        {
            SqlCommand cmd = new SqlCommand("select * from QuestionBank where (CourseID ='" + CourseCodeDropList.Text + "')", con);
            con.Open();

            QuestionsData.DataSource = cmd.ExecuteReader();
            QuestionsData.DataBind();
        }
    }
Ejemplo n.º 10
0
        public override async Task OnActivateAsync()
        {
            _questionGrainId = QuestionGrainId.FromString(this.GetPrimaryKeyString());
            _tenantId        = _dbContext.Tenant.AsNoTracking().First(t => t.OrganisationId == _questionGrainId.OrganisationId).TenantId;

            await _dbContext.Post.Where(p => p.PostId == _questionGrainId.QuestionId)
            .Include(p => p.InversePostNavigation) // answers and comments
            .Include(p => p.Vote)                  // votes
            .LoadAsync();

            _ctx = new QuestionsData(
                new EFList <Post>(_dbContext.Post)
                );
        }
Ejemplo n.º 11
0
        protected override void OnStart()
        {
            base.OnStart();

            _scoreController = _bootstrap.GetController(ControllerTypes.Score) as ScoreController;
            _register        = _bootstrap.GetController(ControllerTypes.Register) as RegisterController;

            _resourcesData = _bootstrap.GetModel(ModelTypes.Resources) as ResourcesDataBase;

            _timeController = _bootstrap.GetController(ControllerTypes.Time) as TimeController;
            if (_timeController != null)
            {
                _timeController.GameTimeout += TimeOut;
            }

            _SoundController = _bootstrap.GetController(ControllerTypes.SoundSFX) as SoundController;
            _questionsData   = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
            _AssociationData = _bootstrap.GetModel(ModelTypes.Association) as AssociationData;
        }
        protected override void OnStart()
        {
            base.OnStart();

#if HAS_SERVER
            if (!UseTurningUDP)
            {
                groupsInfo      = _bootstrap.GetModel(ModelTypes.Group) as GroupsInfo;
                turningVoteData = _bootstrap.GetModel(ModelTypes.TurningVote) as TurningVoteData;
                groupsInfo      = _bootstrap.GetModel(ModelTypes.Group) as GroupsInfo;
                quizTurning     = _bootstrap.GetController(ControllerTypes.Quiz) as QuizTurningController;

                if (UseGrid)
                {
                    gridInfo = _bootstrap.GetModel(ModelTypes.Grid) as GridData;
                    gridInfo.GridGenerated += OnGenerated;
                }
            }
            else
            {
                turningVoteData = _bootstrap.GetModel(ModelTypes.TurningVote) as TurningVoteData;
                groupsInfo      = _bootstrap.GetModel(ModelTypes.Group) as GroupsInfo;
                quizTurning     = _bootstrap.GetController(ControllerTypes.Quiz) as QuizTurningController;

                if (UseGrid)
                {
                    gridInfo = _bootstrap.GetModel(ModelTypes.Grid) as GridData;
                    gridInfo.GridGenerated += OnGenerated;
                }
            }
#else
            turningVoteData = _bootstrap.GetModel(ModelTypes.TurningVote) as TurningVoteData;
            groupsInfo      = _bootstrap.GetModel(ModelTypes.Group) as GroupsInfo;
            gridInfo        = _bootstrap.GetModel(ModelTypes.Grid) as GridData;
            quizTurning     = _bootstrap.GetController(ControllerTypes.Quiz) as QuizTurningController;

            gridInfo.GridGenerated += OnGenerated;
#endif

            questionsData = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
        }
    protected void QuestionsData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            GridViewRow row = QuestionsData.Rows[rowIndex];

            int    qnodel    = Convert.ToInt32(row.Cells[1].Text);
            string coursedel = row.Cells[2].Text;

            UserBO ob = new UserBO();
            ob.qno        = qnodel;
            ob.coursecode = coursedel;

            clsBLL obj = new clsBLL();

            if (obj.deletetheQuestionBLL(ob) == 1)
            {
                if (obj.updatetheQuestionBLL(ob) >= 0)
                {
                    Response.Write("<script>alert('Deleted QuestionSuccessfully');</script>");

                    using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["userdataConnectionString"].ConnectionString.ToString()))
                    {
                        SqlCommand cmd = new SqlCommand("select * from QuestionBank where (CourseID ='" + CourseCodeDropList.Text + "')", con);
                        con.Open();

                        QuestionsData.DataSource = cmd.ExecuteReader();
                        QuestionsData.DataBind();
                    }
                }
            }
            else
            {
                Response.Write("<script>alert('Question can't be deleted');</script>");
            }
        }
    }
        protected override void OnStart()
        {
            base.OnStart();

            _quizController = _controller as QuizController;
            _quizController.OnReceiveAnswer += FeedBack;
            _quizController.OnQuestionDone  += Reset;
            _quizController.OnClick         += Deselect;

            _cv = GetComponent <CanvasGroup>();

            _questionsData = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
            _questionsData.OnNewQuestionReady += SetButton;


            if (HideOnPrepared)
            {
                _quizController.OnGamePrepare += Hide;
                _quizController.Reset         += Hide;
                //_quizController.OnGameStart += Show;
                Hide();
            }
        }
 protected abstract void UpdateActivityHandler(ActivityScore isPositiveAnswer, QuestionsData todaysAnswers);
Ejemplo n.º 16
0
 protected override void UpdateActivityHandler(ActivityScore score, QuestionsData todaysAnswers)
 {
     todaysAnswers.FoodScore = score;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Creates a new instance of <see cref="QuestionsController"/>
 /// </summary>
 /// <param name="category"></param>
 public QuestionsController(Category category) : base(UITableViewStyle.Grouped)
 {
     _data     = new QuestionsData(category);
     _category = category;
 }
Ejemplo n.º 18
0
 public QuestionsTableSource(QuestionsData data, QuestionsController questionsController)
 {
     _data = data;
     _questionsController = questionsController;
 }
        public void CreateQuizJSON(TblQuiz objQuiz, int rows)
        {
            try
            {
                JavaScriptSerializer json_serializer = new JavaScriptSerializer();
                json_serializer.MaxJsonLength = int.MaxValue;
                object[]   objTblQue = (object[])json_serializer.DeserializeObject(objQuiz.hdnData);
                var        QuizData  = quizRepository.GetQuizByID(rows);
                var        ques      = QuizData[0].TblQuestions;
                List <int> queIds    = new List <int>();
                foreach (var que in ques)
                {
                    queIds.Add(que.QuestionId);
                }
                int index = 0;
                foreach (Dictionary <string, object> item in objQuiz.questionObject)
                {
                    item["QuestionId"] = Convert.ToString(queIds[index]);
                    index++;
                }

                SCORMJSON  jsonData = new SCORMJSON();
                ConfigData config   = new ConfigData();
                config.scormType = 1.2;
                jsonData.config  = config;

                QuizData quiz = new QuizData();
                quiz.title            = "Quiz";
                quiz.nameLabel        = "Name";
                quiz.name             = objQuiz.QuizName;
                quiz.descLabel        = "Description";
                quiz.description      = objQuiz.QuizDescription;
                quiz.timeLabel        = "Time remaining: ";
                quiz.duration         = objQuiz.Duration == 0 ? null : objQuiz.Duration;
                quiz.passingScore     = 80;//This need to be change
                quiz.minScore         = 0;
                quiz.maxScore         = 100;
                quiz.multipleAttempts = false;
                quiz.timeoutMessage   = "Exam time ended.";
                jsonData.quiz         = quiz;

                ReviewQuizData reviewQuiz = new ReviewQuizData();
                reviewQuiz.title       = "Review Quiz";
                reviewQuiz.nameLabel   = "Name:";
                reviewQuiz.name        = objQuiz.QuizName;
                reviewQuiz.descLabel   = "Description:";
                reviewQuiz.description = objQuiz.QuizDescription;
                reviewQuiz.scoreLabel  = "Score:";
                jsonData.reviewQuiz    = reviewQuiz;

                List <QuestionsData> lstQuestions = new List <QuestionsData>();

                foreach (Dictionary <string, object> item in objQuiz.questionObject)
                {
                    QuestionsData que = new QuestionsData();
                    que.questionText = Convert.ToString(item["QuestionText"]);
                    if (Convert.ToInt32(item["QuestionTypeId"]) == 1)
                    {
                        que.type            = "mcq";
                        que.instructionText = "Options";
                        que.randomOptions   = Convert.ToBoolean(item["isRandomOption"]);
                        List <OptionsData> lstOptions = new List <OptionsData>();
                        var   optionsCount            = (object[])item["Options"];
                        int[] arrAnswers = new int[optionsCount.Length];
                        int   counter    = 0;


                        foreach (Dictionary <string, object> itemNew1 in (object[])item["Options"])
                        {
                            OptionsData ops = new OptionsData();
                            ops.text            = Convert.ToString(itemNew1["OptionText"]);
                            ops.feedback        = Convert.ToString(itemNew1["OptionFeedback"]);
                            arrAnswers[counter] = Convert.ToInt32(itemNew1["CorrectOption"]);
                            lstOptions.Add(ops);
                            counter++;
                        }
                        que.answer  = arrAnswers;
                        que.points  = 1;
                        que.options = lstOptions;
                    }
                    if (Convert.ToInt32(item["QuestionTypeId"]) == 2)
                    {
                        que.type            = "mrq";
                        que.instructionText = "Options";
                        que.randomOptions   = Convert.ToBoolean(item["isRandomOption"]);
                        List <OptionsData> lstOptions = new List <OptionsData>();
                        var   optionsCount            = (object[])item["Options"];
                        int[] arrAnswers = new int[optionsCount.Length];
                        int   counter    = 0;
                        foreach (Dictionary <string, object> itemNew1 in (object[])item["Options"])
                        {
                            OptionsData ops = new OptionsData();
                            ops.text            = Convert.ToString(itemNew1["OptionText"]);
                            arrAnswers[counter] = Convert.ToInt32(itemNew1["CorrectOption"]);
                            lstOptions.Add(ops);
                            counter++;
                        }
                        que.answer  = arrAnswers;
                        que.points  = 1;
                        que.options = lstOptions;
                        CorrectFeedbackData correctFeedback = new CorrectFeedbackData();
                        correctFeedback.text = Convert.ToString(item["CorrectFeedback"]);
                        que.correctFeedback  = correctFeedback;

                        IncorrectFeedbackData inCorrectFeedback = new IncorrectFeedbackData();
                        inCorrectFeedback.text = Convert.ToString(item["InCorrectFeedback"]);
                        que.incorrectFeedback  = inCorrectFeedback;
                    }
                    if (Convert.ToInt32(item["QuestionTypeId"]) == 3)
                    {
                        que.type            = "para";
                        que.placeholderText = "Write your answer here";
                        que.answer          = null;
                        que.points          = 1;
                        CorrectFeedbackData correctFeedback = new CorrectFeedbackData();
                        correctFeedback.text = Convert.ToString(item["CorrectFeedback"]);
                        que.correctFeedback  = correctFeedback;

                        IncorrectFeedbackData inCorrectFeedback = new IncorrectFeedbackData();
                        inCorrectFeedback.text = Convert.ToString(item["InCorrectFeedback"]);
                        que.incorrectFeedback  = inCorrectFeedback;
                    }
                    if (Convert.ToInt32(item["QuestionTypeId"]) == 4)
                    {
                        que.type = "video";
                        string base64String = string.Empty;
                        if (!string.IsNullOrEmpty(Convert.ToString(item["mediaFile"])))
                        {
                            base64String = Convert.ToString(item["mediaFile"]);
                            byte[]       newBytes = Convert.FromBase64String(base64String);
                            MemoryStream ms       = new MemoryStream(newBytes, 0, newBytes.Length);
                            ms.Write(newBytes, 0, newBytes.Length);
                            string fileName        = Convert.ToString(item["qTypeId"]);
                            string DestinationPath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"];
                            DestinationPath = DestinationPath + "\\" + objQuiz.QuizName + "\\data\\media";
                            FileStream file = new FileStream(DestinationPath + "\\" + fileName, FileMode.Create, FileAccess.Write);
                            ms.WriteTo(file);
                            file.Close();
                            ms.Close();
                            que.path = "data//media//" + fileName;
                        }
                        else
                        {
                            string fileName = Convert.ToString(item["qTypeId"]);
                            var    extn     = fileName.Split('.');
                            int    count    = extn.Length;
                            fileName = Convert.ToString(item["QuestionId"]) + "." + extn[count - 1];
                            string DestinationPath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"];
                            DestinationPath = DestinationPath + "\\" + objQuiz.QuizName + "\\data\\media";
                            string path = System.Configuration.ConfigurationManager.AppSettings["QuizMediaPath"];
                            System.IO.File.Move(path + "\\" + fileName, DestinationPath + "\\" + fileName);
                            que.path = "data//media//" + fileName;
                        }
                    }
                    if (Convert.ToInt32(item["QuestionTypeId"]) == 5)
                    {
                        que.type = "audio";
                        string base64String = string.Empty;
                        if (!string.IsNullOrEmpty(Convert.ToString(item["mediaFile"])))
                        {
                            base64String = Convert.ToString(item["mediaFile"]);
                            byte[]       newBytes = Convert.FromBase64String(base64String);
                            MemoryStream ms       = new MemoryStream(newBytes, 0, newBytes.Length);
                            ms.Write(newBytes, 0, newBytes.Length);
                            string fileName        = Convert.ToString(item["qTypeId"]);
                            string DestinationPath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"];
                            DestinationPath = DestinationPath + "\\" + objQuiz.QuizName + "\\data\\media";
                            FileStream file = new FileStream(DestinationPath + "\\" + fileName, FileMode.Create, FileAccess.Write);
                            ms.WriteTo(file);
                            file.Close();
                            ms.Close();
                            que.path = "data//media//" + fileName;
                        }
                        else
                        {
                            string fileName = Convert.ToString(item["qTypeId"]);
                            var    extn     = fileName.Split('.');
                            int    count    = extn.Length;
                            fileName = Convert.ToString(item["QuestionId"]) + "." + extn[count - 1];

                            string DestinationPath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"];
                            DestinationPath = DestinationPath + "\\" + objQuiz.QuizName + "\\data\\media";
                            string path = System.Configuration.ConfigurationManager.AppSettings["QuizMediaPath"];
                            System.IO.File.Move(path + "\\" + fileName, DestinationPath + "\\" + fileName);
                            que.path = "data//media//" + fileName;
                        }
                    }

                    lstQuestions.Add(que);
                }
                jsonData.questions = lstQuestions;
                string jsonFilePath = System.Configuration.ConfigurationManager.AppSettings["ScormDestinationPath"];
                jsonFilePath = jsonFilePath + "\\" + objQuiz.QuizName + "\\data\\json\\";
                var json = new JavaScriptSerializer().Serialize(jsonData);
                System.IO.File.WriteAllText(jsonFilePath + "quizdata.json", json);
            }
            catch (Exception ex)
            {
                newException.AddException(ex);
            }
        }
Ejemplo n.º 20
0
        private void LoadTree()
        {
            treeView1.Nodes.Clear();
            if (Utility.IsAdmin())
            {
                if (File.Exists(Utility.XML_QUESTION_NAME))
                {
                    result = ObjectXMLSerializer <QuestionsData> .Load(KnowledgeMatrix.Framework.Utility.XML_QUESTION_NAME);
                }
                else
                {
                    MessageBox.Show("Kindly validate the license. Contact System Administrator");
                    return;
                }
            }
            else
            {
                if (File.Exists(Utility.XML_QUESTION_NAME))
                {
                    result = ObjectXMLSerializer <QuestionsData> .Load(KnowledgeMatrix.Framework.Utility.XML_QUESTION_NAME);
                }
                else
                {
                    MessageBox.Show("Kindly validate the license. Contact System Administrator");
                    return;
                }
            }

            if (result != null && result.objQuestionMas != null && result.objQuestionMas.Count > 0)
            {
                //Get the First Level Node using Parent Node is null
                getParent = LoadTreeInfo(0, 0, true);
                //(from QuestionMast in result.objQuestionMas
                // where QuestionMast.ParentParentQuestionNo == i && QuestionMast.ParentQuestionNo == j
                // select QuestionMast).ToList();

                for (int prntCnt = 0; prntCnt < getParent.Count; prntCnt++)
                {
                    if ((Utility.IsAdmin()) || (!string.IsNullOrWhiteSpace(getParent[prntCnt].eTutor) && (getParent[prntCnt].eTutor == "Purchased") && !string.IsNullOrWhiteSpace(getParent[prntCnt].QuesBankDate) && Convert.ToDateTime(getParent[prntCnt].QuesBankDate).AddDays(KnowledgeMatrix.Properties.Settings.Default.DaysToAdd) >= System.DateTime.Now))
                    {
                        //Add to tree
                        TreeNode treeNode = new TreeNode(getParent[prntCnt].Name);
                        treeNode.Tag                = getParent[prntCnt].QuesNo.ToString();
                        treeNode.ImageIndex         = rootImageIndex;
                        treeNode.SelectedImageIndex = 3;

                        treeView1.Nodes.Add(treeNode);
                        //For each of them get the child and pass the node to be added if > 0

                        getFirstChild = LoadTreeInfo(1, getParent[prntCnt].QuesNo, false);
                        //(from QuestionMast in result.objQuestionMas
                        // where QuestionMast.ParentQuestionNo == getParent[prntCnt].QuesNo
                        // select QuestionMast).ToList();
                        for (int childCnt = 0; childCnt < getFirstChild.Count; childCnt++)
                        {
                            TreeNode childtreeNode = new TreeNode(getFirstChild[childCnt].Name);
                            childtreeNode.Tag                = getFirstChild[childCnt].QuesNo.ToString();
                            childtreeNode.ImageIndex         = selectedCustomerImageIndex;
                            childtreeNode.SelectedImageIndex = 3;

                            treeNode.Nodes.Add(childtreeNode);

                            //Add the Subchild
                            getSecondChild = LoadTreeInfo(2, getFirstChild[childCnt].QuesNo, false);
                            //(from QuestionMast in result.objQuestionMas
                            // where QuestionMast.ParentQuestionNo == getFirstChild[childCnt].QuesNo
                            // select QuestionMast).ToList();
                            for (int childSecondCnt = 0; childSecondCnt < getSecondChild.Count; childSecondCnt++)
                            {
                                TreeNode childsecondtreeNode = new TreeNode(getSecondChild[childSecondCnt].Name);
                                childsecondtreeNode.Tag                = getSecondChild[childSecondCnt].QuesNo.ToString();
                                childsecondtreeNode.ImageIndex         = rootImageIndex + 2;
                                childsecondtreeNode.SelectedImageIndex = 3;

                                childtreeNode.Nodes.Add(childsecondtreeNode);

                                //Add the Subchild
                            }
                        }
                    }
                }
            }
        }
 protected override void OnStart()
 {
     _questions = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;
 }
        public PurchaseManagement()
        {
            InitializeComponent();
            #region DataGrid Definition
            //   getParent = ObjectXMLSerializer<QuestionsData>.Load(XML_QUESTION_NAME);
            label1.Text = "System IP : " + EntropyGenerator.GetIPForMachine();
            this.Size   = new System.Drawing.Size(Int32.Parse(KnowledgeMatrix.Properties.Settings.Default.PanelWidth), Int32.Parse(KnowledgeMatrix.Properties.Settings.Default.PanelHeight));
            if (File.Exists(Utility.XML_QUESTION_NAME))
            {
                result = ObjectXMLSerializer <QuestionsData> .Load(Utility.XML_QUESTION_NAME);
            }
            else
            {
                MessageBox.Show("Kindly validate the license. Contact System Administrator");
                return;
            }
            DataGridViewTextBoxColumn col0 = new DataGridViewTextBoxColumn();
            col0.ReadOnly   = true;
            col0.HeaderText = "Product Name";
            col0.Name       = "ProductName";
            dataGridView1.Columns.Add(col0);
            this.dataGridView1.Columns[0].Width = 445;

            DataGridViewDisableButtonColumn buttonColumn =
                new DataGridViewDisableButtonColumn();
            buttonColumn.HeaderText = "Km-Knowledge Tutor";
            buttonColumn.Name       = "eTutor";
            buttonColumn.Text       = "Purchase";
            buttonColumn.Tag        = "eTutor";
            dataGridView1.Columns.Add(buttonColumn);


            DataGridViewDisableButtonColumn buttonColumn1 =
                new DataGridViewDisableButtonColumn();
            buttonColumn1.HeaderText = "Km- Knowledge Base";
            buttonColumn1.Name       = "QuestionBank";
            buttonColumn1.Tag        = "QuestionBank";
            buttonColumn1.Text       = "Purchase";
            //buttonColumn1.UseColumnTextForButtonValue = false;

            dataGridView1.Columns.Add(buttonColumn1);


            DataGridViewDisableButtonColumn buttonColumn2 =
                new DataGridViewDisableButtonColumn();
            buttonColumn2.HeaderText = "Km-Knowledge Assessment";
            buttonColumn2.Name       = "QuestionPaper";
            buttonColumn2.Tag        = "QuestionBankGeneration";
            buttonColumn2.Text       = "Purchase";
            //buttonColumn2.UseColumnTextForButtonValue = false;
            dataGridView1.Columns.Add(buttonColumn2);
            this.dataGridView1.Columns[3].Width = 100;

            DataGridViewDisableButtonColumn buttonColumn3 =
                new DataGridViewDisableButtonColumn();
            buttonColumn3.HeaderText = "Km-Knowledge Evaluator";
            buttonColumn3.Name       = "MockTest";
            buttonColumn3.Tag        = "MockTest";
            buttonColumn3.Text       = "Purchase";
            // buttonColumn3.UseColumnTextForButtonValue = false;

            dataGridView1.Columns.Add(buttonColumn3);


            // dataGridView1.Columns.Add(column0);

            //  dataGridView1.RowCount = 2;
            // dataGridView1.AutoSize = true;
            dataGridView1.AllowUserToAddRows = false;
            dataGridView1.ColumnHeadersDefaultCellStyle.Alignment =
                DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.Update();// = buttonColumn3;
            #endregion
            dataGridView1.CellClick +=
                new DataGridViewCellEventHandler(dataGridView1_CellClick);

            //  dataGridView1.Dock = DockStyle.Fill;
            dataGridView1.BackgroundColor = Color.LightGray;
            dataGridView1.BorderStyle     = BorderStyle.Fixed3D;

            // Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default
            // value won't override DataGridView.DefaultCellStyle.SelectionBackColor.
            dataGridView1.RowHeadersDefaultCellStyle.SelectionBackColor = Color.Empty;

            // Set the selection background color for all the cells.
            dataGridView1.DefaultCellStyle.SelectionBackColor = Color.White;
            dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Black;
            //Set RowHeadersDefaultCellStyle.SelectionBackColor so that its default
            // value won't override DataGridView.DefaultCellStyle.SelectionBackColor.
            dataGridView1.RowHeadersDefaultCellStyle.SelectionBackColor = Color.Empty;

            // Set the background color for all rows and for alternating rows.
            // The value for alternating rows overrides the value for all rows.
            dataGridView1.RowsDefaultCellStyle.BackColor            = Color.LightBlue;
            dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.MediumAquamarine;

            //// Set the text for each button.
            if (result != null && result.objQuestionMas.Count > 0)
            {
                //Get the First Level Node using Parent Node is null
                getParent =
                    (from QuestionMast in result.objQuestionMas
                     where QuestionMast.ParentParentQuestionNo == 0 && QuestionMast.ParentQuestionNo == 0
                     select QuestionMast).ToList();
                dataGridView1.RowCount = getParent.Count;
                for (int prntCnt = 0; prntCnt < getParent.Count; prntCnt++)
                {
                    dataGridView1.Rows[prntCnt].Cells["ProductName"].Value = getParent[prntCnt].Name;

                    if (Utility.IsAdmin())
                    {
                        dataGridView1.Rows[prntCnt].Cells["eTutor"].Value        = "Export";
                        dataGridView1.Rows[prntCnt].Cells["QuestionBank"].Value  = "Export";
                        dataGridView1.Rows[prntCnt].Cells["QuestionPaper"].Value = "Export";
                        dataGridView1.Rows[prntCnt].Cells["MockTest"].Value      = "Export";
                    }
                    else
                    {
                        dataGridView1.Rows[prntCnt].Cells["eTutor"].Value        = getParent[prntCnt].eTutor;
                        dataGridView1.Rows[prntCnt].Cells["QuestionBank"].Value  = getParent[prntCnt].QuesBank;
                        dataGridView1.Rows[prntCnt].Cells["QuestionPaper"].Value = getParent[prntCnt].QuesBankGen;
                        dataGridView1.Rows[prntCnt].Cells["MockTest"].Value      = getParent[prntCnt].MockTest;
                    }
                }
            }

            if (Utility.IsAdmin())
            {
                //button3.Visible = true;
                textBox1.Visible = true;
                button5.Enabled  = false;
                //textBox1.Text = EntropyGenerator.GetIPForMachine();
                label2.Visible = true;
            }
            else
            {
                button3.Visible = false;
                button5.Visible = button6.Visible = textBox1.Visible = false;

                label2.Visible = false;
            }
        }
 /// <summary>
 /// Creates a new instance of <see cref="QuestionsController"/>
 /// </summary>
 /// <param name="category"></param>
 public QuestionsController(Category category)
     : base(UITableViewStyle.Grouped)
 {
     _data = new QuestionsData(category);
     _category = category;
 }
 public QuestionsTableSource(QuestionsData data, QuestionsController questionsController)
 {
     _data = data;
     _questionsController = questionsController;
 }