| | |
| | | } |
| | | |
| | | } |
| | | else if (OperationType == 2)//复制 |
| | | { |
| | | string realExplain = omdelMian.Explain.Substring(0, omdelMian.Explain.IndexOf("#复制原角色ID:")); //获取界面设置的Explain值 |
| | | string sourceBill_GroupID = omdelMian.Explain.Replace(realExplain + "#复制原角色ID:", ""); //获取复制的源单据的ID |
| | | omdelMian.Explain = realExplain; |
| | | |
| | | //主表 |
| | | oCN.RunProc("insert into System_UserGroup (GroupName,HLev,Explain)values" + |
| | | $"('{omdelMian.GroupName}','{omdelMian.HLev}','{omdelMian.Explain}')"); |
| | | |
| | | //新增后查询 确保数据添加成功 |
| | | ds = oCN.RunProcReturn("Select * from System_UserGroup where GroupName='" + omdelMian.GroupName + "'", "System_UserGroup"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "用户新增失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | var HGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["GroupID"]); |
| | | |
| | | |
| | | //根据复制的源单据的ID,获取源单据的ID对应角色的权限 |
| | | ds = oCN.RunProcReturn("Select * from System_UserGroup where GroupID='" + sourceBill_GroupID + "'", "System_UserGroup"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "被复制的角色不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | string AuthorityID = ds.Tables[0].Rows[0]["AuthorityID"].ToString(); |
| | | oCN.RunProc("update System_UserGroup set AuthorityID = '" + AuthorityID + "' where GroupID = " + HGroupID); |
| | | |
| | | |
| | | //设置角色绑定的用户 |
| | | oCN.RunProc("delete from System_UserGroupInfo where GroupId=" + HGroupID.ToString()); |
| | | |
| | | if (num[0] != "-1") |
| | | { |
| | | for (int i = 0; i < num.Length; i++) |
| | | { |
| | | oCN.RunProc("insert into System_UserGroupInfo (GroupId,UserId) values (" + HGroupID.ToString() + ",'" + num[i] + "')"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else if (OperationType == 3) |
| | | { |
| | | oCN.RunProc("update System_UserGroup set GroupName='" + omdelMian.GroupName + "',HLev='" + omdelMian.HLev + "',Explain='" + omdelMian.Explain + "'" |