示例#1
0
 private void InitUserFunctions(UserModule userModule)
 {
     foreach (var function in userModule.Module.Functions)
     {
         var userFunctions = userModule.UserFunctions.Where(uf => uf.Function.FunctionID == function.FunctionID);
         if (userFunctions.Count() == 0)
         {
             UserFunction uf = new UserFunction()
             {
                 UserFunctionID = Guid.NewGuid(),
                 UserModule     = userModule,
                 Function       = function,
                 IsActive       = userModule.UserSystem.User.UserName == "Admin"
             };
             userModule.UserSystem.IsActive = userModule.UserSystem.User.UserName == "Admin";
             SetParentUserModuleIsActiveFalse(userModule);
             userModule.IsActive = userModule.UserSystem.User.UserName == "Admin";
             UserFunctionRepository.Add(uf);
             UserFunctionRepository.SaveChanges();
         }
     }
 }
示例#2
0
 private void InitUserFunctions(AUTH_USER_MODULE userModule)
 {
     foreach (var function in userModule.AUTH_MODULE.AUTH_FUNCTION)
     {
         var userFunctions = userModule.AUTH_USER_FUNCTION.Where(uf => uf.AUTH_FUNCTION.FUNCTION_ID == function.FUNCTION_ID);
         if (userFunctions.Count() == 0)
         {
             AUTH_USER_FUNCTION uf = new AUTH_USER_FUNCTION()
             {
                 // USER_FUNCTION_ID = Guid.NewGuid().ToString(), GetNewID(),
                 USER_FUNCTION_ID = UserFunctionRepository.GetNewID("AUTH_USER_FUNCTION", "USER_FUNCTION_ID"),
                 AUTH_USER_MODULE = userModule,
                 AUTH_FUNCTION    = function,
                 IS_ACTIVE        = userModule.AUTH_USER_SYSTEM.AUTH_USER.USER_NAME == "Admin" ? "1" : "0"
             };
             userModule.AUTH_USER_SYSTEM.IS_ACTIVE = userModule.AUTH_USER_SYSTEM.AUTH_USER.USER_NAME == "Admin" ? "1" : "0";
             SetParentUserModuleIsActiveFalse(userModule);
             userModule.IS_ACTIVE = userModule.AUTH_USER_SYSTEM.AUTH_USER.USER_NAME == "Admin"?"1":"0";
             UserFunctionRepository.Add(uf);
             UserFunctionRepository.SaveChanges();
         }
     }
 }