public AddNavicertCard()
        {
            InitializeComponent();

            #region 初始化IC卡驱动
            strBaudRate = ini.IniReadValue("IcCard", "BoudRate");
            strDataBits = ini.IniReadValue("IcCard", "DataBits");
            strStopBits = ini.IniReadValue("IcCard", "StopBits");
            strParity = ini.IniReadValue("IcCard", "Parity");
            strPortName = ini.IniReadValue("IcCard", "PortName");
            commclass = new CoalTraffic.DBUtility.CommClassADDNC(strBaudRate, strDataBits, strStopBits, strParity, strPortName);

            commclass.RecTxt = txtNavicertCode;
            commclass.alarmSound = alarmSound;
            commclass.OpenCommPort();

            #endregion

            IsHaveRemote = ini.IniReadValue("ReMote", "IsHaveRemote");
            //iLen = Convert.ToInt32(ini.IniReadValue("IcCard", "CardNoLength"));
            this.txtSendPerson.Text = StaticParameter.UserName;
            this.txtOrgName.Text = DbHelperSQL.GetSingle("Select isnull(OrgName,'') from VSys_Operator where UserCode='" + StaticParameter.UserCode + "'").ToString();
            this.txtStartTime.Text = DateTime.Now.ToString();
            //InitICCard();
            if (IsHaveRemote == "1")
            {
                InitRemoteCard();
            }
            //if (strCard == "ID")
            //this.txtNavicertCode.ReadOnly = false;
        }
        public BNavicertCard()
        {
            InitializeComponent();

            #region 读卡器初始化相关
            strBaudRate = ini.IniReadValue("IcCard", "BoudRate");
            strDataBits = ini.IniReadValue("IcCard", "DataBits");
            strStopBits = ini.IniReadValue("IcCard", "StopBits");
            strParity = ini.IniReadValue("IcCard", "Parity");
            strPortName = ini.IniReadValue("IcCard", "PortName");
            commclass = new CoalTraffic.DBUtility.CommClassADDNC(strBaudRate, strDataBits, strStopBits, strParity, strPortName);
            commclass.RecTxt = txtBNavicertCode;
            commclass.alarmSound = alarmSound;
            commclass.OpenCommPort();
            #endregion

            this.txtBSendPerson.Text = StaticParameter.UserName;
            this.txtBOrgName.Text = DbHelperSQL.GetSingle("Select isnull(OrgName,'') from VSys_Operator where UserCode='" + StaticParameter.UserCode + "'").ToString();
            this.txtBStartTime.Text = DateTime.Now.ToString();

            #region 电子标签初始化
            IsHaveRemote = ini.IniReadValue("ReMote", "IsHaveRemote");
            if (IsHaveRemote == "1")
            {
                InitRemoteCard();
            }
            #endregion
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        public AddNavicertCard()
        {
            InitializeComponent();

            #region 初始化IC卡驱动
            strBaudRate = ini.IniReadValue("IcCard", "BoudRate");
            strDataBits = ini.IniReadValue("IcCard", "DataBits");
            strStopBits = ini.IniReadValue("IcCard", "StopBits");
            strParity = ini.IniReadValue("IcCard", "Parity");
            strPortName = ini.IniReadValue("IcCard", "PortName");
            commclass = new CoalTraffic.DBUtility.CommClassADDNC(strBaudRate, strDataBits, strStopBits, strParity, strPortName);
            commclass.RecTxt = txtNavicertCode;
            commclass.alarmSound = alarmSound;
            if (!commclass.OpenCommPort())
            {
                alarmSound.Alarm("串口设置不正确或者此端口不存在");
                MessageBox.Show("串口设置不正确或者此端口不存在", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            #endregion

            #region 加载窗体背景
            this.BackgroundImage = Image.FromFile(StaticParameter.Skin + "cbg.jpg");
            this.BackgroundImageLayout = ImageLayout.Stretch;
            #endregion

            #region 电子标签初始化
            this.txtSendPerson.Text = StaticParameter.UserName;
            this.txtOrgName.Text = DbHelperSQL.GetSingle("Select isnull(OrgName,'') from VSys_Operator where UserCode='" + StaticParameter.UserCode + "'").ToString();
            this.txtStartTime.Text = DateTime.Now.ToString();
            if (StaticParameter.IsRemoteReader == "1")
            {
                InitRemoteCard();
            }
            else
            {
                label3.Visible = false;
                txtRemoteCard.Visible = false;
            }
            #endregion

            #region 判断该站是不是煤矿端计量站
            string strRoomCode = ini.IniReadValue("RoomSetting", "RoomCode");
            StringBuilder sbselectsql = new StringBuilder();
            sbselectsql.Append("select count(*) from TT_Room");
            sbselectsql.Append(" where RoomCode <> '0' and RoomCode ='" + strRoomCode + "'");

            object OCount = DbHelperSQL.GetSingle(sbselectsql.ToString());

            if (int.Parse(OCount.ToString()) == 0)
            {
                btnSend.Enabled = false;
                alarmSound.Alarm("请设置该站的磅房");
            }
            else
            {
                btnSend.Enabled = true;
            }
            #endregion
        }