private void btReadCard_Click(object sender, RoutedEventArgs e)
        {
            IDCardInfo iDCardInfo = null;
            bool       issucc     = this.iDCReader.open();

            try
            {
                if (issucc)
                {
                    iDCardInfo = this.iDCReader.read();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                MessageBox.Show(ex.StackTrace);
                //Console.WriteLine(ex.Message);
                //Console.Write(ex.StackTrace);
            }
            if (iDCardInfo != null)
            {
                this.tbAddressDire.Text = iDCardInfo.Address;
            }
            this.iDCReader.close();
        }
        //指纹验证
        private void FingerprintVerify(IDCardInfo idInfo)
        {
            //TO-DO
            //...指纹识别
            faceStop = true;

            /*
             * while (StartFingerVerify)
             * {
             *  //假设都通过
             *  idInfo.isPass = 2;
             *  //存放数据到数据库
             *  sendDataToMySql();
             *  messageBox.AppendText("指纹识别通过...\n");
             *
             *  idInfo.isRight = false;
             *
             *
             *  //关闭指纹验证
             *  StartFingerVerify = false;
             *
             *
             *
             *  //Thread.Sleep(1000);
             * }
             *
             */
        }
        private void readIDCrad_OnReadedInfo(object sender, ReadEventArgs e)
        {
            if (isShowFrom == false)
            {
                idinfo      = new IDCardInfo();
                idinfo.Name = e.NewHuman.Name;

                idinfo.Address   = e.NewHuman.Address;
                idinfo.Sex       = e.NewHuman.Gender;
                idinfo.Birthday  = e.NewHuman.BirthDay.ToString("yyyy-MM-dd");
                idinfo.Signdate  = e.NewHuman.InceptDate;
                idinfo.Number    = e.NewHuman.IDCardNo;
                idinfo.Name      = e.NewHuman.Name;
                idinfo.People    = e.NewHuman.Nation;
                idinfo.ValidDate = e.NewHuman.ExpireDate;
                idinfo.ImagePath = e.NewHuman.PhotoLocation;
                if (idinfo != null && !string.IsNullOrEmpty(idinfo.Name))
                {
                    rc.Over();
                    isShowFrom = true;
                    if (ShowForm() == true)
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        if (!rc.IsRun)
                        {
                            rc.Start(ReadType.读基本信息);
                        }
                    }
                }
            }
        }
 void iDCReader_idcReaderReadSuccess(IDCardInfo iDCardInfo)
 {
     this.Dispatcher.Invoke(new Action(() =>
     {
         this.tbAddress.Text = iDCardInfo.Address;
     }));
 }
示例#5
0
 /// <summary>
 /// 添加用户
 /// </summary>
 public void AddUser(IDCardInfo entity)
 {
     if (entity != null)
     {
         _iDCardInfo.Add(entity);
         RaisePropertyChanged("IDCardInfos");
     }
 }
示例#6
0
        public override IDCardInfo readIDCard(bool get_photo, out string msg)
        {
            msg = "";
            //如果端口号为空,则以1001为默认
            if (port_number == "")
            {
                port_number = "1001";
            }
            IDCardInfo info = new IDCardInfo();

            try
            {
                int i = InitComm(Convert.ToInt32(port_number));
                if (i == 1)
                {
                    i = Authenticate();
                    if (i == 1)
                    {
                        i = Read_Content(2);
                        if (i == 1)
                        {
                            info.name             = getName();
                            info.address          = getAddress();
                            info.birthday         = getBirthday();
                            info.department       = getDepartment();
                            info.end_date         = getEndDate();
                            info.gender           = getSex();
                            info.id_card_number   = getIdCode();
                            info.nation           = getNation();
                            info.reserve_contents = getReserve();
                            info.start_date       = getStartDate();
                            if (get_photo)
                            {
                                info.photo = getPhotoBMP();
                            }
                            info.read_from_machine = true;
                            i = CloseComm();
                        }
                        else
                        {
                            msg = "读取卡信息失败.";
                        }
                    }
                    else
                    {
                        msg = "卡认证失败, 请确认您已正确放置好身份证, 读取一次身份证之后如果需要再次读取需要将身份证拿起后再放置一次.";
                    }
                }
                else
                {
                    msg = "设备初始化失败, 请确认您已正确连接好设备并正确配置.";
                }
            }
            catch (Exception ex) { msg = ex.Message; }
            return(info);
        }
示例#7
0
        public int OutCardD1000(int sqadd, int blockAddr, IDCardInfo userInfo, decimal sumChargeMoney)
        {
            try
            {
                D1000Card d1000     = new D1000Card();
                string    cardstate = d1000.CheckState();
                if (cardstate != string.Empty)
                {
                    MyMsg.MsgInfo(cardstate);
                    return(-1);
                }

                if (d1000.sendcmd("DC") == false)
                {
                    MyMsg.MsgInfo("卡片传动失败,不能继续发卡,请通过补办卡重新发卡!");
                    return(-1);
                }


                string            CardNo = string.Empty;
                FrmInCardM100Send fi     = new FrmInCardM100Send();
                if (fi.ShowDialog() == DialogResult.OK)
                {
                    CardNo = FrmMain.cardInfoStruct.CardNo;
                    SkyComm skyComm = new SkyComm();
                    try
                    {
                        skyComm.CreatCard(CardNo, FrmMain.userInfo.Name, FrmMain.userInfo.Number, FrmMain.userInfo.Address, sumChargeMoney);
                    }
                    catch
                    {
                        MyMsg.MsgInfo("卡号重复,请插入新卡后尝试重新办卡");
                        return(-1);
                    }


                    //bool isSuccess = true;
                    //MyMsg.MsgInfo("办卡成功!");
                }
                else
                {
                    MyMsg.MsgInfo("发卡失败!请重试自助发卡!");
                    return(-1);
                }

                return(0);
            }
            catch (Exception err)
            {
                //k101.MoveCard("回收卡片");
                MyMsg.MsgInfo("吐卡失败!请重试自助发卡!" + err.Message);
                return(-1);
                //this.eLCardAuthorizationData.Clear();
            }
        }
 public FrmConfirmSendCardInfo(IDCardInfo idinfo, string tel)
 {
     InitializeComponent();
     this.lblxm.Text   = idinfo.Name;
     this.lblsex.Text  = idinfo.Sex;
     this.lblmz.Text   = idinfo.People;
     this.lblzfzh.Text = idinfo.Number;
     this.lblcsrq.Text = idinfo.Birthday;
     this.lbldz.Text   = idinfo.Address;
     this.lbltel.Text  = tel;
 }
示例#9
0
 public FormElectronicsInput(IDCardInfo idinfo)
 {
     InitializeComponent();
     IdInfo                 = idinfo;
     this.lblxm.Text        = idinfo.Name;
     this.lblsex.Text       = idinfo.Sex;
     this.lblmz.Text        = idinfo.People;
     this.lblzfzh.Text      = idinfo.Number;
     this.lblcsrq.Text      = idinfo.Birthday;
     this.lbldz.Text        = idinfo.Address;
     picImage.ImageLocation = idinfo.ImagePath;
 }
 private void button_readCard_Click(object sender, EventArgs e)
 {
     try
     {
         IDCardInfo info = IDCardReader.getInstance().CardInfo;
         textBox_name.Text     = info.name;
         textBox_idNumber.Text = info.idNumber;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void timer1_Tick(object sender, EventArgs e)
        {
            idinfo          = new IDCardInfo();
            idinfo.Name     = "西安天网";
            idinfo.Sex      = "男";
            idinfo.People   = "汉族";
            idinfo.Number   = "610100199401010228";
            idinfo.Birthday = "1994-01-01";
            idinfo.Address  = "西安市雁塔区丈八六路51号";

            timer1.Stop();
            ShowForm();
        }
示例#12
0
        public void IDCardDetail()
        {
            IDCardInfo idcard = vm.IDCardData.GetIDCardInfo();

            this.tb_name.Content         = idcard.Name;
            this.tb_nation.Content       = idcard.Nation;
            this.tb_id.Content           = idcard.Idcard;
            this.tb_sex.Content          = idcard.Sex;
            this.tb_effitivedate.Content = idcard.Effitivedate;
            this.tb_address.Content      = idcard.Address;
            this.tb_birth.Content        = idcard.Birthday;
            this.tb_sign.Content         = idcard.Sign;
            this.tb_photo.Source         = GetFilebyte(idcard.ImgPath);
        }
示例#13
0
        private void readIDCrad_OnReadedInfo(object sender, ReadEventArgs e)
        {
            idinfo      = new IDCardInfo();
            idinfo.Name = e.NewHuman.Name;

            idinfo.Address   = e.NewHuman.Address;
            idinfo.Sex       = e.NewHuman.Gender;
            idinfo.Birthday  = e.NewHuman.BirthDay.ToString("yyyy-MM-dd");
            idinfo.Signdate  = e.NewHuman.InceptDate;
            idinfo.Number    = e.NewHuman.IDCardNo;
            idinfo.Name      = e.NewHuman.Name;
            idinfo.People    = e.NewHuman.Nation;
            idinfo.ValidDate = e.NewHuman.ExpireDate;
        }
示例#14
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                if (Settings.Default.运行模式 == "RUN" || Settings.Default.运行模式 == "TEST")
                {
                    if (sec == 0)
                    {
                        this.timer1.Stop();
                        this.DialogResult = DialogResult.Cancel;
                    }
                    sec = sec - 1;
                    if (idinfo != null)
                    {
                        FrmMain.userInfo = idinfo;
                        if (FrmMain.userInfo != null)
                        {
                            timer1.Stop();
                            this.DialogResult = DialogResult.OK;
                        }
                    }
                }
                else
                {
                    if (sec == 0)
                    {
                        idinfo      = new IDCardInfo();
                        idinfo.Name = "李某某";

                        idinfo.Address   = "西安";
                        idinfo.Sex       = "男";
                        idinfo.Birthday  = "1983-12-03";
                        idinfo.Signdate  = "2050-01-01";
                        idinfo.Number    = "123456789";
                        idinfo.People    = "汗";
                        idinfo.ValidDate = "2050-01-01";
                        FrmMain.userInfo = idinfo;
                        this.timer1.Stop();
                        this.DialogResult = DialogResult.OK;
                    }
                    sec = sec - 1;
                }
            }
            catch (Exception ex)
            {
                timer1.Stop();
                MyMsg.MsgInfo(ex.Message);
            }
        }
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                do
                {
                    idinfo = CardCpu.readIdCard();

                    Thread.Sleep(1000);
                } while (idinfo == null);

                e.Result = idinfo;
            }
            catch { }
        }
 public FrmInputForChild(IDCardInfo idinfo)
 {
     InitializeComponent();
     IdInfo            = idinfo;
     this.txtName.Text = IdInfo.Name + "之子";
     //this.lblsex.Text = idinfo.Sex;
     this.lblmz.Text   = idinfo.People;
     this.lblzfzh.Text = idinfo.Number;
     //this.lblcsrq.Text = idinfo.Birthday;
     this.txtYear.Text  = DateTime.Now.ToString("yyyy");
     this.txtMonth.Text = DateTime.Now.ToString("MM");
     this.txtDay.Text   = DateTime.Now.ToString("dd");
     this.lbldz.Text    = idinfo.Address;
     //picImage.ImageLocation = idinfo.ImagePath;
 }
示例#17
0
        public override IDCardInfo readIDCard(bool get_photo, out string msg)
        {
            msg = "";
            //如果端口号为空,则以1001为默认
            if (port_number == "")
            {
                port_number = "1001";
            }
            IDCardInfo info = new IDCardInfo();

            try
            {
                int i = InitCommExt();
                if (i != 0)
                {
                    i = Authenticate();
                    if (i == 1)
                    {
                        i = Read_Content(1);
                        if (i == 1)
                        {
                            getCardInfo(ref info);
                            if (get_photo)
                            {
                                info.photo = getPhotoBMP();
                            }
                            info.read_from_machine = true;
                            i = CloseComm();
                        }
                        else
                        {
                            msg = "读取卡信息失败.";
                        }
                    }
                    else
                    {
                        msg = "卡认证失败, 请确认您已正确放置好身份证, 读取一次身份证之后如果需要再次读取需要将身份证拿起后再放置一次.";
                    }
                }
                else
                {
                    msg = "设备初始化失败, 请确认您已正确连接好设备并正确配置.";
                }
            }
            catch (Exception ex) { msg = ex.Message; }
            return(info);
        }
        //从证件照中提取特征值
        private IntPtr GetFeatureFromIDImage(IDCardInfo idInfo)
        {
            if (idInfo != null)
            {
                Image image = idInfo.image;
                //提取证件照的特征
                IntPtr featureTemp = getFeatureFromImage(image);
                messageBox.AppendText("Succeed to extract feature from ID card...\n");
                idInfo.imageFeature = featureTemp;

                return(featureTemp);
            }
            else
            {
                return(IntPtr.Zero);
            }
        }
示例#19
0
        private void Test(object sender, System.Timers.ElapsedEventArgs e)
        {
            timer.Stop();
            Console.WriteLine("paizhao");

            string minPhotoPath = Utility.GetPath("Photo") + "Photo.jpg";

            Console.WriteLine(minPhotoPath);

            //抓拍照片
            string     minPhotoNewPath = CameraHelper.CaptureImage(minPhotoPath);
            IDCardInfo iDCardInfo      = vm.IDCardData.GetIDCardInfo();

            Huoti(iDCardInfo.ImgPath, minPhotoNewPath);

            CompareTest(iDCardInfo.ImgPath, minPhotoNewPath);
        }
        //和身份证证件照做对比 因此人脸库(即指定的文件夹)中只存放读卡器读出来的证件照
        // 比对函数,得到feature比较结果
        private int CompareFeatureWithIDimgFeature(IntPtr feature, IDCardInfo idInfo)
        {
            faceState = false;
            int   result     = -1;
            float similarity = 0.0f;

            //如果存在证件照并且特征值不为空,则进行人脸匹配
            if (idInfo != null & idInfo.imageFeature != null)
            {
                similarity = CompareTwoFeatures(feature, idInfo.imageFeature);
                if (similarity >= threshold)
                {
                    result = 1;
                }
            }

            return(result);
        }
示例#21
0
        private bool ShowForm()
        {
            #region 输入手机号码
            if (SendCardType == "成人")
            {
                string TelePhone            = string.Empty;
                FormElectronicsInput frmTel = new FormElectronicsInput(idinfo);
                frmTel.IdInfo = idinfo;
                if (frmTel.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    TelePhone = frmTel.TelePhone;
                }
                else
                {
                    idinfo      = null;
                    ucTime1.Sec = 60;
                    ucTime1.timer1.Start();
                    return(false);
                }
            }
            else
            {
                string           TelePhone = string.Empty;
                FrmInputForChild frmChild  = new FrmInputForChild(idinfo);
                frmChild.IdInfo = idinfo;
                if (frmChild.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    TelePhone = frmChild.TelePhone;
                }
                else
                {
                    idinfo      = null;
                    ucTime1.Sec = 60;
                    ucTime1.timer1.Start();
                    return(false);
                }
            }

            ucTime1.Sec = 60;

            return(true);

            #endregion
        }
示例#22
0
        private void button_readCard_Click(object sender, EventArgs e)
        {
            try
            {
                IDCardInfo info = IDCardReader.getInstance().CardInfo;
                textBox_name.Text     = info.name;
                comboBox_idType.Text  = "居民身份证";
                textBox_idNumber.Text = info.idNumber;
                switch (info.sex)
                {
                case "男": comboBox_gender.Text = "男性"; break;

                case "女": comboBox_gender.Text = "女性"; break;

                default: comboBox_gender.Text = "未说明性别"; break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private bool ShowForm()
        {
            #region 验证身份证下是否存在卡信息
            string            sqlSelect = " AND ((A.IDENTITYNAME='身份证' AND A.IDENTITYCARD='" + idinfo.Number.Trim() + "' AND A.PATIENTNAME='" + idinfo.Name.Trim() + "') OR (A.GUARDIANIDNUMBER='" + idinfo.Number.Trim() + "')) AND B.CIRCUIT_STATE IN (0,1) ";
            PatientInfoFacade pfacade   = new PatientInfoFacade();
            DataSet           pdata     = pfacade.FindCardPatientinfoByCondition(sqlSelect);
            if (pdata == null || pdata.Tables.Count == 0 || pdata.Tables[0].Rows.Count == 0)
            {
                SkyComm.ShowMessageInfo("无该身份证对应的就诊卡信息,请使用自助办卡功能办理就诊卡!");
                idinfo      = null;
                ucTime1.Sec = 60;
                ucTime1.timer1.Start();
                return(false);
            }

            #endregion

            #region 输入手机号码
            FrmReIssueCardInfo frmTel = new FrmReIssueCardInfo();
            frmTel.IdInfo = idinfo;
            if (frmTel.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
            }
            else
            {
                idinfo      = null;
                ucTime1.Sec = 60;
                ucTime1.timer1.Start();
                return(false);
            }
            ucTime1.Sec = 60;

            return(true);

            #endregion
        }
示例#24
0
        public static IDCardInfo readIdCard()
        {
            try
            {
                IDCardInfo    mCardInfo = new IDCardInfo();
                StringBuilder mIn       = new StringBuilder("<invoke name=\"SHENFENZHENG\"><arguments></arguments></invoke>", 1024);
                Log.Info("省医院读取身份证", "读取身份证传入参数", mIn.ToString());
                string strResult1 = XuHuiInterface_DLL.XmlTcp(mIn, 0);

                if (mIn.ToString().Contains("DEVEEROR"))
                {
                    SkyComm.ShowMessageInfo("写卡失败:DEVEEROR!");
                    return(null);
                }

                Log.Info("省医院读取身份证", "读取身份返回结果", strResult1);

                if (string.IsNullOrEmpty(mIn.ToString()))
                {
                    return(null);
                }
                if (!mIn.ToString().Contains("IDNAME"))
                {
                    return(null);
                }

                Log.Info("省医院读取身份证", "读取身份返回参数", mIn.ToString());

                XmlDocument mDoc = new XmlDocument();
                mDoc.LoadXml(mIn.ToString());
                XmlNode mXmlNode = mDoc.SelectSingleNode("/return/arguments/string[@id='IDNAME']");
                mCardInfo.Name = mXmlNode.InnerText;
                Log.Info("省医院读取身份证", "姓名", mCardInfo.Name);
                mXmlNode      = mDoc.SelectSingleNode("/return/arguments/string[@id='SEX']");
                mCardInfo.Sex = mXmlNode.InnerText;
                Log.Info("省医院读取身份证", "性别", mCardInfo.Name);
                mXmlNode = mDoc.SelectSingleNode("/return/arguments/string[@id='BORN']");
                try
                {
                    mCardInfo.Birthday = GetAge(mXmlNode.InnerText);
                }
                catch (Exception e)
                {
                    mCardInfo.Birthday = mXmlNode.InnerText;
                }
                Log.Info("省医院读取身份证", "出生", mCardInfo.Birthday);
                mXmlNode          = mDoc.SelectSingleNode("/return/arguments/string[@id='ADDRESS']");
                mCardInfo.Address = mXmlNode.InnerText;
                Log.Info("省医院读取身份证", "地址", mCardInfo.Address);
                mXmlNode         = mDoc.SelectSingleNode("/return/arguments/string[@id='IDCARDNO']");
                mCardInfo.Number = mXmlNode.InnerText;
                Log.Info("省医院读取身份证", "身份证号", mCardInfo.Number);

                if (mIn.ToString().Contains("NATION"))
                {
                    mXmlNode         = mDoc.SelectSingleNode("/return/arguments/string[@id='NATION']");
                    mCardInfo.People = mXmlNode.InnerText;
                }

                mCardInfo.ImagePath = Application.StartupPath + "\\_Temp.bmp";// SkyComm.getvalue("省医院身份证照片路径");

                return(mCardInfo);
            }
            catch (Exception ex)
            {
                Log.Info("省医院读取身份证错误", "读取身份证错误详情", ex.ToString());
                return(null);
            }
        }
示例#25
0
        private void ReadIDCardInfo2()
        {
            try
            {
                #region MyRegion
                dispatcherTimer.Stop();
                stopwatch.Start();
                ret = Authenticate();

                if (ret != 1)//
                {
                    dispatcherTimer.Start();
                    return;
                }

                stopwatch.Start();

                int           IntInfo = 0; //判断读取身份证信息
                StringBuilder name, sex, nation, birthday, address, idcard, sign, effitivedate, deadline;
                name         = new StringBuilder(31);
                sex          = new StringBuilder(3);
                nation       = new StringBuilder(10);
                birthday     = new StringBuilder(9);
                idcard       = new StringBuilder(19);
                address      = new StringBuilder(71);
                sign         = new StringBuilder(31);
                effitivedate = new StringBuilder(9);
                deadline     = new StringBuilder(9);

                IntInfo = ReadBaseInfos(name, sex, nation, birthday, idcard, address, sign, effitivedate, deadline);
                if (IntInfo != 1)
                {
                    dispatcherTimer.Start();
                    return;
                }
                SpeechDuDu();

                Console.WriteLine("读到身份信息!");

                string minPath = System.IO.Directory.GetCurrentDirectory() + "\\photo.bmp";
                Console.WriteLine(minPath);

                string minNewPath = Utility.GetPath("BiDui") + "IdCardPhoto.jpg";
                File.Copy(minPath, minNewPath);

                IDCardInfo userEntity = new IDCardInfo();
                userEntity.Name         = name.ToString();
                userEntity.Sex          = sex.ToString();
                userEntity.Nation       = nation.ToString();
                userEntity.Birthday     = birthday.ToString();
                userEntity.Idcard       = idcard.ToString();
                userEntity.Address      = address.ToString();
                userEntity.ImgPath      = minNewPath.ToString();
                userEntity.Sign         = sign.ToString();
                userEntity.Effitivedate = effitivedate.ToString() + "-" + deadline.ToString();

                ViewModelLocator vm = new ViewModelLocator();
                vm.IDCardData.SetIDCardInfo(userEntity);
                Console.WriteLine(name);


                //dispatcherTimer.Start();
                stopwatch.Stop();
                this.grid_IndexWrap.Dispatcher.Invoke(
                    new Action(
                        delegate
                {
                    ToNext();
                }
                        )
                    );


                //Read_IdCardInfo read_IdCardInfo = new Read_IdCardInfo();
                //read_IdCardInfo.tb_name.Content = name.ToString();
                //this.NavigationService.Navigate(read_IdCardInfo);

                #endregion
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.ToString());
                dispatcherTimer.Start();
            }
        }
示例#26
0
        public void OutCard(int sqadd, int blockAddr, IDCardInfo userInfo, decimal sumChargeMoney)
        {
            try
            {
                //PatientInfoFacade pfacade = new PatientInfoFacade();
                //string ConditionStr = " AND A.IDENTITYNAME='身份证' AND A.IDENTITYCARD='" + FrmMain.userInfo.Number.Trim() + "' AND B.CIRCUIT_STATE=0 ";
                //DataSet pdata = pfacade.FindCardPatientinfoByCondition(ConditionStr);
                //if (pdata!=null && pdata.Tables[0].Rows.Count > 0)
                //{
                //    MyMsg.MsgInfo("发卡失败! 证件【" + FrmMain.userInfo.Number + "】已经办理了卡业务,请先到窗口注销后再继续办理!");
                //    return;
                //}

                //if (eLCardAuthorizationData != null)
                //{
                //    eLCardAuthorizationData.Tables[0].Rows.Clear();
                //}

                if (k101.CheckCardPosition() == false)
                {
                    MyMsg.MsgInfo("卡机状态不正确,不能继续发卡,请联系管理员!");
                    return;
                }

                string cardTemp = string.Empty;
                string cardType = SkyComm.getvalue("卡类型");

                if (cardType == "磁条卡")
                {
                    k101.MoveCard("移动到读磁卡位");
                    if (k101.MoveCard("移动到读磁卡位") == false)
                    {
                        k101.MoveCard("回收卡片");
                        MyMsg.MsgInfo("卡片传动失败,不能继续发卡,请联系管理员!");
                        return;
                    }

                    cardTemp = k101.ReadCard();
                    if (cardTemp == string.Empty)
                    {
                        k101.MoveCard("回收卡片");
                        MyMsg.MsgInfo("磁卡数据错误,或是空卡,不能继续发卡,请联系管理员!");
                        return;
                    }

                    FrmMain.cardInfoStruct.CardNo = cardTemp;
                    string sql = "SELECT * FROM T_PRECARD WHERE CARDID = '" + cardTemp + "'";
                    //DataSet dsPre = new QuerySolutionFacade().ExecCustomQuery(sql);
                    //if (dsPre.Tables[0].Rows.Count <= 0)
                    //{
                    //    k101.MoveCard("回收卡片");
                    //    MyMsg.MsgInfo("卡片数据非法,请重试发卡,或联系管理员!");
                    //    return;
                    //}

                    //ConditionStr = " AND B.CARDID='" + cardTemp + "' AND (B.CIRCUIT_STATE=0 OR B.CIRCUIT_STATE=1) ";
                    //pdata = pfacade.FindCardPatientinfoByCondition(ConditionStr);
                    //if (pdata != null && pdata.Tables[0].Rows.Count > 0)
                    //{
                    //    k101.MoveCard("回收卡片");
                    //    MyMsg.MsgInfo("发卡失败! 卡片损坏,请重试发卡!");
                    //    return;
                    //}
                }

                string CardNo = cardTemp;

                SkyComm skyComm = new SkyComm();
                skyComm.CreatCard(CardNo, FrmMain.userInfo.Name, FrmMain.userInfo.Number, FrmMain.userInfo.Address, sumChargeMoney);


                bool isSuccess = true;
                if (cardType == "IC卡")
                {
                    k101.MoveCard("传动到IC卡位");
                    if (k101.MoveCard("传动到IC卡位") == false)
                    {
                        k101.MoveCard("回收卡片");
                        MyMsg.MsgInfo("卡片传动失败,不能继续发卡,请通过补办卡重新发卡!");
                        return;
                    }

                    //写卡,如果失败则重试
                    int state = -1;
                    while (0 != state)
                    {
                        state = k101.WriteCard(CardNo);

                        if (state != 0)
                        {
                            MyAlert my = new MyAlert();
                            my.Msg       = "写卡失败,是否重试?";
                            my.alerttype = "确认取消";
                            if (my.ShowDialog() == DialogResult.OK)
                            {
                                state = -1;
                            }
                            else
                            {
                                state = 0;
                            }
                            isSuccess = false;
                        }
                        else
                        {
                            isSuccess = true;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(cardTemp))
                {
                    if (isSuccess == true)
                    {
                        //吐出卡片
                        if (k101.MoveCard("传动到前端夹卡位") == false)
                        {
                            MyMsg.MsgInfo("吐卡失败!请通过补办卡重新发卡!");
                            isSuccess = false;
                        }
                        else
                        {
                            isSuccess = true;
                            MyMsg.MsgInfo("发卡成功!");
                        }
                    }

                    if (isSuccess == false)
                    {
                        k101.MoveCard("回收卡片");
                        //CardFreezeThawData eCardFreezeThawData = (CardFreezeThawData)eCardAuthorizationFacade.SelectPatientAndCardInfoByAccount_ID_FREEZE_THAW(eLCardAuthorizationData.Tables[0].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_ACCOUNT_ID].ToString());
                        //20100616 mzq
                        //if (eCardFreezeThawData.Tables[0].Rows.Count <= 0)
                        //{
                        //    MyMsg.MsgInfo("此操作没有找到所要挂失的卡信息!");
                        //    return;
                        //}
                        //eCardFreezeThawData.Tables["T_CARD_FREEZE_THAW_ATHU"].Rows[0].BeginEdit();
                        ////冻结时间
                        //eCardFreezeThawData.Tables["T_CARD_FREEZE_THAW_ATHU"].Rows[0][CardFreezeThawData.T_CARD_FREEZE_THAW_LOCKDATE] = DateTime.Now;
                        //////冻结员
                        //eCardFreezeThawData.Tables["T_CARD_FREEZE_THAW_ATHU"].Rows[0][CardFreezeThawData.T_CARD_FREEZE_THAW_LOCKOPERATOR] = SysOperatorInfo.OperatorID;
                        //eCardFreezeThawData.Tables["T_CARD_FREEZE_THAW_ATHU"].Rows[0].EndEdit();

                        //1.在中间层更新发卡表T_CARD_AUTHORIZATION的CIRCUIT_STATE为1(冻结状态)信息
                        //2.在中间层插入T_CARD_FREEZE_THAW表信息
                        //CardFreezeThawaFcade eCardFreezeThawaFcade = new CardFreezeThawaFcade();
                        //eCardFreezeThawaFcade.insertEntity(eCardFreezeThawData);

                        MyMsg.MsgInfo("写卡失败,请通过补办卡重新发卡!");

                        //this.eLCardAuthorizationData = (CardAuthorizationData)eCardAuthorizationFacade.SelectPatientAndCardInfoByCardID(eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CARDID].ToString());
                    }
                }
            }
            catch (Exception err)
            {
                k101.MoveCard("回收卡片");
                MyMsg.MsgInfo("吐卡失败!请重试自助发卡!" + err.Message);
                //this.eLCardAuthorizationData.Clear();
            }
        }
        public CardAuthorizationData SetCardInfo(IDCardInfo userInfo, string TelePhone)
        {
            PinWbCode pw = new PinWbCode();

            eLCardAuthorizationData.Tables[0].Rows.Clear();
            DataRow dr = this.eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].NewRow();

            //卡号
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_ACCOUNT_ID] = "0000000000";

            string strDiagnoseID = GetDiagnoseID(userInfo.Number, _childName);

            //用户诊疗号
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_DIAGNOSEID] = strDiagnoseID;

            // 卡类型
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_TYPEID] = SkyComm.dsCardType.Tables[0].Rows[0]["TYPE_NO"];
            //卡类型名称
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_TYPE_NAME] = SkyComm.dsCardType.Tables[0].Rows[0]["TYPE_NAME"];
            //随机码
            ValidateCode vc        = new ValidateCode();
            string       RoundCode = vc.GenValidateCode();

            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_RANDOMCODE] = RoundCode;

            Skynet.LoggingService.LogService.GlobalInfoMessage("发卡保存数据设置押金之前1");
            //押金、工本费
            if (!string.IsNullOrEmpty(SkyComm.getvalue("发卡工本费")) && SkyComm.getvalue("发卡工本费") != "0")
            {
                dr[CardAuthorizationData.T_CARD_AUTHORIZATION_DEPOSIT] = Convert.ToDecimal(SkyComm.getvalue("发卡工本费"));
            }
            else
            {
                dr[CardAuthorizationData.T_CARD_AUTHORIZATION_DEPOSIT] = SkyComm.dsCardType.Tables[0].Rows[0]["FEES"];
            }
            Skynet.LoggingService.LogService.GlobalInfoMessage("发卡保存数据设置押金之后1");
            //证件类型
            //dr[CardAuthorizationData.T_CARD_AUTHORIZATION_IDENTITYNAME] = "身份证";
            //证件号码
            //dr[CardAuthorizationData.T_CARD_AUTHORIZATION_IDENTITYCARD] = userInfo.Number;
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_GUARDIANIDNUMBER] = userInfo.Number;
            //姓名
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_PATIENTNAME] = _childName.Replace("\n", "").Replace("\r", "");
            //拼音码
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_NAMEPY] = pw.GetQuanPin(_childName);
            //性别
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_SEX] = _childSex;
            //出生年月
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_BIRTHDAY] = Convert.ToDateTime(_childBirthDay);
            //户口地址
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_HOMEPLACE] = userInfo.Address;
            //费别
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_SICKTYPE] = SkyComm.FeeTypeID;//费用类别
            //身份
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_EMPLOYMENT] = "";

            //职业
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_EMPLOYMENT] = "其他";

            //家庭电话
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_TELEPHONE] = TelePhone;
            //联系地址
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_REGISTEREDADDRESS] = userInfo.Address;
            //邮政编码
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_POSTALCODE] = "";
            //合同单位
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_WORKUNIT] = "";
            //单位电话t
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_UNITTELEPHONE] = "";
            //单位地址
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_ADDRESS] = "";
            //单位邮编
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_UNITPOSTCODE] = "";
            //国籍NATIONALITY
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_NATIONALITY] = "中国";
            //民族
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_NATION] = userInfo.People;
            //保密等级
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_SECRECYCLASS] = "内部级";
            //卡状态
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_CIRCUIT_STATE] = 0;
            //照片
            //ImageConverter con = new ImageConverter();
            //年龄
            #region 设置年龄

            int age = DateTime.Today.Year - Convert.ToDateTime(_childBirthDay).Year;
            if (age > 0)
            {
                dr[CardAuthorizationData.T_CARD_AUTHORIZATION_AGE] = age.ToString();
                //年龄单位
                dr[CardAuthorizationData.T_CARD_AUTHORIZATION_AGEUNIT] = "岁";
            }
            else
            {
                int month = DateTime.Today.Month - Convert.ToDateTime(_childBirthDay).Month;
                if (month > 0)
                {
                    dr[CardAuthorizationData.T_CARD_AUTHORIZATION_AGE] = month.ToString();
                    //年龄单位
                    dr[CardAuthorizationData.T_CARD_AUTHORIZATION_AGEUNIT] = "月";
                }
                else
                {
                    int day1 = Convert.ToDateTime(_childBirthDay).Day;
                    int day  = DateTime.Today.Day - Convert.ToDateTime(_childBirthDay).Day;
                    if (day >= 0)
                    {
                        dr[CardAuthorizationData.T_CARD_AUTHORIZATION_AGE] = day.ToString();
                        //年龄单位
                        dr[CardAuthorizationData.T_CARD_AUTHORIZATION_AGEUNIT] = "天";
                    }
                }
            }
            #endregion
            //dr[CardAuthorizationData.T_CARD_AUTHORIZATION_PERSONPHOTO] = userInfo.ImagePath;

            //发卡时间
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_PROVIDECARDDATE] = DateTime.Now;
            //卡有效年限
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_CARDVALIDDATE] = DateTime.Now.AddYears(1);
            //发卡方式
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_MODEID] = 0;
            //密码修改时间
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_LASTPASSWORDCHANGEDDATE] = DateTime.Now;
            //最后修改时间
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_LASTLOGINDATE] = DateTime.Now;
            //1-不设置密码,0-设置密码)

            //string PWD = cbxCardType.SelectedRow["IS_SET_PWD"].ToString();//1-不设置密码,0-设置密码)
            //if (PWD != "1")
            //{
            //    //密码
            //    dr[CardAuthorizationData.T_CARD_AUTHORIZATION_PASSWORD] = this.strPassword;
            //}
            //else
            //{
            string PWD = SkyComm.getvalue("发卡默认密码").ToString().Trim();
            if (string.IsNullOrEmpty(PWD))
            {
                dr[CardAuthorizationData.T_CARD_AUTHORIZATION_PASSWORD] = "NOPWD";
            }
            else
            {
                dr[CardAuthorizationData.T_CARD_AUTHORIZATION_PASSWORD] = PWD;
            }
            //}
            //操作员
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_OPERATOR] = SysOperatorInfo.OperatorID;

            int INTERNAL_AUDITING = SkyComm.dsCardType.Tables[0].Rows[0]["INTERNAL_AUDITING"].ToString() == "1" ? -1 : 1;//1-不需要审核,0--需要审核
            // 是否需要内部审核状态(Internal_Auditing)0-	是(需要审核)、1-否(不需要审核)
            // (Auditing_State)0 已审核、1未审核
            if (INTERNAL_AUDITING == 1)
            {
                dr[CardAuthorizationData.T_CARD_AUTHORIZATION_AUDITING_STATE] = 1;//未审核状态
            }
            else//1-不需要审核
            {
                dr[CardAuthorizationData.T_CARD_AUTHORIZATION_AUDITING_STATE] = -1;//-1 悬空
            }
            dr[CardAuthorizationData.T_CARD_AUTHORIZATION_ISGUARDIAN] = 1;

            this.eLCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows.Add(dr);
            return(eLCardAuthorizationData);
        }
示例#28
0
        private void lblOk_Click(object sender, EventArgs e)
        {
            ucTime1.timer1.Stop();

            #region 获取身份证信息
            IDCardInfo      idinfo = null;
            FrmIdentityCard frm    = new FrmIdentityCard();
            try
            {
                if (frm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    //获取身份份信息
                    idinfo = frm.IdInfo;
                }
                else
                {
                    //ucTime1.Sec = 60;
                    //ucTime1.timer1.Start();

                    //idinfo = new IDCardInfo();
                    //idinfo.Name = "西安天网";
                    //idinfo.Sex = "男";
                    //idinfo.People = "汉族";
                    //idinfo.Number = "610100199401010229";
                    //idinfo.Birthday = "1994-01-01";
                    //idinfo.Address = "西安市雁塔区丈八六路51号";

                    //return;
                }
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("读取居民身份证信息失败:" + ex.Message);
                return;
            }
            finally
            {
                frm.Dispose();
            }
            #endregion

            #region 验证身份证号码
            if (SendCardType == "成人")
            {
                //通过身份证查询是否已经个办理过就诊卡,如果已经办理过则不充许再次办理
                string ConditionStr = string.Empty;

                if (SystemInfo.SystemConfigs["院内就诊卡模式"].DefaultValue.ToString() == "0")
                {
                    ConditionStr = " AND A.IDENTITYNAME='身份证' AND A.IDENTITYCARD='" + idinfo.Number.Trim().ToUpper() + "' AND B.CIRCUIT_STATE IN (0,1) ";
                }
                else
                {
                    ConditionStr = " AND A.IDENTITYNAME='身份证' AND A.IDENTITYCARD='" + idinfo.Number.Trim().ToUpper() + "' AND B.CIRCUIT_STATE IN (0,1) AND B.TYPEID=" + SkyComm.dsCardType.Tables[0].Rows[0]["TYPE_NO"];
                }
                PatientInfoFacade pfacade = new PatientInfoFacade();
                DataSet           pdata   = pfacade.FindCardPatientinfoByCondition(ConditionStr);

                if (pdata.Tables[0].Rows.Count > 0)
                {
                    string strMessage = "患者[" + pdata.Tables[0].Rows[0]["PATIENTNAME"].ToString() + "]已于" + Convert.ToDateTime(pdata.Tables[0].Rows[0]["PROVIDECARDDATE"].ToString()).ToShortDateString() + "办卡,为保证就诊档案完整,不可重复办卡;请核实患者身份,挂失原卡后,补发卡!";
                    if (pdata.Tables[0].Rows[0]["CIRCUIT_STATE"].ToString() == "1")
                    {
                        strMessage = "患者[" + pdata.Tables[0].Rows[0]["PATIENTNAME"].ToString() + "]已于" + Convert.ToDateTime(pdata.Tables[0].Rows[0]["PROVIDECARDDATE"].ToString()).ToShortDateString() + "办过卡,此卡已挂失,请补发卡!";
                    }
                    SkyComm.ShowMessageInfo(strMessage);
                    idinfo      = null;
                    ucTime1.Sec = 60;
                    ucTime1.timer1.Start();
                    return;
                }
            }
            #endregion

            #region 输入手机号码
            if (SendCardType == "成人")
            {
                string TelePhone           = string.Empty;
                FrmSendCardInputTel frmTel = new FrmSendCardInputTel(idinfo);
                frmTel.IdInfo = idinfo;
                if (frmTel.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    TelePhone = frmTel.TelePhone;
                }
                else
                {
                    idinfo      = null;
                    ucTime1.Sec = 60;
                    ucTime1.timer1.Start();
                    return;
                }
            }
            else
            {
                string           TelePhone = string.Empty;
                FrmInputForChild frmChild  = new FrmInputForChild(idinfo);
                frmChild.IdInfo = idinfo;
                if (frmChild.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    TelePhone = frmChild.TelePhone;
                }
                else
                {
                    idinfo      = null;
                    ucTime1.Sec = 60;
                    ucTime1.timer1.Start();
                    return;
                }
            }
            ucTime1.Sec = 60;
            ucTime1.timer1.Start();

            #endregion
        }
        private void lblOk_Click(object sender, EventArgs e)
        {
            ucTime1.timer1.Stop();

            #region 获取身份证信息
            IDCardInfo      idinfo = null;
            FrmIdentityCard frm    = new FrmIdentityCard();
            try
            {
                if (frm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    //获取身份份信息
                    idinfo = frm.IdInfo;
                }
                else
                {
                    //ucTime1.Sec = 60;
                    //ucTime1.timer1.Start();

                    //idinfo = new IDCardInfo();
                    //idinfo.Name = "西安天网";
                    //idinfo.Sex = "男";
                    //idinfo.People = "汉族";
                    //idinfo.Number = "610100199401010229";
                    //idinfo.Birthday = "1994-01-01";
                    //idinfo.Address = "西安市雁塔区丈八六路51号";

                    //return;
                }
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("读取居民身份证信息失败:" + ex.Message);
                return;
            }
            finally
            {
                frm.Dispose();
            }
            #endregion

            #region 验证身份证下是否存在卡信息
            string            sqlSelect = " AND ((A.IDENTITYNAME='身份证' AND A.IDENTITYCARD='" + idinfo.Number.Trim() + "' AND A.PATIENTNAME='" + idinfo.Name.Trim() + "') OR (A.GUARDIANIDNUMBER='" + idinfo.Number.Trim() + "')) AND B.CIRCUIT_STATE IN (0,1) ";
            PatientInfoFacade pfacade   = new PatientInfoFacade();
            DataSet           pdata     = pfacade.FindCardPatientinfoByCondition(sqlSelect);
            if (pdata == null || pdata.Tables.Count == 0 || pdata.Tables[0].Rows.Count == 0)
            {
                SkyComm.ShowMessageInfo("无该身份证对应的就诊卡信息,请使用自助办卡功能办理就诊卡!");
                idinfo      = null;
                ucTime1.Sec = 60;
                ucTime1.timer1.Start();
                return;
            }

            #endregion

            #region 输入手机号码
            string TelePhone           = string.Empty;
            FrmSendCardInputTel frmTel = new FrmSendCardInputTel(idinfo);
            frmTel.IdInfo = idinfo;
            if (frmTel.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                TelePhone = frmTel.TelePhone;
            }
            else
            {
                idinfo      = null;
                ucTime1.Sec = 60;
                ucTime1.timer1.Start();
                return;
            }

            ucTime1.Sec = 60;
            ucTime1.timer1.Start();

            #endregion
        }
示例#30
0
        private static void getCardInfo(ref IDCardInfo info)
        {
            var path = $"{AppDomain.CurrentDomain.BaseDirectory}\\libs\\ZhiYiXing\\wz.txt";

            using (var fs = new FileStream(path, FileMode.Open))
            {
                using (var sr = new StreamReader(fs, System.Text.Encoding.Unicode))
                {
                    string filecontent = sr.ReadToEnd();
                    sr.Close();
                    fs.Close();

                    //解析身份证指纹
                    //name
                    try
                    {
                        info.name = filecontent.Substring(0, 15).Trim();
                    }
                    catch { }
                    //gender
                    try
                    {
                        var gender = filecontent.Substring(15, 1);
                        if (gender == "1")
                        {
                            info.gender = "男";
                        }
                        else
                        {
                            info.gender = "女";
                        }
                    }
                    catch { }
                    //nation
                    try
                    {
                        int nation_id = Convert.ToInt32(filecontent.Substring(16, 2));
                        info.nation = getNation(nation_id);
                    }
                    catch { }
                    //birthday
                    try
                    {
                        var date_str = filecontent.Substring(18, 8);
                        info.Birthday = date_str.Insert(4, "-").Insert(7, "-");
                    }
                    catch { }
                    //address
                    try
                    {
                        info.address = filecontent.Substring(26, 35);
                    }
                    catch { }
                    //id_card_number
                    try
                    {
                        info.id_card_number = filecontent.Substring(61, 18);
                    }
                    catch { }
                    //department
                    try
                    {
                        info.department = filecontent.Substring(79, 15);
                    }
                    catch { }
                    //start date
                    try
                    {
                        var date_str = filecontent.Substring(94, 8);
                        info.StartDate = date_str.Insert(4, "-").Insert(7, "-");
                    }
                    catch { }
                    //end date
                    try
                    {
                        var date_str = filecontent.Substring(102, 8);
                        info.EndDate = date_str.Insert(4, "-").Insert(7, "-");
                    }
                    catch { }
                }
            }
        }