using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using CY.Model; using CY.BLL; using CY.Infrastructure.Common; using CY.BLL.Sys; using CY.BLL.EC; using CY.Infrastructure.DESEncrypt; using CY.Infrastructure.Query; namespace CY.WebForm.Pages.Property { //吴辉 //行政物品申领批复 public partial class PropertyRecordApprove : BasePage { Sys_DictionaryBLL bll_Sys_DictionaryBLL = null; OA_PropertyRecordBLL bll_OA_PropertyRecordBLL = null; OA_PropertyManageBLL bll_OA_PropertyManageBLL = null; OA_StaffBLL bll_OA_StaffBLL = null; public PropertyRecordApprove() { bll_Sys_DictionaryBLL = new Sys_DictionaryBLL(); bll_OA_PropertyRecordBLL = new OA_PropertyRecordBLL(); bll_OA_PropertyManageBLL = new OA_PropertyManageBLL(); bll_OA_StaffBLL = new OA_StaffBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } //数据加载 public void InitData() { OA_PropertyRecord m_OA_PropertyRecord = bll_OA_PropertyRecordBLL.GetModelByKeyid(Request["keyid"].ToInt32()); if (m_OA_PropertyRecord != null) { this.spanCateName.InnerText = m_OA_PropertyRecord.CateName.ToString(); this.spanPropertyName.InnerText = m_OA_PropertyRecord.PropertyName.ToString(); this.spanAddTime.InnerText = m_OA_PropertyRecord.AddTime.ToString(); this.spanAddQuality.InnerText = m_OA_PropertyRecord.AddQuality.ToString(); this.spanDepartmentName.InnerText = m_OA_PropertyRecord.DepartmentName.ToString(); this.spanAddName.InnerText = m_OA_PropertyRecord.AddName.ToString(); this.divAddRemark.InnerText = m_OA_PropertyRecord.AddRemark.ToString(); this.txtApproveQuality.Value = m_OA_PropertyRecord.AddQuality.ToString2(); this.txtApproveQuality.Attributes.Add("max",m_OA_PropertyRecord.AddQuality.ToString()); } } //表单提交 protected void btn_submit_form(object sender, EventArgs e) { try { OA_PropertyRecord m_OA_PropertyRecord = bll_OA_PropertyRecordBLL.GetModelByKeyid(Request["keyid"].ToInt32()); if (this.txtApproveQuality.Value.ToInt32() > m_OA_PropertyRecord.AddQuality) { JavaScript.MessageBox("批准数量不能大于申领数量",this); this.selStatus.Value = "3"; return; } DateTime nowTime = DateTime.Now; if (m_OA_PropertyRecord == null) { JavaScript.MessageBox("操作失败", this, true, true); this.selStatus.Value = "3"; return; } m_OA_PropertyRecord.ApproveId = CurrentUser.TrueMemberId; if (this.selStatus.Value.ToInt32() == 3) { m_OA_PropertyRecord.ApproveQuality = this.txtApproveQuality.Value.ToInt32(); } else { m_OA_PropertyRecord.ApproveQuality = 0; } m_OA_PropertyRecord.ApproveRemark = this.txtApproveRemark.Value; m_OA_PropertyRecord.ApproveTime = nowTime; m_OA_PropertyRecord.Status = this.selStatus.Value.ToInt32(); m_OA_PropertyRecord.Operator = CurrentUser.ShortName; m_OA_PropertyRecord.LastUpdateTime = nowTime; if (Request["keyid"].ToInt32() > 0) { if (bll_OA_PropertyRecordBLL.UpdateModel(m_OA_PropertyRecord)) { if (m_OA_PropertyRecord.Status == 3) { OA_PropertyManage m_OA_PropertyManage = bll_OA_PropertyManageBLL.GetModelByKeyid(m_OA_PropertyRecord.PropertyId); if (m_OA_PropertyManage != null) { m_OA_PropertyManage.ReceiveNum += m_OA_PropertyRecord.ApproveQuality; bll_OA_PropertyManageBLL.UpdateModel(m_OA_PropertyManage); } } JavaScript.MessageBox("批复成功", this, true, true); } else { this.selStatus.Value = "3"; JavaScript.MessageBox("批复失败", this); } } } catch (Exception ex) { PAGEHandleException(ex); JavaScript.MessageBox("操作失败", this); } } } }