public ActiveExtensions(Guid DriverGuid, Guid GrabberGuid, Guid[] ProcessorGuids, Guid[] FilterGuids, Guid[] NotifierGuids) { this._ActiveProcessors = new List<GlowScreenProcessor>(); this._ActiveFilters = new List<GlowFilter>(); this._ActiveNotifiers = new List<GlowNotifier>(); this.DriverGuid = DriverGuid; this.GrabberGuid = GrabberGuid; this.ProcessorGuids = ProcessorGuids.ToList(); this.FilterGuids = FilterGuids.ToList(); this.NotifierGuids = NotifierGuids.ToList(); }
public ActionResult Post(Guid roleId, Guid[] ids) { try { _roleFunctionService.Update(roleId, ids.ToList()); return Json(true); } catch (Exception e) { _logger.Error(e.Message); _logger.Error(e.StackTrace); return Json(false); } }
public LeadDto[] GetByIds(Guid[] ids) { try { using (var transactionScope = new TransactionScope()) { var employeeDtos = new LeadDtoMapper().Map(_leadRepository.GetByIds(ids.ToList()).ToArray()); transactionScope.Complete(); return employeeDtos; } } finally { _sessionProvider.CloseCurrent(); } }
public AppointmentDto[] GetByIds(Guid[] ids) { try { using (var transactionScope = new TransactionScope()) { var appointmentDtos = new AppointmentDtoMapper().Map(_appointmentRepository.GetByIds(ids.ToList()).ToArray()); transactionScope.Complete(); return appointmentDtos; } } finally { _sessionProvider.CloseCurrent(); } }
public PartialViewResult AddSelectedEmployees(long riskAssessmentId, Guid[] employeeIds) { var request = new AddEmployeesToChecklistGeneratorRequest() { CompanyId = CurrentUser.CompanyId, CurrentUserId = CurrentUser.UserId, EmployeeIds = employeeIds.ToList(), PersonalRiskAssessmentId = riskAssessmentId }; _personalRiskAssessmentService.AddEmployeesToChecklistGenerator(request); var model = _selectedEmployeeViewModelFactory.WithCompanyId(CurrentUser.CompanyId).WithRiskAssessmentId(riskAssessmentId).WithUserId(CurrentUser.UserId) .GetViewModel(); return PartialView("_EmployeeSelected", model); }
public static List<Tuple<Guid, string, List<Tuple<Guid, string>>>> GetDependingEntityAccess(string metaviewName, Guid[] ids, int deep = 1) { DynamicEntityRepository repo = new DynamicEntityRepository(); EntityMetadata metadata = repo.GetEntityMetadataByEntityName(metaviewName); List<Guid> dependingEntityMetadataIds = MetadataRepositoty.GetDependingEntityIds(new TableDescription(metadata.SchemaName, metadata.TableName)); Dictionary<Guid, EntityMetadata> dependingMetadata = dependingEntityMetadataIds.Select(id => new KeyValuePair<Guid, EntityMetadata>(id, repo.GetEntityMetadataByEntityId(id))) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); var dependingEntities = new List<Tuple<Guid, string, List<Tuple<Guid, string>>>>(); foreach (var entityMetadata in dependingMetadata) { FilterCriteriaSet filters = FilterCriteriaSet.Empty; AttributeDescription entityCaptionAttribute = OptimaJet.BJet.CommonMethods.GetEntityCaptionAttribute(entityMetadata.Value); List<FilterCriteriaSet> filterSets = entityMetadata.Value.PlainAttributes.Where(a => a.IsReference && a.ReferencedSchemaName == metadata.SchemaName && a.ReferencedTableName == metadata.TableName) .Select(a => FilterCriteriaSet.And.In(ids.ToList(), entityMetadata.Value.GetColumn(a))).ToList(); filterSets.ForEach(f => filters = filters != FilterCriteriaSet.Empty ? filters.Merge(f) : f); var entities = repo.GetEntitiesByMetadata(entityMetadata.Value, filters).Entities; if (entities == null || entities.Count() == 0) continue; var dependingEntity = new Tuple<Guid, string, List<Tuple<Guid, string>>>( entityMetadata.Key, entityMetadata.Value.TableName, new List<Tuple<Guid, string>>(entities.Select(e => new Tuple<Guid, string>((Guid)e.Id, e.GetProperty(entityCaptionAttribute.PropertyName).ToString()) ).ToList())); dependingEntities.Add(dependingEntity); if (deep > 0) dependingEntities.AddRange(GetDependingEntityAccess(dependingEntity.Item2, dependingEntity.Item3.Select(t => t.Item1).ToArray(), deep - 1)); } return dependingEntities; }
protected override void OnDeleteRows(Guid[] checkedRecords) { string entityName = LocalizationProvider.Provider.GetMetaEntiryName(); var objs = DynamicRepository.GetByEntity(entityName, FilterCriteriaSet.And.In(checkedRecords.ToList(), "Id")); List<string> keys = new List<string>(); foreach(var obj in objs) { if(!keys.Contains(obj.Key)) keys.Add(obj.Key); } DynamicRepository.DeleteByEntity(entityName, DynamicRepository.GetByEntity(entityName, FilterCriteriaSet.And.In(keys, "Key")).Select(c=> c.Id).ToList()); }
/// <summary> /// Remove photo to employee /// </summary> /// <param name="employeeId">Employee identifier</param> /// <param name="photoIdentifier">Employee photo identifier</param> public Model.EmployeePhotoExecutionResults EmployeePhotosRemove(long employeeId, Guid[] photoIdentifiers) { UpdateSessionCulture(); using (var logSession = Helpers.Log.Session($"{GetType()}.{System.Reflection.MethodBase.GetCurrentMethod().Name}()", VerboseLog, RaiseLog)) try { var emp = EmployeeGet(employeeId); if (emp.Exception != null) throw emp.Exception; using (var rep = GetNewRepository(logSession)) { photoIdentifiers.ToList().ForEach(photoIdentifier => { var dbPhoto = rep.Get<Repository.Model.EmployeePhoto>(e => e.FileId == photoIdentifier).SingleOrDefault(); if (dbPhoto == null) throw new Exception(string.Format(Properties.Resources.FILESERVICE_FileNotFound, photoIdentifier)); rep.Remove(dbPhoto, saveAfterRemove: false); }); rep.SaveChanges(true); } return EmployeePhotosGet(employeeId); } catch (Exception ex) { ex.Data.Add(nameof(employeeId), employeeId); ex.Data.Add(nameof(photoIdentifiers), photoIdentifiers.Concat(i => i.ToString(),", ")); logSession.Enabled = true; logSession.Add(ex); return new EmployeePhotoExecutionResults(ex); } }
public ActionResult ExceptionsDeleteList(string log, Guid[] ids, bool returnCounts = false) { if (ids == null || ids.Length == 0) return Json(true); ExceptionStores.Action(log, s => s.DeleteErrors(log, ids.ToList())); return returnCounts ? ExceptionCounts() : Json(new { url = Url.Action("Exceptions", new { log }) }); }