Inheritance: IMeetingLibRepository
Ejemplo n.º 1
0
        public ActionResult delete(int id)
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();
            MeetingLib ml = new MeetingLib();

            //GET MEETING
            try
            {
                ml = MeetingLibRep.getMeetingLibByID(id);
            }
            catch (Exception exception)
            {
                //IF THERE IS A MESS UP, RETURN ERROR TO FRONT
                TempData["flash"] = "Unable to retrieve meeting: " + exception.Message;
                return RedirectToAction("Index");
            }

            //DELETE MEETING
            try
            {
                MeetingLibRep.Delete(ml);
                TempData["flash"] = "Deleted meeting.";
                return RedirectToAction("Index");
            }
            catch (Exception exception)
            {
                TempData["flash"] = "Unable to delete meeting: " + exception.Message;
                return RedirectToAction("Index");
            }
        }
Ejemplo n.º 2
0
        public void Delete_MeetingLib()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = MeetingLibRep.getMeetingLibByID(2);

            MeetingLibRep.Delete(m);

            m = MeetingLibRep.getMeetingLibByID(2);

            Assert.IsTrue(m.Deleted == true);
        }
Ejemplo n.º 3
0
        public static void UpdateMeetingLib(MeetingLib m, FormCollection collection)
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            m.MeetingLibDesc = collection["MeetingLibDesc"];
            m.MeetingLibNumber = collection["MeetingLibNumber"];
            m.MeetingLibDate = DateTime.Parse(collection["meeting_date"]);
            m.DateModified = DateTime.Now;
            

            MeetingLibRep.Save(m);
            return;
        }
Ejemplo n.º 4
0
        public void Adding_MeetingLib()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = new MeetingLib();

            IList<SelectItems> allItems = new List<SelectItems>();
            allItems.ToPagedList(0, 10);

               m.MeetingLibDesc = "Plants";
            m.MeetingLibNumber = "PL01";
            m.MeetingLibDate = DateTime.Parse("02/02/2009");
            m.DateAdded = DateTime.Now;
            m.DateModified = DateTime.Now;

            int saved = MeetingLibRep.Save(m);
            Assert.AreEqual(saved, 3);
        }
Ejemplo n.º 5
0
        public void MeetingLibs_Get_By_ID()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = MeetingLibRep.getMeetingLibByID(1);

            Assert.AreEqual(m.MeetingLibDesc,"Animal");
        }
Ejemplo n.º 6
0
        public void Update_Meeting_Lib()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = MeetingLibRep.getMeetingLibByID(2);
            FormCollection form = new FormCollection();
            form["MeetingLibNumber"] = "x";
            form["MeetingLibDesc"] = "xy";
            form["MeetingLibDate"] = "01/01/2009";

            m.MeetingLibDesc = form["MeetingLibDesc"];
            m.MeetingLibNumber = form["MeetingLibNumber"];
            m.MeetingLibDate = DateTime.Parse(form["MeetingLibDate"]);

            MeetingLibRep.Save(m);

               Assert.AreEqual(MeetingLibRep.Save(m),0);
        }
Ejemplo n.º 7
0
        public void testAllCommittees()
        {
            IGenericRepository generic = new GenericRepository();
            IMeetingLibRepository mlib = new MeetingLibRepository();
               // IList<TblMeetingLib> coms = generic.getAllMeetings();

            //IList<SelectItems> items = generic.getAllCommitteesSelect();

            IList<SelectItems> items = generic.getAllMeetingsSelect();

            IList<MeetingLib> itemsm = mlib.getAllMeetingLibs();
            SelectList sl = new SelectList(itemsm, "MeetingLibID", "MeetingLibDesc");

            Assert.AreEqual(sl.First().Text,"hello");
        }
Ejemplo n.º 8
0
        public void Modify_MeetingLib()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = MeetingLibRep.getMeetingLibByID(2);

            m.MeetingLibDesc = "PLants Committee";
            m.DateModified = DateTime.Now;

            int saved = MeetingLibRep.Save(m);
            Assert.AreEqual(saved, 1);
        }
Ejemplo n.º 9
0
        public static void UpdateMeetingLib(MeetingLib m, FormCollection collection)
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            m.MeetingLibDesc = collection["MeetingLibDesc"];
            m.MeetingLibNumber = collection["MeetingLibNumber"];
            m.MeetingLibDate = DateTime.Parse(collection["meeting_date"]);
            m.DateModified = DateTime.Now;

            MeetingLibRep.Save(m);
            return;
        }
Ejemplo n.º 10
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;
            }
        }
Ejemplo n.º 11
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;
            }
        }
Ejemplo n.º 12
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;
            }
        }
Ejemplo n.º 13
0
        public ActionResult Edit(int id)
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = MeetingLibRep.getMeetingLibByID(id);
            ViewData.Model = m;
            return View();
        }
Ejemplo n.º 14
0
 public ActionResult Index()
 {
     IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();
     ViewData.Model = MeetingLibRep.getAllMeetingLibs();
     return View();
 }
Ejemplo n.º 15
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
                IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();
                MeetingLib m = MeetingLibRep.getMeetingLibByID(id);

                m.MeetingLibDesc = collection["meeting_description"];
                m.MeetingLibNumber = collection["meeting_number"];
                m.MeetingLibDate = DateTime.Parse(collection["meeting_date"]);
                m.DateModified = DateTime.Now;

                MeetingLibRep.Save(m);

                return RedirectToAction("Index");
            }
            catch (SubSonic.SqlQueryException e)
            {
                Console.WriteLine("{0} Exception caught.", e.Message);
                IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();
                MeetingLib m = MeetingLibRep.getMeetingLibByID(id);
                ViewData.Model = m;
                return View();
            }
        }