123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using Central.Control.Domain;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace MES.Production.Service.ServiceImp
- {
-
-
-
-
- public class UserRoleManage : RepositoryBase<SYS_USER_ROLE>,IService.IUserRoleManage
- {
-
-
-
-
-
-
- public bool SetUserRole(int userId, string roleId)
- {
- try
- {
-
- this.Delete(p => p.FK_USERID == userId);
-
- if (string.IsNullOrEmpty(roleId)) return true;
- foreach (var entity in roleId.Split(',').Select(t => new SYS_USER_ROLE()
- {
- FK_USERID = userId,
- FK_ROLEID = int.Parse(t)
- }))
- {
- this.dbSet.Add(entity);
- }
- return this.Context.SaveChanges() > 0;
- }
- catch (Exception e) { throw e; }
- }
- }
- }
|