コード例 #1
0
        private void btnConfirmPay_Click_1(object sender, EventArgs e)
        {
            if (allowPay)
            {
#if DEBUG
                UserObject usertmp = GlobalTools.GetLoginUser();
                string     pwdtmp  = usertmp.Pwd;
#endif
                if (GlobalTools.GetLoginUser().Pwd.Length == 0)
                {
                    UserObject user = HiPiaoOperatorFactory.GetHiPiaoOperator().Login(GlobalTools.GetLoginUser().Name, this.txtUserPwd.Text);
                    if (user != null)
                    {
                        GlobalTools.loginUser = user;
                    }
                    else
                    {
                        this.lbMsg.Text = "密码输入错误!";
                        return;
                    }
                }
                if (this.txtUserPwd.Text != GlobalTools.GetLoginUser().Pwd)
                {
                    this.lbMsg.Text = "密码输入错误!";
                    return;
                }
                this.FindForm().Close();
                //string retCode="1";
                string retCode = HiPiaoCache.UserBuyTicket(GlobalTools.GetLoginUser(), this.lists);
                //<?xml version="1.0" encoding="utf-8"?><root><order res="0" stat="购票失败"  text="场次过期"  phone="4001-099-088" ></order></root>
                //订购成功
                if (retCode == "1")
                {
                    GlobalTools.GetLoginUser().NeedRefresh();
                    GlobalTools.ChangePanel(GlobalTools.MainForm, new WaitTicketPrintPanel(this.lists, this.movieInfo, this.moviePlan));
                    this.FindForm().Close();
                }
                //订购失败
                else if (retCode.StartsWith("0"))
                {
                    this.FindForm().Close();
                    GlobalTools.Pop(retCode.Substring(1));
                    //GlobalTools.PopNetError();
                }
                //座位已售出,重新刷座位图
                else if (retCode.StartsWith("2"))
                {
                    this.FindForm().Close();
                    this.lbMsg.Text = "座位已售出,重新选择座位!";
                    GlobalTools.ChangePanel(GlobalTools.MainForm, new MovieSeatSelectorPanel(this.roomPlan, this.movieInfo, this.moviePlan, dt));
                }
            }
        }
コード例 #2
0
ファイル: ModifyPwdPanel.cs プロジェクト: marcellus/fivemen
        private void btnSure_Click(object sender, EventArgs e)
        {
            if (allowUpdate)
            {
                string oldPwd    = this.txtOldPwd.Text.Trim();
                string pwd       = this.txtNewPwd.Text.Trim();
                string repeatPwd = this.txtRepeatPwd.Text.Trim();

                bool result = true;

                if (GlobalTools.GetLoginUser().Pwd != oldPwd)
                {
                    this.lbOldPwdHint.Text = "密码输入有误!";
                    this.txtOldPwd.Text    = string.Empty;
                    this.txtOldPwd.Focus();
                    this.picOldPwdHint.Image = Properties.Resources.Error;
                    result = false;;
                }
                else
                {
                    this.lbOldPwdHint.Text   = string.Empty;
                    this.picOldPwdHint.Image = Properties.Resources.Right;
                }

                if (!ValidatorHelper.ValidatePostCode(pwd, false))
                {
                    this.lbNewPwdHint.Text     = "密码只允许6位数字";
                    this.picNewPwdHint.Visible = true;
                    this.picNewPwdHint.Image   = Properties.Resources.Error;
                    this.txtNewPwd.Focus();
                    result = false;
                }
                else
                {
                    this.lbNewPwdHint.Text   = string.Empty;
                    this.picNewPwdHint.Image = Properties.Resources.Right;
                }

                if (pwd != repeatPwd)
                {
                    this.lbRepeatPwdHint.Text     = "两次输入的密码不一致,请重新输入";
                    this.picRepeatPwdHint.Visible = true;
                    this.picRepeatPwdHint.Image   = Properties.Resources.Error;
                    this.txtNewPwd.Text           = this.txtRepeatPwd.Text = string.Empty;
                    this.txtNewPwd.Focus();
                    result = false;
                }
                else
                {
                    this.lbRepeatPwdHint.Text   = string.Empty;
                    this.picRepeatPwdHint.Image = Properties.Resources.Right;
                }


                if (result)
                {
                    if (HiPiaoOperatorFactory.GetHiPiaoOperator().UpdatePwd(GlobalTools.GetLoginUser(), pwd))
                    {
                        this.lbNewPwdHint.Text = this.lbOldPwdHint.Text = this.lbRepeatPwdHint.Text = string.Empty;
                        GlobalTools.PopSecond("修改密码成功!");
                    }
                    else
                    {
                        GlobalTools.PopNetError();
                    }
                }
            }
        }
コード例 #3
0
        /*
         * protected override bool ProcessDialogKey(Keys keyData)
         * {
         *  if (keyData == Keys.Enter)
         *  {
         *      //Cursor.Current = Cursors.Default;
         *      // Cursor.Show();
         *      this.btnAgreeAndRegister_Click(null, null);
         *      //this.Close();
         *     // return true;
         *  }
         *  return false;
         * }
         */
        // private

        private void btnAgreeAndRegister_Click(object sender, EventArgs e)
        {
            // this.txtPassword.UnFocus();
            //  this.txtRepeatPwd.UnFocus();
            //  this.txtMobile.UnFocus();
            //  this.txtUserName.UnFocus();
            // GlobalTools.Pop(new UserRegister.UserRegisterSuccessPanel());
            // GlobalTools.PopNetError();
            //  return;
            if (allowRegister)
            {
#if DEBUG
                Console.WriteLine("点击注册按钮开始隐藏小键盘");
#endif
                GlobalTools.HideAllKeyBoard();
                string name      = this.txtUserName.Text.Trim();
                string pwd       = this.txtPassword.Text.Trim();
                string repeatPwd = this.txtRepeatPwd.Text.Trim();
                string mobile    = this.txtMobile.Text.Trim();
                bool   result    = true;
                this.lbMobileHint.Text = this.lbPasswordHint.Text = this.lbRepeatPwdHint.Text = this.lbUserNameHint.Text = string.Empty;

                if (!ValidatorHelper.ValidateMobile(mobile, false))
                {
                    this.lbMobileHint.Text     = "手机号输入错误";
                    this.picMobileHint.Visible = true;
                    this.picMobileHint.Image   = Properties.Resources.Error;

                    this.txtPassword.UnFocus();
                    this.txtRepeatPwd.UnFocus();
                    this.txtUserName.UnFocus();
                    this.txtMobile.Focus();
                    result = false;
                    // return;
                }
                else
                {
                    this.lbMobileHint.Text   = string.Empty;
                    this.picMobileHint.Image = Properties.Resources.Right;
                }

                /*
                 * if (!HiPiaoOperatorFactory.GetHiPiaoOperator().CheckUserName(name))
                 * {
                 *  this.lbUserNameHint.Text = "你输入的用户名已经存在,请重新输入";
                 *  this.picUserNameHint.Visible = true;
                 *  this.picUserNameHint.Image = Properties.Resources.Error;
                 *  this.txtUserName.Text = string.Empty;
                 *  result = false;
                 *
                 * }
                 * else
                 * {
                 *  this.lbUserNameHint.Text = string.Empty;
                 *  this.picUserNameHint.Image = Properties.Resources.Right;
                 * }
                 * */

                if (!ValidatorHelper.ValidatePostCode(pwd, false))
                {
                    this.lbPasswordHint.Text     = "密码只允许6位数字";
                    this.picPasswordHint.Visible = true;
                    this.picPasswordHint.Image   = Properties.Resources.Error;

                    this.txtMobile.UnFocus();
                    this.txtRepeatPwd.UnFocus();
                    this.txtUserName.UnFocus();
                    this.txtPassword.Focus();
                    result = false;
                    return;
                }
                else
                {
                    this.lbPasswordHint.Text   = string.Empty;
                    this.picPasswordHint.Image = Properties.Resources.Right;
                }

                if (pwd != repeatPwd)
                {
                    this.lbRepeatPwdHint.Text     = "两次输入的密码不一致,请重新输入";
                    this.picRepeatPwdHint.Visible = true;
                    this.picRepeatPwdHint.Image   = Properties.Resources.Error;
                    this.txtPassword.Text         = this.txtRepeatPwd.Text = string.Empty;

                    this.txtMobile.UnFocus();
                    this.txtRepeatPwd.UnFocus();
                    this.txtUserName.UnFocus();
                    this.txtPassword.Focus();
                    result = false;
                    return;
                }
                else
                {
                    this.lbRepeatPwdHint.Text   = string.Empty;
                    this.picRepeatPwdHint.Image = Properties.Resources.Right;
                }


                /*
                 * else if (!HiPiaoOperatorFactory.GetHiPiaoOperator().CheckMobile(mobile))
                 * {
                 * this.lbMobileHint.Text = "您输入的手机号已经被注册";
                 * this.picMobileHint.Visible = true;
                 * this.picMobileHint.Image = Properties.Resources.Error;
                 * this.txtMobile.Text = string.Empty;
                 * result = false;
                 * }
                 * else
                 * {
                 * this.lbMobileHint.Text = string.Empty;
                 * this.picMobileHint.Image = Properties.Resources.Right;
                 * }
                 * */
                if (result)
                {
                    string retcode = "0";
                    try
                    {
                        UserObject user = HiPiaoOperatorFactory.GetHiPiaoOperator().Register(name, pwd, mobile, ref retcode);
                        if (user != null)
                        {
                            GlobalTools.loginUser = user;
                            this.txtPassword.UnFocus();
                            this.txtRepeatPwd.UnFocus();
                            this.txtMobile.UnFocus();
                            this.txtUserName.UnFocus();
                            GlobalTools.Pop(new UserRegister.UserRegisterSuccessPanel());
                        }
                        else if (retcode == "2")
                        {
                            this.lbUserNameHint.Text     = "你输入的用户名已经存在或者无效,请重新输入";
                            this.picUserNameHint.Visible = true;
                            this.picUserNameHint.Image   = Properties.Resources.Error;
                            this.txtUserName.Text        = string.Empty;
                            this.txtPassword.UnFocus();
                            this.txtRepeatPwd.UnFocus();
                            this.txtMobile.UnFocus();
                            this.txtUserName.Focus();
                        }
                        else
                        {
                            GlobalTools.PopNetError();
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobalTools.PopNetError();
                    }
                }
            }
        }