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

110 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 FrmCopyStaffPermission : BaseForm
{
//人员id
public string Id;
public FrmCopyStaffPermission()
{
InitializeComponent();
}
public FrmCopyStaffPermission(string id)
{
InitializeComponent();
Id = id;
this.GetAllCharacters();
}
private void GetAllCharacters()
{
DataTable employeetable = PowerImpl.GetWorkEmployee(Id);
labelAutoGridLook.LabelText = "";
labelAutoGridLook.ValueField = labelAutoGridLook.ValueMember = "员工ID";
labelAutoGridLook.TextField = "员工姓名";
labelAutoGridLook.SetDataSource(employeetable);
}
private void btnOK_Click(object sender, EventArgs e)
{
//下拉框选中的人员id
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">权限来源id</param>
/// <param name="jsid">权限接收id</param>
/// <returns></returns>
public int CopyPermission(string lyid, string jsid, 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("@sourceUser",SqlDbType.Int),
new SqlParameter("@destUser",SqlDbType.Int),
new SqlParameter("@loginname",SqlDbType.VarChar,100),
pMsg,
returnValue,
};
SqlParameter[] param = list.ToArray();
param[0].Value = lyid;
param[1].Value = jsid;
param[2].Value = ERPInfo.Instance.UserName;
param[3].Value = "";
DataSet dataSet = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_SystemUserPurviewCopy", "billApply", param);
tipMsg = pMsg.Value.ToString();
return Convert.ToInt32(returnValue.Value + "");
}
}
}