📄 delivertypeui.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.ExtendedControls;
using PowerEasy.Model.Shop;
using PowerEasy.Shop;
using PowerEasy.Web.UI;
using PowerEasy.WebSite.Controls;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class DeliverTypeUI : AdminPage
{
protected Button BtnAddAreaType4;
protected ExtendedButton BtnSave;
protected CheckBox ChkIsDefault;
protected ExtendedGridView GdvAreaType4;
protected HiddenField HdnArrArea;
protected Label LblChargeMsg1;
protected Label LblChargeMsg2;
protected Label LblTitle;
protected Literal LtrShowStep;
protected Panel PnlAddCharge;
protected Panel PnlChargeType1;
protected Panel PnlChargeType2;
protected Panel PnlReleaseCharge;
protected RadioButtonList RadlChargeType;
protected RadioButtonList RadlReleaseType;
protected ScriptManager ScriptManager1;
protected ExtendedSiteMapPath SmpNavigator;
protected TaxRateSetting TaxRateSet;
protected HtmlGenericControl TbodyFixMoney;
protected HtmlGenericControl TbodyTaxRate;
protected HtmlGenericControl TbodyTaxRateSetting;
protected TextBox TxtarrArea;
protected TextBox TxtCharge_Max;
protected TextBox TxtCharge_Max1;
protected TextBox TxtCharge_Max2;
protected TextBox TxtCharge_Max3;
protected TextBox TxtCharge_Max5;
protected TextBox TxtCharge_Min;
protected TextBox TxtCharge_Min1;
protected TextBox TxtCharge_Min2;
protected TextBox TxtCharge_Min3;
protected TextBox TxtCharge_Min5;
protected TextBox TxtCharge_Percent;
protected TextBox TxtChargePerUnit1;
protected TextBox TxtChargePerUnit2;
protected TextBox TxtChargePerUnit3;
protected TextBox TxtChargePerUnit5;
protected TextBox TxtFixMoney;
protected TextBox TxtIntro;
protected TextBox TxtMaxCharge;
protected TextBox TxtMinMoney1;
protected TextBox TxtMinMoney2;
protected TextBox TxtMinMoney3;
protected TextBox TxtReleaseCharge;
protected TextBox TxtTaxRate;
protected TextBox TxtTypeName;
protected TextBox TxtWeight_Min1;
protected TextBox TxtWeight_Min2;
protected TextBox TxtWeight_Min3;
protected TextBox TxtWeight_Min5;
protected TextBox TxtWeightPerUnit1;
protected TextBox TxtWeightPerUnit2;
protected TextBox TxtWeightPerUnit3;
protected TextBox TxtWeightPerUnit5;
protected System.Web.UI.UpdatePanel UpdatePanel1;
protected System.Web.UI.UpdatePanel Upnl;
protected CompareValidator ValcChargePercent;
protected CompareValidator ValcFixMoney;
protected RangeValidator ValrTaxRate;
protected PowerEasy.Controls.RequiredFieldValidator ValrTypeName;
protected void BtnAddAreaType4_Click(object sender, EventArgs e)
{
}
protected void BtnSave_Click(object sender, EventArgs e)
{
bool flag;
int typeId = 0;
if (this.ViewState["action"].ToString() == "Add")
{
typeId = DeliverType.GetMaxTypeId() + 1;
}
string selectedValue = this.RadlChargeType.SelectedValue;
if (selectedValue != null)
{
if (!(selectedValue == "0"))
{
if (selectedValue == "1")
{
flag = this.SaveWithChargeType1(typeId);
goto Label_009A;
}
if (selectedValue == "2")
{
flag = this.SaveWithChargeType0(typeId);
goto Label_009A;
}
if (selectedValue == "3")
{
flag = this.SaveWithFixMoneyType(typeId);
goto Label_009A;
}
}
else
{
flag = this.SaveWithChargeType0(typeId);
goto Label_009A;
}
}
flag = false;
Label_009A:
if (flag)
{
BasePage.ResponseRedirect("DeliverTypeManage.aspx");
}
else
{
AdminPage.WriteErrMsg("添加送货方式失败,请检查输入的数据格式是否有误!");
}
}
private void FillControls()
{
if (!string.IsNullOrEmpty(BasePage.RequestString("TypeId")))
{
DeliverTypeInfo deliverTypeById = DeliverType.GetDeliverTypeById(BasePage.RequestInt32("TypeId"));
this.ViewState["orderId"] = deliverTypeById.OrderId;
this.ViewState["typeId"] = deliverTypeById.TypeId;
this.TxtTypeName.Text = DataSecurity.HtmlDecode(deliverTypeById.TypeName);
this.TxtIntro.Text = DataSecurity.HtmlDecode(deliverTypeById.Intro);
this.RadlChargeType.SelectedValue = deliverTypeById.ChargeType.ToString();
if (deliverTypeById.ChargeType == 3)
{
this.TxtFixMoney.Text = deliverTypeById.MinMoney1.ToString("0.00");
}
this.ChkIsDefault.Checked = deliverTypeById.IsDefault;
this.RadlReleaseType.SelectedValue = deliverTypeById.ReleaseType.ToString();
this.TxtMinMoney1.Text = deliverTypeById.MinMoney1.ToString("0.00");
this.TxtReleaseCharge.Text = deliverTypeById.ReleaseCharge.ToString("0.00");
this.TxtMinMoney2.Text = deliverTypeById.MinMoney2.ToString("0.00");
this.TxtMaxCharge.Text = deliverTypeById.MaxCharge.ToString("0.00");
this.TxtMinMoney3.Text = deliverTypeById.MinMoney3.ToString("0.00");
this.TxtCharge_Min.Text = deliverTypeById.ChargeMin.ToString("0.00");
this.TxtCharge_Max.Text = deliverTypeById.ChargeMax.ToString("0.00");
this.TxtCharge_Percent.Text = deliverTypeById.ChargePercent.ToString();
this.TaxRateSet.TaxRate = deliverTypeById.IncludeTax;
this.TxtTaxRate.Text = deliverTypeById.TaxRate.ToString();
IList<DeliverChargeInfo> deliverChargeListByTypeId = DeliverCharge.GetDeliverChargeListByTypeId(deliverTypeById.TypeId);
for (int i = 0; i < deliverChargeListByTypeId.Count; i++)
{
int areaType = deliverChargeListByTypeId[i].AreaType;
if (areaType != 4)
{
((TextBox) this.PnlChargeType1.FindControl("TxtCharge_Min" + areaType)).Text = deliverChargeListByTypeId[i].ChargeMin.ToString("0.00");
((TextBox) this.PnlChargeType1.FindControl("TxtWeight_Min" + areaType)).Text = deliverChargeListByTypeId[i].WeightMin.ToString();
((TextBox) this.PnlChargeType1.FindControl("TxtCharge_Max" + areaType)).Text = deliverChargeListByTypeId[i].ChargeMax.ToString("0.00");
((TextBox) this.PnlChargeType1.FindControl("TxtChargePerUnit" + areaType)).Text = deliverChargeListByTypeId[i].ChargePerUnit.ToString("0.00");
((TextBox) this.PnlChargeType1.FindControl("TxtWeightPerUnit" + areaType)).Text = deliverChargeListByTypeId[i].WeightPerUnit.ToString();
if (areaType == 2)
{
this.TxtarrArea.Text = deliverChargeListByTypeId[i].ArrArea;
this.HdnArrArea.Value = deliverChargeListByTypeId[i].ArrArea;
}
}
}
this.GdvAreaType4DataBind(deliverTypeById.TypeId);
}
}
protected void GdvAreaType4_RowCommand(object sender, CommandEventArgs e)
{
if (e.CommandName == "Del")
{
if (DeliverCharge.DeleteById(DataConverter.CLng(e.CommandArgument)))
{
this.GdvAreaType4DataBind(DataConverter.CLng(this.ViewState["typeId"]));
}
else
{
AdminPage.WriteErrMsg("操作失败!");
}
}
}
private void GdvAreaType4DataBind(int typeId)
{
IList<DeliverChargeInfo> deliverChargeListByAreaType = DeliverCharge.GetDeliverChargeListByAreaType(typeId, 4);
this.GdvAreaType4.DataSource = deliverChargeListByAreaType;
this.GdvAreaType4.DataBind();
ArrayList provinceList = DeliverCharge.GetProvinceList();
for (int i = 0; i < deliverChargeListByAreaType.Count; i++)
{
string[] strArray = deliverChargeListByAreaType[i].ArrArea.Split(new char[] { ',' });
for (int k = 0; k < strArray.Length; k++)
{
provinceList.Remove(strArray[k]);
}
}
provinceList.Remove(SiteConfig.ShopConfig.Province);
StringBuilder builder = new StringBuilder();
for (int j = 0; j < provinceList.Count; j++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -