using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.Model;
|
using CY.Infrastructure.Common;
|
using CY.Infrastructure.Query;
|
using CY.BLL.OA;
|
using CY.BLL.Sys;
|
|
namespace CY.WebForm.Pages.procurement
|
{
|
public partial class CargoSpaceEdit : BasePage
|
{
|
|
OA_CargoSpace CargoSpace = null;
|
OA_CargoSpaceBLL _OA_CargoSpaceBLL = null;
|
Sys_DictionaryBLL _Sys_DictionaryBLL = null;
|
OA_WarehouseInfoBLL _OA_WarehouseInfoBLL = null;
|
OA_BrandBLL _OA_BrandBLL = null;
|
public CargoSpaceEdit()
|
{
|
_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
_OA_WarehouseInfoBLL = new OA_WarehouseInfoBLL();
|
CargoSpace = new OA_CargoSpace();
|
_OA_CargoSpaceBLL = new OA_CargoSpaceBLL();
|
_OA_BrandBLL = new OA_BrandBLL();
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
this.txtOrderNum.Value = _OA_BrandBLL.GetMaxOrderNumMemberId(CurrentUser.MemberId, " OA_CargoSpace");
|
InitialSelData();
|
if (Request["Keyid"].ToInt32() > 0)
|
{
|
InitialModifyData();
|
}
|
|
}
|
}
|
/// <summary>
|
/// 绑定下拉列表数据
|
/// </summary>
|
public void InitialSelData()
|
{
|
selWarehouseId.DataSource = _OA_WarehouseInfoBLL.getAllWarehouseInfo(CurrentUser.MemberId);
|
selWarehouseId.DataTextField = "WarehouseName";
|
selWarehouseId.DataValueField = "Keyid";
|
selWarehouseId.DataBind();
|
|
selStatus.DataSource = _Sys_DictionaryBLL.GetDataByType("货位状态");
|
selStatus.DataValueField = "Keyid";
|
selStatus.DataTextField = "Name";
|
selStatus.DataBind();
|
}
|
/// <summary>
|
/// 绑定要修改的数据
|
/// </summary>
|
protected void InitialModifyData()
|
{
|
CargoSpace = _OA_CargoSpaceBLL.getSingleModel(Request["Keyid"].ToString2());
|
this.txtWidth.Value = CargoSpace.Width.ToString2();
|
this.txtHeight.Value = CargoSpace.Height.ToString2();
|
this.txtLength.Value = CargoSpace.Length.ToString2();
|
this.txtName.Value = CargoSpace.Name;
|
this.selStatus.Value = CargoSpace.StatusId.ToString2();
|
this.selWarehouseId.Value = CargoSpace.WarehouseId.ToString2();
|
this.txtOrderNum.Value = CargoSpace.OrderNum.ToString2();
|
}
|
|
protected void btn_Submit_Click(object sender, EventArgs e)
|
{
|
if (Request["Keyid"].ToInt32() > 0)
|
{
|
CargoSpace = _OA_CargoSpaceBLL.getSingleModel(Request["Keyid"].ToString2());
|
}
|
CargoSpace.LastUpdateTime = DateTime.Now;
|
CargoSpace.Remark = "";
|
CargoSpace.StatusId = this.selStatus.Value.ToInt32();
|
CargoSpace.Length = this.txtLength.Value.ToInt32();
|
CargoSpace.Height = this.txtHeight.Value.ToInt32();
|
CargoSpace.Width = this.txtWidth.Value.ToInt32();
|
CargoSpace.Operator = this.CurrentUser.ShortName;
|
CargoSpace.Name = this.txtName.Value;
|
CargoSpace.WarehouseId = this.selWarehouseId.Value.ToInt32();
|
CargoSpace.MemberId = this.CurrentUser.MemberId;
|
CargoSpace.OrderNum = this.txtOrderNum.Value.ToInt32();
|
if (Request["Keyid"].ToInt32() > 0)
|
{
|
if (_OA_CargoSpaceBLL.UpdateModel(CargoSpace))
|
JavaScript.RefreshDIVOpener(this);
|
else
|
JavaScript.MessageBox("修改失败", this);
|
|
}
|
else
|
{
|
if (_OA_CargoSpaceBLL.InsertModel(CargoSpace))
|
JavaScript.RefreshDIVOpener(this);
|
else
|
JavaScript.MessageBox("添加失败", this);
|
}
|
}
|
}
|
}
|