📄 presentlist.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Model.Shop;
using PowerEasy.Shop;
using PowerEasy.Web.UI;
using System;
using System.Collections.Generic;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class PresentList : AdminPage
{
protected Button BtnSearch;
protected DataList DlstPresent;
protected HtmlForm form1;
private string m_UploadPath;
protected AspNetPager Pager;
protected Table TbEmpty;
protected TextBox TxtKeyWord;
protected void BtnSearch_Click(object sender, EventArgs e)
{
this.DlstPresentDataBind();
}
protected void DlstPresent_ItemDataBound(object sender, DataListItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
ImageButton button = e.Item.FindControl("Imgbtn") as ImageButton;
LinkButton button2 = e.Item.FindControl("LbtnProductName") as LinkButton;
PresentInfo dataItem = e.Item.DataItem as PresentInfo;
if (!dataItem.IsNull && (button != null))
{
int thumbsWidth = SiteConfig.ThumbsConfig.ThumbsWidth;
int thumbsHeight = SiteConfig.ThumbsConfig.ThumbsHeight;
if (thumbsWidth != 0)
{
button.Width = thumbsWidth;
}
if (thumbsHeight != 0)
{
button.Height = thumbsHeight;
}
if (!string.IsNullOrEmpty(dataItem.PresentPic))
{
button.ImageUrl = this.m_UploadPath + dataItem.PresentPic;
}
else if (!string.IsNullOrEmpty(dataItem.PresentThumb))
{
button.ImageUrl = this.m_UploadPath + dataItem.PresentThumb;
}
button.OnClientClick = this.GetReturnValue(dataItem);
if (button2 != null)
{
button2.Text = dataItem.PresentName;
button2.OnClientClick = this.GetReturnValue(dataItem);
}
}
}
}
private void DlstPresentDataBind()
{
IList<PresentInfo> list = PowerEasy.Shop.Present.GetPresentList((this.Pager.CurrentPageIndex - 1) * this.Pager.PageSize, this.Pager.PageSize, 1, this.TxtKeyWord.Text.Trim());
this.DlstPresent.DataSource = list;
this.Pager.RecordCount = PowerEasy.Shop.Present.GetPresentTotal();
this.DlstPresent.DataBind();
this.DlstPresent.Visible = this.DlstPresent.Items.Count != 0;
this.TbEmpty.Visible = !this.DlstPresent.Visible;
}
private string GetReturnValue(PresentInfo info)
{
return ("ReturnValue('" + info.PresentName + "','" + info.PresentId.ToString() + "')");
}
protected void Page_Load(object sender, EventArgs e)
{
if (!base.ClientScript.IsStartupScriptRegistered("ReturnValue"))
{
string str = BasePage.RequestString("ReturnFunction");
string script = "<script type='text/javascript'>";
script = script + "function ReturnValue(strText ,strValue){";
if (string.IsNullOrEmpty(str))
{
script = (script + "window.opener.document.getElementById('" + BasePage.RequestString("OpenerKey") + "').value=strValue;") + "window.opener.document.getElementById('" + BasePage.RequestString("OpenerText") + "').value=strText;";
}
else
{
script = script + "window.opener." + str + "(strText,strValue);";
}
script = script + "window.close();}" + "</script>";
base.ClientScript.RegisterStartupScript(base.GetType(), "ReturnValue", script);
}
this.m_UploadPath = base.FullBasePath + SiteConfig.SiteOption.UploadDir + "/";
if (!base.IsPostBack)
{
this.Pager.PageSize = 20;
this.DlstPresentDataBind();
}
}
protected void Pager_PageChanged(object sender, PageChangedEventArgs e)
{
this.Pager.CurrentPageIndex = e.NewPageIndex;
this.DlstPresentDataBind();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -