public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsDateTime(txtBirthday.Text)) { strErr += "生日格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int Id = int.Parse(this.lblId.Text); string Name = this.lblName.Text; String Password = this.txtPassword.Text; String TrueName = this.txtTrueName.Text; String Sex = this.ddlSex.SelectedValue; String Phone = this.txtPhone.Text; string path = Server.MapPath("~/"); string Photo = ""; string filename = ""; string contentType = fuPhoto.PostedFile.ContentType; if (contentType == "image/pjpeg" || contentType == "image/bmp" || contentType == "image/gif") { string format = fuPhoto.FileName.Split('.')[1]; Photo = "Upload/" + Guid.NewGuid() + "." + format; filename = path + Photo; fuPhoto.PostedFile.SaveAs(filename); } else { Maticsoft.Common.MessageBox.Show(this, "请上传图片文件!"); return; } String Email = this.txtEmail.Text; DateTime Birthday = DateTime.Parse(this.txtBirthday.Text); bool IsActivity = this.chkIsActivity.Checked; int Fk_Roles_Id = int.Parse(this.ddlFk_Roles_Id.SelectedValue); Maticsoft.Model.Users model = new Maticsoft.Model.Users(); model.Id = Id; model.Name = Name; model.Password = Password; model.TrueName = TrueName; model.Sex = Sex; model.Phone = Phone; model.Photo = Photo; model.Email = Email; model.Birthday = Birthday; model.IsActivity = IsActivity; model.Fk_Roles_Id = Fk_Roles_Id; Maticsoft.BLL.Users bll = new Maticsoft.BLL.Users(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "usercenter.aspx"); }
protected void RadListView1_ItemCommand(object sender, Telerik.Web.UI.RadListViewCommandEventArgs e) { string OrderID; OrderID = e.CommandArgument.ToString(); Maticsoft.Model.Users molUsers = Users_Bll.GetModel(UsersInfo.UserID); if (e.CommandName == "Pay") { Response.Write("<script>window.location.href='/ForeManagement/ForeOrdersDetail.aspx?OrderID=" + OrderID + "'</script>"); } if (e.CommandName == "Cancel") { Maticsoft.Model.Orders molOrders = Orders_Bll.GetModel(OrderID); molOrders.OrderState = "订单取消"; Orders_Bll.Update(molOrders); } if (e.CommandName == "Hurry") { Response.Write("<script> alert('催单成功!')</script>"); } if (e.CommandName == "Check") { Orders_Mol = Orders_Bll.GetModel(OrderID);//引用 DataSet ds = new DataSet(); ds = Orders_Bll.GetList2(0, " a.OrderID='" + OrderID + "' ", " OrderDate"); Users_Mol = Users_Bll.GetModel(UsersInfo.UserID);//引用 foreach (DataRow dr in ds.Tables[0].Rows) { //增加销售数量 Commodity_Mol = Commodity_Bll.GetModel(dr["CommodityID"].ToString()); Commodity_Mol.CommoditySaled = Commodity_Mol.CommoditySaled + Convert.ToInt32(dr["OrderNumber"]); Commodity_Bll.Update(Commodity_Mol);//更新 //增加积分点数 string str = dr["BuyScore"].ToString(); string shu = dr["OrderNumber"].ToString(); Users_Mol.UserScore += Convert.ToInt32(str) * Convert.ToInt32(shu); } Users_Mol.UserGrade = "VIP"; Orders_Mol.OrderState = "完成"; Orders_Bll.Update(Orders_Mol); //更新 Users_Bll.Update(Users_Mol); //更新 RadListView1.Rebind(); Maticsoft.Model.Orders molOrders = Orders_Bll.GetModel(OrderID); //Maticsoft.Model.Commodity molCommodity = Commodity_Bll.GetModel(OrderID); //int total = Orders_Bll.GetTotal(OrderID); //molUsers.UserScore += total; //molOrders.OrderState = "完成"; Orders_Bll.Update(molOrders); } if (e.CommandName == "Score") { } }
protected void Button1_Click(object sender, EventArgs e) { string path = @"(^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$)"; Regex rx = new Regex(path); if (RadTextBox2.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入姓名!"); } else if (RadTextBox3.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入邮箱!"); } else if (ddlprovince.SelectedValue == "")//判断是否为空 { RadAjaxManager1.Alert("请输入所在地!"); } else if (ddlcity.SelectedValue == "")//判断是否为空 { RadAjaxManager1.Alert("请输入所在地!"); } else if (RadTextBox6.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入详细地址!"); } else if (!rx.IsMatch(RadTextBox3.Text)) { RadTextBox3.Text = ""; RadAjaxManager1.Alert("邮箱格式错误!"); } else { User_Model = Users_Bll.GetModel(UsersInfo.UserID); User_Model.UserRealName = RadTextBox2.Text;//添加数据 User_Model.Province = ddlprovince.SelectedValue; User_Model.City = ddlcity.SelectedValue; User_Model.Address1 = RadTextBox6.Text;//添加数据 User_Model.UserEmail = RadTextBox3.Text; if (Rad_nan.Checked == true) { User_Model.UserSex = "男"; } else { User_Model.UserSex = "女"; } Users_Bll.Update(User_Model); Response.Write("<script>alert('修改成功!');window.location.href='ForeVIP.aspx'</script>"); } }
protected void Btn_Check_Click(object sender, EventArgs e) { Maticsoft.Model.Users modelnew = Users_Bll.GetModel(UsersInfo.UserID);//引用id所在行的数据 string path = "^[a-zA-Z0-9_]{6,16}$"; Regex rx = new Regex(path); if (RadTextBox1.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入原密码!"); } else if (RadTextBox1.Text != modelnew.UserPassword) { RadAjaxManager1.Alert("原密码错误!"); } else if (RadTextBox2.Text == modelnew.UserPassword) { RadAjaxManager1.Alert("不能与原密码相同!"); } else if (RadTextBox2.Text == "") { RadAjaxManager1.Alert("请输入新密码!"); } else if (!rx.IsMatch(RadTextBox2.Text)) { RadTextBox2.Text = ""; RadAjaxManager1.Alert("密码格式错误!"); } else if (RadTextBox3.Text == "") { RadAjaxManager1.Alert("请确认密码!"); } else if (RadTextBox2.Text != RadTextBox3.Text) { RadAjaxManager1.Alert("两次密码输入不一致!"); } else { User_Model = Users_Bll.GetModel(UsersInfo.UserID); User_Model.UserPassword = RadTextBox3.Text; //添加数据 Users_Bll.Update(User_Model); Response.Write("<script>alert('修改成功!');window.location.href='../Login.aspx'</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { string path = @"(^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$)"; Regex rx = new Regex(path); string name = "^[a-zA-Z0-9\u4e00-\u9fa5]{1,}$";//字母数字汉字 Regex rxname = new Regex(name); if (RadTextBox2.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入姓名!"); } else if (!rxname.IsMatch(RadTextBox2.Text)) { RadAjaxManager1.Alert("不能输入特殊字符!"); return; } else if (RadTextBox3.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入邮箱!"); } else if (RadDatePicker1.SelectedDate.ToString() == "")//判断是否为空 { RadAjaxManager1.Alert("请输入生日!"); } else if (ddlprovince.SelectedValue == "")//判断是否为空 { RadAjaxManager1.Alert("请输入所在地!"); } else if (ddlcity.SelectedValue == "")//判断是否为空 { RadAjaxManager1.Alert("请输入所在地!"); } else if (RadTextBox6.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入详细地址!"); } else if (!rxname.IsMatch(RadTextBox6.Text)) { RadAjaxManager1.Alert("不能输入特殊字符!"); return; } else if (RadNumericTextBox1.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入会员积分!"); } else if (RadDropDownList1.SelectedValue == "")//判断是否为空 { RadAjaxManager1.Alert("请输入会员等级"); } else if (!rx.IsMatch(RadTextBox3.Text)) { RadTextBox3.Text = ""; RadAjaxManager1.Alert("邮箱格式错误!"); } else { User_Model = Users_Bll.GetModel(Request.QueryString["ID"].ToString()); User_Model.UserRealName = RadTextBox2.Text;//添加数据 User_Model.Province = ddlprovince.SelectedValue; User_Model.City = ddlcity.SelectedValue; User_Model.Address1 = RadTextBox6.Text;//添加数据 User_Model.UserEmail = RadTextBox3.Text; User_Model.UserScore = Convert.ToInt32(RadNumericTextBox1.Text); if (Rad_nan.Checked == true) { User_Model.UserSex = "男"; } else { User_Model.UserSex = "女"; } User_Model.RegistTime = RadDatePicker1.SelectedDate; User_Model.UserGrade = RadDropDownList1.SelectedValue;//添加数据 Users_Bll.Update(User_Model); Response.Write("<script>alert('修改成功!');window.location.href='Backhygl.aspx?ID=" + UsersInfo.UserID + "'</script>"); } }
protected void LinkButton1_Click(object sender, EventArgs e) { string phone = @"((^13[0-9]{1}[0-9]{8}|^15[0-9]{1}[0-9]{8}|^14[0-9]{1}[0-9]{8}|^16[0-9]{1}[0-9]{8}|^17[0-9]{1}[0-9]{8}|^18[0-9]{1}[0-9]{8}|^19[0-9]{1}[0-9]{8})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)"; Regex rxphone = new Regex(phone); string yb = @"^[1-9]\d{5}$"; Regex rxyb = new Regex(yb); Maticsoft.Model.Orders molOrders = Orders_Bll.GetModel(Request.QueryString["OrderID"].ToString()); if (RadTextBox1.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入收件人姓名!"); } else if (ddlprovince.SelectedValue == "")//判断是否为空 { RadAjaxManager1.Alert("请输入收件人地址!"); } else if (ddlcity.SelectedValue == "")//判断是否为空 { RadAjaxManager1.Alert("请输入收件人地址!"); } else if (RadTextBox2.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入收件人详细地址!"); } else if (RadTextBox3.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入收件人邮编!"); } else if (RadTextBox4.Text == "")//判断是否为空 { RadAjaxManager1.Alert("请输入收件人联系电话!"); } else if (RadDropDownList1.SelectedValue == "")//判断是否为空 { RadAjaxManager1.Alert("请选择送货方式!"); } else if (RadDropDownList2.SelectedValue == "")//判断是否为空 { RadAjaxManager1.Alert("请选择支付方式!"); } else if (!rxyb.IsMatch(RadTextBox3.Text)) { RadTextBox3.Text = ""; RadAjaxManager1.Alert("邮编格式错误!"); } else if (!rxphone.IsMatch(RadTextBox4.Text)) { RadTextBox4.Text = ""; RadAjaxManager1.Alert("手机格式错误!"); } else if (Convert.ToInt32(RadTextBox5.Text) > Convert.ToInt32(Label1.Text)) { RadAjaxManager1.Alert("积分不足!"); } else { Maticsoft.Model.Users molUsers = Users_Bll.GetModel(UsersInfo.UserID); molOrders.AddresseeName = RadTextBox1.Text; molOrders.AddresseeAddress = ddlprovince.SelectedValue; molOrders.AddresseeAddress += ddlcity.SelectedValue; molOrders.AddresseeAddress += RadTextBox2.Text; molOrders.AddresseeZipCode = RadTextBox3.Text; molOrders.AddresseePhone = RadTextBox4.Text; molOrders.Delivery = RadDropDownList1.SelectedText; molOrders.PayType = RadDropDownList2.SelectedText; molOrders.Message = TextArea1.InnerText; molOrders.OrderState = "已付款待发货"; molUsers.UserScore = molUsers.UserScore - Convert.ToInt32(RadTextBox5.Text); Users_Bll.Update(molUsers); molOrders.TotalMoney = molOrders.TotalMoney - Convert.ToDecimal(Convert.ToInt32(RadTextBox5.Text) * 0.01); Orders_Bll.Update(molOrders); Response.Write("<script>alert('提交成功!');window.location.href='ForeOrderShow.aspx?OrderID=" + Request.QueryString["OrderID"] + "'</script>"); } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtUsername.Text.Trim().Length == 0) { strErr += "Username不能为空!\\n"; } if (this.txtUserPassword.Text.Trim().Length == 0) { strErr += "UserPassword不能为空!\\n"; } if (this.txtUserRealName.Text.Trim().Length == 0) { strErr += "UserRealName不能为空!\\n"; } if (this.txtUserSex.Text.Trim().Length == 0) { strErr += "UserSex不能为空!\\n"; } if (this.txtUserEmail.Text.Trim().Length == 0) { strErr += "UserEmail不能为空!\\n"; } if (this.txtUserGrade.Text.Trim().Length == 0) { strErr += "UserGrade不能为空!\\n"; } if (!PageValidate.IsNumber(txtUserScore.Text)) { strErr += "UserScore格式错误!\\n"; } if (this.txtProvince.Text.Trim().Length == 0) { strErr += "Province不能为空!\\n"; } if (this.txtCity.Text.Trim().Length == 0) { strErr += "City不能为空!\\n"; } if (this.txtAddress1.Text.Trim().Length == 0) { strErr += "Address1不能为空!\\n"; } if (this.txtUserIdentity.Text.Trim().Length == 0) { strErr += "UserIdentity不能为空!\\n"; } if (!PageValidate.IsDateTime(txtRegistTime.Text)) { strErr += "RegistTime格式错误!\\n"; } if (this.txtPhone.Text.Trim().Length == 0) { strErr += "Phone不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string UserID = this.lblUserID.Text; string Username = this.txtUsername.Text; string UserPassword = this.txtUserPassword.Text; string UserRealName = this.txtUserRealName.Text; string UserSex = this.txtUserSex.Text; string UserEmail = this.txtUserEmail.Text; string UserGrade = this.txtUserGrade.Text; int UserScore = int.Parse(this.txtUserScore.Text); string Province = this.txtProvince.Text; string City = this.txtCity.Text; string Address1 = this.txtAddress1.Text; string UserIdentity = this.txtUserIdentity.Text; DateTime RegistTime = DateTime.Parse(this.txtRegistTime.Text); string Phone = this.txtPhone.Text; Maticsoft.Model.Users model = new Maticsoft.Model.Users(); model.UserID = UserID; model.Username = Username; model.UserPassword = UserPassword; model.UserRealName = UserRealName; model.UserSex = UserSex; model.UserEmail = UserEmail; model.UserGrade = UserGrade; model.UserScore = UserScore; model.Province = Province; model.City = City; model.Address1 = Address1; model.UserIdentity = UserIdentity; model.RegistTime = RegistTime; model.Phone = Phone; Maticsoft.BLL.Users bll = new Maticsoft.BLL.Users(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }