Ejemplo n.º 1
0
        public ActionResult Update(int id, DateTime? processDate, int statusId, string comments, List<int> approvals, DateTime? mvrDate, int mvrStatusId)
        {
            var m = new VolunteerModel(id);
            m.Update(processDate, statusId, comments, approvals, mvrDate, mvrStatusId);

            m = new VolunteerModel(id);
            return View("Display", m);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(int id)
 {
     var vol = new VolunteerModel(id);
     return View(vol);
 }
Ejemplo n.º 3
0
        public ActionResult Upload(int id, HttpPostedFileBase file)
        {
            if (file == null)
                return Content("no file");

            var vol = new VolunteerModel(id);
            var Name = System.IO.Path.GetFileName(file.FileName);

            var f = new VolunteerForm
                        {
                            UploaderId = Util.UserId1,
                            PeopleId = vol.V.PeopleId,
                            Name = Name.Truncate(100),
                            AppDate = Util.Now,
                        };

            var bits = new byte[file.ContentLength];
            file.InputStream.Read(bits, 0, bits.Length);

            var mimetype = file.ContentType.ToLower();

            switch (mimetype)
            {
                case "image/jpeg":
                case "image/pjpeg":
                case "image/gif":
                case "image/png":
                    {
                        f.IsDocument = false;

                        try
                        {
                            f.SmallId = ImageData.Image.NewImageFromBits(bits, 165, 220).Id;
                            f.MediumId = ImageData.Image.NewImageFromBits(bits, 675, 900).Id;
                            f.LargeId = ImageData.Image.NewImageFromBits(bits).Id;
                        }
                        catch
                        {
                            return View("Index", vol);
                        }

                        break;
                    }

                case "text/plain":
                case "application/pdf":
                case "application/msword":
                case "application/vnd.ms-excel":
                    {
                        f.MediumId = ImageData.Image.NewImageFromBits(bits, mimetype).Id;
                        f.SmallId = f.MediumId;
                        f.LargeId = f.MediumId;
                        f.IsDocument = true;
                        break;
                    }

                default: return View("Index", vol);
            }

            DbUtil.Db.VolunteerForms.InsertOnSubmit(f);
            DbUtil.Db.SubmitChanges();
            DbUtil.LogActivity("Uploading VolunteerApp for {0}".Fmt(vol.V.Person.Name));

            return Redirect("/Volunteering/Index/" + vol.V.PeopleId);
        }
Ejemplo n.º 4
0
 public ActionResult Update(int id, DateTime? processDate, int statusId, string comments, List<int> approvals)
 {
     var m = new VolunteerModel(id);
     m.Update(processDate, statusId, comments, approvals);
     return RedirectToAction("Index", "Volunteering", new {id = id});
 }
Ejemplo n.º 5
0
 public ActionResult Update(int id, DateTime? processDate, int statusId, string comments, List<int> approvals)
 {
     var m = new VolunteerModel(id);
     m.Update(processDate, statusId, comments, approvals);
     return Redirect("/Volunteering/" + id);
 }