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.BLL.OA; using CY.Infrastructure.Query; using CY.Infrastructure.Common; namespace CY.WebForm.Pages.procurement { public partial class WarehouseInfoEdit : BasePage { OA_WarehouseInfo warehouesInfo = null; OA_WarehouseInfoBLL _OA_WarehouseInfoBLL = null; OA_BrandBLL _OA_BrandBLL = null; public WarehouseInfoEdit() { warehouesInfo = new OA_WarehouseInfo(); _OA_WarehouseInfoBLL = new OA_WarehouseInfoBLL(); _OA_BrandBLL = new OA_BrandBLL(); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.txtWarehouseNumber.Value = _OA_WarehouseInfoBLL.GetMaxWarehouserNumber(CurrentUser.MemberId, " OA_WarehouseInfo "); this.txtOrderNum.Value = _OA_BrandBLL.GetMaxOrderNum(CurrentUser.MemberId, " OA_WarehouseInfo "); if (Request["Keyid"].ToInt32() > 0) InitialData(); } } protected void InitialData() { warehouesInfo = _OA_WarehouseInfoBLL.getSingleModel(Request["Keyid"].ToString2()); this.txtPhone.Value = warehouesInfo.Phone; this.txtQQ.Value = warehouesInfo.QQ; this.txtWarehouseAddress.Value = warehouesInfo.WarehouseAddress; this.txtWarehouseKeeper.Value = warehouesInfo.WarehouseKeeper; this.txtWarehouseName.Value = warehouesInfo.WarehouseName; this.txtOrderNum.Value = warehouesInfo.OrderNum.ToString2(); this.txtWarehouseNumber.Value = warehouesInfo.WarehouserNumber.ToString2(); } protected void btn_Submit_Click(object sender, EventArgs e) { if (Request["Keyid"].ToInt32() > 0) { warehouesInfo = _OA_WarehouseInfoBLL.getSingleModel(Request["Keyid"].ToString2()); } warehouesInfo.FirmId = CurrentUser.MemberId; warehouesInfo.LastUpdateTime = DateTime.Now; warehouesInfo.Operator = CurrentUser.ShortName; warehouesInfo.Remark = ""; warehouesInfo.WarehouseName = this.txtWarehouseName.Value; warehouesInfo.WarehouseAddress = this.txtWarehouseAddress.Value; warehouesInfo.WarehouseKeeper = this.txtWarehouseKeeper.Value; warehouesInfo.QQ = this.txtQQ.Value; warehouesInfo.Phone = this.txtPhone.Value; warehouesInfo.OrderNum = this.txtOrderNum.Value.ToInt32(); warehouesInfo.WarehouserNumber = this.txtWarehouseNumber.Value.ToInt32(); if (Request["Keyid"].ToInt32() > 0) { if (_OA_WarehouseInfoBLL.UpdateModel(warehouesInfo)) JavaScript.RefreshDIVOpener(this); else JavaScript.MessageBox("更新失败", this); } else { if (_OA_WarehouseInfoBLL.InsertModel(warehouesInfo)) JavaScript.RefreshDIVOpener(this); else JavaScript.MessageBox("更新失败", this); } } } }