186 lines
9.2 KiB
C#
186 lines
9.2 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_appdeclaration2_edit : Mtxfw.Utility.MemberBase
|
|
{
|
|
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;
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
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");
|
|
}
|
|
Page.Title = "修改提货点 - " + config.webName;
|
|
|
|
Hidd_Url.Value = Request.UrlReferrer.ToString();
|
|
|
|
/*DataSet ds = daoUser.GetList1("id,UserName", "uutype='0' And UserState='正常' And IFStores=0 And uLevel2=2 And ShippingID=1");
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
|
|
{
|
|
int UID = int.Parse(Dr["id"].ToString());
|
|
string UserName = Dr["UserName"].ToString();
|
|
Drop_SDLS.Items.Add(new ListItem(UserName, UID.ToString()));
|
|
}
|
|
}
|
|
ds.Clear();*/
|
|
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_Name.Text = pmodel.AName;
|
|
Text_Tel.Text = pmodel.ATel;
|
|
|
|
address.Text = pmodel.AAddress;
|
|
tradingname.Text = (pmodel.IFFill == 1 ? pmodel.Agentrading : "");
|
|
ycoo.Value = pmodel.longitude.ToString("0.######");
|
|
xcoo.Value = pmodel.latitude.ToString("0.######");
|
|
}
|
|
pid = pmodel.Agenprovince;
|
|
cid = pmodel.Agencity;
|
|
qid = pmodel.Agencounty;
|
|
tid = (pmodel.IFFill == 1 ? "-1" : pmodel.Agentrading);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
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)
|
|
{
|
|
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;
|
|
if (b)
|
|
{
|
|
|
|
if (strProvince == "" || strProvince == "-1")
|
|
{
|
|
b = false;
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('省份必须选择!');</script>");
|
|
}
|
|
if (b)
|
|
{
|
|
if (strCity == "" || strCity == "-1")
|
|
{
|
|
b = false;
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('城市必须选择!');</script>");
|
|
}
|
|
}
|
|
if (b)
|
|
{
|
|
if (strCounty == "" || strCounty == "-1")
|
|
{
|
|
b = false;
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('区县必须选择!');</script>");
|
|
}
|
|
}
|
|
if (b)
|
|
{
|
|
if (tradingarea == "")
|
|
{
|
|
b = false;
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('街道/乡镇必须选择或填写!');</script>");
|
|
}
|
|
}
|
|
/*if (b)
|
|
{
|
|
if (daoproxy.GetCount("gtype=" + gtype + " and TType=0 and Id<>" + pmodel.Id + " And AgenLevel=0 And Agenprovince='" + strProvince + "' And Agencity='" + strCity + "' And Agencounty='" + strCounty + "' And Agentrading='" + tradingarea + "'") > 0)
|
|
{
|
|
b = false;
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('所选街道/乡镇已经有提货点!');</script>");
|
|
}
|
|
}*/
|
|
}
|
|
|
|
if (b)
|
|
{
|
|
pmodel.AName = Text_Name.Text;
|
|
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 = (xcoo.Value != "" ? Convert.ToDecimal(xcoo.Value) : 0);
|
|
pmodel.longitude = (ycoo.Value != "" ? Convert.ToDecimal(ycoo.Value) : 0);
|
|
daoproxy.Update(pmodel);
|
|
|
|
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);
|
|
|
|
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('提交成功!');location.replace('" + Hidd_Url.Value + "')</script>");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |