public void RemoveComment() { CellAddress addrA1 = new CellAddress("A1"); CellAddress addrA2 = new CellAddress("A2"); CellAddress addrA3 = new CellAddress("A3"); CommentsTable sheetComments = new CommentsTable(); CT_Comment a1 = sheetComments.NewComment(addrA1); CT_Comment a2 = sheetComments.NewComment(addrA2); CT_Comment a3 = sheetComments.NewComment(addrA3); Assert.AreSame(a1, sheetComments.GetCTComment(addrA1)); Assert.AreSame(a2, sheetComments.GetCTComment(addrA2)); Assert.AreSame(a3, sheetComments.GetCTComment(addrA3)); Assert.AreEqual(3, sheetComments.GetNumberOfComments()); Assert.IsTrue(sheetComments.RemoveComment(addrA1)); Assert.AreEqual(2, sheetComments.GetNumberOfComments()); Assert.IsNull(sheetComments.GetCTComment(addrA1)); Assert.AreSame(a2, sheetComments.GetCTComment(addrA2)); Assert.AreSame(a3, sheetComments.GetCTComment(addrA3)); Assert.IsTrue(sheetComments.RemoveComment(addrA2)); Assert.AreEqual(1, sheetComments.GetNumberOfComments()); Assert.IsNull(sheetComments.GetCTComment(addrA1)); Assert.IsNull(sheetComments.GetCTComment(addrA2)); Assert.AreSame(a3, sheetComments.GetCTComment(addrA3)); Assert.IsTrue(sheetComments.RemoveComment(addrA3)); Assert.AreEqual(0, sheetComments.GetNumberOfComments()); Assert.IsNull(sheetComments.GetCTComment(addrA1)); Assert.IsNull(sheetComments.GetCTComment(addrA2)); Assert.IsNull(sheetComments.GetCTComment(addrA3)); }
public ResultResponse ReviewCapexComment(CommentsTable commets, int userId) { try { accessManager.SqlConnectionOpen(DataBase.SQQeye); List <SqlParameter> aParameters = new List <SqlParameter>(); aParameters.Add(new SqlParameter("@CapexInfoId", commets.CapexInfoId)); aParameters.Add(new SqlParameter("@userId", userId)); aParameters.Add(new SqlParameter("@ReviewTo", commets.ReviewerTo)); aParameters.Add(new SqlParameter("@ReviewMessage", commets.ReviewMessage)); ResultResponse result = new ResultResponse(); result.isSuccess = accessManager.UpdateData("sp_ReviewUpdateComment", aParameters); return(result); } catch (Exception e) { accessManager.SqlConnectionClose(true); throw; } finally { accessManager.SqlConnectionClose(); } }
public void GetCellComment() { CommentsTable sheetComments = new CommentsTable(); CT_Comments comments = sheetComments.GetCTComments(); CT_CommentList commentList = comments.commentList; // Create 2 comments for A1 and A" cells CT_Comment comment0 = commentList.InsertNewComment(0); comment0.@ref = "A1"; CT_Rst ctrst0 = new CT_Rst(); ctrst0.t = (TEST_A1_TEXT); comment0.text = (ctrst0); CT_Comment comment1 = commentList.InsertNewComment(0); comment1.@ref = ("A2"); CT_Rst ctrst1 = new CT_Rst(); ctrst1.t = (TEST_A2_TEXT); comment1.text = (ctrst1); // Test Finding the right comment for a cell Assert.AreSame(comment0, sheetComments.GetCTComment(new CellAddress("A1"))); Assert.AreSame(comment1, sheetComments.GetCTComment(new CellAddress("A2"))); Assert.IsNull(sheetComments.GetCTComment(new CellAddress("A3"))); }
public async Task <IActionResult> Edit(int id, [Bind("CommentId,Comment,CommentDate,AdventurePostId,UserId")] CommentsTable commentsTable) { if (id != commentsTable.CommentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(commentsTable); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentsTableExists(commentsTable.CommentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AdventurePostId"] = new SelectList(_context.AdventuresPost, "PostId", "PostId", commentsTable.AdventurePostId); ViewData["UserId"] = new SelectList(_context.User, "Id", "Id", commentsTable.UserId); return(View(commentsTable)); }
/** * Creates a comment. * @param anchor the client anchor describes how this comment is attached * to the sheet. * @return the newly Created comment. */ public IComment CreateCellComment(IClientAnchor anchor) { XSSFClientAnchor ca = (XSSFClientAnchor)anchor; XSSFSheet sheet = (XSSFSheet)GetParent(); //create comments and vmlDrawing parts if they don't exist CommentsTable comments = sheet.GetCommentsTable(true); XSSFVMLDrawing vml = sheet.GetVMLDrawing(true); NPOI.OpenXmlFormats.Vml.CT_Shape vmlShape = vml.newCommentShape(); if (ca.IsSet()) { // convert offsets from emus to pixels since we get a DrawingML-anchor // but create a VML Drawing int dx1Pixels = ca.Dx1 / Units.EMU_PER_PIXEL; int dy1Pixels = ca.Dy1 / Units.EMU_PER_PIXEL; int dx2Pixels = ca.Dx2 / Units.EMU_PER_PIXEL; int dy2Pixels = ca.Dy2 / Units.EMU_PER_PIXEL; String position = ca.Col1 + ", " + dx1Pixels + ", " + ca.Row1 + ", " + dy1Pixels + ", " + ca.Col2 + ", " + dx2Pixels + ", " + ca.Row2 + ", " + dy2Pixels; vmlShape.GetClientDataArray(0).SetAnchorArray(0, position); } String ref1 = new CellReference(ca.Row1, ca.Col1).FormatAsString(); if (comments.FindCellComment(ref1) != null) { throw new ArgumentException("Multiple cell comments in one cell are not allowed, cell: " + ref1); } return(new XSSFComment(comments, comments.NewComment(ref1), vmlShape)); }
public FeatureEntry(string id, string status_id, string name_enu, string status_enu, string comments_enu, string name_fra, string status_fra, string comments_fra) { int.TryParse(id, out int IdInt); Id = IdInt; int.TryParse(status_id, out int StatusInt); StatusId = StatusInt; string EnglishName = Language.ReplaceHtml(name_enu); NameTable.Add(LanguageStates.English, EnglishName); string EnglishStatus = Language.ReplaceHtml(status_enu); StatusTable.Add(LanguageStates.English, EnglishStatus); string EnglishComments = Language.ReplaceHtml(comments_enu); CommentsTable.Add(LanguageStates.English, EnglishComments); string FrenchName = Language.ReplaceHtml(name_fra); NameTable.Add(LanguageStates.French, FrenchName); string FrenchStatus = Language.ReplaceHtml(status_fra); StatusTable.Add(LanguageStates.French, FrenchStatus); string FrenchComments = Language.ReplaceHtml(comments_fra); CommentsTable.Add(LanguageStates.French, FrenchComments); }
public List <CommentsTable> GetAllComments(int RequestId) { List <CommentsTable> requestList = new List <CommentsTable>(); try { accessManager.SqlConnectionOpen(DataBase.DataEntryTracker); List <SqlParameter> aParameters = new List <SqlParameter>(); aParameters.Add(new SqlParameter("@RequestId", RequestId)); SqlDataReader dr = accessManager.GetSqlDataReader("sp_GetAllComments", aParameters); while (dr.Read()) { CommentsTable requestmodal = new CommentsTable(); requestmodal.UserName = dr["UserName"].ToString(); requestmodal.ReviewMessage = dr["Comments"].ToString(); requestmodal.CreateTime = dr["CreateTime"].ToString(); requestList.Add(requestmodal); } return(requestList); } catch (Exception e) { accessManager.SqlConnectionClose(true); throw e; } finally { accessManager.SqlConnectionClose(); } }
public ActionResult ReviewCapexInfo(CommentsTable comments) { ResultResponse result = new ResultResponse(); int userID = Convert.ToInt32(Session["SQuserId"].ToString()); result = capexApproval.ReviewCapexComment(comments, userID); return(Json(result, JsonRequestBehavior.AllowGet)); }
// GET: CommentsTables/Create public IActionResult Create(string userid, int id) { //ViewData["AdventurePostId"] = id; //ViewData["UserId"] = userid; CommentsTable commentsTable = new CommentsTable() { UserId = userid, AdventurePostId = id }; return(View(commentsTable)); }
public void Adds_Prefix_To_Table_Name() { // Arrange var prefix = Rnd.Str; var expected = $"{prefix}comments"; // Act var result = new CommentsTable(prefix).ToString(); // Assert Assert.Equal(expected, result); }
public async Task <IActionResult> Create([Bind("CommentId,Comment,CommentDate,AdventurePostId,UserId")] CommentsTable commentsTable) { if (ModelState.IsValid) { _context.Add(commentsTable); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AdventurePostId"] = new SelectList(_context.AdventuresPost, "PostId", "PostId", commentsTable.AdventurePostId); ViewData["UserId"] = new SelectList(_context.User, "Id", "Id", commentsTable.UserId); return(View(commentsTable)); }
public void FindAuthor() { CommentsTable sheetComments = new CommentsTable(); Assert.AreEqual(1, sheetComments.GetNumberOfAuthors()); Assert.AreEqual(0, sheetComments.FindAuthor("")); Assert.AreEqual("", sheetComments.GetAuthor(0)); Assert.AreEqual(1, sheetComments.FindAuthor(TEST_AUTHOR)); Assert.AreEqual(2, sheetComments.FindAuthor("another author")); Assert.AreEqual(1, sheetComments.FindAuthor(TEST_AUTHOR)); Assert.AreEqual(3, sheetComments.FindAuthor("YAA")); Assert.AreEqual(2, sheetComments.FindAuthor("another author")); }
protected void PostComment_Click(object sender, EventArgs e) { string text = CommentText.Text; if (String.IsNullOrEmpty(text)) { return; } SqlDatabase database = new SqlDatabase(); CommentsTable comments = new CommentsTable(database); ApplicationUserManager manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>(); string userID = ApplicationUserStore.GetUserIDByName(manager, User); comments.Insert(postID, userID, text); Response.Redirect(Request.RawUrl); }
public IComment CreateCellComment(IClientAnchor anchor) { XSSFClientAnchor xssfClientAnchor = (XSSFClientAnchor)anchor; XSSFSheet parent = (XSSFSheet)this.GetParent(); CommentsTable commentsTable = parent.GetCommentsTable(true); NPOI.OpenXmlFormats.Vml.CT_Shape vmlShape = parent.GetVMLDrawing(true).newCommentShape(); if (xssfClientAnchor.IsSet()) { string str = xssfClientAnchor.Col1.ToString() + ", 0, " + (object)xssfClientAnchor.Row1 + ", 0, " + (object)xssfClientAnchor.Col2 + ", 0, " + (object)xssfClientAnchor.Row2 + ", 0"; vmlShape.GetClientDataArray(0).SetAnchorArray(0, str); } return((IComment) new XSSFComment(commentsTable, commentsTable.CreateComment(), vmlShape) { Column = xssfClientAnchor.Col1, Row = xssfClientAnchor.Row1 }); }
private void DisplayComments() { if (comments == null) { SqlDatabase database = new SqlDatabase(); CommentsTable commentsTable = new CommentsTable(database); comments = commentsTable.GetComments(postID); } if (!User.Identity.IsAuthenticated && comments.Count == 0) { commentsLabel.Visible = false; } while (comments.Count > 0) { Comment comment = comments.Pop(); CommentsTable.Rows.Add(comment.GetRow()); } }
public void Author() { CommentsTable sheetComments = new CommentsTable(); CT_Comment ctComment = sheetComments.NewComment("A1"); Assert.AreEqual(1, sheetComments.GetNumberOfAuthors()); XSSFComment comment = new XSSFComment(sheetComments, ctComment, null); Assert.AreEqual("", comment.Author); comment.Author = ("Apache POI"); Assert.AreEqual("Apache POI", comment.Author); Assert.AreEqual(2, sheetComments.GetNumberOfAuthors()); comment.Author = ("Apache POI"); Assert.AreEqual(2, sheetComments.GetNumberOfAuthors()); comment.Author = (""); Assert.AreEqual("", comment.Author); Assert.AreEqual(2, sheetComments.GetNumberOfAuthors()); }
public void GetSetCol() { CommentsTable sheetComments = new CommentsTable(); XSSFVMLDrawing vml = new XSSFVMLDrawing(); CT_Comment ctComment = sheetComments.NewComment(CellAddress.A1); CT_Shape vmlShape = vml.newCommentShape(); XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); comment.Column = (1); Assert.AreEqual(1, comment.Column); Assert.AreEqual(1, new CellReference(ctComment.@ref).Col); Assert.AreEqual(1, vmlShape.GetClientDataArray(0).GetColumnArray(0)); comment.Column = (5); Assert.AreEqual(5, comment.Column); Assert.AreEqual(5, new CellReference(ctComment.@ref).Col); Assert.AreEqual(5, vmlShape.GetClientDataArray(0).GetColumnArray(0)); }
public void GetSetRow() { CommentsTable sheetComments = new CommentsTable(); XSSFVMLDrawing vml = new XSSFVMLDrawing(); CT_Comment ctComment = sheetComments.NewComment("A1"); CT_Shape vmlShape = vml.newCommentShape(); XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); comment.Row = (1); Assert.AreEqual(1, comment.Row); Assert.AreEqual(1, new CellReference(ctComment.@ref).Row); Assert.AreEqual(1, vmlShape.GetClientDataArray(0).GetRowArray(0)); comment.Row = (5); Assert.AreEqual(5, comment.Row); Assert.AreEqual(5, new CellReference(ctComment.@ref).Row); Assert.AreEqual(5, vmlShape.GetClientDataArray(0).GetRowArray(0)); }
public void Constructor() { CommentsTable sheetComments = new CommentsTable(); Assert.IsNotNull(sheetComments.GetCTComments().commentList); Assert.IsNotNull(sheetComments.GetCTComments().authors); Assert.AreEqual(1, sheetComments.GetCTComments().authors.SizeOfAuthorArray()); Assert.AreEqual(1, sheetComments.GetNumberOfAuthors()); CT_Comment ctComment = sheetComments.NewComment("A1"); CT_Shape vmlShape = new CT_Shape(); XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); Assert.AreEqual(null, comment.String.String); Assert.AreEqual(0, comment.Row); Assert.AreEqual(0, comment.Column); Assert.AreEqual("", comment.Author); Assert.AreEqual(false, comment.Visible); }
/** * Creates a new XSSFComment, associated with a given * low level comment object. */ public XSSFComment(CommentsTable comments, CT_Comment comment, CT_Shape vmlShape) { _comment = comment; _comments = comments; _vmlShape = vmlShape; // we potentially need to adjust the column/row information in the shape // the same way as we do in setRow()/setColumn() if (vmlShape != null && vmlShape.SizeOfClientDataArray() > 0) { CellReference ref1 = new CellReference(comment.@ref); CT_ClientData clientData = vmlShape.GetClientDataArray(0); clientData.SetRowArray(0, ref1.Row); clientData.SetColumnArray(0, ref1.Col); // There is a very odd xmlbeans bug when changing the row // arrays which can lead to corrupt pointer // This call seems to fix them again... See bug #50795 //vmlShape.GetClientDataList().ToString(); } }
/** * Creates a comment. * @param anchor the client anchor describes how this comment is attached * to the sheet. * @return the newly Created comment. */ public IComment CreateCellComment(IClientAnchor anchor) { XSSFClientAnchor ca = (XSSFClientAnchor)anchor; XSSFSheet sheet = (XSSFSheet)GetParent(); //create comments and vmlDrawing parts if they don't exist CommentsTable comments = sheet.GetCommentsTable(true); XSSFVMLDrawing vml = sheet.GetVMLDrawing(true); NPOI.OpenXmlFormats.Vml.CT_Shape vmlShape = vml.newCommentShape(); if (ca.IsSet()) { String position = ca.Col1 + ", 0, " + ca.Row1 + ", 0, " + ca.Col2 + ", 0, " + ca.Row2 + ", 0"; vmlShape.GetClientDataArray(0).SetAnchorArray(0, position); } String ref1 = new CellReference(ca.Row1, ca.Col1).FormatAsString(); XSSFComment shape = new XSSFComment(comments, comments.NewComment(ref1), vmlShape); return(shape); }
public XSSFComment(CommentsTable comments, CT_Comment comment, CT_Shape vmlShape) { this._comment = comment; this._comments = comments; this._vmlShape = vmlShape; }
public ModelDetail() { _detailContext = new MyWebContext(); _commentTable = new CommentsTable(); }
public ContentDetailController() { _detailContext = new MyWebContext(); _commentTable = new CommentsTable(); _modelDetail = new ModelDetail(); }
/** * Creates a new XSSFComment, associated with a given * low level comment object. */ public XSSFComment(CommentsTable comments, CT_Comment comment, CT_Shape vmlShape) { _comment = comment; _comments = comments; _vmlShape = vmlShape; }
public CapexInformationMaster GetSavedCapex(int userId, int capexInfoId) { CapexInformationMaster capexInformationMaster = new CapexInformationMaster(); try { accessManager.SqlConnectionOpen(DataBase.SQQeye); List <SqlParameter> aList = new List <SqlParameter>(); aList.Add(new SqlParameter("@capexId", capexInfoId)); SqlDataReader dr = accessManager.GetSqlDataReader("sp_GetSavedCapex", aList); while (dr.Read()) { capexInformationMaster.CapexInfoId = (int)dr["CapexInfoId"]; capexInformationMaster.CapexName = dr["CapexName"].ToString(); capexInformationMaster.CapexAssetType = dr["CapexAssetType"].ToString(); capexInformationMaster.CapexCreateDate = (DateTime)dr["CapexCreateDate"]; capexInformationMaster.CapexDescription = dr["CapexDescription"].ToString(); capexInformationMaster.BusinessUnitName = dr["BusinessUnitName"].ToString(); capexInformationMaster.CapexCatagoryName = dr["CapexCatagoryName"].ToString(); capexInformationMaster.Currency = dr["CurrencyName"].ToString(); capexInformationMaster.UserName = dr["UserName"].ToString(); capexInformationMaster.UserId = (int)dr["UserId"]; capexInformationMaster.Revision = (int)dr["Revision"]; } dr.Close(); capexInformationMaster.CapexInformationDetails = new List <CapexInformationDetails>(); dr = accessManager.GetSqlDataReader("sp_GetDetailsSavedCapex", aList); while (dr.Read()) { CapexInformationDetails capexInformation = new CapexInformationDetails(); capexInformation.CapexInfoDetailsId = (int)dr["CapexInfoDetailsId"]; capexInformation.CapexAssetCatagory = dr["CapexAssetCatagory"].ToString(); capexInformation.CapexAssetDescription = dr["CapexAssetDescription"].ToString(); capexInformation.CapexDetailsQty = float.Parse(dr["CapexDetailsQty"].ToString()); capexInformation.CapexUnitPrice = float.Parse(dr["CapexUnitPrice"].ToString()); capexInformation.CapexEstimatedCost = float.Parse(dr["CapexEstimatedCost"].ToString()); capexInformationMaster.CapexInformationDetails.Add(capexInformation); } capexInformationMaster.ApproverQueryModelList = new List <QueryModel>(); dr.Close(); dr = accessManager.GetSqlDataReader("sp_GetApproverReview", aList); while (dr.Read()) { QueryModel query = new QueryModel(); query.ApprovalId = (int)dr["CapApproverId"]; query.IsApproved = (int)dr["IsApproved"]; query.ApproverUserId = (int)dr["UserId"]; query.UpdateDate = dr["UpdateDate"].ToString(); query.ReplyMessage = dr["ReplyMessComment"].ToString(); query.ReviewComment = dr["ReviewComment"].ToString(); query.DesignationName = dr["DesignationName"].ToString(); query.ApproverName = dr["UserName"].ToString(); capexInformationMaster.ApproverQueryModelList.Add(query); } capexInformationMaster.CommentsTables = new List <CommentsTable>(); dr.Close(); dr = accessManager.GetSqlDataReader("sp_GetAllCommentsByID", aList); while (dr.Read()) { CommentsTable comment = new CommentsTable(); comment.ReviewerByName = dr["ReviwerBY"].ToString(); comment.ReviewerToName = dr["ReviwerTo"].ToString(); comment.ReviewMessage = dr["ReviewMessage"].ToString(); comment.UpdatedBY = (DateTime)dr["UpdatedBY"]; capexInformationMaster.CommentsTables.Add(comment); } capexInformationMaster.CapexFileUpload = new List <CapexFileUploadDetails>(); capexInformationMaster.CapexFileUpload = GetUploadedFilesByID(capexInfoId, userId); return(capexInformationMaster); } catch (Exception e) { accessManager.SqlConnectionClose(true); throw; } finally { accessManager.SqlConnectionClose(); } }
public void TestBug58175() { IWorkbook wb = new SXSSFWorkbook(); try { ISheet sheet = wb.CreateSheet(); IRow row = sheet.CreateRow(1); ICell cell = row.CreateCell(3); cell.SetCellValue("F4"); ICreationHelper factory = wb.GetCreationHelper(); // When the comment box is visible, have it show in a 1x3 space IClientAnchor anchor = factory.CreateClientAnchor(); anchor.Col1 = (cell.ColumnIndex); anchor.Col2 = (cell.ColumnIndex + 1); anchor.Row1 = (row.RowNum); anchor.Row2 = (row.RowNum + 3); XSSFClientAnchor ca = (XSSFClientAnchor)anchor; // create comments and vmlDrawing parts if they don't exist CommentsTable comments = (((SXSSFWorkbook)wb).XssfWorkbook .GetSheetAt(0) as XSSFSheet).GetCommentsTable(true); XSSFVMLDrawing vml = (((SXSSFWorkbook)wb).XssfWorkbook .GetSheetAt(0) as XSSFSheet).GetVMLDrawing(true); CT_Shape vmlShape1 = vml.newCommentShape(); if (ca.IsSet()) { String position = ca.Col1 + ", 0, " + ca.Row1 + ", 0, " + ca.Col2 + ", 0, " + ca.Row2 + ", 0"; vmlShape1.GetClientDataArray(0).SetAnchorArray(0, position); } // create the comment in two different ways and verify that there is no difference XSSFComment shape1 = new XSSFComment(comments, comments.NewComment(CellAddress.A1), vmlShape1); shape1.Column = (ca.Col1); shape1.Row = (ca.Row1); CT_Shape vmlShape2 = vml.newCommentShape(); if (ca.IsSet()) { String position = ca.Col1 + ", 0, " + ca.Row1 + ", 0, " + ca.Col2 + ", 0, " + ca.Row2 + ", 0"; vmlShape2.GetClientDataArray(0).SetAnchorArray(0, position); } CellAddress ref1 = new CellAddress(ca.Row1, ca.Col1); XSSFComment shape2 = new XSSFComment(comments, comments.NewComment(ref1), vmlShape2); Assert.AreEqual(shape1.Author, shape2.Author); Assert.AreEqual(shape1.ClientAnchor, shape2.ClientAnchor); Assert.AreEqual(shape1.Column, shape2.Column); Assert.AreEqual(shape1.Row, shape2.Row); Assert.AreEqual(shape1.GetCTComment().ToString(), shape2.GetCTComment().ToString()); Assert.AreEqual(shape1.GetCTComment().@ref, shape2.GetCTComment().@ref); /*CommentsTable table1 = shape1.CommentsTable; * CommentsTable table2 = shape2.CommentsTable; * Assert.AreEqual(table1.CTComments.toString(), table2.CTComments.toString()); * Assert.AreEqual(table1.NumberOfComments, table2.NumberOfComments); * Assert.AreEqual(table1.Relations, table2.Relations);*/ Assert.AreEqual(vmlShape1.ToString().Replace("_x0000_s\\d+", "_x0000_s0000"), vmlShape2.ToString().Replace("_x0000_s\\d+", "_x0000_s0000"), "The vmlShapes should have equal content afterwards"); } finally { wb.Close(); } }