示例#1
0
        public ActionResult DeleteConfirmed(int primaryKey1, int primaryKey2, string primaryKey3, string primaryKey4)
        {
            //make sure date is in the correct format
            DateTime meetingPKDateTime;

            if (!DateTime.TryParse(primaryKey3, out meetingPKDateTime))
            {
                return(HttpNotFound());
            }

            //find meeting
            Meeting meeting = db.Meeting.Find(primaryKey1, primaryKey2, meetingPKDateTime);

            //if meeting doesn't exist return error
            if (meeting == null)
            {
                return(HttpNotFound());
            }
            //TODO : add check for permissions

            //delete meeting and return to committee
            db.Meeting.Remove(meeting);

            db.SaveChanges();
            AuditLogController.Add("Deleted", User.Identity.Name, "Deleted Meeting: " + meeting.Comm_CommOwn_ID + "/" + meeting.Comm_ID + "/" + meeting.DateTime.ToString("MM-dd-yyyy h.mm.ss t\\M"));
            return(RedirectToAction("Details", "Committees", new { primaryKey1 = meeting.Comm_CommOwn_ID, primaryKey2 = meeting.Comm_ID }));
        }
        public ActionResult DeleteConfirmed(int primaryKey1, int primaryKey2, string primaryKey3)
        {
            CommDocument commdocument = db.CommDocument.Find(primaryKey1, primaryKey2, primaryKey3);

            db.CommDocument.Remove(commdocument);
            db.SaveChanges();

            AuditLogController.Add("Delete Committee Document", User.Identity.Name, "Committee Document: " + commdocument.Title + " in committee " + commdocument.Comm_CommOwn_ID + " - " + commdocument.Comm_ID + "was edited");

            return(RedirectToAction("Details", "Committees", new { primaryKey1 = commdocument.Comm_CommOwn_ID, primaryKey2 = commdocument.Comm_ID }));
        }
示例#3
0
        public ActionResult DeleteConfirmed(int primaryKey1, int primaryKey2)
        {
            // Check current user is CSA
            // if (user is CSA)
            Comm comm = db.Comm.Find(primaryKey1, primaryKey2);

            if (!comm.CommMember.Any())
            {
                db.Comm.Remove(comm);
                db.SaveChanges();
            }
            // Generate AuditLog on Delete committee
            AuditLogController.Add("Delete", User.Identity.Name, "Delete " + comm.Name);
            return(RedirectToAction("index", "divisions", new { primaryKey1 = comm.CommOwn_ID }));
        }
示例#4
0
        public ActionResult Edit(int primaryKey1, int primaryKey2, Comm comm)
        {
            // if Check current user is Committees Super Admin first
            // If (isCSA is true)
            if (ModelState.IsValid)
            {
                db.Entry(comm).State = EntityState.Modified;
                db.SaveChanges();

                AuditLogController.Add("Edit", User.Identity.Name, "Edited committee: " + comm.Name);
                return(RedirectToAction("details", new { primaryKey1 = comm.CommOwn_ID, primaryKey2 = comm.ID }));
            }

            return(View(comm));
        }
示例#5
0
        public ActionResult Edit(Meeting meeting)
        {
            //TODO: check permissions

            //if updated data is valid save and redirect to meeting parent committee
            if (ModelState.IsValid)
            {
                db.Entry(meeting).State = EntityState.Modified;
                db.SaveChanges();
                AuditLogController.Add("Edit", User.Identity.Name, "Edited Meeting: " + meeting.Comm_CommOwn_ID + "/" + meeting.Comm_ID + "/" + meeting.DateTime.ToString("MM-dd-yyyy h.mm.ss t\\M"));
                return(RedirectToAction("Details", "Meetings", new { primaryKey1 = meeting.Comm_CommOwn_ID, primaryKey2 = meeting.Comm_ID, primaryKey3 = meeting.DateTime.ToString("MM-dd-yyyy h.mm.ss t\\M") }));
            }

            //otherwise return to editing meeting
            return(View(meeting));
        }
        public ActionResult Edit(CommDocument commdocument)
        {
            HttpPostedFileBase file = Request.Files["myFile"];

            if ((string)Session["isPublic"] == "Y" && commdocument.IsPublic == "N")
            {
                ModelState.AddModelError("IsPublic", "Can not make a public document protected");

                ViewBag.Category = new SelectList(db.Category, "Type", "Description", commdocument.Category);

                return(View(commdocument));
            }

            switch (commdocument.IsPublic)
            {
            case "N":
                commdocument.IsPublic    = "N";
                commdocument.IsProtected = "Y";
                commdocument.IsArchived  = "N";
                break;

            case "A":
                commdocument.IsPublic    = "N";
                commdocument.IsProtected = "N";
                commdocument.IsArchived  = "Y";
                break;

            case "Y":
                commdocument.IsPublic    = "Y";
                commdocument.IsProtected = "N";
                commdocument.IsArchived  = "N";
                break;
            }

            if (file.ContentLength > 0) // checks if file was uploaded to the form
            {
                // getting size of file
                int fileLen = file.ContentLength;

                // create write buffer
                byte[] byteFile = new byte[fileLen];
                file.InputStream.Read(byteFile, 0, fileLen);

                // write file to commdocument, replacing old file
                commdocument.FileImage   = byteFile;
                commdocument.Filename    = file.FileName;
                commdocument.ContentType = file.ContentType;
            }
            else
            {
                // put old document back and leave unchanged
                commdocument.FileImage   = (byte[])Session["fileImage"];
                commdocument.ContentType = (string)Session["contentType"];
            }

            // clears out session data, no longer needed
            Session["fileImage"]   = null;
            Session["contentType"] = null;
            Session["isPublic"]    = null;

            // sets who archived and archive time, if document is flagged for archive by user
            if (commdocument.IsArchived == "Y")
            {
                commdocument.ArchivedBy   = User.Identity.Name;
                commdocument.ArchivedDate = DateTime.Now;
            }



            if (ModelState.IsValid)
            {
                db.Entry(commdocument).State = EntityState.Modified;
                db.SaveChanges();
                AuditLogController.Add("Committee Document Edit", User.Identity.Name, "Committee Document: " + commdocument.Title + " in committee " + commdocument.Comm_CommOwn_ID + " - " + commdocument.Comm_ID + "was edited");
                return(RedirectToAction("Details", "Committees", new { primaryKey1 = commdocument.Comm_CommOwn_ID, primaryKey2 = commdocument.Comm_ID }));
            }


            // something went wrong, return to edit page
            ViewBag.Category = new SelectList(db.Category, "Type", "Description", commdocument.Category);

            return(View(commdocument));
        }