Beispiel #1
0
        public void BindData()
        {
            #region
            //if (!Context.User.Identity.IsAuthenticated)
            //{
            //    return;
            //}
            //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name);
            //if (user.HasPermissionID(PermId_Modify))
            //{
            //    gridView.Columns[6].Visible = true;
            //}
            //if (user.HasPermissionID(PermId_Delete))
            //{
            //    gridView.Columns[7].Visible = true;
            //}
            #endregion

            DataSet       ds       = new DataSet();
            StringBuilder strWhere = new StringBuilder();
            if (txtKeyword.Text.Trim() != "")
            {
                #warning 代码生成警告:请修改 keywordField 为需要匹配查询的真实字段名称
                //strWhere.AppendFormat("keywordField like '%{0}%'", txtKeyword.Text.Trim());
            }
            ds = bll.GetList(strWhere.ToString());
            gridView.DataSource = ds;
            gridView.DataBind();
        }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = "";
            Label2.Text = "";
            Label3.Text = "";
            if (RadTextBox1.Text == "")
            {
                Label1.Text    = "账户不能为空";
                Label1.Visible = true;
                return;
            }
            if (RadTextBox3.Text == "")
            {
                Label2.Text    = "密码不能为空";
                Label2.Visible = true;
                return;
            }
            if (RadTextBox2.Text == "")
            {
                Label3.Text    = "验证码不能为空";
                Label3.Visible = true;
                return;
            }
            if (User_Bll.GetRecordCount(" Username='******' ") == 0)
            {
                Label1.Text    = "该账户不存在";
                Label1.Visible = true;
                return;
            }
            if (User_Bll.GetRecordCount(" Username='******' and UserPassword='******'") == 0)
            {
                Label2.Text    = "密码错误";
                Label2.Visible = true;
                return;
            }
            if (Session["CheckCode"].ToString().ToLower() != RadTextBox2.Text.ToLower())
            {
                Label3.Text    = "验证码错误";
                Label3.Visible = true;
                return;
            }
            DataSet ds = User_Bll.GetList(" Username='******' ");

            if (ds.Tables[0].Rows[0]["UserIdentity"].ToString() != "管理员")
            {
                Label1.Text    = "您没有权限";
                Label1.Visible = true;
                return;
            }
            UsersInfo.UserID   = ds.Tables[0].Rows[0]["UserID"].ToString();
            UsersInfo.UserRole = ds.Tables[0].Rows[0]["UserIdentity"].ToString();
            UsersInfo.UserName = ds.Tables[0].Rows[0]["Username"].ToString();


            //UsersInfo user = new UsersInfo();
            //UsersInfo.UserName = RadTextBox1.Text;
            //UsersInfo.UserRole = RadTextBox2.Text;
            Response.Redirect("~/BackManagement/BackIndex.aspx");
        }
Beispiel #3
0
        protected void DataLoad()
        {
            string sqlselect = " Username like '%" + RadTextBox1.Text + "%' ";

            if (Grade != "")
            {
                sqlselect += " and UserGrade = '" + Grade + "' ";
            }
            RadGrid1.DataSource = Users_Bll.GetList(sqlselect);
        }
Beispiel #4
0
        protected void btnlogin_Click(object sender, EventArgs e)
        {
            string email      = @"^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$";
            Regex  rxemail    = new Regex(email);
            string phone      = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$";
            Regex  rxphone    = new Regex(phone);
            string username   = @"^\w+$";
            Regex  rxusername = new Regex(username);
            string name       = "^[a-zA-Z0-9\u4e00-\u9fa5]{1,}$";//字母数字汉字
            Regex  rxname     = new Regex(name);

            lblUserName.Text  = "";
            lblPassword.Text  = "";
            lblPassword2.Text = "";
            lblEmail.Text     = "";
            lblcode.Text      = "";
            if (txtUserName.Text == "")
            {
                lblUserName.Text = "账户不能为空!";
                return;
            }
            if (!rxname.IsMatch(txtUserName.Text))
            {
                lblPassword.Text = "不能输入特殊字符!";
                return;
            }
            if (txtPassword.Text == "")
            {
                lblPassword.Text = "密码不能为空!";
                return;
            }
            if (txtPassword2.Text == "")
            {
                lblPassword2.Text = "确认密码不能为空!";
                return;
            }
            if (txtphone.Text == "")
            {
                lblphone.Text = "手机号不能为空!";
                return;
            }
            if (txtEmail.Text == "")
            {
                lblEmail.Text = "邮箱不能为空!";
                return;
            }
            if (txtcode.Text == "")
            {
                lblcode.Text = "验证码不能为空!";
                return;
            }
            if (!rxusername.IsMatch(txtUserName.Text))
            {
                lblUserName.Text = "格式错误!";
                return;
            }
            if (!rxusername.IsMatch(txtPassword.Text))
            {
                lblPassword.Text = "格式错误!";
                return;
            }
            if (!rxusername.IsMatch(txtcode.Text))
            {
                lblUserName.Text = "格式错误!";
                return;
            }
            if (!rxusername.IsMatch(txtPassword2.Text))
            {
                lblUserName.Text = "格式错误!";
                return;
            }
            if (Users_Bll.GetList(" Username ='******' ").Tables[0].Rows.Count != 0)
            {
                lblUserName.Text = "用户名已存在!";
                return;
            }

            if (txtPassword.Text != txtPassword2.Text)
            {
                lblPassword2.Text = "两次密码输入不一致!";
                return;
            }

            if (!rxphone.IsMatch(txtphone.Text))
            {
                txtphone.Text = "";
                lblphone.Text = "手机格式错误!";
                return;
            }

            if (!rxemail.IsMatch(txtEmail.Text))
            {
                txtEmail.Text = "";
                lblEmail.Text = "邮箱输入错误!";
                return;
            }
            if (Session["CheckCode"].ToString().ToLower() != txtcode.Text.ToLower())
            {
                txtcode.Text = "";
                lblcode.Text = "验证码错误!";
                return;
            }
            if (txtUserName.Text.Count() < 6)
            {
                lblUserName.Text = "账户不能小于6位!";
                return;
            }

            Users_Mol.UserID       = DateTime.Now.ToString("yyyyMMddHHmmss");
            Users_Mol.Username     = txtUserName.Text;
            Users_Mol.UserPassword = txtPassword.Text;
            Users_Mol.Phone        = txtphone.Text;
            Users_Mol.UserEmail    = txtEmail.Text;
            Users_Mol.RegistTime   = DateTime.Now;
            Users_Mol.UserScore    = 0;
            Users_Mol.UserGrade    = "会员";
            Users_Mol.UserIdentity = "会员";
            if (CheckBox1.Checked == true)
            {
                Users_Bll.Add(Users_Mol);
                Response.Write("<script>alert('注册成功!');window.location.href='/Login.aspx'</script>");
            }
            else
            {
                CheckBox1.Checked = false;
                Response.Write("<script>alert('请同意条款!')</script>");
            }
        }
Beispiel #5
0
 protected void RadLVVipjfph_NeedDataSource(object sender, Telerik.Web.UI.RadListViewNeedDataSourceEventArgs e)
 {
     RadLVVipjfph.DataSource = Users_Bll.GetList(0, "  ", "UserScore desc");
 }
Beispiel #6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string username   = "******";
            Regex  rxusername = new Regex(username);

            Label1.Text = "";
            Label2.Text = "";
            Label3.Text = "";
            if (RadTextBox1.Text == "")
            {
                Label1.Text    = "账户不能为空";
                Label1.Visible = true;
                return;
            }
            if (RadTextBox3.Text == "")
            {
                Label2.Text    = "密码不能为空";
                Label2.Visible = true;
                return;
            }
            if (RadTextBox2.Text == "")
            {
                Label3.Text    = "验证码不能为空";
                Label3.Visible = true;
                return;
            }
            if (!rxusername.IsMatch(RadTextBox1.Text))
            {
                Label1.Text    = "账户格式错误";
                Label1.Visible = true;
                return;
            }
            if (User_Bll.GetRecordCount(" Username='******' ") == 0)
            {
                Label1.Text    = "该账户不存在";
                Label1.Visible = true;
                return;
            }
            if (!rxusername.IsMatch(RadTextBox3.Text))
            {
                Label1.Text    = "密码格式错误";
                Label1.Visible = true;
                return;
            }
            if (User_Bll.GetRecordCount(" Username='******' and UserPassword='******'") == 0)
            {
                Label2.Text    = "密码错误";
                Label2.Visible = true;
                return;
            }
            if (Session["CheckCode"].ToString().ToLower() != RadTextBox2.Text.ToLower())
            {
                Label3.Text    = "验证码错误";
                Label3.Visible = true;
                return;
            }

            DataSet ds = User_Bll.GetList(" Username='******' ");

            UsersInfo.UserID   = ds.Tables[0].Rows[0]["UserID"].ToString();
            UsersInfo.UserRole = ds.Tables[0].Rows[0]["UserIdentity"].ToString();
            UsersInfo.UserName = ds.Tables[0].Rows[0]["Username"].ToString();
            if (ds.Tables[0].Rows[0]["UserIdentity"].ToString() == "管理员")
            {
                RadAjaxManager1.Alert("该账户无效!");
                RadTextBox1.Text = "";
                RadTextBox2.Text = "";
                RadTextBox3.Text = "";
                return;
            }
            if (ShoppingCar.ShoppingList.Count != 0)
            {
                Users_Mol = User_Bll.GetModel(UsersInfo.UserID);
                decimal discount1;
                if (Users_Mol.UserGrade == "VIP")
                {
                    discount1 = Convert.ToDecimal(0.95);
                }
                else
                {
                    discount1 = Convert.ToDecimal(1);
                }
                if (ShoppingCar.ShoppingList.Count != 0)    //泛型中有数据
                {
                    int i = 0;
                    foreach (var item in ShoppingCar.ShoppingList)
                    {
                        Commodity_Mol = Commodity_Bll.GetModel(item.CommodityID);
                        if (ShoppingCart_Bll.GetRecordCount(" UserID ='" + UsersInfo.UserID + "' and CommodityID ='" + item.CommodityID + "' ") != 0)
                        {
                            string basketid = ShoppingCart_Bll.GetList(" UserID ='" + UsersInfo.UserID + "' and CommodityID ='" + item.CommodityID + "' ").Tables[0].Rows[0]["ShoppingCartID"].ToString();
                            ShoppingCart_Mol             = ShoppingCart_Bll.GetModel(basketid);
                            ShoppingCart_Mol.OrderNumber = ShoppingCart_Mol.OrderNumber + item.OrderNumber;
                            if (ShoppingCart_Mol.OrderNumber > Commodity_Mol.Stock)
                            {
                                ShoppingCart_Mol.OrderNumber = Commodity_Mol.Stock;
                            }
                            ShoppingCart_Mol.Subtotal = (Convert.ToDecimal(ShoppingCart_Mol.OrderNumber) * Convert.ToDecimal(item.VIPPrice) * discount1).ToString("F2");
                            ShoppingCart_Bll.Update(ShoppingCart_Mol);
                        }
                        else
                        {
                            ShoppingCart_Mol.ShoppingCartID = DateTime.Now.ToString("yyyyMMddHHmmss") + i.ToString();
                            i++;
                            ShoppingCart_Mol.UserID      = UsersInfo.UserID;
                            ShoppingCart_Mol.CommodityID = item.CommodityID;
                            ShoppingCart_Mol.OrderNumber = item.OrderNumber;
                            if (ShoppingCart_Mol.OrderNumber > Commodity_Mol.Stock)
                            {
                                ShoppingCart_Mol.OrderNumber = Commodity_Mol.Stock;
                            }
                            ShoppingCart_Mol.Subtotal = (item.Subtotal * discount1).ToString("F2");
                            ShoppingCart_Bll.Add(ShoppingCart_Mol);
                        }
                    }
                    ShoppingCar.ShoppingList.Clear();
                }
            }
            Response.Redirect("HomePage.aspx");
        }