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 ShebeimanageEdit : BasePage
|
{
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
|
OA_ShebeiManageBLL bll_OA_ShebeiManageBLL = null;
|
OA_StaffBLL bll_OA_StaffBLL = null;
|
|
public ShebeimanageEdit()
|
{
|
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
bll_OA_ShebeiManageBLL = new OA_ShebeiManageBLL();
|
bll_OA_StaffBLL = new OA_StaffBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
this.selCateId.DataSource = bll_OA_ShebeiManageBLL.GetDataByType(CurrentUser.MemberId);
|
this.selCateId.DataTextField = "Name";
|
this.selCateId.DataValueField = "Keyid";
|
this.selCateId.DataBind();
|
//this.selCateId.Items.Insert(0, new ListItem("请选择", ""));
|
//this.selCateId.Value = "";
|
|
|
this.selZerenren.DataSource = bll_OA_StaffBLL.SelectListByFirmId(CurrentUser.MemberId, null, null);
|
this.selZerenren.DataTextField = "Name";
|
this.selZerenren.DataValueField = "Keyid";
|
this.selZerenren.DataBind();
|
//this.selZerenren.Items.Insert(0, new ListItem("全部", ""));
|
//this.selZerenren.Value = "";
|
|
InitData();
|
}
|
}
|
|
//数据加载
|
public void InitData()
|
{
|
OA_ShebeiManage m_OA_ShebeiManage = bll_OA_ShebeiManageBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
if (m_OA_ShebeiManage != null)
|
{
|
this.selCateId.Value = m_OA_ShebeiManage.CateId.ToString2();
|
this.txtCarNumber.Value = m_OA_ShebeiManage.Name;
|
this.txtPrice.Value = m_OA_ShebeiManage.Price.Value.ToString("0.00");
|
this.selAnzhuangdidian.Value = m_OA_ShebeiManage.Anzhuangdidian;
|
this.txtQiyongTime.Value = m_OA_ShebeiManage.QiyongTime.HasValue? m_OA_ShebeiManage.QiyongTime.Value.ToString("yyyy-MM-dd"):"";
|
this.selZerenren.Value = m_OA_ShebeiManage.Zerenren.HasValue? m_OA_ShebeiManage.Zerenren.ToString():"";
|
}
|
}
|
|
//表单提交
|
protected void btn_submit_form(object sender, EventArgs e)
|
{
|
try
|
{
|
//if (string.IsNullOrEmpty(this.txtAllNum.Value) || string.IsNullOrEmpty(this.txtReceiveNum.Value))
|
//{
|
// JavaScript.MessageBox("物品总数量和已领取数量均不能为空", this);
|
// return;
|
//}
|
|
//if (this.txtAllNum.Value.ToInt32() < this.txtReceiveNum.Value.ToInt32())
|
//{
|
// JavaScript.MessageBox("已领取数量不能大于总数量",this);
|
// return;
|
//}
|
|
DateTime nowTime = DateTime.Now;
|
OA_ShebeiManage m_OA_ShebeiManage = bll_OA_ShebeiManageBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
if (m_OA_ShebeiManage == null)
|
{
|
m_OA_ShebeiManage = new OA_ShebeiManage();
|
m_OA_ShebeiManage.MemberId = CurrentUser.MemberId;
|
|
|
}
|
m_OA_ShebeiManage.CateId = this.selCateId.Value.ToInt32();
|
m_OA_ShebeiManage.Name = this.txtCarNumber.Value;
|
m_OA_ShebeiManage.Price = this.txtPrice.Value.ToDecimal2();
|
m_OA_ShebeiManage.Anzhuangdidian = this.selAnzhuangdidian.Value;
|
|
m_OA_ShebeiManage.QiyongTime = this.txtQiyongTime.Value.ToDateTime2();
|
|
m_OA_ShebeiManage.Zerenren = this.selZerenren.Value.ToInt32();
|
var a_Staff = bll_OA_StaffBLL.GetModelByKeyid(m_OA_ShebeiManage.Zerenren);
|
if (a_Staff != null)
|
{
|
m_OA_ShebeiManage.ZerenrenName = a_Staff.Name;
|
}
|
else
|
{
|
m_OA_ShebeiManage.ZerenrenName = "";
|
}
|
m_OA_ShebeiManage.Remark = "";
|
m_OA_ShebeiManage.Operator = CurrentUser.ShortName;
|
m_OA_ShebeiManage.LastUpdateTime = nowTime;
|
m_OA_ShebeiManage.Status = 2;
|
|
if (Request["keyid"].ToInt32() > 0)
|
{
|
if (bll_OA_ShebeiManageBLL.UpdateModel(m_OA_ShebeiManage))
|
{
|
JavaScript.MessageBox("更新成功", this, true, true);
|
}
|
|
else
|
JavaScript.MessageBox("更新失败", this);
|
}
|
else
|
{
|
if (bll_OA_ShebeiManageBLL.InsertModel(m_OA_ShebeiManage))
|
{
|
this.txtCarNumber.Value = "";
|
this.txtPrice.Value="";
|
this.selAnzhuangdidian.Value = "";
|
|
this.txtQiyongTime.Value = "";
|
JavaScript.MessageBox("新增成功", this, false, true);
|
}
|
|
else
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
}
|
}
|