using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.Model;
|
using CY.Infrastructure.Query;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
using CY.BLL.OA;
|
using CY.BLL.EC;
|
using System.Transactions;
|
|
namespace CY.WebForm.Pages.financial
|
{
|
public partial class PlanOrderEdit : BasePage
|
{
|
CoreCmsPlanOrderBLL _PlanOrderBLL = new CoreCmsPlanOrderBLL();
|
CoreCmsPlanOrderItemBLL _coreCmsPlanOrderItemBLL = new CoreCmsPlanOrderItemBLL();
|
|
public PlanOrderEdit()
|
{
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
InitialData();
|
if (Request["Keyid"].ToInt32() > 0) // 加载要修改的的数据
|
{
|
HideKeyid.Value = Request["Keyid"].ToString2();
|
InitialModifyData();
|
}
|
}
|
}
|
|
/// <summary>
|
/// 初始化科目类别
|
/// </summary>
|
public void InitialData()
|
{
|
|
}
|
|
/// <summary>
|
/// 初始化要修改的数据
|
/// </summary>
|
public void InitialModifyData()
|
{
|
var coreCmsPlanOrder = _PlanOrderBLL.GetModelByKeyid(Request["Keyid"].ToInt32().Value);
|
spnsheng.InnerText = coreCmsPlanOrder.sheng;
|
spnshi.InnerText = coreCmsPlanOrder.shi;
|
spnquxian.InnerText = coreCmsPlanOrder.quxian;
|
spnpianqu.Value = coreCmsPlanOrder.pianqu;
|
spnshipAddress.Value = coreCmsPlanOrder.shipAddress;
|
spnshipName.Value = coreCmsPlanOrder.shipName;
|
spnshipMobile.Value = coreCmsPlanOrder.shipMobile;
|
spnshouhuoAddress.Value = coreCmsPlanOrder.shouhuoAddress;
|
OrderAmount.Value = coreCmsPlanOrder.orderAmount.ToString2();
|
|
|
|
this.RepSubjeSetctList.DataSource = _coreCmsPlanOrderItemBLL.GetModelsByOrderid(Request["Keyid"].ToInt32().Value);
|
|
this.RepSubjeSetctList.DataBind();
|
}
|
|
/// <summary>
|
/// 添加或修改科目
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
protected void btn_Submit_Config(object sender, EventArgs e)
|
{
|
|
string id = HideKeyid.Value;
|
var orderAmount = this.OrderAmount.Value;
|
var pianqu = this.spnpianqu.Value.Trim();
|
var shipAddress = this.spnshipAddress.Value.Trim();
|
var shipName = this.spnshipName.Value.Trim();
|
var shipMobile = this.spnshipMobile.Value.Trim();
|
var shouhuoAddress = this.spnshouhuoAddress.Value.Trim();
|
string[] ids = Request["id"].ToString2().Split(',');
|
string[] price = Request["price"].ToString2().Split(',');
|
string[] itemNumarray = Request["itemNumarray"].ToString2().Split(',');
|
string[] amount = Request["amount"].ToString2().Split(',');
|
var sss = false;
|
EC_OrderBasicBLL _eC_OrderBasicBLL = new EC_OrderBasicBLL();
|
int orderkeyid = 0;
|
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
|
new TransactionOptions
|
{
|
IsolationLevel = IsolationLevel.ReadCommitted,
|
Timeout = TransactionManager.MaximumTimeout
|
}
|
))
|
{
|
var coreCmsPlanOrder = _PlanOrderBLL.GetModelByKeyid(id.ToInt32().Value);
|
orderkeyid = coreCmsPlanOrder.orderkeyid.Value;
|
coreCmsPlanOrder.orderAmount = orderAmount.ToDecimal2().Value;
|
coreCmsPlanOrder.pianqu = pianqu;
|
coreCmsPlanOrder.shipAddress = shipAddress;
|
coreCmsPlanOrder.shipName = shipName;
|
coreCmsPlanOrder.shipMobile = shipMobile;
|
coreCmsPlanOrder.userMobile = shipMobile;
|
coreCmsPlanOrder.shouhuoAddress = shouhuoAddress;
|
coreCmsPlanOrder.upDataTime = DateTime.Now;
|
coreCmsPlanOrder.upDataBy = CurrentUser.ShortName;
|
if (!coreCmsPlanOrder.createTime.HasValue)
|
{
|
coreCmsPlanOrder.createTime = DateTime.Now;
|
coreCmsPlanOrder.createBy = CurrentUser.ShortName;
|
|
}
|
|
|
sss = _PlanOrderBLL.UpdateModel(coreCmsPlanOrder);
|
|
|
for (int i = 0; i < ids.Length; i++)
|
{
|
var cmsPlanOrderItem = _coreCmsPlanOrderItemBLL.GetModelByKeyid(ids[i].ToInt32().Value);
|
cmsPlanOrderItem.nums = itemNumarray[i].ToInt32().Value;
|
cmsPlanOrderItem.amount = amount[i].ToDecimal2().Value;
|
cmsPlanOrderItem.upDataTime = DateTime.Now;
|
cmsPlanOrderItem.upDataBy = CurrentUser.ShortName;
|
if (!cmsPlanOrderItem.createTime.HasValue)
|
{
|
cmsPlanOrderItem.createTime = DateTime.Now;
|
cmsPlanOrderItem.createBy = CurrentUser.ShortName;
|
|
}
|
sss = _PlanOrderBLL.UpdateModelOrderItem(cmsPlanOrderItem);
|
}
|
|
//更新整个订单的总价格
|
|
|
|
|
scope.Complete();
|
}
|
sss = _eC_OrderBasicBLL.UpdateorderJine(orderkeyid);
|
|
if (sss)
|
{
|
JavaScript.MessageBoxCloseAndRefreshFirsts("更新成功", this);
|
|
}
|
else
|
{
|
JavaScript.MessageBox("更新失败", this);
|
}
|
|
}
|
}
|
}
|