169 lines
6.8 KiB
C#
169 lines
6.8 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Text;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
namespace Mtxfw.shop
|
||
{
|
||
public partial class Member_users_add0 : Mtxfw.Utility.MemberBase
|
||
{
|
||
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
|
||
protected String pid, cid, qid;
|
||
protected override void OnLoad(EventArgs e)
|
||
{
|
||
base.OnLoad(e);
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
|
||
Page.Title = "绑定VIP会员 - " + config.webName;
|
||
|
||
}
|
||
Btn_Update.Click += Update_Info;
|
||
}
|
||
|
||
protected String GetProvince()
|
||
{
|
||
StringBuilder sb = new StringBuilder();
|
||
Mtxfw.DAL.province daoPro = new Mtxfw.DAL.province();
|
||
System.Data.DataSet Ds = daoPro.GetCacheList("", "1=1 Order by Id Asc", "Province");
|
||
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
|
||
foreach (System.Data.DataRow Dr in Dt.Rows)
|
||
{
|
||
sb.Append("<option value=\"" + Dr["ProvinceID"] + "\">" + Dr["ProvinceName"] + "</option>\r\n");
|
||
}
|
||
return sb.ToString();
|
||
}
|
||
|
||
protected void Update_Info(object s, EventArgs ex)
|
||
{
|
||
bool b = true;
|
||
Text_card.Text = Text_card.Text.Trim();
|
||
Text_UserName.Text = Text_UserName.Text.Trim();
|
||
Text_Password.Text = Text_Password.Text.Trim();
|
||
//Text_Password2.Text = Text_Password2.Text.Trim();
|
||
//Text_conform_Password2.Text = Text_conform_Password2.Text.Trim();
|
||
if (String.IsNullOrEmpty(Text_card.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('请输入卡号!');</script>");
|
||
}
|
||
else
|
||
{
|
||
if (!daoUser.IsExistsCar(Text_card.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('卡号不存在,请换一个再试!');</script>");
|
||
}
|
||
}
|
||
if (String.IsNullOrEmpty(Text_UserName.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('请输入用户名!');</script>");
|
||
}
|
||
if (b)
|
||
{
|
||
if (!String.IsNullOrEmpty(Text_UserName.Text))
|
||
{
|
||
if (daoUser.IsExists(Text_UserName.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('用户名已被其它用户占用,请换一个再试!');</script>");
|
||
}
|
||
}
|
||
}
|
||
if (b)
|
||
{
|
||
if (String.IsNullOrEmpty(Text_Password.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('请输入密码!');</script>");
|
||
}
|
||
}
|
||
|
||
if (b)
|
||
{
|
||
if (!String.IsNullOrEmpty(Text_Email.Text))
|
||
{
|
||
if (daoUser.IsExistsEmail(Text_Email.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('您的Email已被其它用户占用,请换一个再试!');</script>");
|
||
}
|
||
}
|
||
}
|
||
if (b)
|
||
{
|
||
if (!String.IsNullOrEmpty(Text_Phone.Text))
|
||
{
|
||
if (!System.Text.RegularExpressions.Regex.IsMatch(Text_Phone.Text.Trim(), @"^[1]+[3,4,5,8]+\d{9}"))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('手机号码格式填写不正确,只能输入11位数字!');</script>");
|
||
}
|
||
}
|
||
}
|
||
int ContactID = Card;
|
||
string ContactIDS = "";
|
||
|
||
SqlDataReader dr = daoUser.GetUserName(ContactID);
|
||
if (dr.HasRows)
|
||
{
|
||
if (dr.Read())
|
||
{
|
||
ContactID = int.Parse(dr["Id"].ToString());
|
||
ContactIDS = dr["ContactIDS"].ToString();
|
||
}
|
||
}
|
||
dr.Close();
|
||
|
||
|
||
if (b)
|
||
{
|
||
|
||
Mtxfw.Model.user_info model = daoUser.GetModel(Text_card.Text);
|
||
if (model != null)
|
||
{
|
||
if (IFStores > 0)
|
||
{
|
||
if (model.IFStores > 0)
|
||
{
|
||
model.MemberCard = Text_card.Text;
|
||
model.UserName = Text_UserName.Text;
|
||
model.Password = Mtxfw.Utility.Security.EncryptString(Text_Password.Text);
|
||
model.Password2 = model.Password;
|
||
|
||
model.Phone = Text_Phone.Text;
|
||
model.Email = Text_Email.Text;
|
||
|
||
model.ContactID = ContactID;
|
||
if (ContactIDS == "")
|
||
{
|
||
model.ContactIDS = "," + ContactID.ToString() + ",";
|
||
}
|
||
else
|
||
{
|
||
model.ContactIDS = ContactIDS + ContactID.ToString() + ",";
|
||
}
|
||
daoUser.Update(model);
|
||
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('恭喜您,绑定成功!');location.replace('/Member_users0.aspx');</script>");
|
||
}
|
||
else
|
||
{
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('您的卡号不是VIP会员,绑定错误!');location.replace('/Member_users0.aspx');</script>");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('您的权限不足,绑定错误!');location.replace('/Member_users0.aspx');</script>");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |