public async Task <List <RequestComments> > UpdateComments(RequestComments comments) { List <RequestComments> req = new List <RequestComments> { }; using (IDbConnection dbConnection = this.GetConnection()) { try { dbConnection.Open(); var result = await dbConnection.QueryMultipleAsync("UpdateComments", new { Id = comments.Id, RequestId = comments.RequestId, Comments = comments.Comments, CreatedBy = comments.CreatedBy }, commandType : CommandType.StoredProcedure);; var requestEntities = await result.ReadAsync <RequestComments>(); req = requestEntities.ToList(); } catch (Exception ex) { throw ex; } finally { dbConnection.Close(); } } return(req); }
public IHttpActionResult actualizarStatus(RequestComments request) { request.userName = User.Identity.Name; IRepositoryCustomer customer = new Customer(); return(Json(customer.UpdateStutus(request))); }
protected async Task DoRefreshCommentsCommand() { if (Status == NetworkStatus.NotReachable) //true || { ShowErrorMessage(Settings.MSG_NETWORK_NOT_REACHABLE); return; } IsLoading = true; var req = new RequestComments(Post.Id); try{ var response = await Service.GetComments(req); var ref_comments = response.Comments; ObservableCollection <Comment> _Comments = new ObservableCollection <Comment>(); foreach (Comment c in ref_comments) { c.Content = GetCommentText(c); _Comments.Add(c); } Comments.Clear(); Comments = _Comments; RaisePropertyChanged(() => Comments); } catch (Exception e) { Debug.WriteLine(e); ShowErrorMessage(Settings.MSG_NETWORK_COMMON, e); return; } IsLoading = false; }
private async Task <CommentsResult> Read(bool all, int page, CancellationToken token) { var request = JsonConvert.SerializeObject(RequestComments.Create(long.Parse(article.Id), all, page: page)); var json = await reader.Post( new Uri("https://api.delfi.lt/comment/v1/graphql"), request, token, webRequest => { webRequest.Headers["Origin"] = "https://www.delfi.lt"; webRequest.Headers["Accept-Encoding"] = "gzip, deflate, br"; webRequest.Referer = article.Url.ToString(); webRequest.ContentType = "application/json"; }).ConfigureAwait(false); var data = JsonConvert.DeserializeObject <CommentsResult>(json, Converter.Settings); return(data); }
public static string GetDetails(int requestId) { Role userRole = SnapSession.CurrentUser.CurrentRole; bool includeADManager = false; int[] commentFilter; switch (userRole) { case Role.AccessTeam: case Role.SuperUser: commentFilter = new int[]{(int)CommentsType.Access_Notes_Requestor, (int)CommentsType.Access_Notes_ApprovingManager, (int)CommentsType.Access_Notes_AccessTeam}; includeADManager = true; break; case Role.ApprovingManager: commentFilter = new int[]{(int)CommentsType.Access_Notes_Requestor, (int)CommentsType.Access_Notes_ApprovingManager}; break; case Role.Requestor: default: commentFilter = new int[] { (int)CommentsType.Access_Notes_Requestor }; break; } using (var db = new SNAPDatabaseDataContext()) { var textIds = from a in db.SNAP_Access_User_Texts where a.requestId == requestId group a by new { a.access_details_formId } into grp select new { ID = grp.Max(s => s.pkId) }; List<int> currentTextIds = new List<int>(); foreach (var id in textIds) { currentTextIds.Add(id.ID); } var details = from r in db.SNAP_Requests join ut in db.SNAP_Access_User_Texts on r.pkId equals ut.requestId join adf in db.SNAP_Access_Details_Forms on ut.access_details_formId equals adf.pkId where r.pkId == requestId && adf.isActive == true && currentTextIds.Contains(ut.pkId) orderby adf.pkId ascending select new { Title = r.userTitle, Manager = r.managerDisplayName, ADManager = r.managerUserId, Requestor = r.submittedBy, UserId = r.userId, Label = adf.label, Text = ut.userText }; var comments = from r in db.SNAP_Requests join rc in db.SNAP_Request_Comments on r.pkId equals rc.requestId where r.pkId == requestId && commentFilter.Contains(rc.commentTypeEnum) orderby rc.createdDate descending select new { Audience = MakeFriendlyCommentAudience((CommentsType)rc.commentTypeEnum), CreatedDate = rc.createdDate, Text = rc.commentText }; if (details != null) { RequestDetails newDetails = new RequestDetails(); List<RequestFormField> newForm = new List<RequestFormField>(); string ADManager = String.Empty; foreach (var detail in details) { if (ADManager == String.Empty) { ADManager = (includeADManager ? CompareManagerName(detail.UserId, detail.ADManager) : null); } newDetails.Title = detail.Title; newDetails.Manager = detail.Manager; newDetails.ADManager = ADManager; newDetails.Requestor = detail.Requestor; newDetails.SearchLinkUrl= Model.Utilities.WebRootUrl + Model.PageNames.SEARCH + ".aspx?requestId=" + requestId.ToString(); RequestFormField newField = new RequestFormField(); newField.Label = detail.Label; newField.Text = detail.Text; newForm.Add(newField); } newDetails.Details = newForm; if (comments != null) { List<RequestComments> newComments = new List<RequestComments>(); foreach (var comment in comments) { RequestComments newComment = new RequestComments(); newComment.Audience = comment.Audience; newComment.CreatedDate = comment.CreatedDate.ToString("MMM d, yyyy") + " at " + comment.CreatedDate.ToString("h:mm tt"); newComment.Text = comment.Text; newComments.Add(newComment); } newDetails.Comments = newComments; } DataContractJsonSerializer serializer = new DataContractJsonSerializer(newDetails.GetType()); using (MemoryStream ms = new MemoryStream()) { serializer.WriteObject(ms, newDetails); string retVal = Encoding.Default.GetString(ms.ToArray()); return retVal; } } return string.Empty; } }
public async Task <List <RequestComments> > UpdateComments(RequestComments comments) { var result = await _requestRepository.UpdateComments(comments); return(result); }
public async Task <IActionResult> UpdateComments([FromBody] RequestComments comment) { var req = await _requestManager.UpdateComments(comment); return(Ok(req)); }