예제 #1
0
파일: CMonitor.cs 프로젝트: wpmyj/Zhuangkao
 public CMonitor()
 {
     settings = ModuleConfig.GetSettings();
     jifennum = settings.Jifennum;
     if (jifennum < 3 || jifennum > 100)
     {
         jifennum = 3;
     }
     iorw          = new CIO();
     mondata_s     = new CMonData();
     mondata_l     = new CMonData();
     mondata_s_cur = new CMonData();
     mondata_l_cur = new CMonData();
     mondata_s_old = new CMonData();
     mondata_l_old = new CMonData();
     jifenQueue_s  = new List <CMonData>(jifennum);
     jifenQueue_l  = new List <CMonData>(jifennum);
     old37a        = iorw.read(0x37a);
     iorw.write(0x37a, 7);
     exit          = 0;
     mrevent       = new ManualResetEvent(false);
     mythread      = new Thread(Monitor);
     delaytime     = settings.Delaytime;
     lvbodelaytime = settings.Lvbodelaytime;
     regobj        = new ArrayList();
     lbgan         = new ulong [9];
     adminpb       = new CMonData();
     adminqf       = new CMonData();
     for (int i = 0; i < 9; i++)
     {
         lbgan[i] = 0;
     }
     Che_Type   = 0;//注意此处为public变量,赋值时会做一系列同步操作
     gan_l      = settings.Gan_l;
     gan_s      = settings.Gan_s;
     xian_l     = settings.Xian_l;
     xian_s     = settings.Xian_s;
     che        = settings.Che;
     modarray_s = new CMonData[jifennum];
     modarray_l = new CMonData[jifennum];
     for (int i = 0; i < jifennum; i++)
     {
         modarray_s[i] = new CMonData();
         modarray_l[i] = new CMonData();
     }
 }
예제 #2
0
파일: CStudent.cs 프로젝트: wpmyj/Zhuangkao
        public CStudent(ModuleSettings settings)
        {
            string connstr = "Data Source=" + settings.Ipaddress + ";Initial Catalog=zhuangkao;Persist Security Info=True;User ID=sa;Password=cgcsxb";//mssql数据库链接

            //connstr =  @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + settings.LocalLinkStr  +";Persist Security Info=False;Jet OLEDB:Database Password=cgcsxb";
            _readlacallink = new CReadLacal(connstr);
            //connstr = "Data Source=oraclelan;Persist Security Info=True;User ID=DRV_KM2;Password=cgcsxb;Unicode=True";
            connstr         = "Data Source=" + settings.Ipaddress + ";Initial Catalog=remote_zhuangkao;Persist Security Info=True;User ID=sa;Password=cgcsxb"; //mssql数据库链接
            _readremotelink = new CReadRemote(connstr);
            _linkpool       = new CLinkPool();
            _linkpool.RegDbLink(_readlacallink);
            //_linkpool.RegDbLink(_readremotelink); //连接次序根据注册先后
            Clear();
            int tmpreturn = _linkpool.OpenLink();

            System.Threading.Thread.Sleep(1000);
        }
예제 #3
0
        private void Sound_Test_Form_Load(object sender, EventArgs e)
        {
            voice = new SpVoiceClass();
            ISpeechObjectTokens spObjs = voice.GetVoices("", "");
            int i = 0;

            foreach (ISpeechObjectToken spObj in spObjs)
            {
                this.comboBoxVoiceList.Items.Add(spObj.GetDescription(i++));
            }
            settings = ModuleConfig.GetSettings();
            try
            {
                this.comboBoxVoiceList.SelectedIndex = settings.VoiceIndex;
            }
            catch
            {
            }
            tmpIndex = settings.VoiceIndex;
        }
예제 #4
0
        public static ModuleSettings GetSettings()
        {
            ModuleSettings data       = null;
            XmlSerializer  serializer = new XmlSerializer(typeof(ModuleSettings));

            try
            {
                string     fileName = "zk.config";
                FileStream fs       = new FileStream(fileName, FileMode.Open);
                data = (ModuleSettings)serializer.Deserialize(fs);
                fs.Close();
            }
            catch
            {
                data = new ModuleSettings();
            }


            return(data);
        }
예제 #5
0
        public CPrintContent()
        {
            settings = ModuleConfig.GetSettings();

            ksddtxt           = new CTextPrintObjSet();
            ksddtxt.Printtext = "";
            ksddtxt.mmX       = settings.Ksdd_x;
            ksddtxt.mmY       = settings.Ksdd_y;
            ksddtxt.Fn        = new Font("宋体", settings.FontSize);

            ksxmtxt           = new CTextPrintObjSet();
            ksxmtxt.Printtext = "";
            ksxmtxt.mmX       = settings.Ksxm_x;
            ksxmtxt.mmY       = settings.Ksxm_y;
            ksxmtxt.Fn        = new Font("宋体", settings.FontSize);

            kscjtxt           = new CTextPrintObjSet();
            kscjtxt.Printtext = "";
            kscjtxt.mmX       = settings.Kscj_x;
            kscjtxt.mmY       = settings.Kscj_y;
            kscjtxt.Fn        = new Font("宋体", settings.FontSize);

            ksrqtxt           = new CTextPrintObjSet();
            ksrqtxt.Printtext = "";
            ksrqtxt.mmX       = settings.Ksrq_x;
            ksrqtxt.mmY       = settings.Ksrq_y;
            ksrqtxt.Fn        = new Font("宋体", settings.FontSize);

            ksyxmtxt           = new CTextPrintObjSet();
            ksyxmtxt.Printtext = "";
            ksyxmtxt.mmX       = settings.Ksyxm_x;
            ksyxmtxt.mmY       = settings.Ksyxm_y;
            ksyxmtxt.Fn        = new Font("宋体", settings.FontSize);

            tiaomaimg     = new CImagePrintObjSet();
            tiaomaimg.mmX = settings.Tiaomaimg_x;
            tiaomaimg.mmY = settings.Tiaomaimg_y;

            printDocument1 = new System.Drawing.Printing.PrintDocument();
            this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
        }
예제 #6
0
 public AdminXhpb_s_Form()
 {
     InitializeComponent();
     ms = ModuleConfig.GetSettings();
 }
예제 #7
0
 public Xhpb_Form_l()
 {
     InitializeComponent();
     ms = ModuleConfig.GetSettings();
 }
예제 #8
0
 public Setting_Form()
 {
     InitializeComponent();
     settings = new ModuleSettings();
     settings = ModuleConfig.GetSettings();
 }
예제 #9
0
        public Main_Form()
        {
            InitializeComponent();
            settings = ModuleConfig.GetSettings();
            sideBarPanelItem2.Visible = false;
            sideBarPanelItem2.Visible = false;
            sideBarPanelItem3.Visible = false;
            sideBarPanelItem5.Visible = false;
            sideBarPanelItem6.Visible = false;
            sideBarPanelItem7.Visible = false;
            switch (CMyGlobal.G_UserClass)
            {
            case 0:
                if (CMyGlobal.G_IsConfig)
                {
                    sideBarPanelItem5.Visible = true;
                    sideBarPanelItem6.Visible = true;
                    sideBarPanelItem7.Visible = true;
                }
                else
                {
                    sideBarPanelItem2.Visible = true;
                    sideBarPanelItem3.Visible = true;
                }
                break;

            case 1:
                if (CMyGlobal.G_IsConfig)
                {
                    sideBarPanelItem5.Visible = true;
                    sideBarPanelItem6.Visible = true;
                }
                else
                {
                    sideBarPanelItem2.Visible = true;
                }
                break;

            case 2:
                if (CMyGlobal.G_IsConfig)
                {
                    sideBarPanelItem5.Visible = true;
                    sideBarPanelItem6.Visible = true;
                }
                else
                {
                    sideBarPanelItem3.Visible = true;
                }
                break;

            case 3:
                if (CMyGlobal.G_IsConfig)
                {
                    sideBarPanelItem5.Visible = true;
                    sideBarPanelItem6.Visible = true;
                    buttonItem9.Visible       = false;
                    buttonItem17.Visible      = false;
                    buttonItem18.Visible      = false;
                    buttonItem19.Visible      = false;
                }
                else
                {
                    sideBarPanelItem3.Visible = true;
                }
                break;
            }
        }
예제 #10
0
        public ExamForm(int chetype, bool isExam)
        {
            InitializeComponent();
            form_mdata = new CMonData();
            _isExam    = isExam;
            settings   = ModuleConfig.GetSettings();
            //tempBmpDir = Environment.CurrentDirectory + @"\Temp\";
            //if (!Directory.Exists(tempBmpDir))
            //    Directory.CreateDirectory(tempBmpDir);

            //显示牌初始化
            //displaycomm = new zhuangkao.Displaycomm.CDisplaycomm(settings);
            //displaycomm.Setdisplaytype = Displaycomm.DisplayType.Zhidisp;


            pictureBox_photo.ImageLocation = "img\\photonull.bmp";
            if (isExam)
            {
                //displaycomm.ShowText("准备考试");
                if (settings.IsNetwork)
                {
                    try
                    {
                        Client = new CNetClient(settings.ServerIP, settings.Devnum);
                        Client.Connect();
                        Client.Event_Devnetdata += new CNetClient.D_DEVNETDATA(netclient_Event_Devnetdata);
                    }
                    catch
                    {
                        MessageBox.Show("不能与点名中心建立网络连接", settings.Devnum.ToString() + "号库");
                    }
                }
                else
                {
                    ButtonStart.Text = "开始考试";
                }
                //-------------身份证识别-------------------------
                idcardinfo = new CIDCardInfo();
                idcardinfo.InitIDcardDev();
                idcardinfo.Start();
                idcardinfo.OnIDCardReceived += new CIDCardInfo.IDCardRequest(idcardinfo_OnIDCardReceived);
                //----------------------------------------------------------------
                student = new CStudent(settings);//增加后台数据库连接时间所以将初始化学员信息前置
                //pictureBox2.Visible = false ;

                if (chetype == 0)
                {
                    this.Text = "小型车考试";
                }
                else
                {
                    this.Text = "大型车考试";
                }
                ToolTip toolTip1 = new ToolTip();
                //--------------鼠标悬停提示------------------------
                toolTip1.AutoPopDelay = 5000;
                toolTip1.InitialDelay = 1000;
                toolTip1.ReshowDelay  = 500;
                toolTip1.ShowAlways   = true;
                toolTip1.SetToolTip(this.showLinkState1, "本地数据库连接");
                toolTip1.SetToolTip(this.showLinkState2, "远端数据库连接");

                //-----------初始化考试信息文本框-------------------
                //StudentText = new TextBox[7];
                //for (int i = 0; i < 7; i++)
                //{
                //    StudentText[i] = new System.Windows.Forms.TextBox();
                //    this.navigationPanePanel1.Controls.Add(this.StudentText[i]);
                //    this.StudentText[i].Location = new System.Drawing.Point(65, 13 + i * 20);
                //    this.StudentText[i].Size = new System.Drawing.Size(115, 21);
                //    this.StudentText[i].TabIndex = i;
                //    this.StudentText[i].KeyPress += new KeyPressEventHandler(this.StudentText_KeyPress);
                //}
                //this.StudentText[0].Leave += new System.EventHandler(this.StudentText_Leave);
                //-----------数据库连接状态灯----------------------
                showLinkState1.init();
                showLinkState2.init();
                //-------------综合初始化-----------------------------
                //-------考验员信息----------
                string    tmpconnstr = "Data Source=" + settings.Ipaddress + ";Initial Catalog=zhuangkao;Persist Security Info=True;User ID=sa;Password=cgcsxb";//mssql数据库链接
                CDatabase tmpdb      = new CMsSqlDatabase(tmpconnstr);
                //if (!tmpdb.OpenConnect())
                //{
                //    MessageBox.Show("数据库连接故障!");
                //    this.Close();
                //    return;
                //}
                while (!tmpdb.OpenConnect())
                {
                    ;
                }


                IDataReader dr = tmpdb.executeReader("select name from kyy");

                while (dr.Read())
                {
                    comboBox1.Items.Add(dr["name"]);
                    comboBox2.Items.Add(dr["name"]);
                }
                dr.Close();
                tmpdb.CloseConnect();
                comboBox1.Text = comboBox1.Items[0].ToString();
                comboBox2.Text = comboBox2.Items[0].ToString();
                // --------学员信息-----------
                // student = new CStudent(settings);
                //Thread.Sleep(500);
                student.GetKsNumber();
                label_pass.Text   = "合格:" + student.PassNumber.ToString() + "人";
                label_nopass.Text = "不合格:" + student.NoPassNumber.ToString() + "人";
                label_sum.Text    = "共计:" + Convert.ToString(student.PassNumber + student.NoPassNumber) + "人";

                showLinkState1.LinkState = student.LinkState1; //显示连接状态
                showLinkState2.LinkState = student.LinkState2;
                myprint          = new CPrintContent();        //初始化打印
                ButtonStart.Text = "申请考试";

                //初始化排队考生列表
                StudentlistView.GridLines     = true;
                StudentlistView.FullRowSelect = true;         //要选择就是一行
                StudentlistView.View          = View.Details; //定义列表显示的方式
                StudentlistView.Scrollable    = true;         //需要时候显示滚动条
                StudentlistView.HeaderStyle   = ColumnHeaderStyle.Nonclickable;
                StudentlistView.Columns.Add("序号", StudentlistView.Width * 1 / 6 + 2, HorizontalAlignment.Left);
                StudentlistView.Columns.Add("姓名", StudentlistView.Width * 2 / 6 - 4, HorizontalAlignment.Left);
                StudentlistView.Columns.Add("证号", StudentlistView.Width * 3 / 6 - 3, HorizontalAlignment.Left);
            }
            else
            {
                if (chetype == 0)
                {
                    this.Text = "小型车练习";
                }
                else
                {
                    this.Text = "大型车练习";
                }
                //displaycomm.ShowText("准备练习");
                ButtonStart.Text = "开始考试";
            }
            myinit(chetype);
        }