コード例 #1
0
        public ActionResult Create(AddrBk_Identification addrbk_identification, Guid organizationId, String orgName, bool isOrganization = true)
        {
            var contactType = Utils.GetLookUpBasisId(isOrganization);
            try
            {
                if(addrbk_identification.IdentificationIssuerID == Guid.Empty || addrbk_identification.IdentificationIssuerID == null)
                    throw new Exception();

                addrbk_identification.Id = Guid.NewGuid();
                addrbk_identification.ContactBasis_LCID = contactType;
                addrbk_identification.CreatedDt = addrbk_identification.LastUpdatedDt = DateTime.Now;
                addrbk_identification.ActiveRec = true;

                if (isOrganization)
                    addrbk_identification.OrgID = organizationId;
                else
                    addrbk_identification.IndivID = organizationId;

                db.AddrBk_Identification.Add(addrbk_identification);
                db.SaveChanges();

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

            var contactBasisId = Utils.GetOrganizationLookUpBasisId(true);

            ViewBag.isOrganization = Convert.ToString(isOrganization);
            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkIdentification + " / " + orgName;
            ViewBag.IdentificationIssuerID = new SelectList(db.AddrBk_OrganizationUnit.Where(a => a.ActiveRec == true && a.Id != organizationId && a.ContactBasis_LCID == contactBasisId), "Id", "Name", addrbk_identification.IdentificationIssuerID);
            ViewBag.IdentType_LCID = new SelectList(db.Lookup_IdentificationType.Where(a => a.ActiveRec == true && a.ContactType_LCID == contactType), "Id", "Title", addrbk_identification.IdentType_LCID);
            ViewBag.VerificationType_LCID = new SelectList(db.Lookup_VerificationType.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_identification.VerificationType_LCID);
            ViewBag.IndentVerifStatus_LCID = new SelectList(db.Lookup_Status.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_IdentificationVerificationStatus), "Id", "Title", addrbk_identification.IndentVerifStatus_LCID);

            if (isOrganization)
                return PartialView("_CreateOrg", addrbk_identification);
            else
                return PartialView("_CreateIndv", addrbk_identification);
        }
コード例 #2
0
        //
        // GET: /AddrBkIdentification/Create
        public ActionResult Create(Guid organizationId, String orgName, bool isOrganization = true)
        {
            var contactType = Utils.GetLookUpBasisId(isOrganization);
            var contactBasisId = Utils.GetOrganizationLookUpBasisId(true);

            ViewBag.isOrganization = Convert.ToString(isOrganization);
            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkIdentification + " / " + orgName;
            ViewBag.IdentificationIssuerID = new SelectList(db.AddrBk_OrganizationUnit.Where(a => a.ActiveRec == true && a.Id != organizationId && a.ContactBasis_LCID == contactBasisId), "Id", "Name");
            ViewBag.IdentType_LCID = new SelectList(db.Lookup_IdentificationType.Where(a => a.ActiveRec == true && a.ContactType_LCID == contactType), "Id", "Title");
            ViewBag.VerificationType_LCID = new SelectList(db.Lookup_VerificationType.Where(a => a.ActiveRec == true), "Id", "Title");
            ViewBag.IndentVerifStatus_LCID = new SelectList(db.Lookup_Status.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_IdentificationVerificationStatus), "Id", "Title");

            AddrBk_Identification addrbk_identification = new AddrBk_Identification();
            addrbk_identification.EffDt = DateTime.Now;

            if (isOrganization)
                return PartialView("_CreateOrg", addrbk_identification);
            else
                return PartialView("_CreateIndv", addrbk_identification);
        }
コード例 #3
0
        public ActionResult Edit(AddrBk_Identification addrbk_identification, Guid organizationId, String orgName, bool isOrganization = true)
        {
            try
            {
                if (addrbk_identification.IdentificationIssuerID == Guid.Empty || addrbk_identification.IdentificationIssuerID == null)
                    throw new Exception();

                addrbk_identification.LastUpdatedDt = DateTime.Now;
                db.Entry(addrbk_identification).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_Identification)entry.GetDatabaseValues().ToObject();
                ModelState.AddModelError(string.Empty, Utils.concurrencyMsg);
                addrbk_identification.Concurrency = databaseValues.Concurrency;
            }
            catch
            {
                ModelState.AddModelError(String.Empty, Utils.errorMsg);
            }

            var contactType = Utils.GetLookUpBasisId(isOrganization);
            var contactBasisId = Utils.GetOrganizationLookUpBasisId(true);

            ViewBag.isOrganization = Convert.ToString(isOrganization);
            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkIdentification + " / " + orgName;
            ViewBag.IdentificationIssuerID = new SelectList(db.AddrBk_OrganizationUnit.Where(a => a.ActiveRec == true && a.Id != organizationId && a.ContactBasis_LCID == contactBasisId), "Id", "Name", addrbk_identification.IdentificationIssuerID);
            ViewBag.IdentType_LCID = new SelectList(db.Lookup_IdentificationType.Where(a => a.ActiveRec == true && a.ContactType_LCID == contactType), "Id", "Title", addrbk_identification.IdentType_LCID);
            ViewBag.VerificationType_LCID = new SelectList(db.Lookup_VerificationType.Where(a => a.ActiveRec == true), "Id", "Title", addrbk_identification.VerificationType_LCID);
            ViewBag.IndentVerifStatus_LCID = new SelectList(db.Lookup_Status.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_IdentificationVerificationStatus), "Id", "Title", addrbk_identification.IndentVerifStatus_LCID);

            if (isOrganization)
                return PartialView("_EditOrg", addrbk_identification);
            else
                return PartialView("_EditIndv", addrbk_identification);
        }