235 lines
9.2 KiB
C#
235 lines
9.2 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.UI;
|
|||
|
|
using System.Web.UI.WebControls;
|
|||
|
|
using System.Data;
|
|||
|
|
namespace Mtxfw.WebSite._Admin
|
|||
|
|
{
|
|||
|
|
public partial class Admin_Member_company_add : Mtxfw.Utility.MemberBase
|
|||
|
|
{
|
|||
|
|
public Mtxfw.DAL.business_info daoBus = new Mtxfw.DAL.business_info();
|
|||
|
|
DAL.user_Goods_lb daolb = new DAL.user_Goods_lb();
|
|||
|
|
DAL.user_info daoUser = new DAL.user_info();
|
|||
|
|
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
|||
|
|
public String TitName = String.Empty;
|
|||
|
|
public String CityID = String.Empty;
|
|||
|
|
public String CountyID = String.Empty;
|
|||
|
|
public string strimg = "", strBody = "";
|
|||
|
|
public int gtype = 0;
|
|||
|
|
protected override void OnLoad(EventArgs e)
|
|||
|
|
{
|
|||
|
|
base.OnLoad(e);
|
|||
|
|
string hostname = Request.Url.Host;
|
|||
|
|
gtype = new DAL.host().GetId(hostname);
|
|||
|
|
if (!IsPostBack)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Select_Bind();
|
|||
|
|
Hidd_Url.Value = Request.UrlReferrer.ToString();
|
|||
|
|
}
|
|||
|
|
if (Request.QueryString["action"] == "add")
|
|||
|
|
{
|
|||
|
|
TitName = "添加企业";
|
|||
|
|
if (!IsPostBack)
|
|||
|
|
{
|
|||
|
|
Btn_Update.Visible = false;
|
|||
|
|
if (Session["Province"] != null)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < Drop_Province.Items.Count; i++)
|
|||
|
|
{
|
|||
|
|
if (Drop_Province.Items[i].Value == Session["Province"].ToString())
|
|||
|
|
{
|
|||
|
|
Drop_Province.Items[i].Selected = true;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Drop_Province.Items[i].Selected = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (Session["City"] != null)
|
|||
|
|
{
|
|||
|
|
CityID = Session["City"].ToString();
|
|||
|
|
}
|
|||
|
|
if (Session["County"] != null)
|
|||
|
|
{
|
|||
|
|
CountyID = Session["County"].ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
TitName = "修改企业";
|
|||
|
|
if (!IsPostBack)
|
|||
|
|
{
|
|||
|
|
Btn_Insert.Visible = false;
|
|||
|
|
}
|
|||
|
|
Mtxfw.Model.business_info model = daoBus.GetModel(int.Parse(Request.QueryString["ID"]));
|
|||
|
|
if (model != null)
|
|||
|
|
{
|
|||
|
|
if (!IsPostBack)
|
|||
|
|
{
|
|||
|
|
Text_CompanyName.Text = model.CompanyName;
|
|||
|
|
//Text_ContactPeople.Text = model.ContactPeople;
|
|||
|
|
Text_ContactPhone.Text = model.ContactPhone;
|
|||
|
|
//Drop_Cls.SelectedValue = model.ClsID.ToString();
|
|||
|
|
Drop_Province.SelectedValue = model.Province;
|
|||
|
|
//Text_Busroutes.Text = model.Busroutes;
|
|||
|
|
//Text_WebSize.Text = model.InternetSite;
|
|||
|
|
Text_CompanyAddress.Text = model.Companyaddress;
|
|||
|
|
//Text_BusinessRange.Text = model.BusinessRange;
|
|||
|
|
Hidd_CompanyId.Value = model.CompanyId;
|
|||
|
|
xcoo.Value = model.xcoo;
|
|||
|
|
ycoo.Value = model.ycoo;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
CityID = model.City;
|
|||
|
|
CountyID = model.County;
|
|||
|
|
strBody = model.Introduction;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Btn_Insert.Click += delegate(object s, EventArgs ex)
|
|||
|
|
{
|
|||
|
|
Mtxfw.Model.business_info model = new Mtxfw.Model.business_info();
|
|||
|
|
model.CompanyName = Text_CompanyName.Text;
|
|||
|
|
model.ClsID = 0;
|
|||
|
|
model.ClsnName = "";
|
|||
|
|
model.ClsID2 = 0;
|
|||
|
|
model.ClsnName2 = "";
|
|||
|
|
model.Province = Drop_Province.SelectedItem.Value;
|
|||
|
|
if (Request.Form["Drop_City"] != null)
|
|||
|
|
{
|
|||
|
|
model.City = Request.Form["Drop_City"];
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.City = "";
|
|||
|
|
}
|
|||
|
|
if (Request.Form["Drop_County"] != null)
|
|||
|
|
{
|
|||
|
|
model.County = Request.Form["Drop_County"];
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.County = "";
|
|||
|
|
}
|
|||
|
|
model.Introduction2 = "";
|
|||
|
|
model.Introduction3 = "";
|
|||
|
|
model.Busroutes = "";
|
|||
|
|
Session["Province"] = model.Province;
|
|||
|
|
Session["City"] = model.City;
|
|||
|
|
Session["County"] = model.County;
|
|||
|
|
|
|||
|
|
model.BusinessRange = "";
|
|||
|
|
model.Businesslicense = "";
|
|||
|
|
model.TaxRegistration = "";
|
|||
|
|
model.Companyaddress = Text_CompanyAddress.Text;
|
|||
|
|
model.InternetSite = "";
|
|||
|
|
model.Busroutes = "";
|
|||
|
|
model.Introduction = "";
|
|||
|
|
model.ContactPeople = "";
|
|||
|
|
model.ContactPhone = Text_ContactPhone.Text;
|
|||
|
|
model.ApplyTime = DateTime.Now;
|
|||
|
|
model.CompanyId = "0";
|
|||
|
|
model.Discount = "";
|
|||
|
|
model.xcoo = xcoo.Value;
|
|||
|
|
model.ycoo = ycoo.Value;
|
|||
|
|
model.utype = "0";
|
|||
|
|
model.gtype = gtype;
|
|||
|
|
daoBus.Add(model);
|
|||
|
|
if (Session["UploadFileIng"] != null)
|
|||
|
|
{
|
|||
|
|
string[] stra = Session["UploadFileIng"].ToString().Split(',');
|
|||
|
|
foreach (string str in stra)
|
|||
|
|
{
|
|||
|
|
if (str.Trim() != "")
|
|||
|
|
{
|
|||
|
|
if (model.Introduction.IndexOf(str.Trim()) == -1)
|
|||
|
|
{
|
|||
|
|
if (System.IO.File.Exists(Server.MapPath(str.Trim())))
|
|||
|
|
{
|
|||
|
|
System.IO.File.Delete(Server.MapPath(str.Trim()));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Session.Remove("UploadFileIng");
|
|||
|
|
Response.Redirect(Hidd_Url.Value);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
Btn_Update.Click += delegate(object s, EventArgs ex)
|
|||
|
|
{
|
|||
|
|
Int32 ID = int.Parse(Request.QueryString["ID"]);
|
|||
|
|
Mtxfw.Model.business_info model = daoBus.GetModel(ID);
|
|||
|
|
model.Id = ID;
|
|||
|
|
model.CompanyName = Text_CompanyName.Text;
|
|||
|
|
model.Province = Drop_Province.SelectedItem.Value;
|
|||
|
|
if (Request.Form["Drop_City"] != null)
|
|||
|
|
{
|
|||
|
|
model.City = Request.Form["Drop_City"];
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.City = "";
|
|||
|
|
}
|
|||
|
|
if (Request.Form["Drop_County"] != null)
|
|||
|
|
{
|
|||
|
|
model.County = Request.Form["Drop_County"];
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.County = "";
|
|||
|
|
}
|
|||
|
|
model.Introduction2 = "";
|
|||
|
|
model.Introduction3 = "";
|
|||
|
|
model.Busroutes = "";
|
|||
|
|
|
|||
|
|
|
|||
|
|
model.Companyaddress = Text_CompanyAddress.Text;
|
|||
|
|
model.ContactPhone = Text_ContactPhone.Text;
|
|||
|
|
|
|||
|
|
model.Discount = "";
|
|||
|
|
model.CompanyId = Hidd_CompanyId.Value;
|
|||
|
|
model.xcoo = xcoo.Value;
|
|||
|
|
model.ycoo = ycoo.Value;
|
|||
|
|
daoBus.Update(model);
|
|||
|
|
|
|||
|
|
if (Session["UploadFileIng"] != null)
|
|||
|
|
{
|
|||
|
|
string[] stra = Session["UploadFileIng"].ToString().Split(',');
|
|||
|
|
foreach (string str in stra)
|
|||
|
|
{
|
|||
|
|
if (str.Trim() != "")
|
|||
|
|
{
|
|||
|
|
if (model.Introduction.IndexOf(str.Trim()) == -1)
|
|||
|
|
{
|
|||
|
|
if (System.IO.File.Exists(Server.MapPath(str.Trim())))
|
|||
|
|
{
|
|||
|
|
System.IO.File.Delete(Server.MapPath(str.Trim()));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Session.Remove("UploadFileIng");
|
|||
|
|
Response.Redirect(Hidd_Url.Value);
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected void Select_Bind()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
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)
|
|||
|
|
{
|
|||
|
|
Drop_Province.Items.Add(new ListItem(Dr["ProvinceName"].ToString(), Dr["ProvinceID"].ToString()));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|