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"); }
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"); }