Ejemplo n.º 1
0
        private void Button_SignUser_Click(object sender, EventArgs e)
        {
            var orgSelect  = (DataRowView)ComboBox_OrgList.SelectedItem;
            var selectExam = (DataRowView)ComboBox_ExamList.SelectedItem;

            if (selectExam == null)
            {
                MessageBox.Show("请选择考试!");
                return;
            }
            Guid?orgId = null;

            if (checkBox_OrgUser.Checked)
            {
                if (orgSelect == null)
                {
                    MessageBox.Show("请选择机构!");
                    return;
                }
                orgId = (Guid)orgSelect[0];
            }
            toolStripStatusLabel_Default.Text = "开始报名";
            var rst = ExamDataHelper.SignOrgUser((Guid)selectExam[0], orgId);

            toolStripStatusLabel_Default.Text = "报名结束";
            MessageBox.Show(rst);
        }
Ejemplo n.º 2
0
        private void Button_ExcelSign_Click(object sender, EventArgs e)
        {
            var selectExam = (DataRowView)ComboBox_ExamList.SelectedItem;

            if (selectExam == null)
            {
                MessageBox.Show("请选择考试!");
                return;
            }

            toolStripStatusLabel_Default.Text = "选择报名文件";
            OpenFileDialog excelFileDialog = new OpenFileDialog
            {
                Title  = "请选择报名文件",
                Filter = "Excel文件|*.xls;*.xlsx" //设置要选择的文件的类型
            };

            if (excelFileDialog.ShowDialog() == DialogResult.OK)
            {
                toolStripStatusLabel_Default.Text = "开始报名";
                var rst = ExamDataHelper.SignExcelUser((Guid)selectExam[0], excelFileDialog.FileName);
                MessageBox.Show(rst);
            }
            toolStripStatusLabel_Default.Text = "报名结束";
        }
Ejemplo n.º 3
0
        private void Button_Create_Click(object sender, EventArgs e)
        {
            var userIds = ExamDataHelper.GetUserIds().ToArray();
            var rst     = ExamDataHelper.SignUserToExam(new Guid("A36C9AF2-F522-4EB7-BB98-945BEBD51C21"), userIds);

            MessageBox.Show(rst);
        }
Ejemplo n.º 4
0
        private void Button_SearchOrg_Click(object sender, EventArgs e)
        {
            toolStripStatusLabel_Default.Text = "加载机构数据";
            var orgs = ExamDataHelper.GetOrgIdNamesTable(TextBox_OrgSearch.Text);

            ComboBox_OrgList.DisplayMember    = "FullName";
            ComboBox_OrgList.ValueMember      = "OrganizeId";
            ComboBox_OrgList.DataSource       = orgs;
            toolStripStatusLabel_Default.Text = "机构数据加载完成";
        }
Ejemplo n.º 5
0
        private void Button_SearchExam_Click(object sender, EventArgs e)
        {
            toolStripStatusLabel_Default.Text = "加载考试数据";
            var orgSelect = (DataRowView)ComboBox_OrgList.SelectedItem;
            var exams     = ExamDataHelper.GetExamTable((Guid?)orgSelect?[0], TextBox_SearchExam.Text);

            ComboBox_ExamList.DisplayMember   = "ExamName";
            ComboBox_ExamList.ValueMember     = "ExamId";
            ComboBox_ExamList.DataSource      = exams;
            toolStripStatusLabel_Default.Text = "考试数据加载完成";
        }
Ejemplo n.º 6
0
        public void SignExcelUser(Guid examId, string fileName)
        {
            var userAccounts = ExcelHelper.GetWorkBookFromFile(fileName).GetUserAccounts().ToArray();
            var userIds      = ExamDataHelper.GetUserIdsByAccount(userAccounts).ToArray();
            var rst          = Parallel.For(0, userIds.Length / 5000, d =>
            {
                ExamDataHelper.SignUserToExam(examId, userIds.Skip(d * 5000).Take(5000).ToArray());
            });

            while (!rst.IsCompleted)
            {
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新缓存数据到数据库
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button_UpdateToDataBase_Click(object sender, EventArgs e)
 {
     var details  = ExamDataHelper.GetStudentPaperDetails(new Guid("7AA8CA7E-194D-4A96-859D-33FB19822C3F"), new Guid("B5798D23-4681-4053-BAB6-AAF57A1F2D0B"), new Guid("D68545F7-73E6-4BE3-9E2D-06C6166C4445")).ToArray();
     var datatale = ExamDataHelper.PaperDetailToDataTable(details);
 }