コード例 #1
0
        public ActionResult Create(AddrBk_Person addrbk_person)
        {
            try
            {
                addrbk_person.Id = Guid.NewGuid();
                addrbk_person.CreatedDt = addrbk_person.LastUpdatedDt = DateTime.Now;
                addrbk_person.ActiveRec = true;
                addrbk_person.IsProspect = false;
                db.AddrBk_Person.Add(addrbk_person);
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            catch (Exception)
            {
                ModelState.AddModelError(string.Empty, Utils.errorMsg);

            }

            ViewBag.MainTitle = Utils.AddressBook + " / " + Utils.AddrBkPerson;
            ViewBag.Ethnicity_LCID = new SelectList(db.Lookup_Ethnicity.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.Ethnicity_LCID);
            ViewBag.Gender_LCID = new SelectList(db.Lookup_Gender.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.Gender_LCID);
            ViewBag.HighestEducLvl_LCID = new SelectList(db.Lookup_EducationalLevel.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.HighestEducLvl_LCID);
            ViewBag.MaritalStatus_LCID = new SelectList(db.Lookup_MaritalStatus.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.MaritalStatus_LCID);
            ViewBag.Occupation_LCID = new SelectList(db.Lookup_Occupation.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.Occupation_LCID);
            ViewBag.Race_LCID = new SelectList(db.Lookup_Race.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.Race_LCID);
            ViewBag.ReligiousBkgd_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_OrganizationUnitMemberReligiousBackground), "Id", "Title", addrbk_person.ReligiousBkgd_LCID);
            ViewBag.Salutation_LCID = new SelectList(db.Lookup_GenderRelationship.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_OrganizationUnitMemberSalutation), "Id", "Title", addrbk_person.Salutation_LCID);
            ViewBag.Suffix_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_OrganizationUnitMemberSuffix), "Id", "Title", addrbk_person.Suffix_LCID);
            return View(addrbk_person);
        }
コード例 #2
0
        //
        // GET: /AddrBkPerson/Create
        public ActionResult Create()
        {
            ViewBag.MainTitle = Utils.AddressBook + " / " + Utils.AddrBkPerson;
            ViewBag.Ethnicity_LCID = new SelectList(db.Lookup_Ethnicity.Where(a => a.ActiveRec == true), "Id", "Title");
            ViewBag.Gender_LCID = new SelectList(db.Lookup_Gender.Where(a => a.ActiveRec == true), "Id", "Title");
            ViewBag.HighestEducLvl_LCID = new SelectList(db.Lookup_EducationalLevel.Where(a => a.ActiveRec == true), "Id", "Title");
            ViewBag.MaritalStatus_LCID = new SelectList(db.Lookup_MaritalStatus.Where(a => a.ActiveRec == true), "Id", "Title");
            ViewBag.Occupation_LCID = new SelectList(db.Lookup_Occupation.Where(a => a.ActiveRec == true), "Id", "Title");
            ViewBag.Race_LCID = new SelectList(db.Lookup_Race.Where(a => a.ActiveRec == true), "Id", "Title");
            ViewBag.ReligiousBkgd_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_OrganizationUnitMemberReligiousBackground), "Id", "Title");
            ViewBag.Salutation_LCID = new SelectList(db.Lookup_GenderRelationship.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_OrganizationUnitMemberSalutation), "Id", "Title");
            ViewBag.Suffix_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_OrganizationUnitMemberSuffix), "Id", "Title");

            AddrBk_Person addrbk_person = new AddrBk_Person();
            addrbk_person.EffDt = DateTime.Now;
            return View(addrbk_person);
        }
コード例 #3
0
        public ActionResult Edit(AddrBk_Person addrbk_person)
        {
            try
            {
                addrbk_person.LastUpdatedDt = DateTime.Now;
                db.Entry(addrbk_person).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            catch (DbUpdateConcurrencyException ex)
            {
                var entry = ex.Entries.Single();
                var databaseValues = (AddrBk_Person)entry.GetDatabaseValues().ToObject();
                ModelState.AddModelError(string.Empty, Utils.concurrencyMsg);
                addrbk_person.Concurrency = databaseValues.Concurrency;
            }
            catch (Exception)
            {
                ModelState.AddModelError(string.Empty, Utils.errorMsg);

            }

            ViewBag.MainTitle = Utils.AddressBook + " / " + Utils.AddrBkPerson;
            ViewBag.Ethnicity_LCID = new SelectList(db.Lookup_Ethnicity.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.Ethnicity_LCID);
            ViewBag.Gender_LCID = new SelectList(db.Lookup_Gender.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.Gender_LCID);
            ViewBag.HighestEducLvl_LCID = new SelectList(db.Lookup_EducationalLevel.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.HighestEducLvl_LCID);
            ViewBag.MaritalStatus_LCID = new SelectList(db.Lookup_MaritalStatus.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.MaritalStatus_LCID);
            ViewBag.Occupation_LCID = new SelectList(db.Lookup_Occupation.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.Occupation_LCID);
            ViewBag.Race_LCID = new SelectList(db.Lookup_Race.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_person.Race_LCID);
            ViewBag.ReligiousBkgd_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_OrganizationUnitMemberReligiousBackground), "Id", "Title", addrbk_person.ReligiousBkgd_LCID);
            ViewBag.Salutation_LCID = new SelectList(db.Lookup_GenderRelationship.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_OrganizationUnitMemberSalutation), "Id", "Title", addrbk_person.Salutation_LCID);
            ViewBag.Suffix_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_OrganizationUnitMemberSuffix), "Id", "Title", addrbk_person.Suffix_LCID);
            return View(addrbk_person);
        }