📄 paymenttypemanage.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.AccessManage;
using PowerEasy.Common;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.Model.Shop;
using PowerEasy.Shop;
using PowerEasy.Web.UI;
using System;
using System.Web.UI.WebControls;
public class PaymentTypeManage : AdminPage
{
protected ExtendedGridView ExtendedGridView1;
protected ObjectDataSource OdsPaymentType;
protected ExtendedSiteMapPath SmpNavigator;
protected void DdlOrderId_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList list = (DropDownList) sender;
int num = Convert.ToInt32(list.SelectedValue, (IFormatProvider) null);
int typeId = Convert.ToInt32(((GridViewRow) list.Parent.NamingContainer).Cells[0].Text, (IFormatProvider) null);
PaymentTypeInfo paymentTypeInfo = new PaymentTypeInfo();
paymentTypeInfo = PaymentType.GetPaymentTypeById(typeId);
paymentTypeInfo.OrderId = num;
if (PaymentType.Update(paymentTypeInfo))
{
this.ExtendedGridView1.DataBind();
}
}
protected void ExtendedGridView1_RowCommand(object sender, CommandEventArgs e)
{
bool flag = false;
int typeId = Convert.ToInt32(e.CommandArgument, null);
PaymentTypeInfo paymentTypeById = PaymentType.GetPaymentTypeById(typeId);
string commandName = e.CommandName;
if (commandName != null)
{
if (!(commandName == "Default"))
{
if (commandName == "Disable")
{
paymentTypeById.IsDisabled = !paymentTypeById.IsDisabled;
flag = PaymentType.Update(paymentTypeById);
goto Label_007C;
}
if (commandName == "Del")
{
flag = PaymentType.Delete(typeId);
goto Label_007C;
}
}
else
{
paymentTypeById.IsDefault = true;
flag = PaymentType.Update(paymentTypeById);
goto Label_007C;
}
}
flag = false;
Label_007C:
if (flag)
{
this.ExtendedGridView1.DataBind();
}
}
protected void ExtendedGridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
PaymentTypeInfo dataItem = e.Row.DataItem as PaymentTypeInfo;
if (dataItem != null)
{
bool flag = RolePermissions.AccessCheck(OperateCode.PaymentTypeManage);
DropDownList list = e.Row.FindControl("DropOrderId") as DropDownList;
LinkButton button = e.Row.FindControl("LbtnDefault") as LinkButton;
LinkButton button2 = e.Row.FindControl("LbtnDisable") as LinkButton;
LinkButton button3 = e.Row.FindControl("LbtnDelete") as LinkButton;
Label label = e.Row.FindControl("LblIntro") as Label;
label.Text = StringHelper.SubString(dataItem.Intro, 0x12, "...");
label.ToolTip = dataItem.Intro;
button.Enabled = flag && !dataItem.IsDefault;
button2.Enabled = flag && !dataItem.IsDefault;
if (flag && !dataItem.IsDefault)
{
button3.Enabled = true;
button3.OnClientClick = "return confirm('是否删除此付款方式?')";
}
else
{
button3.Enabled = false;
}
if (dataItem.IsDisabled)
{
button.Enabled = false;
}
list.Enabled = flag;
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -