📄 productmanage.aspx.cs
字号:
namespace PowerEasy.WebSite.User.Shop
{
using PowerEasy.Common;
using PowerEasy.CommonModel;
using PowerEasy.Contents;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.ExtendedControls;
using PowerEasy.Model.Shop;
using PowerEasy.ModelControls;
using PowerEasy.Shop;
using PowerEasy.Web.UI;
using System;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class ProductManage : DynamicPage
{
protected ExtendedButton BtnBatchMove;
protected ExtendedButton BtnBatchSet;
protected ExtendedButton BtnDelete;
protected ExtendedButton BtnSetBest;
protected ExtendedButton BtnSetElite;
protected ExtendedButton BtnSetHot;
protected ExtendedButton BtnSetNew;
protected ExtendedButton BtnStartSale;
protected ExtendedButton BtnStopBest;
protected ExtendedButton BtnStopElite;
protected ExtendedButton BtnStopHot;
protected ExtendedButton BtnStopNew;
protected ExtendedButton BtnStopSale;
protected HtmlForm form1;
protected ExtendedGridView GdvProductList;
protected HiddenField HdnKeyword;
protected HiddenField HdnListType;
protected HiddenField HdnSearch;
protected HiddenField HdnStatus;
protected ObjectDataSource OdsProductList;
protected void ExecuteCommand(object sender, EventArgs e)
{
Button button = sender as Button;
bool flag = false;
StringBuilder selectList = new StringBuilder("");
selectList = this.GdvProductList.SelectList;
if (((selectList.Length == 0) && (button.CommandName != "BtnBatchSet")) && (button.CommandName != "BtnBatchMove"))
{
DynamicPage.WriteErrMsg("<li>对不起,您没有选择任何商品!</li>", "");
}
else
{
string errorMessage = "操作失败";
switch (button.CommandName)
{
case "BtnDelete":
{
StringBuilder builder2 = new StringBuilder();
string[] strArray = selectList.ToString().Split(new char[] { ',' });
for (int i = 0; i < strArray.Length; i++)
{
if (!ContentManage.UpdateStatus(DataConverter.CLng(strArray[i]), -3))
{
builder2.Append(strArray[i] + ",");
}
}
if (builder2.Length != 0)
{
errorMessage = "商品ID为:" + builder2.ToString().TrimEnd(new char[] { ',' }) + " 的商品存在于订单中,不能删除!";
flag = false;
}
else
{
flag = true;
}
break;
}
case "BtnStartSale":
flag = Product.SetSale(selectList.ToString(), true);
break;
case "BtnStopSale":
flag = Product.SetSale(selectList.ToString(), false);
break;
case "BtnStopHot":
flag = Product.SetHot(selectList.ToString(), false);
break;
case "BtnSetHot":
flag = Product.SetHot(selectList.ToString(), true);
break;
case "BtnStopBest":
flag = Product.SetBest(selectList.ToString(), false);
break;
case "BtnSetBest":
flag = Product.SetBest(selectList.ToString(), true);
break;
case "BtnStopNew":
flag = Product.SetNew(selectList.ToString(), false);
break;
case "BtnSetNew":
flag = Product.SetNew(selectList.ToString(), true);
break;
case "BtnBatchSet":
BasePage.ResponseRedirect("ProductBatchSet.aspx?GeneralIdList=" + selectList);
break;
}
if (flag)
{
DynamicPage.WriteSuccessMsg("<li>操作成功!</li>", "ProductManage.aspx");
}
else
{
DynamicPage.WriteErrMsg(errorMessage, "ProductManage.aspx");
}
}
}
protected void GdvProductList_RowCommand(object sender, CommandEventArgs e)
{
if (e.CommandName == "DeleteProduct")
{
if (ContentManage.UpdateStatus(DataConverter.CLng(e.CommandArgument.ToString()), -3))
{
DynamicPage.WriteSuccessMsg("<li>删除成功!</li>", "ProductManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
}
else
{
DynamicPage.WriteErrMsg("<li>删除失败,存在于订单中的商品不能删除!</li>");
}
}
}
protected void GdvProductList_RowDataBound(object sender, GridViewRowEventArgs e)
{
string str2;
string str5;
if (e.Row.RowType != DataControlRowType.DataRow)
{
return;
}
ProductDetailInfo dataItem = (ProductDetailInfo) e.Row.DataItem;
Label label = e.Row.FindControl("LblProductType") as Label;
Label label2 = e.Row.FindControl("LblProductAttribute") as Label;
Label label3 = e.Row.FindControl("LblProductPrice") as Label;
string s = ("市场参考价:" + dataItem.PriceMarket.ToString("0.00")) + " 当前零售价:" + dataItem.PriceInfo.Price.ToString("0.00");
string str4 = dataItem.PriceInfo.PriceMember.ToString("0.00");
if (str4 != null)
{
if (!(str4 == "-1.00"))
{
if (str4 == "0.00")
{
s = s + " 会员价:使用会员组中设定的折扣比率";
goto Label_012E;
}
}
else
{
s = s + " 会员价:详细设置每个会员组的价格";
goto Label_012E;
}
}
s = s + " 统一会员价格:" + dataItem.PriceInfo.PriceMember.ToString("0.00");
Label_012E:
if ((str5 = dataItem.PriceInfo.PriceAgent.ToString("0.00")) != null)
{
if (!(str5 == "-1.00"))
{
if (str5 == "0.00")
{
s = s + " 代理价:使用代理商组中设定的折扣比率";
goto Label_01B1;
}
}
else
{
s = s + " 代理价:详细设置每个代理商组的价格";
goto Label_01B1;
}
}
s = s + " 统一代理商价格:" + dataItem.PriceInfo.PriceAgent.ToString("0.00");
Label_01B1:
label3.ToolTip = base.Server.HtmlDecode(s);
label3.Text = dataItem.PriceInfo.Price.ToString("0.00");
switch (dataItem.ProductType)
{
case ProductType.Normal:
label.Text = "正常";
break;
case ProductType.Special:
label.Text = "特价";
goto Label_020F;
}
Label_020F:
str2 = "";
if (dataItem.IsBest)
{
str2 = str2 + "<font color=blue>精</font> ";
}
else
{
str2 = str2 + " ";
}
if (dataItem.IsHot)
{
str2 = str2 + "<font color=red>热</font> ";
}
else
{
str2 = str2 + " ";
}
if (dataItem.IsNew)
{
str2 = str2 + "<font color=green>新</font> ";
}
else
{
str2 = str2 + " ";
}
if (!string.IsNullOrEmpty(dataItem.ProductThumb))
{
str2 = str2 + "<font color=blue>图</font>";
}
else
{
str2 = str2 + " ";
}
label2.Text = str2;
LinkImage image = e.Row.FindControl("LinkImageModel") as LinkImage;
string itemIcon = ModelManager.GetCacheModelById(dataItem.ModelId).ItemIcon;
if (string.IsNullOrEmpty(itemIcon))
{
itemIcon = "Product.gif";
}
image.Icon = itemIcon;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!base.IsPostBack)
{
this.HdnListType.Value = BasePage.RequestStringToLower("ListType");
this.HdnStatus.Value = BasePage.RequestStringToLower("status", "100");
this.HdnSearch.Value = "SpeedSearch";
this.HdnKeyword.Value = "20";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -