193 lines
7.6 KiB
C#
193 lines
7.6 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Text;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
|
||
namespace Mtxfw.shop._Admin
|
||
{
|
||
public partial class admin_member_add : Mtxfw.Utility.AdminPage
|
||
{
|
||
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
|
||
public Mtxfw.DAL.Admin admin = new Mtxfw.DAL.Admin();
|
||
public string strprovince = "";
|
||
#region 判断页面是否刷新
|
||
private bool _refreshState;
|
||
private bool _isRefresh;
|
||
|
||
/// <summary>
|
||
/// 判断页面是否刷新
|
||
/// </summary>
|
||
public bool IsRefresh
|
||
{
|
||
get
|
||
{
|
||
return _isRefresh;
|
||
}
|
||
}
|
||
protected override void LoadViewState(object savedState)
|
||
{
|
||
object[] allStates = (object[])savedState;
|
||
base.LoadViewState(allStates[0]);
|
||
_refreshState = (bool)allStates[1];
|
||
_isRefresh = _refreshState == (bool)Session["__ISREFRESH"];
|
||
}
|
||
protected override object SaveViewState()
|
||
{
|
||
Session["__ISREFRESH"] = _refreshState;
|
||
object[] allStates = new object[2];
|
||
allStates[0] = base.SaveViewState();
|
||
allStates[1] = !_refreshState;
|
||
return allStates;
|
||
}
|
||
#endregion
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
|
||
Hidd_Url.Value = Request.UrlReferrer.ToString();
|
||
|
||
}
|
||
|
||
Btn_Edit.Click += delegate(object s, EventArgs ex)
|
||
{
|
||
try
|
||
{
|
||
string province = "", city = "", county = "", strMemberCard = (daoUser.GetMaxMemberCard() + 1).ToString();
|
||
|
||
bool b = true;
|
||
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_UserName.Text))
|
||
{
|
||
if (daoUser.IsExists(Text_UserName.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('用户名已被其它用户占用,请换一个再试!');</script>");
|
||
}
|
||
}
|
||
else
|
||
{
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('请输入用户名!');</script>");
|
||
}
|
||
}
|
||
if (String.IsNullOrEmpty(Text_Password.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('请输入密码!');</script>");
|
||
}
|
||
|
||
|
||
if (String.IsNullOrEmpty(Text_Phone.Text))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('请输入手机号码!');</script>");
|
||
}
|
||
else
|
||
{
|
||
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 = 0;
|
||
string ContactIDS = "";
|
||
|
||
|
||
if (b)
|
||
{
|
||
|
||
Mtxfw.Model.user_info model = new Mtxfw.Model.user_info();
|
||
model.MemberCard = strMemberCard;
|
||
model.UserName = Text_UserName.Text;
|
||
model.Password = Mtxfw.Utility.Security.EncryptString(Text_Password.Text);
|
||
model.Password2 = model.Password; //Mtxfw.Utility.Security.EncryptString(Text_Password2.Text);
|
||
model.RealName = "";
|
||
model.NCName = "";
|
||
model.UserPic = "";
|
||
model.Sex = "";
|
||
model.SFZ = "";
|
||
model.Mobile = "";
|
||
model.Phone = Text_Phone.Text;
|
||
model.Email = "";
|
||
model.Province = province;
|
||
model.City = city;
|
||
model.County = county;
|
||
model.MailingAddress = "";
|
||
model.PostalCode = "";
|
||
model.QQ = "";
|
||
model.CompanyName = "";
|
||
model.CompanyNumber = "";
|
||
model.CompanyContact = "";
|
||
model.ProductName = "";
|
||
model.UserState = "正常";
|
||
model.RegTime = DateTime.Now;
|
||
model.RegTime2 = DateTime.Now;
|
||
/*SqlDataReader Dr = daoUser.GetUserId(Text_RememberID.Text);
|
||
if (Dr.Read())
|
||
{
|
||
RememberID = int.Parse(Dr["Id"].ToString());
|
||
RememberIDS = Dr["RememberIDS"].ToString();
|
||
}
|
||
Dr.Close();*/
|
||
model.RememberID = 0;
|
||
model.RememberIDS = "";
|
||
|
||
model.SuperiorsID = 0;
|
||
model.SuperiorsIDS = "";
|
||
|
||
model.ContactID = ContactID;
|
||
if (ContactIDS == "")
|
||
{
|
||
model.ContactIDS = "," + ContactID.ToString() + ",";
|
||
}
|
||
else
|
||
{
|
||
model.ContactIDS = ContactIDS + ContactID.ToString() + ",";
|
||
}
|
||
|
||
model.DLRememberID = 0;
|
||
model.DLRememberIDS = "";
|
||
|
||
model.SJRememberID = 0;
|
||
model.SJRememberIDS = "";
|
||
|
||
model.uLevel0 = 0;
|
||
model.uLevel3 = 0;
|
||
int uLevel5 = 0;
|
||
|
||
model.uLevel5 = uLevel5;
|
||
model.utype = "0";
|
||
model.uutype = "0";
|
||
model.openid = "";
|
||
model.opentype = 0;
|
||
model.opentype2 = 0;
|
||
model.refresh_token = "";
|
||
model.refresh_token_time = "";
|
||
model.IFUpUserName = 0;
|
||
model.Id = daoUser.Add(model);
|
||
daoUser.UpdateMoney("umoney30", 10, model.Id);
|
||
Mtxfw.Utility.Tools.Message("添加成功!", Hidd_Url.Value);
|
||
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
}
|
||
};
|
||
}
|
||
|
||
|
||
}
|
||
} |