コード例 #1
0
        public ActionResult Closing(ClosingViewModel viewModel, FormCollection formCollection)
        {
            TRecPeriod recPeriod = new TRecPeriod();

            recPeriod.SetAssignedIdTo(Guid.NewGuid().ToString());
            recPeriod.PeriodFrom  = viewModel.DateFrom.Value;
            recPeriod.PeriodTo    = viewModel.DateTo.Value;
            recPeriod.PeriodType  = EnumPeriodType.Custom.ToString();
            recPeriod.PeriodDesc  = string.Format("{0:dd-MMM-yyyy} s/d {1:dd-MMM-yyyy}", viewModel.DateFrom.Value, viewModel.DateTo.Value);
            recPeriod.CreatedBy   = User.Identity.Name;
            recPeriod.CreatedDate = DateTime.Now;

            try
            {
                _tRecPeriodRepository.Save(recPeriod);
                _tRecPeriodRepository.DbContext.CommitChanges();
                _tRecAccountRepository.RunClosing(recPeriod);
                TempData[EnumCommonViewData.SaveState.ToString()] = EnumSaveState.Success;
            }
            catch (Exception)
            {
                TempData[EnumCommonViewData.SaveState.ToString()] = EnumSaveState.Failed;
            }
            return(RedirectToAction("Closing"));
        }
コード例 #2
0
        public ActionResult Closing()
        {
            ClosingViewModel viewModel = ClosingViewModel.CreateClosingViewModel(_tRecPeriodRepository, _tJournalRepository);

            viewModel.DateTo = DateTime.Today;

            ListJournalDet          = new List <TJournalDet>();
            ViewData["CurrentItem"] = "Tutup Buku";
            return(View(viewModel));
        }
コード例 #3
0
        public ActionResult Index(ClosingViewModel viewModel, FormCollection formCollection)
        {
            string Message = string.Empty;
            bool   Success = true;

            try
            {
                _tRecPeriodRepository.DbContext.BeginTransaction();

                TRecPeriod recPeriod = new TRecPeriod();
                recPeriod.SetAssignedIdTo(Guid.NewGuid().ToString());
                recPeriod.PeriodFrom  = Helper.CommonHelper.ConvertToDate(formCollection["StartDate"]);
                recPeriod.PeriodTo    = Helper.CommonHelper.ConvertToDate(formCollection["EndDate"]);
                recPeriod.PeriodType  = EnumPeriodType.Custom.ToString();
                recPeriod.PeriodDesc  = string.Format("{0} s/d {1}", formCollection["StartDate"], formCollection["EndDate"]);
                recPeriod.CreatedBy   = User.Identity.Name;
                recPeriod.CreatedDate = DateTime.Now;

                CalculateCommission(recPeriod);

                _tRecPeriodRepository.Save(recPeriod);
                _tRecPeriodRepository.DbContext.CommitChanges();
                Success = true;
                Message = "Tutup buku Berhasil Disimpan.";
            }
            catch (Exception ex)
            {
                Success = false;
                Message = "Error :\n" + ex.GetBaseException().Message;
                _tRecPeriodRepository.DbContext.RollbackTransaction();
            }
            var e = new
            {
                Success,
                Message
            };

            return(Json(e, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
 public async Task <IActionResult> AddClosing(Guid id, ClosingViewModel closing, CancellationToken token)
 {
     return(RedirectToAction("Edit", new { id }));
 }
コード例 #5
0
        public ActionResult Index()
        {
            ClosingViewModel viewModel = ClosingViewModel.Create(_tRecPeriodRepository);

            return(View(viewModel));
        }