📄 orderadd.aspx.cs
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using System.Text;
using Shop.Web.UI;
namespace YXShop.Web.Admin.Orderfrom
{
public partial class OrderAdd : System.Web.UI.Page
{
protected string Prvoinces;
BasePage bp = new BasePage();
protected void Page_Load(object sender, EventArgs e)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(YXShop.Web.Admin.Orderfrom.OrderAdd));
if (!PowerTree.PowerPass.isPass("006001002", PowerTree.PowerPanel.PowerType.add))
{
bp = new BasePage();
bp.PageError("对不起,你没有添加订单的权限!", "../index.aspx");
}
if (!IsPostBack)
{
///配送方式
Sendmode();
///省份
Provinces();
Moneymode();
}
}
#region 省份
#region 省
public void Provinces()
{
StringBuilder shtml = new StringBuilder();
YXShop.BLL.Provinces datab = new YXShop.BLL.Provinces();
List<YXShop.Model.Provinces> data = datab.GetListByColumn("Fid", 0);
if (data.Count > 0)
{
shtml.Append("<select id=\"Provinces\" name=\"Provinces\" onchange=\"Province(this.value)\">");
shtml.Append("<option value='' selected>--请选择--</option>");
foreach (YXShop.Model.Provinces dr in data)
{
shtml.Append("<option value=" + dr.ID + ">" + dr.Province_city + "</option> ");
}
shtml.Append("</select>");
}
Prvoinces = shtml.ToString();
}
#endregion
#region 城
[AjaxPro.AjaxMethod]
public string Provinces_City(string idstr)
{
StringBuilder shtml = new StringBuilder();
YXShop.BLL.Provinces datab = new YXShop.BLL.Provinces();
List<YXShop.Model.Provinces> data = datab.GetListByColumn("Fid", idstr);
if (data.Count > 0)
{
shtml.Append("<select id=\"City\" name=\"City\" onchange=\"Citys(this.value)\">");
shtml.Append("<option value=\"\">--请选择--</option> ");
foreach (YXShop.Model.Provinces dr in data)
{
shtml.Append("<option value=" + dr.ID + ">" + dr.Province_city + "</option> ");
}
shtml.Append("</select>");
}
return shtml.ToString();
}
#endregion
#region 区
[AjaxPro.AjaxMethod]
public string Provinces_Borough(string idstr)
{
StringBuilder shtml = new StringBuilder();
YXShop.BLL.Provinces datab = new YXShop.BLL.Provinces();
List<YXShop.Model.Provinces> data = datab.GetListByColumn("Fid", idstr);
if (data.Count > 0)
{
shtml.Append("<select id=\"borough\" name=\"borough\"");
foreach (YXShop.Model.Provinces dr in data)
{
shtml.Append("<option value=" + dr.ID + " selected>" + dr.Province_city + "</option> ");
}
shtml.Append("</select>");
}
return shtml.ToString();
}
#endregion
#endregion
#region 配送方式
protected void Sendmode()
{
YXShop.BLL.YXShop_Deliver datab = new YXShop.BLL.YXShop_Deliver();
string str = string.Format(" D_IsUsed=1");
DataSet data = datab.GetAllList(str);
if (data.Tables[0].Rows.Count > 0)
{
this.ddDeliverymode.DataSource = data;
this.ddDeliverymode.DataBind();
}
}
#endregion
#region 付款方式
protected void Moneymode()
{
YXShop.BLL.BankAccount datab = new YXShop.BLL.BankAccount();
YXShop.BLL.TerraceManage datat = new YXShop.BLL.TerraceManage();
List<YXShop.Model.TerraceManage> datatm = datat.GetAllPutout();
int i = 0;
int j = 0;
List<YXShop.Model.BankAccount> data = datab.GetAll(1, 20, out i, out j);
if (data.Count > 0)
{
foreach (YXShop.Model.BankAccount da in data)
{
this.ddAccount.Items.Add(new ListItem(da.BC_Bankac.ToString(), da.BC_Id.ToString()));
}
}
if (datatm.Count > 0)
{
foreach(YXShop.Model.TerraceManage da in datatm)
{
this.ddAccount.Items.Add(new ListItem(da.TM_name.ToString(), da.TM_ID.ToString()));
}
}
}
#endregion
#region 添加订单
protected void Button1_Click(object sender, EventArgs e)
{
YXShop.BLL.Orders datab = new YXShop.BLL.Orders();
YXShop.Model.Orders datam = new YXShop.Model.Orders();
YXShop.Model.OrderInvoice datai = new YXShop.Model.OrderInvoice();
YXShop.Common.OrderNumber datac = new YXShop.Common.OrderNumber();
string OrderId = datac.OrderID;
datam.OrderId =OrderId;
datam.ShopDate = System.DateTime.Now;
datam.OrderDate = System.DateTime.Now;
datam.UserId =this.SelUserName.UID.ToString();
datam.ConsigneeRealName = this.tbName.Text;
datam.ConsigneeName = this.tbLinkman.Text;
datam.ConsigneePhone = this.tbPhone.Text;
datam.ConsigneeProvince = Request.Form["Provinces"] + "," + Request.Form["City"] + "," + Request.Form["borough"];
datam.ConsigneeAddress = this.tbAddress.Text;
datam.ConsigneeZip = this.tbZip.Text;
datam.ConsigneeTel = this.tbTel.Text;
datam.ConsigneeFax = this.tbFax.Text;
datam.ConsigneeEmail = this.tbEmail.Text;
datam.Courier = this.ddDeliverymode.SelectedValue.ToString();
datam.Payment = this.ddAccount.SelectedValue.ToString();
if (Request.Form["rbInvoice"] != string.Empty && Request.Form["rbInvoice"] != null)
{
datai.OrderId = OrderId;
datai.InvoiceType =Convert.ToInt32(Request.Form["rbInvoice"]);
datai.InvoiceRise = this.tbCompanyName.Text;
datai.InvoicePerAndCom = Convert.ToInt32(Request.Form["rbInvoiceTitle"]);
datai.CompanyName = this.tbCompany.Text;
datai.TaxpayerNumber = this.tbNumber.Text;
datai.RegionAddress = this.tbRegionAddress.Text;
datai.RegionTel = this.tbRegionTel.Text;
datai.AccountBack = this.tbPay.Text;
datai.BackNumber = this.tbPayNumber.Text;
(new YXShop.BLL.OrderInvoice()).Create(datai);
}
datam.Remark = this.tbDescript.Text;
if (datab.Create(datam) > 0)
{
bp.PageRight("订单添加成功.", "orderList.aspx");
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -