Пример #1
0
        /// <summary>
        /// 生成账号
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        private string CreateAccount(string account)
        {
            //client = new ScreeningServiceClient();
            screenWebapiClient = new ScreenWebapiClient();

            string prototype = account;
            string result    = string.Empty;
            //存在则生成账号
            Random random = new Random();
            int    number = random.Next(100, 999);

            account += "-" + number;
            bool had = screenWebapiClient.GetUserInfoByAccount(account);

            //client.Close();
            if (had)
            {
                result = CreateAccount(prototype);
            }
            else
            {
                result = account;
            }
            return(result);
        }
Пример #2
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            string fullName = this.txtName.Text;
            string cardNo   = this.txtCard.Text;
            int    sex      = radSexA.Checked ? 1 : 2;
            //var birthday = "2016-01-01";
            var birthday = "";
            //1561 小屋类型、专项筛查
            int cottageOrgId = Properties.Settings.Default.CottageOrgId == -1 ? Convert.ToInt32("1561") : Properties.Settings.Default.CottageOrgId;

            //如果设置界面选择了访客模式
            if (Properties.Settings.Default.SetIsCustomer)
            {
                //设置默认小屋
                cottageOrgId = Convert.ToInt32("1561");
            }

            if (string.IsNullOrEmpty(fullName))
            {
                //MessageBox.Show("真实姓名不能为空");
                label5.Text = "请您输入真实姓名!";
                return;
            }

            //if (string.IsNullOrEmpty(cardNo))
            //{
            //    //MessageBox.Show("身份证号码不能为空");
            //    label5.Text = "身份证号码不能为空!";
            //    return;
            //}

            if (!string.IsNullOrEmpty(cardNo))
            {
                if ((!Regex.IsMatch(cardNo, @"^(^\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$", RegexOptions.IgnoreCase)))
                {
                    //MessageBox.Show("请输入正确的身份证号码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    label5.Text = "请您输入正确的身份证号码!";
                    return;
                }

                if (cardNo.Length == 18)
                {
                    birthday = cardNo.Substring(6, 4) + "-" + cardNo.Substring(10, 2) + "-" + cardNo.Substring(12, 2);
                    try
                    {
                        DateTime.Parse(birthday);
                    }
                    catch
                    {
                        //MessageBox.Show("请输入正确的身份证号码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        label5.Text = "请您输入正确的身份证号码!";
                        return;
                    }
                }

                //处理15位的身份证号码从号码中得到生日和性别代码
                if (cardNo.Length == 15)
                {
                    birthday = "19" + cardNo.Substring(6, 2) + "-" + cardNo.Substring(8, 2) + "-" + cardNo.Substring(10, 2);
                    try
                    {
                        DateTime.Parse(birthday);
                    }
                    catch
                    {
                        //MessageBox.Show("请输入正确的身份证号码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        label5.Text = "请您输入正确的身份证号码!";
                        return;
                    }
                }
            }



            //ScreeningServiceClient client =new ScreeningServiceClient();
            ScreenWebapiClient screenWebapiClient = new ScreenWebapiClient();

            //M_Msg result = client.Regist(account, password, fullName, cardNo, sex, DateTime.Parse(birthday));

            Model.M_Msg result = null;
            if (string.IsNullOrEmpty(birthday))
            {
                result = screenWebapiClient.Regist(account, mobile, password, fullName, cardNo, sex, null, cottageOrgId);
            }
            else
            {
                result = screenWebapiClient.Regist(account, mobile, password, fullName, cardNo, sex, DateTime.Parse(birthday), cottageOrgId);
            }

            if (result.IsSuccss)
            {
                MessageBox.Show("注册成功");
                //label5.Text = "注册成功!";
                //RegistSucess registSucess = new RegistSucess();
                //registSucess.TopMost = false;
                //registSucess.Show();
                //this.Close();

                //把注册的人作为活动参与人员建立与活动的关联关系。
                //M_CottageActivityRecord entity=new M_CottageActivityRecord();
                //entity.CActivityID = Properties.Settings.Default.ActivityId;
                //entity.PatientAccount = account;
                //entity.PatientID = result.PatientId;
                //entity.PatientName = fullName;
                //entity.Phone = account;
                //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;
                ////新增
                //entity.CreateDrID = Properties.Settings.Default.DoctorId;
                //entity.CreateDrName = Properties.Settings.Default.DoctorName;
                //entity.UpdateDrName = Properties.Settings.Default.DoctorName;
                ////报名来源,默认0,1-WEB医生端,2-网络医院APP,3-推广大使APP,4-健康管理师APP,5-筛查机
                //entity.RegSource = 5;
                ////签到来源,默认0,1-WEB医生端,2-网络医院APP,3-推广大使APP,4-健康管理师APP,5-筛查机
                //entity.SignSource = 5;


                //var aResult= client.AddPatientToCottageActivity(entity);
                //if (aResult != null)
                //{
                //    Properties.Settings.Default.CARecordID = aResult.CARecordID;
                //    Properties.Settings.Default.Save();
                //}


                //登录
                //Services.M_User userInfo = client.Login(account, password);
                Model.M_User userInfo = screenWebapiClient.Login(account, password);
                if (userInfo != null)
                {
                    Public.LoginInfo.GetInstance().UserId         = userInfo.UserId;
                    Public.LoginInfo.GetInstance().Name           = userInfo.UserName;
                    Public.LoginInfo.GetInstance().FamilyMemberID = 0;
                    Public.LoginInfo.GetInstance().PatientAccount = account;
                    Public.LoginInfo.GetInstance().Phone          = mobile;

                    //登录成功
                    //清空Questionnairs集合
                    Public.LoginInfo.GetInstance().Questionnairs.Clear();

                    //int iWhichQuestion = Properties.Settings.Default.ScreenSet;
                    //switch (iWhichQuestion)
                    //{
                    //    case 1: //老年痴呆筛查
                    //        AD.FirstFrm frmAdFirst = new AD.FirstFrm();
                    //        frmAdFirst.TopMost = false;
                    //        frmAdFirst.Show();
                    //        break;
                    //    case 2: //脑卒中筛查
                    //        Naocuzhong.FirstFrm naoFirst = new Naocuzhong.FirstFrm();
                    //        naoFirst.TopMost = false;
                    //        naoFirst.Show();
                    //        break;
                    //    case 3: //早癌筛查
                    //        Zaoai.ScreeningZaoaiSelect frmZaoAi = new Zaoai.ScreeningZaoaiSelect();
                    //        frmZaoAi.TopMost = false;
                    //        frmZaoAi.Show();
                    //        break;
                    //    case 4: //工伤康复筛查
                    //        Kangfu.ScreeningSelect frmKangfu = new Kangfu.ScreeningSelect();
                    //        frmKangfu.TopMost = false;
                    //        frmKangfu.Show();
                    //        break;
                    //    case 5: //排尿异常
                    //        Other.ScreenOtherSelect screenOtherSelect = new Other.ScreenOtherSelect();
                    //        screenOtherSelect.TopMost = false;
                    //        screenOtherSelect.Show();
                    //        break;
                    //    default:
                    //        break;

                    //}
                    this.Close();
                }
            }
            else
            {
                //MessageBox.Show("注册失败 "+result.Message);
                label5.Text = "注册失败 " + result.Message;
                return;
            }
        }