|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using ICSharpCode.Core;
|
|
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
using Mesnac.Action.Default.Entity;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.Default.Purview.BasRole
|
|
|
|
|
{
|
|
|
|
|
public partial class FrmInsert : Form
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 字段定义
|
|
|
|
|
|
|
|
|
|
private ActionType _actionType = ActionType.Add; //操作类别,默认为添加
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 属性定义
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 角色名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string RoleName
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return this.txtRoleName.Text;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 构造方法
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 无参构造方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
public FrmInsert()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 参数构造方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="actionType">操作类型</param>
|
|
|
|
|
public FrmInsert(ActionType actionType)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
this._actionType = actionType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 方法定义
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化界面元素
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void InitUIMethod()
|
|
|
|
|
{
|
|
|
|
|
if (this._actionType == ActionType.Add)
|
|
|
|
|
{
|
|
|
|
|
this.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Action_Default_Purview_BasRole_FrmInsert_Text")); //添加角色
|
|
|
|
|
this.groupBox1.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Action_Default_Purview_BasRole_FrmInsert_groupBox1_Text")); //角色信息
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Action_Default_Purview_BasRole_FrmInsert_Text_Query")); //查询角色
|
|
|
|
|
this.groupBox1.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Action_Default_Purview_BasRole_FrmInsert_groupBox1_Text_Query")); //查询条件
|
|
|
|
|
}
|
|
|
|
|
this.label1.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Action_Default_Purview_BasRole_FrmInsert_label1_Text")); //角色名称
|
|
|
|
|
this.btnOk.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_btnOK"));
|
|
|
|
|
this.btnCancel.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_btnCancel"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void InitData()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 事件处理
|
|
|
|
|
|
|
|
|
|
private void FrmInsert_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.InitUIMethod();
|
|
|
|
|
this.InitData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnOk_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this._actionType == ActionType.Add)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(this.txtRoleName.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<FrmInsert>.Warn("角色名称不能为空,请输入角色名称!");
|
|
|
|
|
string msg1 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_Default_Purview_BasRole_FrmInsert_msg1")); //角色名称不能为空,请输入角色名称!
|
|
|
|
|
MessageBox.Show(msg1, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
this.txtRoleName.Focus();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (PurviewHelper.IsExistsRoleName(this.txtRoleName.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<FrmInsert>.Warn("已存在此角色名称,请输入新的角色名称!");
|
|
|
|
|
string msg2 = StringParser.Parse(ResourceService.GetString("Mesnac_Action_Default_Purview_BasRole_FrmInsert_msg2")); //已存在此角色名称,请输入新的角色名称!
|
|
|
|
|
MessageBox.Show(msg2, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
this.txtRoleName.Focus();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|