首次推送
This commit is contained in:
266
Mtxfw.VipSite/bindproducts.aspx.cs
Normal file
266
Mtxfw.VipSite/bindproducts.aspx.cs
Normal file
@@ -0,0 +1,266 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
namespace Mtxfw.VipSite
|
||||
{
|
||||
public partial class bindproducts : Mtxfw.Utility.MemberBase
|
||||
{
|
||||
public Mtxfw.DAL.Ads daoAds = new Mtxfw.DAL.Ads();
|
||||
public Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
|
||||
public Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
|
||||
public Mtxfw.DAL.Article daoArt = new Mtxfw.DAL.Article();
|
||||
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
||||
public int gtype = 0;
|
||||
public string strTitle = "绑定商品";
|
||||
#region 判断页面是否刷新
|
||||
private bool _refreshState;
|
||||
private bool _isRefresh;
|
||||
|
||||
/// <summary>
|
||||
/// 判断页面是否刷新
|
||||
/// </summary>
|
||||
public bool IsRefresh
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isRefresh;
|
||||
}
|
||||
}
|
||||
protected override void LoadViewState(object savedState)
|
||||
{
|
||||
object[] allStates = (object[])savedState;
|
||||
base.LoadViewState(allStates[0]);
|
||||
_refreshState = (bool)allStates[1];
|
||||
_isRefresh = _refreshState == (bool)Session["__ISREFRESH"];
|
||||
}
|
||||
protected override object SaveViewState()
|
||||
{
|
||||
Session["__ISREFRESH"] = _refreshState;
|
||||
object[] allStates = new object[2];
|
||||
allStates[0] = base.SaveViewState();
|
||||
allStates[1] = !_refreshState;
|
||||
return allStates;
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
string hostname = Request.Url.Host;
|
||||
gtype = new DAL.host().GetId(hostname);
|
||||
if (!IsPostBack)
|
||||
{
|
||||
|
||||
if (Session["IFPassword"] == null)
|
||||
{
|
||||
Response.Redirect("/Member_IFPassword.aspx?Url=/bindproducts.aspx");
|
||||
}
|
||||
if (IFStores != 1)
|
||||
{
|
||||
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
||||
}
|
||||
if (MemberJS.IndexOf("视频管理") == -1)
|
||||
{
|
||||
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
||||
}
|
||||
Page.Title = "绑定商品 - " + GetWebName;
|
||||
|
||||
Select_Bind();
|
||||
Data_Bind();
|
||||
}
|
||||
MyPager.PageChanged += delegate(object s, EventArgs ex)
|
||||
{
|
||||
Data_Bind();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
protected void Data_Bind()
|
||||
{
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
String cls = Request.QueryString["cls"];
|
||||
String type = Request.QueryString["type"];
|
||||
String morn = Request.QueryString["morn"];
|
||||
String key = HttpUtility.UrlDecode(Request.QueryString["key"]);
|
||||
String state = HttpUtility.UrlDecode(Request.QueryString["state"]);
|
||||
|
||||
|
||||
sb.Append("gtype=" + gtype + " And IFDelete=0");
|
||||
if (!String.IsNullOrEmpty(type))
|
||||
{
|
||||
sb.Append(" And utype='" + type + "'");
|
||||
Drop_type.SelectedValue = type;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(" And utype='0'");
|
||||
Drop_type.SelectedValue = "0";
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(cls) && cls != "-1")
|
||||
{
|
||||
Drop_Cls.SelectedValue = cls;
|
||||
cls = cls.Split('|')[0];
|
||||
sb.Append("and (P_CATEGORY=" + cls + " Or P_CATEGORYs like '%," + cls + ",%')");
|
||||
}
|
||||
if (!String.IsNullOrEmpty(state) && state != "所有状态")
|
||||
{
|
||||
if (state == "已处理" || state == "未处理")
|
||||
{
|
||||
sb.Append("and P_State='" + state + "'");
|
||||
}
|
||||
if (state == "推荐")
|
||||
{
|
||||
sb.Append("and P_COMMENDF=1");
|
||||
}
|
||||
|
||||
if (state == "品牌")
|
||||
{
|
||||
sb.Append("and P_ppproduct=1");
|
||||
}
|
||||
if (state == "最新上架")
|
||||
{
|
||||
sb.Append("and P_cjproduct=1");
|
||||
}
|
||||
if (state == "热销")
|
||||
{
|
||||
sb.Append("and P_jpproduct=1");
|
||||
}
|
||||
if (state == "置顶")
|
||||
{
|
||||
sb.Append("and P_IFTop=1");
|
||||
}
|
||||
Drop_State.Text = state;
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(key))
|
||||
{
|
||||
Drop_MorN.SelectedValue = morn;
|
||||
if (morn=="2")
|
||||
{
|
||||
sb.Append(" and P_UserID in(Select b.id from user_info b where b.gtype=" + gtype + " and b.UserName like '%" + key + "%')");
|
||||
}
|
||||
else if (morn == "1")
|
||||
{
|
||||
sb.Append(" and P_bianhao like '%" + key + "%'");
|
||||
}
|
||||
else if (morn == "0")
|
||||
{
|
||||
sb.Append(" and P_NAME like '%" + key + "%'");
|
||||
}
|
||||
}
|
||||
|
||||
string groupby = "";
|
||||
string strOrder = " P_HITED desc";
|
||||
int Start = 0;
|
||||
int Limit = 0;
|
||||
Int32 Recount = 0;
|
||||
MyPager.PageSize = 50;
|
||||
Start = MyPager.PageSize * (MyPager.CurrentPageIndex - 1);
|
||||
Limit = MyPager.PageSize;
|
||||
DataSet dss = daoProduct.GetDataSet(groupby, strOrder, "P_ID,utype,P_images,P_CATEGORYs,P_NAME,P_bianhao,P_VIP_P,P_Inventory,P_HITED,P_COMMENDF,P_ppproduct,P_jpproduct,P_cjproduct,P_ADDATE,P_State", "", sb.ToString(), Start, Limit, out Recount);
|
||||
Mtxfw.Utility.Tools.ToBind(Repeater1, dss.Tables[1]);
|
||||
MyPager.RecordCount = Recount;
|
||||
if (MyPager.RecordCount == 0)
|
||||
{
|
||||
MyPager.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Select_Bind()
|
||||
{
|
||||
string remark = null;
|
||||
int lbConut2 = 0;
|
||||
DataSet ds = daoCategory.GetList("gtype=" + gtype + " and ttype=0 Order By C_Layer asc,C_LinkID asc");
|
||||
foreach (DataRowView drv2 in ds.Tables[0].DefaultView)//绑定根结点
|
||||
{
|
||||
lbConut2 = Convert.ToInt32(drv2["C_Layer"].ToString());
|
||||
string LB = drv2["C_NAME"].ToString();
|
||||
string Pid = drv2["C_PARENTID"].ToString();
|
||||
string id = drv2["C_ID"].ToString();
|
||||
remark = "";
|
||||
for (int l = 0; l < lbConut2; l++)
|
||||
{
|
||||
remark += "├";
|
||||
}
|
||||
if (lbConut2 == 1)
|
||||
{
|
||||
Drop_Cls.Items.Add(new ListItem(remark + LB, id + "|" + Pid));
|
||||
}
|
||||
else
|
||||
{
|
||||
int jj = 0;
|
||||
for (int j = 0; j < Drop_Cls.Items.Count; j++)
|
||||
{
|
||||
string[] lbpid = Drop_Cls.Items[j].Value.Split('|');
|
||||
if (lbpid.Length == 2)
|
||||
{
|
||||
if (Pid == lbpid[1])
|
||||
{
|
||||
jj += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < Drop_Cls.Items.Count; j++)
|
||||
{
|
||||
string[] lbpid = Drop_Cls.Items[j].Value.Split('|');
|
||||
if (lbpid.Length == 2)
|
||||
{
|
||||
if (Pid == lbpid[0])
|
||||
{
|
||||
if (jj != 0)
|
||||
{
|
||||
Drop_Cls.Items.Insert(j + jj + 1, new ListItem(remark + LB, id + "|" + Pid));
|
||||
}
|
||||
else
|
||||
{
|
||||
Drop_Cls.Items.Insert(j + 1, new ListItem(remark + LB, id + "|" + Pid));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ds.Clear();
|
||||
Drop_Cls.Items.Insert(0, new ListItem("==请选择分类==", ""));
|
||||
}
|
||||
|
||||
|
||||
public void Createtopproduct()
|
||||
{
|
||||
|
||||
}
|
||||
protected string getje(Double je,int P_Inventory, int id)
|
||||
{
|
||||
string strje = "";
|
||||
DataSet ds = new DAL.P_Guige().GetList("ttype=0 And G_PID=" + id);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
strje +="";
|
||||
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
|
||||
{
|
||||
int G_ID = int.Parse(Dr["G_ID"].ToString());
|
||||
string G_Name = Dr["G_Name"].ToString();
|
||||
Double G_JG = Double.Parse(Dr["G_JG"].ToString());
|
||||
Double G_JF = Double.Parse(Dr["G_JF"].ToString());
|
||||
int G_KC = int.Parse(Dr["G_KC"].ToString());
|
||||
strje += G_Name + " " + G_JG + "元/" + G_KC + "<br>";
|
||||
}
|
||||
strje += "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
strje += je.ToString("f2") + "元/" + P_Inventory;
|
||||
}
|
||||
ds.Clear();
|
||||
return strje;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user