📄 ordersearch.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Shop
{
using PowerEasy.Accessories;
using PowerEasy.Controls;
using PowerEasy.Enumerations;
using PowerEasy.Model.Accessories;
using PowerEasy.Model.Shop;
using PowerEasy.ModelControls;
using PowerEasy.Shop;
using PowerEasy.Web.UI;
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
public class OrderSearch : AdminPage
{
protected Button BtnExportExcel;
protected Button BtnSearch;
protected RadioButtonList RadlDeliverStatus;
protected RadioButtonList RadlOrderStatus;
protected RadioButtonList RadlOrderType;
protected RadioButtonList RadlPayStatus;
protected CrmSelectControl SelectFunctionary;
protected ExtendedSiteMapPath SmpNavigator;
protected TextBox TxtAddress;
protected TextBox TxtAgentName;
protected TextBox TxtBeginDate;
protected TextBox TxtBeginId;
protected TextBox TxtClientName;
protected TextBox TxtContacterName;
protected TextBox TxtEmail;
protected TextBox TxtEndDate;
protected TextBox TxtEndId;
protected TextBox TxtInvoice;
protected TextBox TxtMaxMoney;
protected TextBox TxtMemo;
protected TextBox TxtMinMoney;
protected TextBox TxtMobile;
protected TextBox TxtOrderNum;
protected TextBox TxtPhone;
protected TextBox TxtProductName;
protected TextBox TxtRemark;
protected TextBox TxtUserName;
protected DateValidator VdateBeginDate;
protected DateValidator VdateEndDate;
protected void BtnExportExcel_Click(object sender, EventArgs e)
{
IList<OrderInfo> list = Order.GetList(0, 0x7fffffff, "20", "0", this.GetKeywords(), "outExcel");
StringBuilder builder = new StringBuilder();
base.Response.Clear();
base.Response.AppendHeader("content-disposition", "attachment;filename=OrderList.xls");
base.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
base.Response.ContentType = "application/vnd.xls";
builder.Append("<table border='0' cellspacing='1' style='border-collapse: collapse;table-layout:fixed' id='AutoNumber1' height='32'><tr>");
builder.Append("<td align='center'><b>订单编号</b></td>");
builder.Append("<td align='center'><b>客户名称</b></td>");
builder.Append("<td align='center'><b>用户名</b></td>");
builder.Append("<td align='center'><b>下单时间</b></td>");
builder.Append("<td align='center'><b>订单金额</b></td>");
builder.Append("<td align='center'><b>收款金额</b></td>");
builder.Append("<td align='center'><b>需要发票</b></td>");
builder.Append("<td align='center'><b>已开发票</b></td>");
builder.Append("<td align='center'><b>发票信息</b></td>");
builder.Append("<td align='center'><b>订单状态</b></td>");
builder.Append("<td align='center'><b>付款状态</b></td>");
builder.Append("<td align='center'><b>物流状态</b></td>");
builder.Append("<td align='center'><b>收货人姓名</b></td>");
builder.Append("<td align='center'><b>联系电话</b></td>");
builder.Append("<td align='center'><b>收货人地址</b></td>");
builder.Append("<td align='center'><b>邮政编码</b></td>");
builder.Append("<td align='center'><b>收货人邮箱</b></td>");
builder.Append("<td align='center'><b>收货人手机</b></td>");
builder.Append("<td align='center'><b>代 理 商</b></td>");
builder.Append("<td align='center'><b>购买日期</b></td>");
builder.Append("<td align='center'><b>购买商品</b></td>");
builder.Append("<td align='center'><b>付款方式</b></td>");
builder.Append("<td align='center'><b>送货方式</b></td>");
builder.Append("<td align='center'><b>备注/留言</b></td></tr>");
foreach (OrderInfo info in list)
{
builder.Append("<tr>");
builder.Append("<td align='center'>" + info.OrderNum + "</td>");
builder.Append("<td align='center'>" + info.ClientName + "</td>");
builder.Append("<td align='center'>" + info.UserName + "</td>");
builder.Append("<td align='center'>" + info.InputTime.Date + "</td>");
builder.Append("<td align='center'>" + info.MoneyTotal + "</td>");
builder.Append("<td align='center'>" + info.MoneyReceipt + "</td>");
if (info.NeedInvoice)
{
builder.Append("<td align='center'>是</td>");
}
else
{
builder.Append("<td align='center'>否</td>");
}
if (info.NeedInvoice && info.Invoiced)
{
builder.Append("<td align='center'>是</td>");
}
else
{
builder.Append("<td align='center'>否</td>");
}
builder.Append("<td align='center'>" + info.InvoiceContent.ToString() + "</td>");
builder.Append("<td align='center'>" + BasePage.EnumToHtml<OrderStatus>(info.Status) + "</td>");
if (info.MoneyTotal > info.MoneyReceipt)
{
if (info.MoneyReceipt > 0M)
{
builder.Append("<td align='center'>" + BasePage.EnumToHtml<PayStatus>(PayStatus.ReceivedEarnest) + "</td>");
}
else
{
builder.Append("<td align='center'>" + BasePage.EnumToHtml<PayStatus>(PayStatus.WaitForPay) + "</td>");
}
}
else
{
builder.Append("<td align='center'>" + BasePage.EnumToHtml<PayStatus>(PayStatus.Payoff) + "</td>");
}
builder.Append("<td align='center'>" + BasePage.EnumToHtml<DeliverStatus>(info.DeliverStatus) + "</td>");
builder.Append("<td align='center'>" + info.ContacterName + "</td>");
builder.Append("<td align='center'>" + info.Phone + "</td>");
builder.Append("<td align='center'>" + info.Address + "</td>");
builder.Append("<td align='center'>" + info.ZipCode + "</td>");
builder.Append("<td align='center'>" + info.Email + "</td>");
builder.Append("<td align='center'>" + info.Mobile + "</td>");
builder.Append("<td align='center'>" + info.AgentName + "</td>");
builder.Append("<td align='center'>" + info.BeginDate.Date + "</td>");
builder.Append("<td align='center'>商品名称</td>");
builder.Append("<td align='center'>" + info.PaymentType + "</td>");
builder.Append("<td align='center'>" + info.DeliverType + "</td>");
builder.Append("<td align='center'>" + info.Remark + "</td>");
builder.Append("</tr>");
}
base.Response.Write(builder.ToString());
base.Response.End();
}
protected void BtnSearch_Click(object sender, EventArgs e)
{
BasePage.ResponseRedirect("OrderList.aspx?SearchType=20&KeyWord=" + this.GetKeywords());
}
private string GetKeywords()
{
string str = this.TxtBeginId.Text.Trim().Replace("|", "");
string str2 = this.TxtEndId.Text.Trim().Replace("|", "");
string str3 = this.TxtBeginDate.Text.Trim().Replace("|", "");
string str4 = this.TxtEndDate.Text.Trim().Replace("|", "");
string str5 = this.TxtMinMoney.Text.Trim().Replace("|", "");
string str6 = this.TxtMaxMoney.Text.Trim().Replace("|", "");
string selectedValue = this.RadlOrderStatus.SelectedValue;
string str8 = this.RadlPayStatus.SelectedValue;
string str9 = this.RadlDeliverStatus.SelectedValue;
string str10 = this.TxtOrderNum.Text.Trim().Replace("|", "");
string str11 = this.TxtClientName.Text.Trim().Replace("|", "");
string str12 = this.TxtUserName.Text.Trim().Replace("|", "");
string str13 = this.TxtAgentName.Text.Trim().Replace("|", "");
string str14 = this.TxtContacterName.Text.Trim().Replace("|", "");
string str15 = this.TxtAddress.Text.Trim().Replace("|", "");
string str16 = this.TxtPhone.Text.Trim().Replace("|", "");
string str17 = this.TxtMobile.Text.Trim().Replace("|", "");
string str18 = this.TxtRemark.Text.Trim().Replace("|", "");
string str19 = this.TxtProductName.Text.Trim().Replace("|", "");
string str20 = this.RadlOrderType.SelectedValue;
string text = this.SelectFunctionary.Text;
string str22 = this.TxtEmail.Text.Trim().Replace("|", "");
string str23 = this.TxtInvoice.Text.Replace("|", "");
string str24 = this.TxtMemo.Text.Replace("|", "");
return string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}|{21}|{22}|{23}", new object[] {
str, str2, str3, str4, str5, str6, selectedValue, str8, str9, str10, str11, str12, str13, str14, str15, str16,
str17, str18, str19, str20, text, str22, str23, str24
});
}
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.IsPostBack)
{
ChoicesetValueInfo item = new ChoicesetValueInfo();
item.DataTextField = "所有类型";
item.DataValueField = -1;
ChoicesetValueInfoCollection dictionaryFieldValueByName = Choiceset.GetDictionaryFieldValueByName("PE_Orders", "OrderType");
dictionaryFieldValueByName.Add(item);
this.RadlOrderType.DataSource = dictionaryFieldValueByName;
this.RadlOrderType.DataBind();
this.RadlOrderType.SelectedValue = "-1";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -