コード例 #1
0
        private PagedList <InputViewModels> Journals()
        {
            var page = new PagedList <InputViewModels>();

            page.Content = InputBusinessLogic.getInstance().TodaysJournal();
            return(page);
        }
コード例 #2
0
        public ActionResult Index(InputViewModels model)
        {
            int _out;
            int year  = 2020;
            int month = 1;
            int day   = 1;

            if (Int32.TryParse(model.Date.Substring(6, 4), out _out))
            {
                year = _out;
            }

            if (Int32.TryParse(model.Date.Substring(0, 2), out _out))
            {
                month = _out;
            }

            if (Int32.TryParse(model.Date.Substring(3, 2), out _out))
            {
                day = _out;
            }
            DateTime tmpDate = new DateTime(year, month, day);

            model.Date = tmpDate.ToString("yyyy-MMM-dd");
            int msg = InputBusinessLogic.getInstance().InputJournal(model);

            if (msg == -1)
            {
                TempData["Success"] = "Successfully was inserted";
                return(RedirectToAction("Index"));
            }
            else
            {
                if (msg == 1)
                {
                    TempData["Error"] = "amount cannot be greater than ceiling";
                }
                else
                {
                    TempData["Error"] = "Unsuccessfully was inserted";
                }
            }

            model.TodaysJournal     = Journals();
            ViewBag.AccountList     = common.ToSelectList(AccountDetailsBusinessLogic.getInstance().getAccountDetailDDL(), "ID", "NAME", model.Account);
            ViewBag.BankAccountList = common.ToSelectList(BankFacilityBusinessLogic.getInstance().getBankFacilityDDL(), "ID", "NAME", model.BankAccount);
            return(View(model));
        }