protected void imgSubmit_Click(object sender, ImageClickEventArgs e) { //判断输入格式 if (!String.IsNullOrEmpty(txtCellphone.Text.Trim()) && !Utility.IsCellPhone(txtCellphone.Text.Trim())) { lbCellPhoneError.Text = "手机号码格式不正确!"; return; } if (string.IsNullOrEmpty(txtCellphone.Text.Trim())) { lbCellPhoneError.Text = "手机号码不能为空!"; return; } if (!String.IsNullOrEmpty(txtPhone.Text.Trim()) && !Utility.IsPhone(txtPhone.Text.Trim())) { lbPhoneError.Text = "座机号码格式不正确!"; return; } if (!String.IsNullOrEmpty(txtQQ.Text.Trim()) && !Utility.IsNumeric(txtQQ.Text.Trim())) { lbQQError.Text = "QQ号码应该都是数字!"; return; } if (!String.IsNullOrEmpty(txtEmail.Text.Trim()) && !Utility.IsEmail(txtEmail.Text.Trim())) { lbQQError.Text = "Email格式不正确!"; return; } if (!String.IsNullOrEmpty(txtZIPCode.Text.Trim()) && !Utility.IsZIPCode(txtZIPCode.Text.Trim())) { lbZIPError.Text = "邮编格式不正确!"; return; } //相同手机号码只能添加一次 if (BuyerBLL.CheckTheSameHPNoIsExit(Users.Nick, txtCellphone.Text.Trim())) { lbMsg.Text = "手机号码重复,系统已经存在该号码!"; lbMsg.ForeColor = Color.Red; txtCellphone.Focus(); return; } Buyers objBuyer = new Buyers(); long tick = DateTime.Now.Ticks; Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32)); objBuyer.BuyerId = Convert.ToInt64(ran.Next().ToString()); objBuyer.SELLER_ID = Users.Nick; objBuyer.BuyerNick = txtNick.Text.Trim(); objBuyer.Buyer_reallName = txtRealName.Text.Trim(); objBuyer.CellPhone = txtCellphone.Text.Trim(); objBuyer.Phone = txtPhone.Text.Trim(); objBuyer.QQ = txtQQ.Text.Trim(); objBuyer.MSN = txtMSN.Text.Trim(); objBuyer.ZipCode = txtZIPCode.Text.Trim(); objBuyer.Email = txtEmail.Text.Trim(); objBuyer.SinaWeibo = txtsinaWeibo.Text.Trim(); objBuyer.QQWeibo = txtQQWeibo.Text.Trim(); objBuyer.BuyerProvince = drpArea.SelectedValue.ToString(); objBuyer.City = txtCity.Text.Trim(); objBuyer.birthDay = datebirthday.Value.ToString(); objBuyer.BuyerType = "2"; try { if (BuyerBLL.AddBuyerBySeller(objBuyer)) { lbMsg.Text = "会员信息添加成功!"; lbMsg.ForeColor = Color.Blue; txtCellphone.Focus(); txtCellphone.Text = ""; } } catch (Exception ex) { lbMsg.Text = "添加会员失败!"; ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } }