private BOExamManage GetEQAList(string examid, object mode)
        {
            BAExamManage _baexmmng = new BAExamManage();
            var          list      = _baexmmng.SelectExamQestionAnswer("GetEQAWithQId", Convert.ToInt32(examid));

            if (list != null)
            {
                list.QuestionList.ForEach(e => e.Event = mode.ToString());
                if (mode.ToString() == "TM" || mode.ToString() == "TO")
                {
                    list = Shuffle(list);
                    if (!string.IsNullOrEmpty(list.TestOption))
                    {
                        var questinlist = list.QuestionList.Take(Convert.ToInt32(list.TestOption)).ToList();
                        list.QuestionList.Clear();
                        list.QuestionList = questinlist;
                    }
                }
                return(list);
            }
            else
            {
                btnprevious.Enabled = false;
                btnnext.Enabled     = false;
                btnEndExam.Enabled  = false;
                return(null);
            }
        }
Example #2
0
        private void btnDownload_Click(object sender, RoutedEventArgs e)
        {
            Button btntest      = (Button)sender;
            var    list         = _baexmmng.SelectExamQestionAnswer("GetEQAWithQId", Convert.ToInt32(btntest.CommandParameter));
            string strserialize = JsonConvert.SerializeObject(list);
            string path         = Common.UserDataFolder;
            string filename     = list.ExamCode + ".json";

            System.IO.File.WriteAllText(path + list.ExamCode + ".json", strserialize);



            //Get the Input File Name and Extension.
            string fileName      = Path.GetFileNameWithoutExtension(filename);
            string fileExtension = Path.GetExtension(filename);

            //Build the File Path for the original (input) and the encrypted (output) file.
            string input  = Common.UserDataFolder + fileName + fileExtension;
            string output = Common.UserDataFolder + list.SecondCategory + " " + fileName + ".vcee";

            //Save the Input File, Encrypt it and save the encrypted file in output path.
            Common.Encrypt(input, output);

            //Download the Encrypted File.

            // WebClient webClient = new WebClient();
            // webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged);
            //webClient.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(client_DownloadFileCompleted);
            // webClient.DownloadFileAsync(new Uri(Common.FullyQualifiedApplicationPath +"/ExamSimulator/" + output), @"D:\Work\Project\ExamSimulator\bin\Debug\Examfile\" + output);

            //Delete the original (input) and the encrypted (output) file.
            File.Delete(input);
            //File.Delete(output);
            // DownloadFiles(list);
            BindFileListBox();
        }