예제 #1
0
        /// <summary>
        /// 返回供应商界面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            SupplierUser supplierUser = new SupplierUser(UserId);

            supplierUser.Show();
        }
예제 #2
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("请选择用户类型");
            }
        }