using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CY.BLL;
using CY.Model;
using CY.Infrastructure.Query;
using CY.Infrastructure.Common;
using CY.BLL.Sys;
namespace CY.WebForm.Pages.membermanage
{
//吴辉
//新增/编辑角色
public partial class PermissionsRoleEdit : BasePage
{
Sys_Permissions_RoleBLL bll_Sys_Permissions_RoleBLL = null;
//初始化
public PermissionsRoleEdit()
{
bll_Sys_Permissions_RoleBLL = new Sys_Permissions_RoleBLL();
}
//加载页面
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
///
/// 绑定数据
///
/// 角色编号
public void BindData()
{
if (Request["Keyid"].ToInt32() > 0)
{
Sys_Permissions_Role m_Sys_Permissions_Role = bll_Sys_Permissions_RoleBLL.SelectModel(Request["Keyid"].ToInt32());
this.selIsUsed.Value = m_Sys_Permissions_Role.IsUsed.ToString2();
this.txtRoleName.Value = m_Sys_Permissions_Role.RoleName.ToString2();
}
}
//提交事件
protected void btn_Submit_Config(object sender, EventArgs e)
{
Sys_Permissions_Role m_Sys_Permissions_Role = new Sys_Permissions_Role();
m_Sys_Permissions_Role.Keyid = Request["Keyid"].ToInt32();
m_Sys_Permissions_Role.RoleName = this.txtRoleName.Value;
m_Sys_Permissions_Role.IsUsed = this.selIsUsed.Value.ToBoolean2();
m_Sys_Permissions_Role.LastUpdateTime = DateTime.Now;
m_Sys_Permissions_Role.Operator = CurrentUser.ShortName;
m_Sys_Permissions_Role.Remark = "admin";
if (Request["Keyid"].ToInt32() > 0)
{
bool result =bll_Sys_Permissions_RoleBLL.UpdateModel(m_Sys_Permissions_Role);
if (result)
JavaScript.RefreshDIVOpener(this);
else
JavaScript.MessageBox("操作失败", this);
}
else
{
bool result = bll_Sys_Permissions_RoleBLL.InsertModel(m_Sys_Permissions_Role);
if (result)
JavaScript.MessageBox("添加成功", this,true,true);
else
JavaScript.MessageBox("操作失败", this);
}
}
}
}