상속: IDocumentsRepository
예제 #1
0
        public static int InsertDocuments(FormCollection collection, int SourceID, int SourceType)
        {
            IDocumentsRepository documents = new DocumentsRepository();

            Document d = new Document();

            d.DateAdded = DateTime.Now;
            d.DocName = collection["DocName"];
            d.DocPath = collection["DocPath"];
            d.RoleAccess = collection["DocAccess"];
            d.DocLegend = collection["txtDocLegend"];

            string docType = collection["docfiletype"];

            if (docType.Equals("upload"))
                d.DocumentType = UpdateUtils.DOC_UPLOADED;
            else if (docType.Equals("hyperlink"))
            {
                d.DocumentType = UpdateUtils.DOC_HYPERLINK;
            }
            d.SourceID = SourceID;
            d.SourceType = SourceType;
            //d.UserID = collection["UserID"];
            d.UserID = Membership.GetUser().ToString();
            
            return documents.Save(d);

        }
예제 #2
0
        public static int InsertDocuments(FormCollection collection, int SourceID, int SourceType)
        {
            IDocumentsRepository documents = new DocumentsRepository();

            Document d = new Document();

            d.DateAdded = DateTime.Now;
            d.DocName = collection["DocName"];
            d.DocPath = collection["DocPath"];
            d.RoleAccess = collection["DocAccess"];
            d.DocLegend = collection["txtDocLegend"];

            string docType = collection["docfiletype"];

            if (docType.Equals("upload"))
                d.DocumentType = UpdateUtils.DOC_UPLOADED;
            else if (docType.Equals("hyperlink"))
            {
                d.DocumentType = UpdateUtils.DOC_HYPERLINK;
            }
            d.SourceID = SourceID;
            d.SourceType = SourceType;
            //d.UserID = collection["UserID"];
            d.UserID = Membership.GetUser().ToString();

            return documents.Save(d);
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        public ActionResult AddDocument(FormCollection collection)
        {
            try
            {
                IDocumentsRepository docs = new DocumentsRepository();

                string _SourceID = collection["SourceID"];
                string _SourceType = collection["SourceType"];
                string _ReviewID = collection["ReviewID"];
                string _PALibID = collection["PALibID"];
                string _contributor = collection["CONTRIBUTOR"];
                collection["UserID"] = 1.ToString();
                collection["docfiletype"] = collection["docfileadd"];

                if (collection["docfileadd"].ToString().Equals("upload"))
                {
                    foreach (string filename in Request.Files)
                    {
                        HttpPostedFileBase file = Request.Files[filename];
                        var document_dir = ConfigurationManager.AppSettings["@BaseDir"];

                        var file_path = Request.PhysicalApplicationPath + document_dir;

                        if (file.ContentLength > 0)
                        {
                            string filePath = Path.Combine(file_path, Path.GetFileName(file.FileName));
                            file.SaveAs(filePath);

                            collection["DocName"] = file.FileName;
                            collection["DocPath"] = file_path;
                            collection["DocAccess"] = collection["ddDocumentTypeEdit"];
                            int documentID = UpdateUtils.InsertDocuments(collection, int.Parse(_SourceID),
                                                                         int.Parse(_SourceType));
                            UpdateUtils.SendDocumentUploadNotification(Membership.GetUser().UserName, documentID);
                        }
                    }
                }
                else if (collection["docfileadd"].ToString().Equals("hyperlink"))
                {
                    collection["DocName"] = collection["txtHyperlinkAdd"];
                    collection["DocPath"] = null;
                    collection["DocAccess"] = collection["ddDocumentTypeEdit"];
                    int documentID = UpdateUtils.InsertDocuments(collection, int.Parse(_SourceID),
                                                                         int.Parse(_SourceType));
                    //NEED TO COME BACK TO THIS
                    UpdateUtils.SendDocumentUploadNotification(System.Web.HttpContext.Current.User.Identity.Name, documentID);
                }

                //return View();
                ViewData["Documents"] = docs.getDocumentsByID(int.Parse(_SourceID),
                                                              int.Parse(_SourceType),UpdateUtils.ROLE_ALL);

                ViewData["ReviewID"] = _ReviewID;
                ViewData["PALibID"] = _PALibID;
                ViewData["PActionID"] = _SourceID;
                ViewData["contributor"] = _contributor;

                return PartialView("display_documents");
                //return RedirectToAction("ParagraphDetails", new { ReviewID = int.Parse(_ReviewID), PALibID = int.Parse(_PALibID) });
                //return RedirectToAction("Details");
            }
            catch
            {
                return null;
            }
        }
예제 #5
0
        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;
            }
        }
예제 #6
0
        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;
            }
        }
예제 #7
0
        // GET: /ProcessReview/GetDocument
        public ActionResult GetDocument(int docId)
        {
            try
            {
                string filename = null;
                IDocumentsRepository rep = new DocumentsRepository();
                var document = rep.getDocumentByID(docId);
                if (document == null)
                {
                    return null;
                }

                filename = document.DocPath + "\\" + document.DocName;

                string contentType = "";
                if (filename.IndexOf(".pdf") > -1)
                    contentType = "application/pdf";
                else if (filename.IndexOf(".doc") > -1)
                    contentType = "application/msword";
                else if (filename.IndexOf(".com") > -1)
                    contentType = "text/html";
                else if (filename.IndexOf(".txt") > -1)
                    contentType = "text/plain";
                if (!contentType.Equals(""))
                    return new FilePathResult(filename, contentType);
                else
                    return null;
            }
            catch (Exception e)
            {
                return null;
            }
            return null;
        }
예제 #8
0
        public ActionResult DeleteDocument(FormCollection collection)
        {
            IDocumentsRepository docs = new DocumentsRepository();

            int ID = int.Parse(collection["ID"]);
            int ReviewID_ = int.Parse(collection["ReviewID"]);
            int PALibID_ = int.Parse(collection["PALibID"]);
            int SourceID = int.Parse(collection["SourceID"]);
            int SourceType = int.Parse(collection["SourceType"]);
            string _contributor = collection["contributor"];
            docs.DeleteDocument(ID);

            ViewData["ReviewID"] = ReviewID_;
            ViewData["PALibID"] = PALibID_;
            ViewData["PActionID"] = SourceID;
            ViewData["contributor"] = _contributor;
            ViewData["Documents"] = docs.getDocumentsByID(SourceID, SourceType, UpdateUtils.ROLE_ALL);
            return PartialView("display_documents");
            //return RedirectToAction("ParagraphDetailsEdit", new { ReviewID = ReviewID_, PALibID = PALibID_ });
            //return View();
        }
예제 #9
0
        public ActionResult DeleteDocument(int ID, int ReviewID_, int PALibID_)
        {
            IDocumentsRepository docs = new DocumentsRepository();

            //int ID = int.Parse(collection["ID"]);
            //int ReviewID_ = int.Parse(collection["ReviewID"]);
            //int PALibID_ = int.Parse(collection["PALibID"]);
            docs.DeleteDocument(ID);

            //return PartialView("display_documents");
            return RedirectToAction("ParagraphDetailsEdit", new { ReviewID = ReviewID_, PALibID = PALibID_ });
            //return View();
        }