Esempio n. 1
0
        private bool Insert(Comment entComment)
        {
            TCRepositoryDataContext context = DataBaseUtils.GetContext();
            try
            {
                tbl_Comments dbComment = new tbl_Comments() {
                    Comment = entComment.CommentSuggestion,
                    CreatedOn = DateTime.Now,
                    Email = entComment.Email,
                    Name = entComment.Name,
                    SupervisorRating = entComment.SupervisorRating,
                    CompanyOpinionRating = entComment.CompanyOpinionRating,
                    WorkEnviromentRating = entComment.WorkEnviromentRating,
                    CompanyWorking = entComment.CompanyWorking,
                    GroupDirectorRating = entComment.GroupDirectorRating,
                    SecurityRating = entComment.SecurityRating,
                    Subject = entComment.Subject,
                    IsRead = false
                };

                context.tbl_Comments.InsertOnSubmit(dbComment);
                context.SubmitChanges();
                return true;
            }
            catch
            {
            }

            return false;
        }
Esempio n. 2
0
 public Comment GetCommentByID(int IdComment)
 {
     TCRepositoryDataContext context = DataBaseUtils.GetContext();
     tbl_Comments dbComment = context.tbl_Comments.Where(c => c.IdComment == IdComment).FirstOrDefault();
     if (dbComment != null)
     {
         Comment EntComment = new Comment()
             {
                 IdComment = dbComment.IdComment,
                 Name = dbComment.Name,
                 Email = dbComment.Email,
                 CommentSuggestion = dbComment.Comment,
                 CreatedOn = dbComment.CreatedOn,
                 Subject = dbComment.Subject,
                 SupervisorRating = dbComment.SupervisorRating,
                 CompanyOpinionRating = dbComment.CompanyOpinionRating,
                 WorkEnviromentRating = dbComment.WorkEnviromentRating,
                 CompanyWorking = dbComment.CompanyWorking,
                 GroupDirectorRating = dbComment.GroupDirectorRating,
                 SecurityRating = dbComment.SecurityRating,
                 IsRead = dbComment.IsRead
             };
         return EntComment;
     }
     return new Comment();
 }
Esempio n. 3
0
 public bool Save(Comment entComment)
 {
     if (entComment != null)
     {
         if (entComment.IdComment == 0)
             return Insert(entComment);
     }
     return false;
 }