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_appdeclaration_edit : Mtxfw.Utility.MemberBase { public Mtxfw.DAL.user_proxy daoproxy = new Mtxfw.DAL.user_proxy(); 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, tid; public int gtype = 0; protected override void OnLoad(EventArgs e) { base.OnLoad(e); string hostname = Request.Url.Host; try { if (!String.IsNullOrEmpty(Request.QueryString["ID"])) { int ID = int.Parse(Request.QueryString["ID"].ToString()); if (Session["IFPassword"] == null) { Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_appdeclaration_edit.aspx" + HttpUtility.UrlEncode("?") + "id=" + ID); } if (IFStores != 1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (MemberJS.IndexOf("代理列表") == -1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (!IsPostBack) { Page.Title = "修改代理 - " + config.webName; if (Request.UrlReferrer != null) { Hidd_Url.Value = Request.UrlReferrer.ToString(); } } Mtxfw.Model.user_proxy pmodel = daoproxy.GetModel(ID); if (pmodel != null) { Mtxfw.Model.user_info model = daoUser.GetModel(pmodel.MemberId); if (model != null) { if (!IsPostBack) { Text_UserName.Text = model.UserName; Text_Tel.Text = pmodel.ATel.ToString(); address.Text = pmodel.AAddress; tradingname.Text = (pmodel.IFFill == 1 ? pmodel.Agentrading : ""); lng.Value = pmodel.longitude.ToString("0.######"); lat.Value = pmodel.latitude.ToString("0.######"); for (int i = 0; i < Drop_LB.Items.Count; i++) { if (pmodel.AgenLevel.ToString() == Drop_LB.Items[i].Value) { Drop_LB.Items[i].Selected = true; } else { Drop_LB.Items[i].Selected = false; } } Mtxfw.Model.user_info umodel = daoUser.GetModel(pmodel.AgentRecomID); if (umodel != null) { Text_RecomName.Text = umodel.UserName; } } pid = pmodel.Agenprovince; cid = pmodel.Agencity; qid = pmodel.Agencounty; tid = (pmodel.IFFill == 1 ? "-1" : pmodel.Agentrading); } } } } catch (Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/aerr.txt", err.ToString()); } Btn_Update.Click += Update_Info; } 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_proxy pmodel = daoproxy.GetModel(ID); if (pmodel != null) { Mtxfw.Model.user_info umodel = daoUser.GetModel(pmodel.MemberId); if (umodel != null) { int DLJB = Convert.ToInt32(Drop_LB.SelectedItem.Value); 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(); } string tradingarea = ""; if (Request.Form["select_t"] != null) { tradingarea = Request.Form["select_t"].ToString(); } bool b = true; Text_Tel.Text = Text_Tel.Text.Trim(); if (Text_Tel.Text == "") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } if (b) { if (DLJB == 5) { if (strProvince == "" || strProvince == "-1") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } if (b) { if (daoproxy.GetCount("gtype=" + gtype + " and TType=1 And Id<>" + pmodel.Id + " And AgenLevel=" + DLJB + " And Agenprovince='" + strProvince + "'") > 0) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } } else if (DLJB == 4) { if (strProvince == "" || strProvince == "-1") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } if (b) { if (strCity == "" || strCity == "-1") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } if (b) { if (daoproxy.GetCount("gtype="+ gtype + " and TType=1 And Id<>" + pmodel.Id + " And AgenLevel=" + DLJB + " And Agenprovince='" + strProvince + "' And Agencity='" + strCity + "'") > 0) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } } else if (DLJB == 3) { if (strProvince == "" || strProvince == "-1") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } if (b) { if (strCity == "" || strCity == "-1") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } if (b) { if (strCounty == "" || strCounty == "-1") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } if (b) { if (daoproxy.GetCount("gtype=" + gtype + " and TType=1 And Id<>" + pmodel.Id + " And AgenLevel=" + DLJB + " And Agenprovince='" + strProvince + "' And Agencity='" + strCity + "' And Agencounty='" + strCounty + "'") > 0) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } } else if (DLJB == 2) { if (strProvince == "" || strProvince == "-1") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } if (b) { if (strCity == "" || strCity == "-1") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } if (b) { if (strCounty == "" || strCounty == "-1") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } if (b) { if (tradingarea == "") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } if (b) { if (daoproxy.GetCount("gtype=" + gtype + " and TType=1 And Id<>" + pmodel.Id + " And AgenLevel=" + DLJB + " And Agenprovince='" + strProvince + "' And Agencity='" + strCity + "' And Agencounty='" + strCounty + "' And Agentrading='" + tradingarea + "'") > 0) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } } } int AgentRecomID = 0; Text_RecomName.Text = Text_RecomName.Text.Trim(); if (Text_RecomName.Text != "") { string strid = daoUser.Getzd("id", "IFStores=0 and UserName='" + Text_RecomName.Text + "'").ToString(); if (strid != "") { AgentRecomID = Convert.ToInt32(strid); } } /*string strumoney24 = Text_DQ.Text.Trim(); if (b) { if (strumoney24 == "") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } else { if (!System.Text.RegularExpressions.Regex.IsMatch(strumoney24, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strumoney24, @"^-?\d+$")) { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } }*/ if (b) { 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 = "修改代理" + umodel.UserName + ",区域:" + new DAL.province().GetProvince(strProvince) + new DAL.city().GetCity(strCity) + new DAL.county().GetCounty(strCounty); logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); pmodel.AgenLevel = DLJB; pmodel.AgentRecomID = AgentRecomID; pmodel.Agenprovince = strProvince; pmodel.Agencity = strCity; pmodel.Agencounty = strCounty; pmodel.IFFill = (tradingarea == "-1" ? 1 : 0); pmodel.Agentrading = (tradingarea == "-1" ? tradingname.Text.Trim() : tradingarea);; pmodel.AAddress = address.Text; pmodel.ATel = Text_Tel.Text; pmodel.latitude = 0; pmodel.longitude = 0; daoproxy.Update(pmodel); if (pmodel.seef == 1) { daoUser.UpdateuLevel("uLevel25", DLJB, umodel.Id); } ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } } } } } }