412 lines
21 KiB
C#
412 lines
21 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;
|
||
namespace Mtxfw.VipSite
|
||
{
|
||
public partial class admin_member_info : Mtxfw.Utility.MemberBase
|
||
{
|
||
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
||
Mtxfw.DAL.user_bank daoBank = new Mtxfw.DAL.user_bank();
|
||
protected String pid, cid, qid, shdz="";
|
||
Mtxfw.DAL.province daoPro = new Mtxfw.DAL.province();
|
||
public int gtype = 0, utype=0;
|
||
protected override void OnLoad(EventArgs e)
|
||
{
|
||
base.OnLoad(e);
|
||
string hostname = Request.Url.Host;
|
||
|
||
if (!IsPostBack)
|
||
{
|
||
if (Session["IFPassword"] == null)
|
||
{
|
||
Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_List.aspx");
|
||
}
|
||
if (IFStores != 1)
|
||
{
|
||
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
||
}
|
||
if (MemberJS.IndexOf("修改会员资料") == -1)
|
||
{
|
||
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
||
}
|
||
Page.Title = "查看会员信息 - " + config.webName;
|
||
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;
|
||
|
||
Hidd_Url.Value = Request.UrlReferrer.ToString();
|
||
if (!String.IsNullOrEmpty(Request.QueryString["ID"]))
|
||
{
|
||
int ID = int.Parse(Request.QueryString["ID"].ToString());
|
||
/*DataSet ds = new Mtxfw.DAL.user_address().GetList1("id,Contactname,Contacttel,Address,IFIndex,Province,City,County,Zipcode", "UserID=" + ID + " Order By IFIndex Desc");
|
||
if (ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
|
||
{
|
||
string _id = Dr["id"].ToString();
|
||
string contact = Dr["Contactname"].ToString();
|
||
string tel = Dr["Contacttel"].ToString();
|
||
string detail = Dr["Address"].ToString();
|
||
string Province = Dr["Province"].ToString();
|
||
string City = Dr["City"].ToString();
|
||
string County = Dr["County"].ToString();
|
||
string IFIndex = Dr["IFIndex"].ToString();
|
||
shdz += contact + " " + tel + " " + new DAL.province().GetProvince(Province) + new DAL.city().GetCity(City) + new DAL.county().GetCounty(County) + detail + "<br>";
|
||
|
||
}
|
||
}
|
||
ds.Clear();*/
|
||
Mtxfw.Model.user_info model = daoUser.GetModel(ID);
|
||
if (model != null)
|
||
{
|
||
utype = Convert.ToInt32(model.utype);
|
||
if (!IsPostBack)
|
||
{
|
||
if (model.uLevel16 > 0)
|
||
{
|
||
grPanel.Visible = false;
|
||
qyPanel.Visible = true;
|
||
}
|
||
else
|
||
{
|
||
grPanel.Visible = true;
|
||
qyPanel.Visible = false;
|
||
}
|
||
string[] stra = config.webbank.Split('|');
|
||
foreach (string str in stra)
|
||
{
|
||
if (str != "")
|
||
{
|
||
DropBank.Items.Add(new ListItem(str, str));
|
||
}
|
||
}
|
||
Text_UserName.Text = model.UserName;
|
||
if (!String.IsNullOrEmpty(model.UserPic))
|
||
{
|
||
Img_Img1.Visible = true;
|
||
Img_Img1.Src = Mtxfw.Utility.Common.GetCoverPic(model.UserPic, "100x100", config.webImgMode);
|
||
Hidd_Img1.Value = model.UserPic;
|
||
}
|
||
else
|
||
{
|
||
Img_Img1.Visible = false;
|
||
Hidd_Img1.Value = String.Empty;
|
||
}
|
||
|
||
Text_RealName.Text = model.RealName;
|
||
Text_NCName.Text = model.NCName;
|
||
Text_Phone.Text = model.Phone;
|
||
Text_SFZ.Text = model.SFZ;
|
||
Text_Pwd1.Text = Mtxfw.Utility.Security.DecryptString(model.Password);
|
||
Text_Pwd2.Text = Mtxfw.Utility.Security.DecryptString(model.Password2);
|
||
Text_KHName.Text = model.ProductName;
|
||
for (int i = 0; i < DropBank.Items.Count; i++)
|
||
{
|
||
if (DropBank.Items[i].Value == model.RealName2)
|
||
{
|
||
DropBank.Items[i].Selected = true;
|
||
}
|
||
else
|
||
{
|
||
DropBank.Items[i].Selected = false;
|
||
}
|
||
}
|
||
Text_BankCard.Text = model.Phone2;
|
||
Text_BankName.Text = model.PostalCode;
|
||
Text_AliAccount.Text = model.AliAccount;
|
||
Text_AliName.Text = model.AliName;
|
||
if (!String.IsNullOrEmpty(model.aliimage))
|
||
{
|
||
aliimage_img.Visible = true;
|
||
aliimage_img.Src = Mtxfw.Utility.Common.GetCoverPic(model.aliimage, "1000x1000", config.webImgMode);
|
||
aliimage_field.Value = model.CompanyPic;
|
||
}
|
||
else
|
||
{
|
||
aliimage_img.Visible = false;
|
||
aliimage_field.Value = String.Empty;
|
||
}
|
||
if (!String.IsNullOrEmpty(model.weixinimage))
|
||
{
|
||
weixinimage_img.Visible = true;
|
||
weixinimage_img.Src = Mtxfw.Utility.Common.GetCoverPic(model.weixinimage, "1000x1000", config.webImgMode);
|
||
weixinimage_field.Value = model.CompanyPic;
|
||
}
|
||
else
|
||
{
|
||
weixinimage_img.Visible = false;
|
||
weixinimage_field.Value = String.Empty;
|
||
}
|
||
Text_qianbao.Text = model.qbaddress;
|
||
Text_DZ.Text = model.MailingAddress;
|
||
CompanyName.Text = model.CompanyName;
|
||
CompanyTel.Text = model.CompanyTel;
|
||
CompanyNumber.Text = model.CompanyNumber;
|
||
if (!String.IsNullOrEmpty(model.CompanyCert))
|
||
{
|
||
Img_Img.Visible = true;
|
||
Img_Img.Src = Mtxfw.Utility.Common.GetCoverPic(model.CompanyCert, "100x100", config.webImgMode);
|
||
Hidd_Img.Value = model.CompanyCert;
|
||
}
|
||
else
|
||
{
|
||
Img_Img.Visible = false;
|
||
Hidd_Img.Value = String.Empty;
|
||
}
|
||
if (!String.IsNullOrEmpty(model.CompanyPic))
|
||
{
|
||
Img_Img0.Visible = true;
|
||
Img_Img0.Src = Mtxfw.Utility.Common.GetCoverPic(model.CompanyPic, "100x100", config.webImgMode);
|
||
Hidd_Img0.Value = model.CompanyPic;
|
||
}
|
||
else
|
||
{
|
||
Img_Img0.Visible = false;
|
||
Hidd_Img0.Value = String.Empty;
|
||
}
|
||
Companyaddress.Text = model.Companyaddress;
|
||
lng.Value = model.Companylongitude.ToString();
|
||
lat.Value = model.Companylatitude.ToString();
|
||
}
|
||
|
||
pid = model.Province;
|
||
cid = model.City;
|
||
qid = model.County;
|
||
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
Btn_Update.Click += Update_Info;
|
||
Btn_updatePwd.Click += Update_Pwd;
|
||
}
|
||
|
||
protected String GetProvince()
|
||
{
|
||
StringBuilder sb = new StringBuilder();
|
||
|
||
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)
|
||
{
|
||
if (!String.IsNullOrEmpty(Request.QueryString["ID"]))
|
||
{
|
||
int ID = int.Parse(Request.QueryString["ID"].ToString());
|
||
Mtxfw.Model.user_info model = daoUser.GetModel(ID);
|
||
bool b = true;
|
||
if (String.IsNullOrEmpty(Text_UserName.Text.Trim()))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('请输入用户名!');</script>");
|
||
}
|
||
else
|
||
{
|
||
Text_UserName.Text = Text_UserName.Text.Trim();
|
||
|
||
if (model.UserName != Text_UserName.Text)
|
||
{
|
||
if (daoUser.IsExists(Text_UserName.Text,gtype))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('用户名已被其它用户占用,请换一个再试!');</script>");
|
||
}
|
||
}
|
||
}
|
||
if (b)
|
||
{
|
||
if (!String.IsNullOrEmpty(Text_Pwd1.Text))
|
||
{
|
||
Text_Pwd1.Text = Text_Pwd1.Text.Trim();
|
||
if (!System.Text.RegularExpressions.Regex.IsMatch(Text_Pwd1.Text, @"^[A-Za-z0-9-]+$") || Text_Pwd1.Text.Length < 6 || Text_Pwd1.Text.Length > 18)
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('登陆密码输入不正确,密码由6-18位数字、字母、中划线組成!')</script>");
|
||
}
|
||
}
|
||
}
|
||
|
||
if (b)
|
||
{
|
||
if (String.IsNullOrEmpty(Text_RealName.Text.Trim()))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('请输入真实姓名!');</script>");
|
||
}
|
||
}
|
||
|
||
string strProvince = "", strCity = "", strCounty = "";
|
||
if (Request.Form["select_p"] != null)
|
||
{
|
||
strProvince = Request.Form["select_p"].ToString();
|
||
}
|
||
if (Request.Form["select_c"] != null)
|
||
{
|
||
strCity = Request.Form["select_c"].ToString();
|
||
}
|
||
if (Request.Form["select_q"] != null)
|
||
{
|
||
strCounty = Request.Form["select_q"].ToString();
|
||
}
|
||
if (b)
|
||
{
|
||
if (String.IsNullOrEmpty(Text_Phone.Text.Trim()))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('请输入手机号码!');</script>");
|
||
}
|
||
else
|
||
{
|
||
if (!System.Text.RegularExpressions.Regex.IsMatch(Text_Phone.Text.Trim(), @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
|
||
{
|
||
b = false;
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('手机号码格式填写不正确,只能输入11位数字!');</script>");
|
||
}
|
||
}
|
||
}
|
||
|
||
if (model != null)
|
||
{
|
||
if (b)
|
||
{
|
||
string editbody = "";
|
||
if (model.Province != strProvince || model.City != strCity || model.County != strCounty)
|
||
{
|
||
model.Province = strProvince;
|
||
model.City = strCity;
|
||
model.County = strCounty;
|
||
}
|
||
if (model.UserName != Text_UserName.Text)
|
||
{
|
||
editbody += " 原用户名" + model.UserName + "改为" + Text_UserName.Text;
|
||
}
|
||
if (model.RealName != Text_RealName.Text)
|
||
{
|
||
editbody += " 原姓名" + model.RealName + "改为" + Text_RealName.Text;
|
||
}
|
||
if (model.Phone != Text_Phone.Text)
|
||
{
|
||
editbody += " 原手机号码" + model.Phone + "改为" + Text_Phone.Text;
|
||
}
|
||
if (model.Phone2 != Text_BankCard.Text)
|
||
{
|
||
editbody += " 原银行卡号" + model.Phone2 + "改为" + Text_BankCard.Text;
|
||
}
|
||
if (model.AliAccount != Text_AliAccount.Text)
|
||
{
|
||
editbody += " 原支付宝" + model.AliAccount + "改为" + Text_AliAccount.Text;
|
||
}
|
||
if (model.qbaddress != Text_qianbao.Text)
|
||
{
|
||
editbody += " 原钱包地址" + model.qbaddress + "改为" + Text_qianbao.Text;
|
||
}
|
||
model.UserName = Text_UserName.Text;
|
||
model.RealName = Text_RealName.Text;
|
||
model.Phone = Text_Phone.Text;
|
||
model.ProductName = Text_KHName.Text;
|
||
model.RealName2 = DropBank.SelectedItem.Value;
|
||
model.Phone2 = Text_BankCard.Text;
|
||
model.PostalCode = Text_BankName.Text;
|
||
model.AliAccount = Text_AliAccount.Text;
|
||
model.AliName = Text_AliName.Text;
|
||
model.qbaddress = Text_qianbao.Text;
|
||
model.SFZ = Text_SFZ.Text;
|
||
Mtxfw.Utility.UploadFile upload1 = new Utility.UploadFile(File_AdsImg1.PostedFile, config.webUpPath, config.webUpType, int.Parse(config.webUpSize));
|
||
if (File_AdsImg1.FileName.Length > 0)
|
||
{
|
||
upload1.StatrUpFile();
|
||
model.UserPic = upload1.UploadPath;
|
||
}
|
||
else model.UserPic = Hidd_Img1.Value;
|
||
Mtxfw.Utility.UploadFile upload = new Utility.UploadFile(aliimage_upload.PostedFile, config.webUpPath, config.webUpType, int.Parse(config.webUpSize));
|
||
if (aliimage_upload.FileName.Length > 0)
|
||
{
|
||
upload.StatrUpFile();
|
||
model.aliimage = upload.UploadPath;
|
||
}
|
||
else model.aliimage = aliimage_field.Value;
|
||
Mtxfw.Utility.UploadFile upload0 = new Utility.UploadFile(weixinimage_upload.PostedFile, config.webUpPath, config.webUpType, int.Parse(config.webUpSize));
|
||
if (weixinimage_upload.FileName.Length > 0)
|
||
{
|
||
upload0.StatrUpFile();
|
||
model.weixinimage = upload0.UploadPath;
|
||
}
|
||
else model.weixinimage = weixinimage_field.Value;
|
||
model.NCName = Text_NCName.Text;
|
||
|
||
model.MailingAddress = Text_DZ.Text;
|
||
model.Province = strProvince;
|
||
model.City = strCity;
|
||
model.County = strCounty;
|
||
|
||
|
||
new Mtxfw.DAL.user_info().UpdatePassword("EWMPic", "", model.Id);
|
||
new Mtxfw.DAL.user_info().UpdatePassword("EWMPic2", "", model.Id);
|
||
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
||
logmodel.MemberId = Card;
|
||
logmodel.AddTime = DateTime.Now;
|
||
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
||
logmodel.Body = "修改会员资料,用户名:" + model.UserName + " " + editbody;
|
||
logmodel.UType = 0;
|
||
logmodel.gtype = gtype;
|
||
new DAL.User_CZ_log().Add(logmodel);
|
||
|
||
|
||
if (!String.IsNullOrEmpty(Text_Pwd1.Text))
|
||
{
|
||
model.Password = Mtxfw.Utility.Security.EncryptString(Text_Pwd1.Text);
|
||
daoUser.UpdatePassword("Password", model.Password, model.Id);
|
||
//model.Password2 = model.Password;
|
||
//daoUser.UpdatePassword("Password2", model.Password2, model.Id);
|
||
}
|
||
if (!String.IsNullOrEmpty(Text_Pwd2.Text))
|
||
{
|
||
model.Password2 = Mtxfw.Utility.Security.EncryptString(Text_Pwd2.Text);
|
||
daoUser.UpdatePassword("Password2", model.Password2, model.Id);
|
||
}
|
||
daoUser.Update(model);
|
||
|
||
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('保存成功!');location.replace('" + Hidd_Url.Value + "')</script>");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
protected void Update_Pwd(object s, EventArgs ex)
|
||
{
|
||
if (!String.IsNullOrEmpty(Request.QueryString["ID"]))
|
||
{
|
||
int ID = int.Parse(Request.QueryString["ID"].ToString());
|
||
Mtxfw.Model.user_info model = daoUser.GetModel(ID);
|
||
if (model != null)
|
||
{
|
||
string strPassword = Mtxfw.Utility.Security.EncryptString("111111");
|
||
daoUser.UpdatePassword("Password", strPassword, ID);
|
||
|
||
string strPassword2 = Mtxfw.Utility.Security.EncryptString("222222");
|
||
daoUser.UpdatePassword("Password2", strPassword2, ID);
|
||
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
||
logmodel.MemberId = Card;
|
||
logmodel.AddTime = DateTime.Now;
|
||
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
||
logmodel.Body = "恢复密码,用户名:" + model.UserName + "";
|
||
logmodel.UType = 0;
|
||
logmodel.gtype = gtype;
|
||
new DAL.User_CZ_log().Add(logmodel);
|
||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('恢复密码成功!');location.replace('" + Hidd_Url.Value + "')</script>");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |