Ejemplo n.º 1
0
        public ActionResult Create(AddrBk_PhoneFax addrbk_phonefax, Guid organizationId, String orgName, bool isOrganization = true)
        {
            try
            {
                addrbk_phonefax.ContactBasis_LCID = Utils.GetLookUpBasisId(isOrganization);
                addrbk_phonefax.CreatedDt = addrbk_phonefax.LastUpdatedDt = DateTime.Now;
                addrbk_phonefax.ActiveRec = true;
                addrbk_phonefax.Id = Guid.NewGuid();

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

                db.AddrBk_PhoneFax.Add(addrbk_phonefax);
                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.AddrBkOrganizationPhoneFax + " / " + orgName;
            ViewBag.PhoneFaxType_LCID = new SelectList(db.Lookup_PhoneFaxType.Where(e => e.ActiveRec == true), "Id", "Title", addrbk_phonefax.PhoneFaxType_LCID);
            return PartialView("_Create", addrbk_phonefax);
        }
Ejemplo n.º 2
0
        //
        // GET: /AddrBkPhoneFax/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.AddrBkOrganizationPhoneFax + " / " + orgName;
            ViewBag.PhoneFaxType_LCID = new SelectList(db.Lookup_PhoneFaxType.Where(e => e.ActiveRec == true), "Id", "Title");

            var addrbk_phonefax = new AddrBk_PhoneFax();
            addrbk_phonefax.EffDt = DateTime.Now;
            return PartialView("_Create", addrbk_phonefax);
        }
Ejemplo n.º 3
0
        public ActionResult Edit(AddrBk_PhoneFax addrbk_phonefax, Guid organizationId, String orgName, bool isOrganization = true)
        {
            try
            {
                addrbk_phonefax.LastUpdatedDt = DateTime.Now;
                db.Entry(addrbk_phonefax).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_PhoneFax)entry.GetDatabaseValues().ToObject();
                ModelState.AddModelError(string.Empty, Utils.concurrencyMsg);
                addrbk_phonefax.Concurrency = databaseValues.Concurrency;
            }
            catch
            {
                ModelState.AddModelError(String.Empty, Utils.errorMsg);
            }

            ViewBag.isOrganization = Convert.ToString(isOrganization);
            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkOrganizationPhoneFax + " / " + orgName + " / " + addrbk_phonefax.PhoneFaxNum;
            ViewBag.PhoneFaxType_LCID = new SelectList(db.Lookup_PhoneFaxType.Where(e => e.ActiveRec == true), "Id", "Title", addrbk_phonefax.PhoneFaxType_LCID);

            return PartialView("_Edit", addrbk_phonefax);
        }