/// <summary>
        /// 窗体初始化...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RF_Initial_Load(object sender, EventArgs e)
        {
            #region 电子标签器初始化
            string strCom  = ini.IniReadValue("ReMote", "COM");
            string strBaud = ini.IniReadValue("ReMote", "Boud");
            iRfLen = int.Parse(ini.IniReadValue("ReMote", "CardNoLen"));
            this.txtCardCode.MaxLength = iRfLen;//设置电子标签文本框数据长度
            this.rfCard.Close();
            i = this.rfCard.Initialize(strCom, strBaud);
            if (i != 0)
            {
                this.lblTips.Text = "电子标签读卡器初始化失败";
                MessageBox.Show("电子标签读卡器初始化失败!", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //this.btnSave.Enabled = false;
            }
            else
            {
                this.lblTips.Text       = "电子标签读卡器初始化成功";
                this.btnSave.Enabled    = true;
                this.rfCard.SetUIValue += new EventHandler(SetUIICCard);//
            }
            #endregion

            string TimeInterval = ini.IniReadValue("ReMote", "Interval");
            timer_start.Interval = int.Parse(TimeInterval);//设置读写频率

            //if (this.strOperateType == "")
            //{
            //    timer_start.Enabled = true;
            //}
        }
 /// <summary>
 /// ��Ӽ�¼
 /// </summary>
 /// <param name="CardNO">�û�����Ŀ���</param>
 /// <param name="CardNOSelf">IC���Դ��Ŀ���</param>
 /// <returns></returns>
 public static bool bolInsertInitialCard(string CardNO, string CardID, string CardType)
 {
     RWini ini = new RWini();
     string IntialPerson=ini.IniReadValue("UserInfo", "UserCode");
     string strSql="";
     if (isExistCardID(CardID, CardType))
         strSql = "Update TT_InitialCard set CardNO='" + CardNO + "' where CardID='" + CardID + "' and CardType='"+CardType+"'";
     else
         strSql = "Insert into TT_InitialCard(CardID,CardNO,CardType,InitialTime,IntialPerson)"
                 + "Values('" + CardID + "','" + CardNO + "','"+CardType+"',getdate(),'" + IntialPerson.Replace("'","''")+ "')";
     return ExecuteSql(strSql) > 0 ? true : false;
 }
Exemplo n.º 3
0
        public IC_CheckCardNO()
        {
            InitializeComponent();

            port = Convert.ToInt32(ini.IniReadValue("ICCard", "Port"));
            baud = Convert.ToInt64(ini.IniReadValue("ICCard", "Baud"));

            strKeyA = CryptDes.DecryptDES(ini.IniReadValue("Key", "KeyA"), "EncryDes");
            strKeyB = CryptDes.DecryptDES(ini.IniReadValue("Key", "KeyB"), "EncryDes");
        }
Exemplo n.º 4
0
        /// <summary>
        /// 窗体加载。。。
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RF_CheckCardNO_Load(object sender, EventArgs e)
        {
            //1、读取配置文件中关于电子标签的端口号和波特率
            string strCom  = ini.IniReadValue("ReMote", "COM");
            string strBaud = ini.IniReadValue("ReMote", "Boud");

            //2、先关闭一次电子标签设备
            this.rfCard.Close();
            //3、对该电子标签设备进行初始化--传入:端口号、波特率
            short i = this.rfCard.Initialize(strCom, strBaud);

            if (i != 0)
            {
                this.lblTips.Text = "电子标签读卡器初始化失败";
                //this.btnSave.Enabled = false;
            }
            else
            {
                rfCard.SetUIValue += new EventHandler(SetUIICCard);
                this.lblTips.Text  = "电子标签读卡器初始化成功";
            }
        }
Exemplo n.º 5
0
    /// <summary>
    /// 添加记录
    /// </summary>
    /// <param name="CardNO">用户输入的卡号</param>
    /// <param name="CardNOSelf">IC卡自带的卡号</param>
    /// <returns></returns>
    public static bool bolInsertInitialCard(string CardNO, string CardID, string CardType)
    {
        RWini  ini          = new RWini();
        string IntialPerson = ini.IniReadValue("UserInfo", "UserCode");
        string strSql       = "";

        if (isExistCardID(CardID, CardType))
        {
            strSql = "Update TT_InitialCard set CardNO='" + CardNO + "' where CardID='" + CardID + "' and CardType='" + CardType + "'";
        }
        else
        {
            strSql = "Insert into TT_InitialCard(CardID,CardNO,CardType,InitialTime,IntialPerson)"
                     + "Values('" + CardID + "','" + CardNO + "','" + CardType + "',getdate(),'" + IntialPerson.Replace("'", "''") + "')";
        }
        return(ExecuteSql(strSql) > 0 ? true : false);
    }
        string strOperateType = "";  //操作方式 人工,升序,降序

        public IC_Initial()
        {
            InitializeComponent();

            try
            {
                strKeyA = CryptDes.DecryptDES(ini.IniReadValue("Key", "KeyA"), "EncryDes");
                strKeyB = CryptDes.DecryptDES(ini.IniReadValue("Key", "KeyB"), "EncryDes");
                DbHelperSQL.ComboxBind(this.cbxCoalKind, "TT_CoalKind", "CoalKindName", "CoalKindCode", "1=1", "CoalKindName");
                this.lblBeginCardNO.Visible = false;
                this.txtBeginCardNO.Visible = false;
            }
            catch
            {
                MessageBox.Show("请确认App.config文件中数据库设置是否正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 7
0
        private void IC_PortSet_Load(object sender, EventArgs e)
        {
            this.txtICCardlen.Text = ini.IniReadValue("ICCard", "CardNoLen");
            this.txtRfCardLen.Text = ini.IniReadValue("RF", "CardNoLen");
            string strPort = ini.IniReadValue("ICCard", "Port");

            if (strPort != "")
            {
                this.cbxIcCom.SelectedIndex = Convert.ToInt32(strPort);
            }
            string strBaud = ini.IniReadValue("ICCard", "Baud");

            if (strBaud != "")
            {
                switch (strBaud)
                {
                case "9600":
                    this.rdbtn9600.Select();
                    break;

                case "19200":
                    this.rdbtn19200.Select();
                    break;

                default:
                    break;
                }
            }
            strBaud = ini.IniReadValue("ReMote", "Baud");
            if (strPort != "")
            {
                this.cbxRFBound.Text = strBaud + "bps";
            }
            this.cbxRFCom.Text   = ini.IniReadValue("ReMote", "COM");
            txtRfCardLen.Text    = ini.IniReadValue("ReMote", "CardNoLen");
            txtReadAndWrite.Text = ini.IniReadValue("ReMote", "Interval");
        }