Esempio n. 1
0
        public ActionResult delete(int id)
        {
            CommitteeLibRepository committee_rep = new CommitteeLibRepository();
            CommitteeLib committee = new CommitteeLib();

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

            //DELETE Committee
            try
            {
                committee_rep.delete(committee);
                TempData["flash"] = "Deleted committee.";
                return RedirectToAction("Index");
            }
            catch (Exception exception)
            {
                TempData["flash"] = "Unable to delete committee: " + exception.Message;
                return RedirectToAction("Index");
            }
        }
        public ActionResult edit(FormCollection collection)
        {
            //Generate new Committee object for form if error
            CommitteeLibRepository committee_rep = new CommitteeLibRepository();
            CommitteeLib           committee     = new CommitteeLib();

            //GET Committee
            try
            {
                committee             = committee_rep.getCommittee(Int32.Parse(collection["committee_id"]));
                TempData["committee"] = committee;
            }
            catch (Exception exception)
            {
                //IF THERE IS A MESS UP, RETURN ERROR TO FRONT
                TempData["flash"] = "Unable to retrieve committee: " + exception.Message;
                return(RedirectToAction("edit", new { controller = "Committees", id = collection["committee_id"] }));
            }


            //UPDATE Committee
            try
            {
                return(committeeFormProcess(committee, committee_rep, collection));
            }
            catch (Exception exception)
            {
                //IF THERE IS A MESS UP, RETURN ERROR TO FRONT
                TempData["flash"] = "Unable to update committee: " + exception.Message;
                return(RedirectToAction("edit", new { controller = "Committees", id = collection["committee_id"] }));
            }
        }
        public ActionResult delete(int id)
        {
            CommitteeLibRepository committee_rep = new CommitteeLibRepository();
            CommitteeLib           committee     = new CommitteeLib();

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


            //DELETE Committee
            try
            {
                committee_rep.delete(committee);
                TempData["flash"] = "Deleted committee.";
                return(RedirectToAction("Index"));
            }
            catch (Exception exception)
            {
                TempData["flash"] = "Unable to delete committee: " + exception.Message;
                return(RedirectToAction("Index"));
            }
        }
Esempio n. 4
0
 public ActionResult create()
 {
     //Generate new Committee object
     CommitteeLibRepository committee_rep = new CommitteeLibRepository();
     CommitteeLib committee = new CommitteeLib();
     ViewData["edit"] = false;
     ViewData["committee"] = committee;
     return View();
 }
        public ActionResult create()
        {
            //Generate new Committee object
            CommitteeLibRepository committee_rep = new CommitteeLibRepository();
            CommitteeLib           committee     = new CommitteeLib();

            ViewData["edit"]      = false;
            ViewData["committee"] = committee;
            return(View());
        }
        //PROCESS EDIT AND CREATE FORMS
        private ActionResult committeeFormProcess(CommitteeLib committee, CommitteeLibRepository committee_rep, FormCollection collection)
        {
            try
            {
                committee.Description = collection["committee_description"];
                committee_rep.save(committee);

                TempData["flash"] = "Committee: " + committee.Description;
                return(RedirectToAction("Index"));
            }
            catch (Exception exception)
            {
                throw new Exception("A data entry problem has occurred.");
            }
        }
Esempio n. 7
0
        public ActionResult create(FormCollection collection)
        {
            //Generate new Committee object
            CommitteeLibRepository committee_rep = new CommitteeLibRepository();
            CommitteeLib committee = new CommitteeLib();
            ViewData["edit"] = false;
            ViewData["committee"] = committee;

            try
            {
                return committeeFormProcess(committee, committee_rep, collection);
            }
            catch (Exception exception)
            {
                //IF THERE IS A MESS UP, RETURN ERROR TO FRONT
                TempData["flash"] = "Unable to create committee: " + exception.Message;
                return RedirectToAction("create");
            }
        }
        public ActionResult create(FormCollection collection)
        {
            //Generate new Committee object
            CommitteeLibRepository committee_rep = new CommitteeLibRepository();
            CommitteeLib           committee     = new CommitteeLib();

            ViewData["edit"]      = false;
            ViewData["committee"] = committee;

            try
            {
                return(committeeFormProcess(committee, committee_rep, collection));
            }
            catch (Exception exception)
            {
                //IF THERE IS A MESS UP, RETURN ERROR TO FRONT
                TempData["flash"] = "Unable to create committee: " + exception.Message;
                return(RedirectToAction("create"));
            }
        }
        public void Insert(string Description,DateTime? DateAdded,bool Deleted)
        {
            CommitteeLib item = new CommitteeLib();

            item.Description = Description;

            item.DateAdded = DateAdded;

            item.Deleted = Deleted;

            item.Save(UserName);
        }
Esempio n. 10
0
        public void Update(int Id,string Description,DateTime? DateAdded,bool Deleted)
        {
            CommitteeLib item = new CommitteeLib();
            item.MarkOld();
            item.IsLoaded = true;

            item.Id = Id;

            item.Description = Description;

            item.DateAdded = DateAdded;

            item.Deleted = Deleted;

            item.Save(UserName);
        }
 public void delete(CommitteeLib c)
 {
     DB.Delete(c);
 }
 public int save(CommitteeLib c)
 {
     return(DB.Save(c));
 }
Esempio n. 13
0
 public int save(CommitteeLib c)
 {
     return DB.Save(c);
 }
Esempio n. 14
0
 public void delete(CommitteeLib c)
 {
     DB.Delete(c);
 }
Esempio n. 15
0
        //PROCESS EDIT AND CREATE FORMS
        private ActionResult committeeFormProcess(CommitteeLib committee, CommitteeLibRepository committee_rep, FormCollection collection)
        {
            try
            {

                committee.Description = collection["committee_description"];
                committee_rep.save(committee);

                TempData["flash"] = "Committee: " + committee.Description;
                return RedirectToAction("Index");
            }
            catch (Exception exception)
            {
                throw new Exception("A data entry problem has occurred.");
            }
        }
Esempio n. 16
0
        public ActionResult edit(FormCollection collection)
        {
            //Generate new Committee object for form if error
            CommitteeLibRepository committee_rep = new CommitteeLibRepository();
            CommitteeLib committee = new CommitteeLib();

            //GET Committee
            try
            {
                committee = committee_rep.getCommittee(Int32.Parse(collection["committee_id"]));
                TempData["committee"] = committee;
            }
            catch (Exception exception)
            {
                //IF THERE IS A MESS UP, RETURN ERROR TO FRONT
                TempData["flash"] = "Unable to retrieve committee: " + exception.Message;
                return RedirectToAction("edit", new { controller = "Committees", id = collection["committee_id"] });
            }

            //UPDATE Committee
            try
            {
                return committeeFormProcess(committee, committee_rep, collection);
            }
            catch (Exception exception)
            {

                //IF THERE IS A MESS UP, RETURN ERROR TO FRONT
                TempData["flash"] = "Unable to update committee: " + exception.Message;
                return RedirectToAction("edit", new { controller = "Committees", id = collection["committee_id"] });
            }
        }