📄 consignmentmanage.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.Common;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.ExtendedControls;
using PowerEasy.Model.Shop;
using PowerEasy.Shop;
using PowerEasy.Web.UI;
using System;
using System.Drawing;
using System.Web.UI.WebControls;
public class ConsignmentManage : AdminPage
{
protected ExtendedButton BtnReceived;
protected ExtendedButton BtnReturnGoods;
protected ExtendedButton BtnSendGoods;
protected HiddenField HdnOrderId;
protected Label LblAddress;
protected Label LblAgentName;
protected Label LblBeginDate;
protected Label LblClientName;
protected Label LblContacterName;
protected Label LblDeliverStatus;
protected Label LblDeliverType;
protected Label LblEmail;
protected Label LblInputTime;
protected Label LblInvoiceContent;
protected Label LblInvoiced;
protected Label LblMobile;
protected Label LblMoneyTotal;
protected Label LblNeedInvoice;
protected Label LblOrderNum;
protected Label LblPaymentType;
protected Label LblPhone;
protected Label LblRemark;
protected Label LblStatus;
protected Label LblUserName;
protected Label LblZipCode;
private bool m_HavePracticality;
protected Repeater RptOrderItem;
protected ExtendedSiteMapPath SmpNavigator;
private void BindControl(OrderInfo info)
{
this.LblOrderNum.Text = info.OrderNum;
this.LblUserName.Text = info.UserName;
this.LblAgentName.Text = info.AgentName;
this.LblClientName.Text = info.ClientName;
if (info.NeedInvoice)
{
this.LblNeedInvoice.Text = "√";
}
else
{
this.LblNeedInvoice.Text = "\x00d7";
this.LblNeedInvoice.ForeColor = Color.FromArgb(0xff0000);
}
if (info.Invoiced)
{
this.LblInvoiced.Text = "√";
}
else
{
this.LblInvoiced.Text = "\x00d7";
this.LblInvoiced.ForeColor = Color.FromArgb(0xff0000);
}
this.LblStatus.Text = BasePage.EnumToHtml<OrderStatus>(info.Status);
switch (Order.GetPayStatus(info))
{
case PayStatus.WaitForPay:
this.LblMoneyTotal.Text = BasePage.EnumToHtml<PayStatus>(PayStatus.WaitForPay);
break;
case PayStatus.ReceivedEarnest:
this.LblMoneyTotal.Text = BasePage.EnumToHtml<PayStatus>(PayStatus.ReceivedEarnest);
break;
case PayStatus.Payoff:
this.LblMoneyTotal.Text = BasePage.EnumToHtml<PayStatus>(PayStatus.Payoff);
break;
}
this.LblDeliverStatus.Text = BasePage.EnumToHtml<DeliverStatus>(info.DeliverStatus);
if (info.NeedInvoice)
{
this.LblInvoiceContent.Text = info.InvoiceContent;
}
this.LblRemark.Text = info.Remark;
this.LblBeginDate.Text = info.BeginDate.ToString("yyyy-MM-dd");
this.LblInputTime.Text = Convert.ToString(info.InputTime);
this.LblContacterName.Text = info.ContacterName;
this.LblAddress.Text = info.Address;
this.LblZipCode.Text = info.ZipCode;
this.LblMobile.Text = info.Mobile;
this.LblPhone.Text = info.Phone;
this.LblEmail.Text = info.Email;
this.LblPaymentType.Text = PaymentType.GetPaymentTypeById(info.PaymentType).TypeName;
this.LblDeliverType.Text = DeliverType.GetDeliverTypeById(info.DeliverType).TypeName;
if (this.m_HavePracticality)
{
switch (info.DeliverStatus)
{
case DeliverStatus.Preparative:
this.BtnSendGoods.Visible = true;
return;
case DeliverStatus.Consignment:
this.BtnReceived.Visible = true;
return;
case DeliverStatus.SignIn:
this.BtnReturnGoods.Visible = true;
return;
default:
return;
}
}
}
protected void BtnReceived_Click(object sender, EventArgs e)
{
int orderId = DataConverter.CLng(this.HdnOrderId.Value);
if (orderId == 0)
{
AdminPage.WriteErrMsg("请指定OrderID!", "OrderManage.aspx" + this.HdnOrderId.Value);
}
else if (Order.Recieve(orderId))
{
BasePage.ResponseRedirect("ConsignmentManage.aspx?OrderID=" + this.HdnOrderId.Value);
}
else
{
AdminPage.WriteErrMsg("签收失败!", "OrderManage.aspx" + this.HdnOrderId.Value);
}
}
protected void BtnReturnGoods_Click(object sender, EventArgs e)
{
BasePage.ResponseRedirect("ReturnGoods.aspx?ReturnUrl=ConsignmentManage.aspx&OrderID=" + this.HdnOrderId.Value);
}
protected void BtnSendGoods_Click(object sender, EventArgs e)
{
BasePage.ResponseRedirect("SendGoods.aspx?ReturnUrl=ConsignmentManage.aspx&OrderID=" + this.HdnOrderId.Value);
}
protected string GetProductName(string productName, string property, int saleType)
{
property = string.IsNullOrEmpty(property) ? string.Empty : ("(" + property + ")");
return (productName + property + Product.ShowProductType(saleType));
}
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.IsPostBack)
{
OrderInfo orderById = Order.GetOrderById(BasePage.RequestInt32("OrderID"));
if (!orderById.IsNull)
{
this.RptOrderItem.DataSource = OrderItem.GetInfoListByOrderId(orderById.OrderId);
this.RptOrderItem.DataBind();
this.HdnOrderId.Value = orderById.OrderId.ToString();
this.BindControl(orderById);
}
else
{
AdminPage.WriteErrMsg("<li>未找到对应的订单信息!</li>");
}
}
}
protected void RptOrderItem_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
OrderItemInfo dataItem = (OrderItemInfo) e.Item.DataItem;
Literal literal = e.Item.FindControl("LtrServiceTerm") as Literal;
literal.Text = dataItem.ServiceTerm.ToString() + BasePage.EnumToHtml<ServiceTermUnit>(dataItem.ServiceTermUnit);
if (!string.IsNullOrEmpty(dataItem.Remark))
{
((Label) e.Item.FindControl("LblItemRemark")).Text = "查看";
((Label) e.Item.FindControl("LblItemRemark")).ToolTip = dataItem.Remark;
}
if (!this.m_HavePracticality && Product.CharacterIsExists(dataItem.ProductCharacter, ProductCharacter.Practicality))
{
this.m_HavePracticality = true;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -