Esempio n. 1
0
        public ActionResult AddDonation(int id)
        {
            DONOR donor = drRepo.FindById(id);

            ViewBag.DonorId   = id;
            ViewBag.DonorName = donor.FName;
            //CreateDonationViewModel cdvm = new CreateDonationViewModel();
            //cdvm.donor = donor;

            ViewBag.TypeOf = new SelectList(ddlData.TYPEOF, "TypeOf", "TypeOf");

            ViewBag.GiftMethod = new SelectList(ddlData.GIFTMETHOD, "GiftMethod", "GiftMethod");

            ViewBag.Fund = new SelectList(ddlData.FUNDS, "Fund", "Fund");

            ViewBag.GL = new SelectList(ddlData.GLS, "GL", "GL");

            ViewBag.Department = new SelectList(ddlData.DEPARTMENTS, "Department", "Department");

            ViewBag.Program = new SelectList(ddlData.PROGRAMS, "Program", "Program");

            ViewBag.Grant = new SelectList(ddlData.GRANTS, "GrantName", "GrantName");

            return(View("~/Views/DONATIONs/DonorCreate.cshtml"));//, cdvm
        }
Esempio n. 2
0
        public void SaveProduct(DONOR product)
        {
            if (product.DonorId == 100)
            {
                context.DONOR.Add(product);
            }
            else
            {
                DONOR dbEntry = context.DONOR.Find(product.DonorId);
                if (dbEntry != null)
                {
                    dbEntry.FName       = product.FName;
                    dbEntry.Init        = product.Init;
                    dbEntry.LName       = product.LName;
                    dbEntry.Suffix      = product.Suffix;
                    dbEntry.Title       = product.Title;
                    dbEntry.Email       = product.Email;
                    dbEntry.Cell        = product.Cell;
                    dbEntry.Birthday    = product.Birthday;
                    dbEntry.Gender      = product.Gender;
                    dbEntry.MarkerId    = product.MarkerId;
                    dbEntry.ContactId   = product.ContactId;
                    dbEntry.CompanyName = product.CompanyName;
                    dbEntry.Address     = product.Address;
                    dbEntry.City        = product.City;
                    dbEntry.Zipcode     = product.Zipcode;
                    dbEntry.Phone       = product.Phone;
                    dbEntry.State       = product.State;
                }
            }

            context.SaveChanges();
        }
Esempio n. 3
0
        public void Remove(int id)
        {
            DONOR d = context.DONOR.Find(id);

            context.DONOR.Remove(d);
            context.SaveChanges();
        }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "DonorId,FName,Init,LName,Title,Suffix,Email,Cell,Birthday,Gender,MarkerId,ContactId,CompanyName,Address,City,State,Zipcode,Phone")] DONOR donor)
 {
     if (ModelState.IsValid)
     {
         drRepo.SaveProduct(donor);
         return(RedirectToAction("Details", new { id = donor.DonorId }));
     }
     ViewBag.CONTACTID = new SelectList(ddlData.CONTACT, "CONTACTID", "TYPEOF", donor.ContactId);
     ViewBag.MARKERID  = new SelectList(ddlData.IDENTITYMARKER, "MARKERID", "MARKERTYPE", donor.MarkerId);
     ViewBag.Gender    = new SelectList(ddlData.DONOR, "Gender", "Gender");
     return(View(donor));
 }
Esempio n. 5
0
        // GET: DOnor/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DONOR donor = drRepo.FindById(id);

            if (donor == null)
            {
                return(HttpNotFound());
            }
            if (donor.DONATION.Count > 0 || donor.NOTES.Count > 0)
            {
                return(RedirectToAction("DeleteDonorError", "DONORs", new { id = id }));
            }
            return(View(donor));
        }
Esempio n. 6
0
        public ActionResult Create([Bind(Include = "DonorId,FName,Init,LName,Title,Suffix,Email,Cell,Birthday,Gender,MarkerId,ContactId,CompanyName,Address,City,State,Zipcode,Phone")] DONOR donor)
        {
            if (ModelState.IsValid)
            {
                DONOR myDonor = donor;
                if (myDonor.FName == null && myDonor.LName == null)
                {
                    myDonor.FName = myDonor.CompanyName;
                }
                drRepo.Add(donor);
                return(RedirectToAction("Index"));
            }

            ViewBag.CONTACTID = new SelectList(ddlData.CONTACT, "CONTACTID", "TYPEOF", donor.ContactId);
            ViewBag.MARKERID  = new SelectList(ddlData.IDENTITYMARKER, "MARKERID", "MARKERTYPE", donor.MarkerId);
            ViewBag.Gender    = new SelectList(ddlData.DONOR, "Gender", "Gender");
            return(View(donor));
        }
Esempio n. 7
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            DONOR donor = drRepo.FindById(Convert.ToInt32(id));

            if (donor == null)
            {
                return(HttpNotFound());
            }

            ViewBag.CONTACTID = new SelectList(ddlData.CONTACT, "CONTACTID", "TYPEOF", donor.ContactId);
            ViewBag.MARKERID  = new SelectList(ddlData.IDENTITYMARKER, "MARKERID", "MARKERTYPE", donor.MarkerId);
            ViewBag.Gender    = new SelectList(ddlData.GENDER, "Gender", "Gender", donor.Gender);

            return(View(donor));
        }
Esempio n. 8
0
 public void Add(DONOR d)
 {
     context.DONOR.Add(d);
     context.SaveChanges();
 }