Exemple #1
0
 /// <summary>
 /// 对返回按钮执行的动作进行判断:是用户预订还是分销商预订
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btReturn_Click(object sender, EventArgs e)
 {
     if (DistributorAccess.SelectById(UserId))
     {
         this.Visible = false;
         DistributorUser distributorUser = new DistributorUser(UserId);
         distributorUser.Show();
     }
     else
     {
         this.Visible = false;
         Homepage homePage = new Homepage(UserId);
         homePage.Show();
     }
 }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            string userName  = this.tbUserName.Text;
            string mail      = this.tbMail.Text;
            string passWord1 = this.tbUserPassWord1.Text;
            string passWord2 = this.tbUserPassWord2.Text;
            string identify  = this.tbnIdentify1.Text;
            string phoneNum  = this.tbPhoneNumber.Text;
            User   user      = new User();
            bool   agree     = this.checkBox1.Checked;

            if (agree)
            {
                if (identify == Identify)
                {
                    if (passWord1 == passWord2)
                    {
                        user.USName          = userName;
                        user.USEmail         = mail;
                        user.USPassWord      = passWord1;
                        user.USPhone         = phoneNum;
                        user.USRegisterTime  = DateTime.Now;
                        user.USLastLoginTime = DateTime.Now;
                        user.USLastLoginIp   = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0].ToString();
                        user.USValid         = 1;
                        if (UserAccess.Add(user))
                        {
                            MessageBox.Show("注册成功!");
                            Homepage homePage = new Homepage(UserAccess.Select(userName));
                            homePage.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("两次填写的密码不一致!");
                    }
                }
                else
                {
                    MessageBox.Show("验证码填写有误");
                }
            }
            else
            {
                MessageBox.Show("请勾选同意!");
            }
        }
Exemple #3
0
 /// <summary>
 /// 门票预订
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btBook_Click(object sender, EventArgs e)
 {
     if (scenery.SYUseNum >= scenery.SYTotal)
     {
         MessageBox.Show("当前时间的门票已售罄!");
     }
     else
     {
         Oreder order = new Oreder();
         order.TKType        = this.cbTicketType.SelectedIndex;
         order.TKReserveTime = DateTime.Now;
         order.TKUseTime     = Convert.ToDateTime(this.dtpUseTime.Text);
         order.TKNum         = Convert.ToInt32(this.nudTicketNum.Value);
         order.TKUserId      = UserId;
         order.TKSupplier    = scenery.SYSupplier;
         order.TKImagSrc     = scenery.SYImagSrc;
         order.TKPrice       = Convert.ToInt32(this.lbPrice2.Text);
         order.TKSYId        = scenery.SYId;
         #region  订票验证
         if (order.TKNum != 0)
         {
             if (UserId != -1)
             {
                 if (SceneryAccess.ShowSceneryByUseTime(order.TKUseTime))
                 {
                     if (this.cbTicketType.SelectedIndex != -1)
                     {
                         if (OrderAccess.AddOrder(order))
                         {
                             #region MyRegion
                             if (DistributorAccess.SelectById(UserId))
                             {
                                 this.Visible = false;
                                 DistributorUser distributorUser = new DistributorUser(UserId);
                                 distributorUser.Show();
                             }
                             else
                             {
                                 MessageBox.Show("预订成功!");
                                 this.Visible = false;
                                 Homepage homePage = new Homepage(UserId);
                                 homePage.Show();
                             }
                         }
                         else
                         {
                             MessageBox.Show("订票失败!");
                         }
                         #endregion
                     }
                     else
                     {
                         MessageBox.Show("请选择票型");
                     }
                 }
                 else
                 {
                     MessageBox.Show("当前门票暂时没有上线,请晚些时候再来!");
                 }
             }
             else
             {
                 MessageBox.Show("请登录后再订票!");
             }
             #endregion
         }
         else
         {
             MessageBox.Show("请选择预订数量!");
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// 用户登录:普通用户,管理员,供应商,分销商
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string userName     = this.tbUserName.Text;
            string userPassWord = this.tbPassWord.Text;
            string Identify     = this.tbIdentify1.Text;
            string userType     = this.comboBox1.Text;

            if (userType == "普通用户")
            {
                if (Identify == tbnIdentify)
                {
                    if (UserAccess.Loin(userName, userPassWord))
                    {
                        int USId = UserAccess.Select(userName);
                        if (USId != 0)
                        {
                            this.Visible = false;
                            Homepage homePage = new Homepage(USId);
                            homePage.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码不正确");
                    }
                }
                else
                {
                    MessageBox.Show("验证码输入有误!");
                }
            }
            else if (userType == "管理员")
            {
                if (Identify == tbnIdentify)
                {
                    if (AdminAccess.Loin(userName, userPassWord))
                    {
                        int USId = Convert.ToInt32(userName);
                        if (USId != 0)
                        {
                            this.Visible = false;
                            SupperUser supperUser = new SupperUser(USId);
                            supperUser.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码不正确");
                    }
                }
                else
                {
                    MessageBox.Show("验证码输入有误!");
                }
            }
            else if (userType == "供应商")
            {
                if (Identify == tbnIdentify)
                {
                    if (SupplierAccess.Loin(userName, userPassWord))
                    {
                        int USId = SupplierAccess.Select(userName);
                        if (USId != 0)
                        {
                            this.Visible = false;
                            SupplierUser supplierUser = new SupplierUser(USId);
                            supplierUser.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码不正确");
                    }
                }
                else
                {
                    MessageBox.Show("验证码输入有误!");
                }
            }
            else if (userType == "分销商")
            {
                if (Identify == tbnIdentify)
                {
                    if (DistributorAccess.Loin(userName, userPassWord))
                    {
                        int USId = DistributorAccess.Select(userName);
                        if (USId != 0)
                        {
                            this.Visible = false;
                            DistributorUser distributorUser = new DistributorUser(USId);
                            distributorUser.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码不正确");
                    }
                }
                else
                {
                    MessageBox.Show("验证码输入有误!");
                }
            }
            else
            {
                MessageBox.Show("请选择用户类型");
            }
        }