Files
g.hnyhua.cn/Mtxfw.shop/Member_Product_Pics.aspx.cs
2026-02-07 15:48:27 +08:00

150 lines
5.8 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;
using System.Data.SqlClient;
namespace Mtxfw.shop
{
public partial class Member_Product_Pics : Mtxfw.Utility.MemberBase
{
public Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
public Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
public string strimg = "", stryanse = "";
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
Data_Bind();
}
Btn_Return.Click += delegate(object s, EventArgs ex)
{
Response.Redirect(Hidd_Url.Value);
};
}
protected void Data_Bind()
{
if (!String.IsNullOrEmpty(Request.QueryString["ID"]))
{
Hidd_ID.Value = Request.QueryString["ID"].ToString();
}
if (!String.IsNullOrEmpty(Request.QueryString["ypage"]))
{
Hidd_Url.Value = "/Member_Product_List.aspx?page=" + Request.QueryString["ypage"].ToString();
}
else
{
Hidd_Url.Value = "/Member_Product_List.aspx";
}
if (!String.IsNullOrEmpty(Hidd_ID.Value))
{
int UpdateID = Convert.ToInt32(Hidd_ID.Value);
Mtxfw.Model.P_Product model = daoProduct.GetModel(UpdateID);
if (model != null)
{
if (!String.IsNullOrEmpty(model.P_images))
{
if (model.P_images.IndexOf("|") == -1)
{
Session["jiaoyouPhoto"] = model.P_images + "|";
}
else
{
Session["jiaoyouPhoto"] = model.P_images;
}
}
else
{
Session["jiaoyouPhoto"] = "";
}
string stryanseoption = "";
if (model.P_yanse != "")
{
stryanse = model.P_yanse;
string[] Ayanse = stryanse.Split('|');
for (int i = 0; i < Ayanse.Length; i++)
{
if (Ayanse[i] != "")
{
string[] stra = Ayanse[i].Split('#');
stryanseoption += "<option value='" + Ayanse[i] + "'>" + stra[0] + "</option>";
}
}
}
if (Session["jiaoyouPhoto"] != null)
{
Y_Certificate.Value = Session["jiaoyouPhoto"].ToString();
string[] strjiaoyouPhotoA = Session["jiaoyouPhoto"].ToString().Split('|');
for (int i = 0; i < strjiaoyouPhotoA.Length; i++)
{
if (strjiaoyouPhotoA[i] != "")
{
string[] strPhoto = strjiaoyouPhotoA[i].Split(',');
strimg += "<li id='picli" + i + "'><img src='" + Mtxfw.Utility.Common.GetCoverPic(strPhoto[0], "100x100", "cut") + "' width='100'/><a href=javascript:DeletePic('" + strjiaoyouPhotoA[i] + "'," + i + ")>删除</a>";
if (i == 0)
{
strimg += "&nbsp;已设为封面";
}
else
{
strimg += "&nbsp;<a href=javascript:SetPic('" + strjiaoyouPhotoA[i] + "'," + i + ")>设为封面</a>";
}
if (stryanseoption != "")
{
string stryanseoption2 = stryanseoption;
if (strPhoto.Length == 2)
{
if (strPhoto[1] != "")
{
stryanseoption2 = stryanseoption.Replace("value='" + strPhoto[1] + "'", "value='" + strPhoto[1] + "' selected");
}
}
strimg += "<br><select id='select_yanse_" + i + "'>" + stryanseoption2 + "</select>";
}
strimg += "</li>";
}
}
}
}
}
}
protected string cyanse(string stryanse, string selyanse)
{
string stryanseoption = "";
string[] Ayanse = stryanse.Split('|');
for (int j = 0; j < Ayanse.Length; j++)
{
if (Ayanse[j] != "")
{
string[] stra = Ayanse[j].Split('#');
if (selyanse == Ayanse[j])
{
stryanseoption += "<option value='" + Ayanse[j] + "' selected>" + stra[0] + "</option>";
}
else
{
stryanseoption += "<option value='" + Ayanse[j] + "'>" + stra[0] + "</option>";
}
}
}
return stryanseoption;
}
}
}