public void getSingleReviewTest() { IReviewRepository reviews = new ReviewRepository(); ReviewDesc review = reviews.getSingleReview(6); Assert.AreEqual(review.TaxonName, "test"); }
/** * This function should construct and send the email finally * * NOT FINISHED!!! */ private void build_send_and_log_message(SigtradeUser user, MessageTemplate template, ParagraphActionCollection paras) { //create the mail message MailMessage mail = new MailMessage(); //set the addresses mail.From = new MailAddress("*****@*****.**"); //Finding user through membership Api MembershipUser my_user = Membership.GetUser(new Guid(user.userid)); mail.To.Add(my_user.Email); //mail.To.Add(user); //MUST USE MEMBERSHIP API TO FIND USER AND PROFILE SETTINGS (INCL EMAIL) NOT WORKING //set the content mail.Subject = template.Title; StringBuilder emailBody = new StringBuilder(); var userProfile = Profile.GetProfile(my_user.UserName); mail.Body = template.Body; emailBody.AppendLine("Dear " + userProfile.first_name + ' ' + userProfile.last_name); emailBody.AppendLine(template.Body); //Need to get the paragraph details IReviewRepository reviews = new ReviewRepository(); ITaxonRepository taxon = new TaxonRepository(); foreach (ParagraphAction para in paras) { var review = reviews.getSingleReview(para.ReviewID); var paragraph = reviews.getSinglePALib(para.PALibID); review.TaxonName = taxon.getReviewTaxonName(review.ID, review.Taxontype, review.Kingdom); //mail.Body = mail.Body.Concat(para.DeadlineDate.ToString()); //SOME SORT OF WARNING HERE! var review_type = review.TaxonName + " [" + review.CtyShort + "]"; emailBody.AppendLine("Review:" + review_type); emailBody.AppendLine("Paragraph details: " + paragraph.Action + " (" + ((DateTime)para.DeadlineDate).ToShortDateString() + ')'); emailBody.AppendLine(); //mail.Body = mail.Body; } emailBody.AppendLine(); emailBody.AppendLine(Resources.SigTrade.emailFooter); mail.Body = emailBody.ToString(); //send the message SmtpClient smtp = new SmtpClient(UpdateUtils.SMTP_RELAY_SERVER,25); try { smtp.Send(mail); } catch(SmtpException e) { } //HERE WE SHOULD WRITE TO THE LOG TABLE. //Prepare the MessageLog object MessageLog log = new MessageLog(); log.SentTo = my_user.Email; log.SentAt = DateTime.Today; log.Title = template.Title; log.Body = emailBody.ToString(); write_to_message_log(log); }
public ActionResult ParagraphDetailsEdit(int ReviewID, int PALibID) { try { ITaxonRepository taxon = new TaxonRepository(); IReviewRepository reviews = new ReviewRepository(); IGenericRepository generic = new GenericRepository(); IMeetingLibRepository mlib = new MeetingLibRepository(); IMembershipRepository members = new MembershipRepository(); ICommentsRepository comments = new CommentsRepository(); IDocumentsRepository docs = new DocumentsRepository(); IRecommendationsRepository recs = new RecommendationsRepository(); IDecisionsRepository decisions = new DecisionsRepository(); var review = reviews.getSingleReview(ReviewID); review.TaxonName = taxon.getReviewTaxonName(review.ID, review.Taxontype, review.Kingdom); List<Actor> userDetails = GetUserDetails(); ViewData["allactorsadd"] = new SelectList(userDetails,"UserName","UserDetails"); ViewData["selectedactorsedit"] = ViewData["allactorsedit"] = ViewData["selectedactorsadd"] = ViewData["allactors2"] = ViewData["allactorsadd"]; ViewData["PATitle"] = review.TaxonName + " [" + review.CtyShort + "]"; ViewData["MeetingsA"] = ViewData["DecMeetings"] = ViewData["LiftedMeetings"] = new SelectList(generic.getAllMeetingsSelect(), "ID", "Description"); // ViewData["Roles"] = new SelectList(members.getAllRoles()); ViewData["roles"] = new SelectList(UpdateUtils.getViewersList()); ViewData["PALib"] = reviews.getSinglePALib(PALibID); //GETTING THE PACTIONLIB TO RETRIEVE RECOMMENDATIONS/DECISIONS VALUES ParagraphActionLib palib = generic.getPActionLib(PALibID); ViewData["NeedsRecommendation"] = palib.Recommendations; ViewData["NeedsDecision"] = palib.Decisions; ViewData["NeedsConcern"] = palib.ConcernVisible; //END GETTING RECOMMENDATIONS/DECISIONS ViewData["ReviewID"] = ReviewID; ParagraphActionDetails pad = reviews.getParagraphDetails(PALibID, ReviewID); ViewData["Meetings"] = new SelectList(generic.getAllMeetingsSelect(), "ID", "Description", pad.MeetingID); ViewData["DateStarted"] = pad.DateStarted.ToShortDateString(); ViewData["Deadline"] = pad.Deadline.ToShortDateString(); ViewData["concerns"] = new SelectList(generic.getAllLevelofConcerns(), "Description", "Description"); // ViewData["concernlevel"]= reviews.getConcernForReview(ReviewID); ViewData["concernlevel"] = generic.getConcernForParagraphAction(pad.ID); ViewData["contributor"] = null; if (pad != null) { if (Request.IsAuthenticated) { var user = UpdateUtils.getCurrentMembershipUser(); var roles = Roles.GetRolesForUser(); if (roles.Contains(UpdateUtils.ROLE_DATA_CONTRIBUTOR)) { ViewData["contributor"] = User.Identity.Name; } if (roles.Contains(UpdateUtils.ROLE_INTERMEDIATE_VIEWER)) { ViewData["Comments"] = comments.getCommentsByID(pad.ID, UpdateUtils.PARAGRAPH_SOURCE,UpdateUtils.ROLE_INTERMEDIATE_VIEWER ); ViewData["Documents"] = docs.getDocumentsByID(pad.ID, UpdateUtils.PARAGRAPH_SOURCE, UpdateUtils.ROLE_INTERMEDIATE_VIEWER); //ViewData["Documents"] = ViewData["Documents"] + docs.getDocumentsByID(pad.ID, UpdateUtils.PARAGRAPH_SOURCE, UpdateUtils.ROLE_PUBLIC_VIEWER); } if (roles.Contains(UpdateUtils.ROLE_FULL_VIEWER)) { ViewData["Comments"] = comments.getCommentsByID(pad.ID, UpdateUtils.PARAGRAPH_SOURCE, UpdateUtils.ROLE_ALL); ViewData["Documents"] = docs.getDocumentsByID(pad.ID, UpdateUtils.PARAGRAPH_SOURCE, UpdateUtils.ROLE_ALL); } } else { ViewData["Comments"] = comments.getCommentsByID(pad.ID, UpdateUtils.PARAGRAPH_SOURCE, UpdateUtils.ROLE_PUBLIC_VIEWER ); ViewData["Documents"] = docs.getDocumentsByID(pad.ID, UpdateUtils.PARAGRAPH_SOURCE, UpdateUtils.ROLE_PUBLIC_VIEWER); } IList<UsersParagraphLink> users = generic.getUserBySource(pad.ID, UpdateUtils.PARAGRAPH_SOURCE); int usercount = users.Count; for (int j = 0; j < usercount; j++) { users[j].UserID = Membership.GetUser(new Guid(users[j].UserID)).UserName; if (User.Identity.IsAuthenticated) { var current_user = User.Identity.Name; if (users[j].UserID == current_user) { ViewData["contributor"] = current_user; } } } ViewData["PActionID"] = pad.ID; ViewData["ReviewID"] = ReviewID; ViewData["PALibID"] = PALibID; ViewData["recommendations"] = recs.getAllRecommendationsByParagraph(pad.ID); ViewData["editmode"] = false; //ViewData["decisions"] = decisions.GetAllDecisionsPerParagraph(pad.ID); IList<Decision> decs = decisions.GetAllDecisionsPerParagraph(pad.ID); ViewData["decisiondetails"] = UpdateUtils.GetDecisionDetails(decs); ViewData["decisions"] = decs; ViewData["decisiontypes"] = new SelectList(generic.GetAllDecisionTypes(), "Description", "Description"); ViewData["tradeterms"] = new SelectList(generic.GetAllTradeTerms(), "Description", "Description"); ViewData["selectedactorsedit"] = new SelectList(users, "UserID", "UserID"); } ViewData["PADetails"] = pad; return View(); } catch (Exception e) { return null; } }
public ActionResult ParagraphDetailsAdd(int? ReviewID, int? PALibID) { try { ITaxonRepository taxon = new TaxonRepository(); IReviewRepository reviews = new ReviewRepository(); IGenericRepository generic = new GenericRepository(); IMeetingLibRepository mlib = new MeetingLibRepository(); IMembershipRepository members = new MembershipRepository(); ICommentsRepository comments = new CommentsRepository(); IDocumentsRepository docs = new DocumentsRepository(); ReviewDesc review = reviews.getSingleReview(ReviewID); ViewData["concernlevel"] = reviews.getConcernForReview(ReviewID.Value); review.TaxonName = taxon.getReviewTaxonName(review.ID, review.Taxontype, review.Kingdom); List<Actor> userdetails = GetUserDetails(); ViewData["allactorsadd"] = new SelectList(userdetails,"UserName", "UserDetails"); //ViewData["selectedactorsedit"] = ViewData["allactorsedit"] = ViewData["selectedactorsadd"] = ViewData["allactors2"] = ViewData["allactorsadd"]; ViewData["PATitle"] = review.TaxonName + " [" + review.CtyShort + "]"; ViewData["committees"] = new SelectList(generic.getAllCommitteesSelect(), "ID", "Description"); ViewData["meetings1"] = new SelectList(mlib.getAllMeetingLibs(), "MeetingLibID", "MeetingLibDesc"); ViewData["meetings"] =new SelectList(generic.getAllMeetingsSelect(), "ID", "Description"); ViewData["concerns"] = new SelectList(generic.getAllLevelofConcerns(), "Description", "Description"); //ViewData["roles"] = new SelectList(members.getAllRoles()); ViewData["rolesc"] = ViewData["rolesd"]=new SelectList(UpdateUtils.getViewersList()); ViewData["paction"] = reviews.getSinglePALib(PALibID); ViewData["PALib"] = PALibID; ViewData["ReviewID"] = ReviewID; ViewData["concernlevel"] = reviews.getConcernForReview(ReviewID.Value); return View(); } catch { return null; } }
public ActionResult ParagraphDetails(int ReviewID, int PALibID) { try { ITaxonRepository taxon = new TaxonRepository(); IReviewRepository reviews = new ReviewRepository(); IGenericRepository generic = new GenericRepository(); IMeetingLibRepository mlib = new MeetingLibRepository(); IMembershipRepository members = new MembershipRepository(); ICommentsRepository comments = new CommentsRepository(); IDocumentsRepository docs = new DocumentsRepository(); ReviewDesc review = reviews.getSingleReview(ReviewID); review.TaxonName = taxon.getReviewTaxonName(review.ID, review.Taxontype, review.Kingdom); ViewData["allactorsadd"] = new SelectList(Membership.GetAllUsers()); ViewData["selectedactorsedit"]= ViewData["allactorsedit"]=ViewData["selectedactorsadd"]=ViewData["allactors2"] = ViewData["allactorsadd"]; ViewData["PATitle"] = review.TaxonName + "-" + review.Taxontype + "\\" + review.CtyShort; ViewData["Committees"] = new SelectList(generic.getAllCommitteesSelect(), "ID", "Description"); ViewData["Meetings"] = new SelectList(mlib.getAllMeetingLibs(), "MeetingLibID", "MeetingLibDesc"); ViewData["Roles"] = new SelectList(members.getAllRoles()); ViewData["PALib"] = reviews.getSinglePALib(PALibID); ViewData["ReviewID"] = ReviewID; ParagraphActionDetails pad = reviews.getParagraphDetails(PALibID, ReviewID); if (pad != null) { ViewData["Comments"] = comments.getCommentsByID(pad.ID, UpdateUtils.PARAGRAPH_SOURCE,UpdateUtils.ROLE_ALL); ViewData["Documents"] = docs.getDocumentsByID(pad.ID, UpdateUtils.PARAGRAPH_SOURCE, UpdateUtils.ROLE_ALL); IList<UsersParagraphLink> users = generic.getUserBySource(pad.ID, UpdateUtils.PARAGRAPH_SOURCE); int usercount = users.Count; for (int j = 0; j < usercount; j++) { users[j].UserID = Membership.GetUser(new Guid(users[j].UserID)).UserName; } ViewData["selectedactorsedit"] = new SelectList(users, "UserID", "UserID"); } ViewData["PADetails"] = pad; return View(); } catch { return null; } }
public ActionResult ParagraphDetails(int ReviewID, int PALibID, FormCollection form) { try { ITaxonRepository taxon = new TaxonRepository(); IReviewRepository reviews = new ReviewRepository(); IMembershipRepository members = new MembershipRepository(); ReviewDesc review = reviews.getSingleReview(ReviewID); review.TaxonName = taxon.getReviewTaxonName(review.ID, review.Taxontype, review.Kingdom); ViewData["PATitle"] = review.TaxonName + "-" + review.Taxontype; ViewData["PALid"] = reviews.getSinglePALib(PALibID); ParagraphActionDetails pad = reviews.getParagraphDetails(PALibID, ReviewID); ViewData["PADetails"] = pad; return View(); //return RedirectToAction("Details"); } catch { return null; } }
// // GET: /ProcessReview/Details/5 public ActionResult Details(int id) { int ReviewID = id; IReviewRepository reviews = new ReviewRepository(); ITaxonRepository taxon = new TaxonRepository(); IGenericRepository generics = new GenericRepository(); ReviewDesc review = reviews.getSingleReview(ReviewID); review.TaxonName = taxon.getReviewTaxonName(review.ID, review.Taxontype, review.Kingdom); bool completed = generics.getOldDataImportedStatus(ReviewID); ViewData["para31_completed"] = completed; ViewData["Title"] = review.TaxonName + " [" + review.CtyShort + "]"; ViewData["Review"] = review; //ViewData["PAction"] = reviews.getParagraphDetails(review.) ViewData["NextPALibID"] = reviews.getNextParagraphForReview(ReviewID); var current_reviews = reviews.getAllPALibExtra(ReviewID); ViewData["PALibs"] = current_reviews; ViewData["para_contributor"] = null; foreach (var currentReview in current_reviews) { if ((currentReview.ReviewID > 0) && !currentReview.Completed && (!completed)) { IList<UsersParagraphLink> users = generics.getUserBySource(currentReview.ID, UpdateUtils.PARAGRAPH_SOURCE); int usercount = users.Count; for (int j = 0; j < usercount; j++) { users[j].UserID = Membership.GetUser(new Guid(users[j].UserID)).UserName; if (User.Identity.IsAuthenticated) { var current_user = User.Identity.Name; if (users[j].UserID == current_user) { ViewData["para_contributor"] = current_user; } } } } } return View(); }