136 lines
4.4 KiB
C#
136 lines
4.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using SOH.Kernel;
|
|
using EAS.Services;
|
|
using SOH.BLL;
|
|
using SOH.Entities;
|
|
using SOH.Data;
|
|
|
|
namespace SOH.BasicSettings
|
|
{
|
|
[ModuleAttribute(ModuleID = "292A6B76-ABF2-4F16-A766-675EA15A5FB9", ModuleName = "角色维护")]
|
|
public partial class JueSeWeiHu : SOH.Window.baseChildForm
|
|
{
|
|
public JueSeWeiHu()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void JueSeWeiHu_Load(object sender, EventArgs e)
|
|
{
|
|
Bind();
|
|
var vservice = ServiceContainer.GetService<IFenDian>();
|
|
cbbfdmc.DataSource = vservice.getAllFenDian();
|
|
}
|
|
public void Bind()
|
|
{
|
|
var vservice = ServiceContainer.GetService<IRole>();
|
|
List<Role> al = vservice.GetRoles(this.textBox1.Text);
|
|
roleBindingSource.DataSource = al;
|
|
}
|
|
|
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
|
{
|
|
Bind();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
tbrolename.Text = "";
|
|
tbid.Text = "";
|
|
udJXZL.Value = 100;
|
|
udTCZL.Value = 100;
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
Role o = dgvRolelist.Rows[dgvRolelist.CurrentRow.Index].DataBoundItem as Role;
|
|
if (button4.Text == "注销")
|
|
o.state = 1;
|
|
else o.state = 0;
|
|
var vservice = ServiceContainer.GetService<IRole>();
|
|
OperationResult or = vservice.Update(o);
|
|
Bind();
|
|
MessageBox.Show(or.Message);
|
|
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
if (tbid.Text != "")
|
|
{
|
|
if (this.tbrolename.Text == "")
|
|
{
|
|
MessageBox.Show("角色名称不能为空!");
|
|
return;
|
|
}
|
|
Role o = new Role();
|
|
o.state = 1;
|
|
o.id = Convert.ToInt32(tbid.Text);
|
|
o.RoleNmae = tbrolename.Text;
|
|
o.fddm = Convert.ToInt32(cbbfdmc.SelectedValue);
|
|
o.tczl = (short)this.udTCZL.Value;
|
|
o.jxzl = (short)this.udJXZL.Value;
|
|
var vservice = ServiceContainer.GetService<IRole>();
|
|
OperationResult or = vservice.Update(o);
|
|
Bind();
|
|
MessageBox.Show(or.Message);
|
|
|
|
}
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
if (tbid.Text == "")
|
|
{
|
|
if (this.tbrolename.Text == "")
|
|
{
|
|
MessageBox.Show("角色名称不能为空!");
|
|
return;
|
|
}
|
|
Role o = new Role();
|
|
o.id = ServiceContainer.GetService<IBasic>().GetMax(o.DbTableName, 1);
|
|
o.state = 0;
|
|
o.RoleNmae = tbrolename.Text;
|
|
o.fddm = Convert.ToInt32(cbbfdmc.SelectedValue);
|
|
o.tczl = (short)this.udTCZL.Value;
|
|
o.jxzl = (short)this.udJXZL.Value;
|
|
var vservice = ServiceContainer.GetService<IRole>();
|
|
OperationResult or = vservice.Insert(o);
|
|
Bind();
|
|
MessageBox.Show(or.Message);
|
|
}
|
|
}
|
|
|
|
private void dgvRolelist_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex < 0)
|
|
{
|
|
return;
|
|
}
|
|
this.tbid.Text = dgvRolelist.Rows[e.RowIndex].Cells["id"].Value.ToString();
|
|
this.tbrolename.Text = dgvRolelist.Rows[e.RowIndex].Cells["rolenmae"].Value.ToString();
|
|
this.cbbfdmc.SelectedValue = Convert.ToInt32(dgvRolelist.Rows[e.RowIndex].Cells["fddm"].Value.ToString());
|
|
this.udTCZL.Value = (short)dgvRolelist.Rows[e.RowIndex].Cells["tczl"].Value;
|
|
this.udJXZL.Value = (short)dgvRolelist.Rows[e.RowIndex].Cells["jxzl"].Value;
|
|
if (dgvRolelist.Rows[e.RowIndex].Cells["state"].Value.ToString() == "1")
|
|
{
|
|
button4.Text = "启用";
|
|
}
|
|
else
|
|
{
|
|
button4.Text = "注销";
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|