示例#1
0
        private void timerLogin_Tick(object sender, EventArgs e)
        {
            Public.LoginInfo loginInfo = Public.LoginInfo.GetInstance();
            if (loginInfo.UserId < 0)
            {
                StringBuilder Name        = new StringBuilder(31);
                StringBuilder Gender      = new StringBuilder(3);
                StringBuilder Folk        = new StringBuilder(10);
                StringBuilder BirthDay    = new StringBuilder(9);
                StringBuilder Code        = new StringBuilder(19);
                StringBuilder Address     = new StringBuilder(71);
                StringBuilder Agency      = new StringBuilder(31);
                StringBuilder ExpireStart = new StringBuilder(9);
                StringBuilder ExpireEnd   = new StringBuilder(9);
                //打开端口
                int intOpenRet = InitComm(1001);
                if (intOpenRet != 1)
                {
                    return;
                }

                //卡认证
                int intReadRet = Authenticate();
                if (intReadRet != 1)
                {
                    CloseComm();
                    return;
                }
                //三种方式读取基本信息
                //ReadBaseInfos(推荐使用)
                try
                {
                }
                catch (Exception)
                {
                    throw;
                }
                int intReadBaseInfosRet = ReadBaseInfos(Name, Gender, Folk, BirthDay, Code, Address, Agency, ExpireStart,
                                                        ExpireEnd);
                if (intReadBaseInfosRet != 1)
                {
                    //MessageBox.Show("读卡失败,请重试");
                    label4.Text = "读卡失败,请重试!";
                    CloseComm();
                    return;
                }

                string cardNo = Code.ToString();
                //关闭端口
                if (!string.IsNullOrEmpty(cardNo))
                {
                    ScreeningServiceClient client = new ScreeningServiceClient();
                    M_User userInfo = client.GetUserInfoByCardNo(cardNo);
                    if (userInfo != null)
                    {
                        Public.LoginInfo.GetInstance().UserId = userInfo.UserId;
                        Public.LoginInfo.GetInstance().Name   = Name.ToString();

                        //把登录的人作为活动参与人员建立与活动的关联关系。
                        //M_CottageActivityRecord entity = new M_CottageActivityRecord();
                        //entity.CActivityID = Properties.Settings.Default.ActivityId;
                        //entity.PatientAccount = userInfo.PatientAccount;
                        //entity.PatientID = userInfo.UserId;
                        //entity.PatientName = userInfo.UserName;
                        //entity.Phone = userInfo.Mobie;
                        //entity.DoctorID = Properties.Settings.Default.DoctorId;
                        //entity.DoctorName = Properties.Settings.Default.DoctorName;
                        //entity.DrID = Properties.Settings.Default.DoctorId;
                        //entity.DrName = Properties.Settings.Default.DoctorName;
                        //entity.UpdateDrID = Properties.Settings.Default.DoctorId;

                        //var result = client.AddPatientToCottageActivity(entity);

                        //if (result != null)
                        //{
                        //    Properties.Settings.Default.CARecordID = result.CARecordID;
                        //    Properties.Settings.Default.Save();

                        //    //MessageBox.Show(Properties.Settings.Default.CARecordID.ToString());
                        //}

                        //清空Questionnairs集合
                        Public.LoginInfo.GetInstance().Questionnairs.Clear();

                        if (mRedicectForm != null)
                        {
                            mRedicectForm.Show();
                            this.Close();
                        }
                    }
                    else
                    {
                        //MessageBox.Show("未找到此用户,请手工输入您的账号和密码进行登录");
                        label4.Text = "未找到此用户,请手工输入您的账号和密码进行登录!";
                    }
                }
            }
        }
示例#2
0
        private void timerLogin_Tick(object sender, EventArgs e)
        {
            //LiuPeng
            return;

            Public.LoginInfo loginInfo = Public.LoginInfo.GetInstance();
            if (loginInfo.UserId < 0)
            {
                StringBuilder Name        = new StringBuilder(31);
                StringBuilder Gender      = new StringBuilder(3);
                StringBuilder Folk        = new StringBuilder(10);
                StringBuilder BirthDay    = new StringBuilder(9);
                StringBuilder Code        = new StringBuilder(19);
                StringBuilder Address     = new StringBuilder(71);
                StringBuilder Agency      = new StringBuilder(31);
                StringBuilder ExpireStart = new StringBuilder(9);
                StringBuilder ExpireEnd   = new StringBuilder(9);
                //打开端口
                int intOpenRet = InitComm(1001);
                if (intOpenRet != 1)
                {
                    return;
                }

                //卡认证
                int intReadRet = Authenticate();
                if (intReadRet != 1)
                {
                    CloseComm();
                    return;
                }
                //三种方式读取基本信息
                //ReadBaseInfos(推荐使用)
                try
                {
                }
                catch (Exception)
                {
                    throw;
                }
                int intReadBaseInfosRet = ReadBaseInfos(Name, Gender, Folk, BirthDay, Code, Address, Agency, ExpireStart,
                                                        ExpireEnd);
                if (intReadBaseInfosRet != 1)
                {
                    //MessageBox.Show("读卡失败,请重试");
                    label4.Text = "读卡失败,请重试!";
                    CloseComm();
                    return;
                }

                string cardNo = Code.ToString();
                //关闭端口
                if (!string.IsNullOrEmpty(cardNo))
                {
                    //ScreeningServiceClient client = new ScreeningServiceClient();
                    //M_User userInfo = client.GetUserInfoByCardNo(cardNo);
                    Model.M_User userInfo = screenWebapiClient.GetUserInfoByCardNo(cardNo);
                    if (userInfo != null)
                    {
                        Public.LoginInfo.GetInstance().UserId         = userInfo.UserId;
                        Public.LoginInfo.GetInstance().Name           = !string.IsNullOrEmpty(userInfo.UserName) ? userInfo.UserName.Trim() : "";//Name.ToString();
                        Public.LoginInfo.GetInstance().FamilyMemberID = 0;
                        Public.LoginInfo.GetInstance().PatientAccount = !string.IsNullOrEmpty(userInfo.PatientAccount) ? userInfo.PatientAccount.Trim() : (!string.IsNullOrEmpty(userInfo.UserName) ? userInfo.UserName.Trim() : "");
                        Public.LoginInfo.GetInstance().Phone          = !string.IsNullOrEmpty(userInfo.Mobie) ? userInfo.Mobie : "";


                        //清空Questionnairs集合
                        Public.LoginInfo.GetInstance().Questionnairs.Clear();

                        if (mRedicectForm != null)
                        {
                            mRedicectForm.Show();
                            this.Close();
                        }
                    }
                    else
                    {
                        label4.Text = "未找到此用户,请手工输入您的账号和密码进行登录!";
                    }
                }
            }
        }