public ActionResult Create(TrnDoModel model) { if (ModelState.IsValid) { try { var CheckDataExist = _trnSpbBLL.GetBySPB(model.NO_SPB); if (CheckDataExist == null) { AddMessageInfo("No SPB tersebut tidak ada", Enums.MessageInfoType.Error); model = Init(model); return(View(model)); } var GetDataExist = _trnDoBLL.GetBySPB(model.NO_SPB); if (GetDataExist != null) { AddMessageInfo("Gagal Create Do, no SPB sudah terdaftar", Enums.MessageInfoType.Error); model = Init(model); return(View(model)); } model.CREATED_BY = CurrentUser.USERNAME; model.CREATED_DATE = DateTime.Now; model.TANGGAL = DateTime.Now; _trnDoBLL.Save(Mapper.Map <TrnDoDto>(model), Mapper.Map <LoginDto>(CurrentUser)); _trnSpbBLL.CloseSpb(model.NO_SPB); AddMessageInfo("Sukses Create Do", Enums.MessageInfoType.Success); return(RedirectToAction("Index", "TrnDo")); } catch (Exception exp) { LogError.LogError.WriteError(exp); AddMessageInfo("Telah terjadi kesalahan", Enums.MessageInfoType.Error); return(RedirectToAction("Index", "TrnDo")); } } model = Init(model); return(View(model)); }
public JsonResult GetSpb(string NoSpb) { var data = new TrnDoModel(); data = Mapper.Map <TrnDoModel>(_trnDoBLL.GetBySPB(NoSpb)); data.AKUMULASI = _trnPengirimanBLL.GetAkumulasi(NoSpb); if (data == null) { data = new TrnDoModel(); } return(Json(data)); }