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.Infrastructure.Query;
|
using CY.Infrastructure;
|
|
namespace CY.WebForm.Pages.soft
|
{
|
//吴辉
|
//新增/修改软件管理
|
public partial class ManageAdd : BasePage
|
{
|
Soft_ManageBLL bll_Soft_ManageBLL = null;
|
|
//初始化
|
public ManageAdd()
|
{
|
bll_Soft_ManageBLL = new Soft_ManageBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
InitData();
|
}
|
}
|
|
//数据加载
|
public void InitData()
|
{
|
Soft_Manage m_Soft_Manage = bll_Soft_ManageBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
if (m_Soft_Manage != null)
|
{
|
this.txtSoftName.Value = m_Soft_Manage.SoftName.ToString2();
|
this.txtSoftPrice.Value = m_Soft_Manage.SoftPrice.ToString2();
|
this.spanSoftContent.InnerText = m_Soft_Manage.SoftContent;
|
this.txtSoftContent.Visible = false;
|
}
|
else
|
{
|
this.txtSoftName.Value = "";
|
this.txtSoftPrice.Value = "";
|
this.txtSoftContent.Visible = true;
|
this.txtSoftContent.Value = "";
|
this.spanSoftContent.Visible = false;
|
}
|
}
|
|
//表单提交
|
protected void btn_submit_form(object sender, EventArgs e)
|
{
|
try
|
{
|
DateTime nowTime = DateTime.Now;
|
Soft_Manage m_Soft_Manage = bll_Soft_ManageBLL.GetModelByKeyid(Request["keyid"].ToInt32());
|
if (m_Soft_Manage == null)
|
{
|
m_Soft_Manage = new Soft_Manage();
|
m_Soft_Manage.SoftContent =this.txtSoftContent.Value;
|
}
|
|
m_Soft_Manage.SoftName = this.txtSoftName.Value.ToString2();
|
m_Soft_Manage.SoftPrice = this.txtSoftPrice.Value.ToInt32();
|
m_Soft_Manage.LastUpdateTime = nowTime;
|
m_Soft_Manage.Operator = CurrentUser.ShortName;
|
|
if (Request["keyid"].ToInt32() > 0)
|
{
|
if (bll_Soft_ManageBLL.UpdateModel(m_Soft_Manage))
|
JavaScript.MessageBox("更新成功", this, true, true);
|
else
|
JavaScript.MessageBox("更新失败", this);
|
}
|
else
|
{
|
if (bll_Soft_ManageBLL.InsertModel(m_Soft_Manage))
|
{
|
JavaScript.MessageBox("新增成功", this, false, true);
|
InitData();
|
}
|
else
|
JavaScript.MessageBox("新增失败", this);
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
}
|
}
|
}
|
}
|