Example #1
0
 private List <string> TypeWiseCommentTexts(CommentType type, bool includeColon)
 {
     return(TanComments.Where(tc => tc.CommentType == type).Select(tc => $"{tc.CommentType.DescriptionAttribute()}{(includeColon ? ": " : " ")}{tc.TotalComment.TrimEnd('.').Trim()}").ToList());
     //if (texts.Any() && texts.Count() == 1)
     //    return texts.Select(c => $"{c}. ").FirstOrDefault();
     //return String.Join("", texts);
 }
Example #2
0
 private void AddOtherComment(object obj)
 {
     try
     {
         if (!string.IsNullOrEmpty(OtherCOMMENT))
         {
             string Other = OtherNUM != 0 ? $"NUM {OtherNUM} {OtherCOMMENT}" : OtherCOMMENT;
             if (EditingComment == null)
             {
                 if (TanComments.Where(tc => tc.Num != 0 && tc.Num == OtherNUM).Count() == 0)
                 {
                     TanComments.Add(new Comments
                     {
                         Id           = Guid.NewGuid(),
                         Num          = OtherNUM,
                         Comment      = OtherCOMMENT,
                         CommentType  = CommentType.OTHER,
                         Length       = Other.Length,
                         TotalComment = Other
                     });
                     ClearVM(null);
                 }
                 else
                 {
                     MessageBox.Show($"For Num {OtherNUM} comments already added. Duplicate Comments are not Allowed", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else if (EditingComment.CommentType == CommentType.OTHER)
             {
                 Comments comment = (from c in TanComments.ToList()
                                     where c.Id == EditingComment.Id
                                     select c).FirstOrDefault();
                 if (comment != null)
                 {
                     comment.Comment      = OtherCOMMENT;
                     comment.CommentType  = CommentType.OTHER;
                     comment.TotalComment = Other;
                     comment.Length       = Other.Length;
                     comment.Num          = OtherNUM;
                     ClearVM(null);
                 }
             }
             else
             {
                 MessageBox.Show("You Do Not Add New Comment in Edit Mode. Please Update " + EditingComment.CommentType + " First.", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             MessageBox.Show("Comments are manadatory to Save TanComments", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         Log.This(ex);
     }
 }
Example #3
0
 private void DeleteComment(object obj)
 {
     try
     {
         DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Do you want to delete Selected Comment?", "Reactions", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (dialogResult == DialogResult.Yes)
         {
             var Comment = TanComments.Where(tc => tc.Id == SelectedComment.Id).FirstOrDefault();
             TanComments.Remove(Comment);
         }
     }
     catch (Exception ex)
     {
         Log.This(ex);
     }
 }
Example #4
0
 private void AddCASComment(object obj)
 {
     try
     {
         if (!string.IsNullOrEmpty(CasConsultedCOMMENT))
         {
             if (EditingComment == null)
             {
                 TanComments.Add(new Comments {
                     Id = Guid.NewGuid(), Comment = CasConsultedCOMMENT, CommentType = CommentType.CAS, Length = CasConsultedCOMMENT.Length, TotalComment = CasConsultedCOMMENT
                 });
                 ClearVM(null);
             }
             else if (EditingComment.CommentType == CommentType.CAS)
             {
                 Comments comment = (from c in TanComments.ToList()
                                     where c.Id == EditingComment.Id
                                     select c).FirstOrDefault();
                 if (comment != null)
                 {
                     comment.Comment      = CasConsultedCOMMENT;
                     comment.Length       = CasConsultedCOMMENT.Length;
                     comment.TotalComment = CasConsultedCOMMENT;
                     comment.CommentType  = CommentType.CAS;
                     ClearVM(null);
                 }
             }
             else
             {
                 MessageBox.Show("You Do Not Add New Comment in Edit Mode. Please Update " + EditingComment.CommentType + " First.", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             MessageBox.Show("Comments are manadatory to Save TanComments", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         Log.This(ex);
     }
 }
Example #5
0
 public void AddTanComment(string Comment, CommentType CommentType, string Column, string Figure, String FootNote, string Line, int Num, string Page, string Para, string Schemes, string Sheet, string Table, string TotalComment)
 {
     TanComments.Add(new Comments
     {
         Id           = Guid.NewGuid(),
         Comment      = Comment,
         CommentType  = CommentType,
         Length       = TotalComment.Length,
         Column       = Column,
         Figure       = Figure,
         FootNote     = FootNote,
         Line         = Line,
         Num          = Num,
         Page         = Page,
         Para         = Para,
         Schemes      = Schemes,
         Sheet        = Sheet,
         Table        = Table,
         TotalComment = TotalComment
     });
 }
Example #6
0
 private void AddAuthorComment(object obj)
 {
     try
     {
         string ErrMsg = string.Empty;
         if (ValidateAuthorComments(out ErrMsg))
         {
             string Author = ("NUM " + AuthorNUM) + (IsAuthorNumCorrected ? " (corrected)" : string.Empty) + (!string.IsNullOrEmpty(AuthorPAGE) ? ",Page " + AuthorPAGE : string.Empty) + (!string.IsNullOrEmpty(AuthorLINE) ? ",Line " + AuthorLINE : string.Empty) + (!string.IsNullOrEmpty(AuthorPARA) ? ",Para " + AuthorPARA : string.Empty) +
                             (!string.IsNullOrEmpty(AuthorCOLUMN) ? ",Column " + AuthorCOLUMN : string.Empty) + (!string.IsNullOrEmpty(AuthorTABLE) ? ",Table " + AuthorTABLE : string.Empty) + (!string.IsNullOrEmpty(AuthorFIGURE) ? ",Figure " + AuthorFIGURE : string.Empty) +
                             (!string.IsNullOrEmpty(AuthorSCHEMES) ? ",Scheme " + AuthorSCHEMES : string.Empty) +
                             (!string.IsNullOrEmpty(AuthorSHEET) ? ",Sheet " + AuthorSHEET : string.Empty) + (!string.IsNullOrEmpty(AuthorFOOTNOTE) ? ",Footnote " + AuthorFOOTNOTE : string.Empty) + "," + AuthorCOMMENT;
             if (EditingComment == null)
             {
                 if (TanComments.Where(tc => tc.Num != 0 && tc.Num == AuthorNUM).Count() == 0)
                 {
                     AddTanComment(AuthorCOMMENT, CommentType.AUTHOR, AuthorCOLUMN, AuthorFIGURE, AuthorFOOTNOTE, AuthorLINE, AuthorNUM, AuthorPAGE, AuthorPARA, AuthorSCHEMES, AuthorSHEET, AuthorTABLE, Author);
                     ClearVM(null);
                 }
                 else
                 {
                     MessageBox.Show($"Num {AuthorNUM} comments already added. Duplicate Comments are not Allowed", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     return;
                 }
             }
             else if (EditingComment.CommentType == CommentType.AUTHOR)
             {
                 Comments comment = (from c in TanComments.ToList()
                                     where c.Id == EditingComment.Id
                                     select c).FirstOrDefault();
                 if (comment != null)
                 {
                     comment.Comment      = AuthorCOMMENT;
                     comment.CommentType  = CommentType.INDEXING;
                     comment.Length       = Author.Length;
                     comment.Column       = AuthorCOLUMN;
                     comment.Figure       = AuthorFIGURE;
                     comment.FootNote     = AuthorFOOTNOTE;
                     comment.Line         = AuthorLINE;
                     comment.Num          = AuthorNUM;
                     comment.Page         = AuthorPAGE;
                     comment.Para         = AuthorPARA.ToString();
                     comment.Schemes      = AuthorSCHEMES;
                     comment.Sheet        = AuthorSHEET;
                     comment.Table        = AuthorTABLE;
                     comment.TotalComment = Author;
                 }
                 ClearVM(null);
             }
             else
             {
                 MessageBox.Show("You Do Not Add New Comment in Edit Mode. Please Update " + EditingComment.CommentType + " First.", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             MessageBox.Show("Page,NUM,Comments are manadatory to Save TanComments", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         Log.This(ex);
     }
 }
Example #7
0
        private void AddIndexComment(object obj)
        {
            try
            {
                string ErrMsg = string.Empty;
                if (ValidateIndexComments(out ErrMsg))
                {
                    string Index = ("NUM " + IndexNUM) + (!string.IsNullOrEmpty(IndexPAGE) ? ",Page " + IndexPAGE : string.Empty) + (!string.IsNullOrEmpty(IndexLINE) ? ",Line " + IndexLINE : string.Empty) + (!string.IsNullOrEmpty(IndexPARA) ? ",Para " + IndexPARA : string.Empty) +
                                   (!string.IsNullOrEmpty(IndexCOLUMN) ? ",Column " + IndexCOLUMN : string.Empty) + (!string.IsNullOrEmpty(IndexTABLE) ? ",Table " + IndexTABLE : string.Empty) + (!string.IsNullOrEmpty(IndexFIGURE) ? ",Figure " + IndexFIGURE : string.Empty) +
                                   (!string.IsNullOrEmpty(IndexSCHEMES) ? ",Scheme " + IndexSCHEMES : string.Empty) +
                                   (!string.IsNullOrEmpty(IndexSHEET) ? ",Sheet " + IndexSHEET : string.Empty) + (!string.IsNullOrEmpty(IndexFOOTNOTE) ? ",Footnote " + IndexFOOTNOTE : string.Empty) + "," + IndexCOMMENT;

                    if (EditingComment == null)
                    {
                        if (TanComments.Where(tc => tc.Num == IndexNUM).Count() == 0)
                        {
                            AddTanComment(IndexCOMMENT, CommentType.INDEXING, IndexCOLUMN, IndexFIGURE, IndexFOOTNOTE, IndexLINE, IndexNUM, IndexPAGE, IndexPARA, IndexSCHEMES, IndexSHEET, IndexTABLE, Index);
                            ClearVM(null);
                        }
                        else
                        {
                            MessageBox.Show($"For Num {IndexNUM} comments already added. Duplicate Comments are not Allowed", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    else if (EditingComment.CommentType == CommentType.INDEXING)
                    {
                        Comments comment = (from c in TanComments.ToList()
                                            where c.Id == EditingComment.Id
                                            select c).FirstOrDefault();
                        if (comment != null)
                        {
                            comment.Comment      = IndexCOMMENT;
                            comment.CommentType  = CommentType.INDEXING;
                            comment.Length       = Index.Length;
                            comment.Column       = IndexCOLUMN;
                            comment.Figure       = IndexFIGURE;
                            comment.FootNote     = IndexFOOTNOTE;
                            comment.Line         = IndexLINE;
                            comment.Num          = IndexNUM;
                            comment.Page         = IndexPAGE;
                            comment.Para         = IndexPARA.ToString();
                            comment.Schemes      = IndexSCHEMES;
                            comment.Sheet        = IndexSHEET;
                            comment.Table        = IndexTABLE;
                            comment.TotalComment = Index;
                        }
                        ClearVM(null);
                    }
                    else
                    {
                        MessageBox.Show("You Do Not Add New Comment in Edit Mode. Please Update " + EditingComment.CommentType + " First.", "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show(ErrMsg, "Reactions", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                ;
            }
            catch (Exception ex)
            {
                Log.This(ex);
            }
        }
Example #8
0
 private void TanComments_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     TanComments.UpdateDisplayOrder();
 }