Exemplo 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");
            }
        }
Exemplo n.º 2
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"] }));
            }
        }
Exemplo n.º 3
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"));
            }
        }
Exemplo 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();
 }
Exemplo n.º 5
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());
        }
Exemplo n.º 6
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.");
            }
        }
Exemplo 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");
            }
        }
Exemplo n.º 8
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"));
            }
        }
Exemplo n.º 9
0
        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);
        }
Exemplo 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);
        }
Exemplo n.º 11
0
 public void delete(CommitteeLib c)
 {
     DB.Delete(c);
 }
Exemplo n.º 12
0
 public int save(CommitteeLib c)
 {
     return(DB.Save(c));
 }
Exemplo n.º 13
0
 public int save(CommitteeLib c)
 {
     return DB.Save(c);
 }
Exemplo n.º 14
0
 public void delete(CommitteeLib c)
 {
     DB.Delete(c);
 }
Exemplo 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.");
            }
        }
Exemplo 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"] });
            }
        }