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_add2 : 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 = "开拓运营中心 - " + 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("\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(), "", ""); } else { if (!daoUser.IsExistsCar(Text_card.Text)) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } if (String.IsNullOrEmpty(Text_UserName.Text)) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } if (b) { if (!String.IsNullOrEmpty(Text_UserName.Text)) { if (daoUser.IsExists(Text_UserName.Text)) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } } if (b) { if (String.IsNullOrEmpty(Text_Password.Text)) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } if (b) { if (!String.IsNullOrEmpty(Text_Email.Text)) { if (daoUser.IsExistsEmail(Text_Email.Text)) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } } 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(), "", ""); } } } 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 > 2) { 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); daoUser.UpdateuLevel("IFStores", 2, model.Id); ClientScript.RegisterStartupScript(this.GetType(), "", ""); } else { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } } } } }