Example #1
0
 /// <summary>
 /// 在CheckListBox中显示某个考场的考号组
 /// </summary>
 /// <param name="kcName">考场名称</param>
 private void showAll(string kcName)
 {
     #region 先清空listBox1列表
     if (listBox1.Items.Count > 0)
     {
         listBox1.DataSource = null;
         listBox1.Items.Clear();
     }
     #endregion
     db_theExamNo manage   = new db_theExamNo();
     string       strWhere = "";
     if (kcName == "")
     {
         strWhere = "id>0 order by id desc";
     }
     else
     {
         strWhere = "kaochangname='" + kcName + "' order by id desc";
     }
     DataTable dtList = manage.GetList(strWhere).Tables[0];
     listBox1.DataSource    = dtList.DefaultView;
     listBox1.ValueMember   = "ID";
     listBox1.DisplayMember = "remark";
     listBox1.SelectedIndex = -1;
 }
Example #2
0
        //修改
        private void btn_Modify_Click(object sender, EventArgs e)
        {
            if (varID == 0)
            {
                MessageBox.Show("请选中要修改的项!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                db_theExamNo theExam = new db_theExamNo();
                theExam.ID           = varID;
                theExam.kaochangName = cmbKaochang.Text;
                theExam.startNum     = Convert.ToInt32(txtStart.Text.Trim());
                theExam.endNum       = Convert.ToInt32(txtEnd.Text.Trim());
                theExam.remark       = theExam.startNum + "-" + theExam.endNum;

                if (theExam.Update())
                {
                    MessageBox.Show("修改考场成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    //showAll();
                    //txtKCMC.Text = String.Empty;
                }
                else
                {
                    MessageBox.Show("操作失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #3
0
 //删除
 private void btn_Del_Click(object sender, EventArgs e)
 {
     if (varID == 0)
     {
         MessageBox.Show("请选中要删除的项!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         if (MessageBox.Show("确定删除?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             db_theExamNo theExam = new db_theExamNo();
             if (varID > 0)
             {
                 if (theExam.Delete(varID))
                 {
                     //showAll();
                     MessageBox.Show("成功删除!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     txtStart.Text = String.Empty;
                     txtEnd.Text   = String.Empty;
                     //txtKCMC.Text = String.Empty;
                 }
             }
             else
             {
                 MessageBox.Show("请选择考场再点删除", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
     }
 }
Example #4
0
        string lujing = Application.StartupPath;  //F:\\MyProjects\\CVR100A_U_DSDK_Demo\\bin\\Debug
        //string lujing = "http://192.168.1.118\\d:";

        /// <summary>
        /// 配置各考场随机数
        /// </summary>
        private void setRandomNum()
        {
            DataTable dtDicCydw = new db_kaochang().GetList(" examnameid='" + publicModel.examName + "'").Tables[0];

            for (int i = 0; i < dtDicCydw.Rows.Count; i++)
            {
                StreamWriter swno      = new StreamWriter(@lujing + "\\" + dtDicCydw.Rows[i]["kcname"].ToString() + "(" + publicModel.examName + ")" + ".txt");
                DataTable    dtTheExam = new db_theExamNo().GetList("kaochangname='" + dtDicCydw.Rows[i]["kcname"].ToString() + "'").Tables[0];
                //循环每个考场有几组
                for (int j = 0; j < dtTheExam.Rows.Count; j++)
                {
                    for (int n = Convert.ToInt32(dtTheExam.Rows[j]["startnum"]); n <= Convert.ToInt32(dtTheExam.Rows[j]["endnum"]); n++)
                    {
                        swno.Write(n.ToString() + "\r\n");
                    }
                }
                swno.Close();
            }
        }
Example #5
0
        //新增
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (cmbKaochang.Text == "--请选择--")
            {
                MessageBox.Show("请选择考场!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (string.IsNullOrEmpty(txtStart.Text.Trim()) || string.IsNullOrEmpty(txtEnd.Text.Trim()))
            {
                MessageBox.Show("起始、终止序号不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                db_theExamNo theExam = new db_theExamNo();
                try
                {
                    theExam.kaochangName = cmbKaochang.Text;
                    theExam.startNum     = Convert.ToInt32(txtStart.Text.Trim());
                    theExam.endNum       = Convert.ToInt32(txtEnd.Text.Trim());
                    theExam.remark       = theExam.startNum + "-" + theExam.endNum;
                    theExam.Add();

                    DialogResult dialogres = MessageBox.Show("添加考号成功!", "系统提示!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    if (dialogres == DialogResult.OK)
                    {
                        BindCmbKCMC();
                        txtStart.Text = String.Empty;
                        txtEnd.Text   = String.Empty;
                        showAll(cmbKaochang.Text);
                        varID = 0;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }