コード例 #1
0
        public ActionResult Create(AddrBk_ContactAddress addrbk_contactaddress, Guid organizationId, String orgName, bool isOrganization = true)
        {
            try
            {
                addrbk_contactaddress.AddrBk_Address.Id = Guid.NewGuid();
                addrbk_contactaddress.AddrBk_Address.CreatedDt = addrbk_contactaddress.AddrBk_Address.LastUpdatedDt = DateTime.Now;
                addrbk_contactaddress.AddrBk_Address.ActiveRec = true;
                addrbk_contactaddress.AddrBk_Address.EffDt = addrbk_contactaddress.AddrBk_ContactAddr.EffDt;

                db.AddrBk_Address.Add(addrbk_contactaddress.AddrBk_Address);
                db.SaveChanges();

                addrbk_contactaddress.AddrBk_ContactAddr.Id = Guid.NewGuid();
                addrbk_contactaddress.AddrBk_ContactAddr.CreatedDt = addrbk_contactaddress.AddrBk_ContactAddr.LastUpdatedDt = DateTime.Now;
                addrbk_contactaddress.AddrBk_ContactAddr.ActiveRec = true;
                addrbk_contactaddress.AddrBk_ContactAddr.AddrID = addrbk_contactaddress.AddrBk_Address.Id;
                addrbk_contactaddress.AddrBk_ContactAddr.ContactBasis_LCID = Utils.GetLookUpBasisId(isOrganization);

                if (isOrganization)
                    addrbk_contactaddress.AddrBk_ContactAddr.OrgID = organizationId;
                else
                    addrbk_contactaddress.AddrBk_ContactAddr.IndivID = organizationId;

                db.AddrBk_ContactAddr.Add(addrbk_contactaddress.AddrBk_ContactAddr);
                db.SaveChanges();

                return RedirectToAction("Index", new { organizationId = organizationId, orgName = orgName, isOrganization = isOrganization });
            }
            catch
            {
                ModelState.AddModelError(String.Empty, Utils.errorMsg);
            }

            ViewBag.isOrganization = Convert.ToString(isOrganization);
            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkContactAddress + " / " + orgName;

            addrbk_contactaddress.Lookup_AddrTypes = db.Lookup_AddrType.Where(a => a.ActiveRec == true).ToList();
            addrbk_contactaddress.Lookup_Countries = db.Lookup_Country.Where(a => a.ActiveRec == true).ToList();
            addrbk_contactaddress.Lookup_VerificationStatuses = db.Lookup_Status.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_AddressVerificationStatus).ToList();

            ViewBag.State = "";
            if (addrbk_contactaddress.AddrBk_Address.Cntry_LCID != null)
                ViewBag.State = db.Lookup_StateProvince.Where(a => a.ActiveRec == true && a.Cntry_LCID == addrbk_contactaddress.AddrBk_Address.Cntry_LCID).ToList();

            return PartialView("_Create", addrbk_contactaddress);
        }
コード例 #2
0
        //
        // GET: /AddrBkContactAddress/Create
        public ActionResult Create(Guid organizationId, String orgName, bool isOrganization = true)
        {
            ViewBag.isOrganization = Convert.ToString(isOrganization);
            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkContactAddress + " / " + orgName;
            ViewBag.State = "";

            AddrBk_ContactAddr addrbk_contactaddr = new AddrBk_ContactAddr();
            addrbk_contactaddr.EffDt = DateTime.Now;

            AddrBk_Address addrbk_address = new AddrBk_Address();
            AddrBk_ContactAddress addrbk_contactaddress = new AddrBk_ContactAddress();

            addrbk_contactaddress.AddrBk_Address = addrbk_address;
            addrbk_contactaddress.AddrBk_ContactAddr = addrbk_contactaddr;
            addrbk_contactaddress.Lookup_AddrTypes = db.Lookup_AddrType.Where(a => a.ActiveRec == true).ToList();
            addrbk_contactaddress.Lookup_Countries = db.Lookup_Country.Where(a => a.ActiveRec == true).ToList();
            addrbk_contactaddress.Lookup_VerificationStatuses = db.Lookup_Status.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_AddressVerificationStatus).ToList();

            return PartialView("_Create", addrbk_contactaddress);
        }
コード例 #3
0
        public ActionResult Edit(AddrBk_ContactAddress addrbk_contactaddress, Guid organizationId, String orgName, bool isOrganization = true)
        {
            try
            {
                AddrBk_Address addrbk_address = addrbk_contactaddress.AddrBk_Address;
                AddrBk_ContactAddr addrbk_contactaddr = addrbk_contactaddress.AddrBk_ContactAddr;

                addrbk_contactaddress.AddrBk_Address.LastUpdatedDt = addrbk_contactaddress.AddrBk_ContactAddr.LastUpdatedDt = DateTime.Now;

                db.Entry(addrbk_address).State = EntityState.Modified;
                db.SaveChanges();

                db.Entry(addrbk_contactaddr).State = EntityState.Modified;
                db.SaveChanges();

                return RedirectToAction("Index", new { organizationId = organizationId, orgName = orgName, isOrganization = isOrganization });
            }
            catch (DbUpdateConcurrencyException ex)
            {
                var entry = ex.Entries.Single();
                var databaseValues = (AddrBk_ContactAddress)entry.GetDatabaseValues().ToObject();
                ModelState.AddModelError(string.Empty, Utils.concurrencyMsg);
                addrbk_contactaddress.AddrBk_ContactAddr.Concurrency = databaseValues.AddrBk_ContactAddr.Concurrency;
                addrbk_contactaddress.AddrBk_Address.Concurrency = databaseValues.AddrBk_Address.Concurrency;
            }
            catch
            {
                ModelState.AddModelError(String.Empty, Utils.errorMsg);
            }

            ViewBag.isOrganization = Convert.ToString(isOrganization);
            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkContactAddress + " / " + orgName + " / " + addrbk_contactaddress.AddrBk_Address.Title;

            ViewBag.State = "";
            if (addrbk_contactaddress.AddrBk_Address.Cntry_LCID != null)
                ViewBag.State = db.Lookup_StateProvince.Where(a => a.ActiveRec == true && a.Cntry_LCID == addrbk_contactaddress.AddrBk_Address.Cntry_LCID).ToList();

            addrbk_contactaddress.Lookup_AddrTypes = db.Lookup_AddrType.Where(a => a.ActiveRec == true).ToList();
            addrbk_contactaddress.Lookup_Countries = db.Lookup_Country.Where(a => a.ActiveRec == true).ToList();
            addrbk_contactaddress.Lookup_VerificationStatuses = db.Lookup_Status.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_AddressVerificationStatus).ToList();

            return PartialView("_Edit", addrbk_contactaddress);
        }
コード例 #4
0
        //
        // GET: /AddrBkContactAddress/Edit/5
        public ActionResult Edit(Guid id, Guid organizationId, String orgName, bool isOrganization = true)
        {
            AddrBk_ContactAddr addrbk_contactaddr = db.AddrBk_ContactAddr.Find(id);
            if (addrbk_contactaddr == null)
            {
                return HttpNotFound();
            }

            AddrBk_Address addrbk_address = db.AddrBk_Address.Find(addrbk_contactaddr.AddrID);
            AddrBk_ContactAddress addrbk_contactaddress = new AddrBk_ContactAddress();

            addrbk_contactaddress.AddrBk_Address = addrbk_address;
            addrbk_contactaddress.AddrBk_ContactAddr = addrbk_contactaddr;

            ViewBag.State = db.Lookup_StateProvince.Where(a => a.ActiveRec == true && a.Cntry_LCID == addrbk_contactaddress.AddrBk_Address.Cntry_LCID).ToList();
            ViewBag.isOrganization = Convert.ToString(isOrganization);
            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkContactAddress + " / " + orgName + " / " + addrbk_contactaddress.AddrBk_Address.Title;

            addrbk_contactaddress.Lookup_AddrTypes = db.Lookup_AddrType.Where(a => a.ActiveRec == true).ToList();
            addrbk_contactaddress.Lookup_Countries = db.Lookup_Country.Where(a => a.ActiveRec == true).ToList();
            addrbk_contactaddress.Lookup_VerificationStatuses = db.Lookup_Status.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_AddressVerificationStatus).ToList();

            return PartialView("_Edit", addrbk_contactaddress);
        }