📄 aaaa.aspx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using System.Collections.Generic;
using YXShop.BLL;
using System.Data.Common;
namespace YXShop.Web.Admin.Area
{
public partial class aaaa : System.Web.UI.Page
{
public static string connnectiongString = ConfigurationManager.ConnectionStrings["InfoManageDBConnectionString"].ConnectionString;
public static SqlConnection dbconnection = new SqlConnection(connnectiongString);
Model.Provinces model = new YXShop.Model.Provinces();
Provinces provinces = new Provinces();
protected void Page_Load(object sender, EventArgs e)
{
DataTable ds = this.da(0);
for (int i = 0; i < ds.Rows.Count; i++)
{
datastring(ds.Rows[i]["province_city"].ToString(), ds.Rows[i]["enprovince_city"].ToString(), Convert.ToInt16(ds.Rows[i]["id"]), Convert.ToInt16(ds.Rows[i]["fid"]));
DataTable ds1 = this.da(Convert.ToInt16(ds.Rows[i]["id"]));
if (ds1.Rows.Count > 0)
{
for (int f = 0; f < ds1.Rows.Count; f++)
{
datastring(ds1.Rows[f]["province_city"].ToString(), ds1.Rows[f]["enprovince_city"].ToString(), Convert.ToInt16(ds1.Rows[f]["id"]), Convert.ToInt16(ds1.Rows[f]["fid"]));
DataTable ds2 = this.da(Convert.ToInt16(ds1.Rows[f]["id"]));
if (ds2.Rows.Count > 0)
{
for (int d = 0; d < ds2.Rows.Count; d++)
{
datastring(ds2.Rows[d]["province_city"].ToString(), ds2.Rows[d]["enprovince_city"].ToString(), Convert.ToInt16(ds2.Rows[d]["id"]), Convert.ToInt16(ds2.Rows[d]["fid"]));
}
}
}
}
}
}
protected DataTable da(int ID)
{
string queryString = "Select * From provinceandcity where fid=" + ID + "";
SqlCommand dbCommand = new SqlCommand();
dbCommand.Connection = dbconnection;
dbCommand.CommandType = CommandType.Text;
dbCommand.CommandText = queryString;
SqlDataAdapter da = new SqlDataAdapter(dbCommand);
DataSet ds = new DataSet();
da.Fill(ds, "Result");
return ds.Tables["Result"];
}
protected void datastring(string province_city, string enprovince_city, int id,int fid)
{
string CName = province_city;
string ECName = enprovince_city;
int Depth = 0;
string ParentPath = "";
int OrderID = 0;
int Child = 0;
int ParentID = fid;
string P_ParentPath = "";
int P_Child = 0;
int P_Depth = 0;
List<Model.Provinces> listProvinces = provinces.GetListByColumn("ID", ParentID);
if (listProvinces.Count > 0)
{
P_ParentPath = listProvinces[0].ParentPath;
P_Child = (int)listProvinces[0].Child;
P_Depth = (int)listProvinces[0].Depth;
provinces.Amend(ParentID);
}
model.ID = id;
model.Fid = fid;
OrderID = provinces.GetValue("MaxOrderId", model);
model.IsUse = 1;
model.ParentPath = P_ParentPath + "," + ParentID;
if (string.IsNullOrEmpty(P_ParentPath))
{
model.ParentPath = ParentID.ToString();
}
model.Child = 0;
model.OrderID = OrderID + 1;
model.Province_city = CName;
model.Enprovince_city = ECName;
model.Depth = P_Depth + 1;
model.AddDate = DateTime.Now;
provinces.Create(model);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -