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(); } /// /// 执行保存时候的存储过程 /// /// 权限来源id /// 权限接收id /// 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 list = new List { 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 + ""); } } }