コード例 #1
0
        public ActionResult OtherPermitsEdit(int PermitKey, OtherPermitsVM model)
        {
            if (!ModelState.IsValid)
                return PartialView("OtherPermitsAddEdit", model);

            try
            {
                ContactDO data = model.GetDataObject();
                ContactBLL.SaveContact(data);
                AddressDO addressdata = model.GetAddressDataObject();
                ContactBLL.SaveAddress(addressdata);
                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.OK, "Contact and address was saved");
                return Json(result);
            }
            catch (Exception ex)
            {
                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message);
                return Json(result);
            }
        }
コード例 #2
0
        public ActionResult OtherPermitsAdd(OtherPermitsVM model)
        {
            AddressDO addressdata = model.GetAddressDataObject();

            if (string.IsNullOrEmpty(addressdata.City) && string.IsNullOrEmpty(addressdata.StateID))
            {
                ModelState.Remove("Address11");
                ModelState.Remove("City");
                ModelState.Remove("StateID");
                ModelState.Remove("ZipCode");
            }

            if (!ModelState.IsValid)
                return PartialView("OtherPermitsAddEdit", model);

            try
            {
                ContactDO data = model.GetDataObject();
                addressdata.ContactID = ContactBLL.SaveContact(data);

                if (!string.IsNullOrEmpty(addressdata.City) && !string.IsNullOrEmpty(addressdata.StateID))
                    ContactBLL.SaveAddress(addressdata);

                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.OK, "Contact and address was saved");
                return Json(result);
            }
            catch (Exception ex)
            {
                AjaxResult result = new AjaxResult(AjaxResult.AjaxStatus.ERROR, ex.Message);
                return Json(result);
            }
        }
コード例 #3
0
 public ActionResult OtherPermitsEdit(int PermitKey, int Id)
 {
     ContactBO bo = ContactBLL.GetContact(Id);
     OtherPermitsVM model = new OtherPermitsVM(bo);
     return PartialView("OtherPermitsAddEdit", model);
 }
コード例 #4
0
 public ActionResult OtherPermitsAdd(int PermitKey)
 {
     OtherPermitsVM model = new OtherPermitsVM();
     model.ContactTypeID = "Other Permits (Coal & Non-Coal)";
     model.AddressTypeID = "Permanent";
     model.PermitKey = PermitKey;
     return PartialView("OtherPermitsAddEdit", model);
 }