Example #1
0
        private void btnIni_Click(object sender, System.EventArgs e)
        {
            cIC cicObj=null;

            cicObj=new cIC(this.axMSComm1);
            if(cicObj.openPort()==true)
            {
                string strCardNo="";
                if(cicObj.iniCard(ref strCardNo)==false)
                {
                    MessageBox.Show("����ʧ��,ʧ��ԭ��:IC��δ�ڸ�Ӧ���ڻ����ѶԸÿ����з�������!");
                }
                else
                {
                    this.txtICNo.Text=strCardNo;
                    MessageBox.Show("�������!");
                    this.saveData(this.txtWellNo.Text,this.txtICNo.Text.Trim(),this.txtDepName.Text.Trim());
                }
                cicObj.closePort();
            }
        }
Example #2
0
        private void btnRead_Click(object sender, System.EventArgs e)
        {
            try
            {
                cIC cicObj=new cIC(this.axMSComm1);
                if(cicObj.openPort()==true)
                {
                    string strCardNo="";
                    string strSal="";
                    if(cicObj.readCard(ref strCardNo,ref strSal)==false)
                    {
                        MessageBox.Show("����ʧ��,ʧ��ԭ��:IC��δ�ڸ�Ӧ���ڻ���δ�Ըÿ����з�������!");
                    }
                    else
                    {
                        this.txtICNo.Text=strCardNo;
                        this.txtLeftAmount.Text=strSal;
                    }
                    cicObj.closePort();
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            string strWellNo="";
            string strDepName="";
            this.getDepName(this.txtICNo.Text,ref strWellNo,ref strDepName);
            this.txtWellNo.Text=strWellNo;
            this.txtDepName.Text=strDepName;
        }
Example #3
0
        private void btnWrite_Click(object sender, System.EventArgs e)
        {
            if(this.txtICNo.Text.Trim()=="")
            {
                MessageBox.Show("���Ƚ��ж�������!");
                return;
            }
            if(this.txtDepName.Text.Trim()=="")
            {
                MessageBox.Show("���ȶԸÿ����з���������");
                return;
            }
            if(this.txtLeftAmount.Text.Trim()=="")
            {
                MessageBox.Show("���Ƚ��ж�������!");
                return;
            }

            if(this.txtAmount.Text.Trim()=="")
            {
                MessageBox.Show("��ˮ������Ϊ�գ�");
                return;
            }

            double dVal=Convert.ToDouble(this.txtAmount.Text);
            double dMax=0xffffffff;
            if(dVal>dMax)
            {
                MessageBox.Show("��ˮ��ֵ����");
                return;
            }

            try
            {
                if(this.txtAmount.Text.Trim()=="")
                {
                    MessageBox.Show("��ˮ������Ϊ��!");
                    return;
                }

                Double dSal=Convert.ToDouble(this.txtAmount.Text.Trim());

                cIC cicObj=new cIC(this.axMSComm1);
                if(cicObj.openPort()==true)
                {
                    string strSal="";
                    if(cicObj.salWater(dSal.ToString(),ref strSal)==false)
                    {
                        MessageBox.Show("��ֵʧ��!");
                    }
                    else
                    {
                        this.txtLeftAmount.Text=strSal;
                        MessageBox.Show("��ֵ��ɣ�");
                        if(this.SaveDatas()==false)
                        {
                            MessageBox.Show("������ˮ��Ϣʱʧ�ܣ�");
                        }
                    }
                    cicObj.closePort();
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }