Files
lserp_cs_6.0/插件库/Lskj.PubUserTomodule/FrmCopyPermission.cs
cyf ab56a9bcf7 基线 SVN r240
SVN-Revision: r240
2025-02-06 06:46:06 +00:00

109 lines
3.2 KiB
C#

using Lskj.Business.Impl;
using Lskj.Control;
using Lskj.Core;
using Lskj.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Lskj.PubUserTomodule
{
public partial class FrmCopyPermission : BaseForm
{
//角色id
public string Id;
public FrmCopyPermission()
{
InitializeComponent();
}
public FrmCopyPermission(string id)
{
InitializeComponent();
Id = id;
this.GetAllCharacters();
}
private void GetAllCharacters()
{
DataTable treeTable = PowerImpl.GetWorkRole(Id);
labelAutoGridLook.LabelText = "";
labelAutoGridLook.ValueField = labelAutoGridLook.ValueMember = "id";
labelAutoGridLook.TextField = "roleName";
labelAutoGridLook.SetDataSource(treeTable);
}
private void btnOK_Click(object sender, EventArgs e)
{
//下拉框选中的角色id
//string SelectId= (this.PrimaryDirectory.EditValue + "").Split(',')[0];
string SelectId = this.labelAutoGridLook.EditValue;
string msg = string.Empty;
int result = CopyPermission(Id, SelectId, out msg);
if (result !=-1)
{
MessageUtil.Show("复制权限成功");
}
else {
MessageUtil.Show("复制权限失败,原因:"+ msg);
}
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
/// <summary>
/// 执行保存时候的存储过程
/// </summary>
/// <param name="lyid">权限来源</param>
/// <param name="mbid">权限接收</param>
/// <returns></returns>
public int CopyPermission(string lyid, string mbid, out string tipMsg)
{
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
pMsg.Direction = ParameterDirection.InputOutput;
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
returnValue.Direction = ParameterDirection.ReturnValue;
List<SqlParameter> list = new List<SqlParameter>
{
new SqlParameter("@lyid",SqlDbType.Int),
new SqlParameter("@mbid",SqlDbType.Int),
new SqlParameter("@loginname",SqlDbType.VarChar,100),
pMsg,
returnValue,
};
SqlParameter[] param = list.ToArray();
param[0].Value = lyid;
param[1].Value = mbid;
param[2].Value = ERPInfo.Instance.UserName;
param[3].Value = "";
DataSet dataSet = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_SystemSetUserPurview_copy", "billApply", param);
tipMsg = pMsg.Value.ToString();
return Convert.ToInt32(returnValue.Value + "");
}
}
}