예제 #1
0
 public JsonResult SaveGroup(int id, List<int> objectIds, List<int> selectedObjectIds)
 {
     //illi 25.12.1012 v16 probleem siia tuleb Permission "Save" ja User Permissions "Save" ja vahet ei saa teha 1.Controller Update erinev 2.vaja Individual door märkida
     var pgtz = _userPermissionGroupTimeZoneRepository.FindByPGId(id);
     var permgr = _userPermissionGroupRepository.FindById(id);
     List<int> ownObjets = new List<int>();
     var t = (from pg in pgtz where pg.Active == true && pg.IsDeleted != true select pg.BuildingObjectId);
     foreach (int tt in t) { ownObjets.Add(tt); }
     string message = "<LM> <LTS LSF='LogMessageUserPermissionGroupChanged'> <LSP> " + permgr.Name + " </LSP> Started </LTS></LM>";
     _logService.CreateLog(CurrentUser.Get().Id, "web", flag, CurrentUser.Get().HostName, CurrentUser.Get().CompanyId,
             message.ToString());
     _userPermissionGroupService.SaveUserPermissionGroup(id, objectIds, selectedObjectIds, true, true);
     _userPermissionGroupService.GroupSaveUserPermissionGroup(id, objectIds, selectedObjectIds, ownObjets);
     message = "<LM> <LTS LSF='LogMessageUserPermissionGroupChanged'> <LSP> " + permgr.Name + " </LSP> Ended </LTS></LM>";
     _logService.CreateLog(CurrentUser.Get().Id, "web", flag, CurrentUser.Get().HostName, CurrentUser.Get().CompanyId,
             message.ToString());
     string[] array = permgr.Name.Split('+');
     if (_userPermissionGroupRepository.FindAll().Where(x => !x.IsDeleted && x.Name.Trim().Contains("++" + permgr.Name.Trim() + "++") || x.Name.Trim().Split('+').Last() == permgr.Name.Trim()).Any())
     {
         _userPermissionGroupService.AddPermissionsToAdditionalGroups(id, selectedObjectIds, ownObjets);
     }
     return Json("", JsonRequestBehavior.AllowGet);
 }