public List <DestinationDto> GetDestinationDto(string[] userNames) { var destinationDto = new List <DestinationDto>(); var context = DbContext as WorkflowContext; foreach (string userName in userNames) { var employee = context.EmployeeViews.Where(x => x.LoginName.ToLower() == userName.ToLower()).FirstOrDefault(); if (employee != null) { var dto = new DestinationDto() { DeptType = employee.DeptType, DisplayName = employee.DisplayName, Email = employee.Email, EmpNo = employee.EmpNo, GroupName = employee.GroupName, LoginName = employee.LoginName, Manager = employee.Manager, MobilePhone = employee.MobilePhone, Position = employee.Position, TeamName = employee.TeamName, Telephone = employee.Telephone }; destinationDto.Add(dto); } } return(destinationDto); }
public bool DoRedirect(string serialNumber, DestinationDto user) { if (user == null || string.IsNullOrEmpty(user.LoginName) || !SecurityLabelUtils.IsCorrectUserName(user.LoginName)) { return(false); } _client.RedirectWorklistItem(serialNumber, SecurityLabelUtils.GetNameWithLabel(user.LoginName)); return(true); }
public bool DoRedirect(string serial, DestinationDto user) { bool result = false; using (var client = new K2Client(_currentUser)) { client.Assign(serial, user.LoginName); result = true; } return(result); }
public async Task <IActionResult> PostAsync([FromBody] DestinationDto destinationDto) { var destination = mapper.Map <Destination>(destinationDto); var user = await userService.GetByIdAsync(destinationDto.UserId); user.Destinations.Add(destination); await userService.SaveChangesAsync(); return(Ok()); }
internal DestinationDto HateoasMainLinksDestinations(DestinationDto destination) { var destinationDto = destination; destinationDto.Links.Add(UrlLink("all", "GetDestinations", null)); destinationDto.Links.Add(UrlLink("_self", "GetDestinationById", new { id = destinationDto.Id })); destinationDto.Links.Add(UrlLink("_next", "GetDestinationById", new { id = destinationDto.Id + 1 })); destinationDto.Links.Add(UrlLink("_cityName", "GetDestinationByCity", new { City = "stockholm" })); destinationDto.Links.Add(UrlLink("_counterName", "GetDestinationByCountry", new { Country = "sweden" })); return(destinationDto); }
public bool Redirect(string serialNumber, DestinationDto user, Domain.Entities.ActivityHistory actLog) { var success = false; success = _provider.DoRedirect(serialNumber, user); if (success) { _actLog.Add(actLog); _actLog.Commit(); } return(success); }
public async Task <ActionResult <DestinationDto> > PostEvent(DestinationDto destinationDto) { try { var mappedEntity = _mapper.Map <Destination>(destinationDto); _destinationRepository.Add(mappedEntity); if (await _destinationRepository.Save()) { return(Created($"/api/v1.0/Destinations/{mappedEntity.Id}", _mapper.Map <Destination>(mappedEntity))); } } catch (Exception e) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}")); } return(BadRequest()); }
///// <summary> ///// Get User Out of Office status from K2 HostServer ///// </summary> ///// <param name="originalDestinationUser">The Originator Destination User</param> ///// <returns>The Worklist user status</returns> //public bool GetOOFStatus(string originalDestinationUser) //{ // bool status = false; // bool worklistUserStatus = true; // switch (string.IsNullOrEmpty(originalDestinationUser) ? _connection.GetUserStatus() : _connection.GetUserStatus(originalDestinationUser)) // { // case UserStatuses.None: // case UserStatuses.Available: // status = true; // break; // case UserStatuses.OOF: // status = false; // break; // } // worklistUserStatus = status; // if (!worklistUserStatus) // { // WorklistShares worklistShares = new WorklistShares(); // worklistShares = _connection.GetCurrentSharingSettings(ShareType.OOF); // if (worklistShares.Count > 0) // { // WorklistShare worklistShare = worklistShares[0]; // worklistShare.ShareType = ShareType.OOF; // List<OOFUser> list = new List<OOFUser>(); // foreach (Destination destination in worklistShare.WorkTypes[0].Destinations) // { // list.Add(new OOFUser // { // UserName = destination.Name, // Type = destination.DestinationType.ToString() // }); // } // worklistUserStatus.users = list; // } // } // return worklistUserStatus; //} public List <DestinationDto> GetDestinationDto(Destinations destinations) { var destinationDto = new List <DestinationDto>(); foreach (Destination dest in destinations) { var destUser = dest.Name.FQNWithoutK2Label(); var dto = new DestinationDto() { DisplayName = destUser, EmpNo = destUser, LoginName = destUser, Position = destUser, TeamName = destUser }; destinationDto.Add(dto); } return(destinationDto); }
public HttpResponseMessage Redirect(string serialNumber, [FromBody] DestinationDto user, string comment, int requestHeaderId) { try { var act = new Domain.Entities.ActivityHistory { RequestHeaderId = requestHeaderId, ActInstId = 0, Activity = "Escalation", Approver = RequestContext.Principal.Identity.Name, Decision = "Redirected", Comments = comment }; if (_employee != null) { act.ApproverDisplayName = _employee.fullName; } return(Request.CreateResponse(HttpStatusCode.OK, _service.Redirect(serialNumber, user, act))); } catch (SmartException ex) { return(CreateErrorMessageResponse(ex)); } }
public async Task <ActionResult> PutDestination(int id, DestinationDto destinationDto) { try { var oldDestination = await _destinationRepository.GetDestinationById(id); if (oldDestination == null) { return(NotFound($"Could not find destination with id {id}")); } var newDestination = _mapper.Map(destinationDto, oldDestination); _destinationRepository.Update(newDestination); if (await _destinationRepository.Save()) { return(NoContent()); } } catch (Exception e) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Database Failure: {e.Message}")); } return(BadRequest()); }