Пример #1
0
        public AddMarkedCard()
        {
            InitializeComponent();
            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");
            try
            {
                commclass = new CoalTraffic.DBUtility.CommclassADDMC(strBaudRate, strDataBits, strStopBits,
                          strParity, strPortName);
                commclass.OpenCommPort();//打开端口--ypf20130415
            }
            catch (Exception ex)
            {
                MessageBox.Show("请检查您的读卡器是否插好,请从新登陆!", "天大天科");
                #region 查找当前的进程,并kill它
                Process current = Process.GetCurrentProcess();
                Process[] processes = Process.GetProcessesByName(current.ProcessName);
                foreach (Process process in processes)
                {
                    if (process.Id == current.Id)
                    {
                        process.Kill();
                    }
                }
                #endregion

            }

            iLen = Convert.ToInt32(ini.IniReadValue("IcCard", "CardNoLength"));
            CommonMethod.ComboxBind(this.cbxColl, "Sys_Colliery", "CollName", "CollCode", "IsForbid=0", "CollName");
            if (this.cbxColl.Items.Count > 0)
            {
                CommonMethod.ComboxBind(this.cbxCoalKind, "VT_CollRunCoalKind", "CoalKindName", "CoalKindCode", "IsForbid=0 and CollCode='" + this.cbxColl.SelectedValue.ToString() + "'", "CoalKindName");
            }
            //InitICCard();
            this.txtDepartName.Text = DbHelperSQL.GetSingle("Select isnull(OrgName,'') from VSys_Operator where UserCode='" + StaticParameter.UserCode + "'").ToString();
            this.txtOperator.Text = StaticParameter.UserName;
            commclass.iLimitCardCount = Convert.ToInt16(txtBuyCount.Text);
        }