public ActionResult DayOpenClose()
        {
            DayOpenCloseViewModel vm = _dayOpenCloseService.GetDayOpenClose(_userHelper.Get().BranchId);

            ViewBag.Title = "Day Open Close";
            return(View(vm));
        }
Example #2
0
        public void CloseDay(int branchId)
        {
            DayOpenCloseViewModel vm = GetDayOpenClose(branchId);

            AccDayOpenClose model = _uow.DayOpenCloseRepository.GetById(vm.Id);

            model.IsClosed = true;
            model.ClosedAt = DateTime.Now;

            _uow.DayOpenCloseRepository.Update(model);
            _uow.Save();
        }
Example #3
0
        public void DayCloseRequest(int branchId, string userId)
        {
            DayOpenCloseViewModel vm = GetDayOpenClose(branchId);

            AccDayOpenClose model = _uow.DayOpenCloseRepository.GetById(vm.Id);

            model.CloseRequest   = true;
            model.CloseRequestBy = userId;
            model.CloseRequestAt = DateTime.Now;

            _uow.DayOpenCloseRepository.Update(model);
            _uow.Save();
        }
Example #4
0
        public void OpenDay(int branchId)
        {
            DayOpenCloseViewModel vm = GetDayOpenClose(branchId);

            AccDayOpenClose model = new AccDayOpenClose
            {
                BranchId    = branchId,
                CurrentDate = vm.SystemDate.AddDays(1).Date,
                OpenedAt    = DateTime.Now
            };

            _uow.DayOpenCloseRepository.Insert(model);
            _uow.Save();
        }
Example #5
0
        public DayOpenCloseViewModel GetDayOpenClose(int branchId)
        {
            DayOpenCloseViewModel vm = (from c in _uow.DayOpenCloseRepository.Get()
                                        where c.BranchId == branchId
                                        orderby c.CurrentDate descending
                                        select new DayOpenCloseViewModel
            {
                Id = c.Id,
                ClosedAt = c.ClosedAt,
                CloseRequestAt = c.CloseRequestAt,
                CloseRequestBy = c.CloseRequestBy,
                IsClosed = c.IsClosed,
                IsCloseRequest = c.CloseRequest,
                OpenedAt = c.OpenedAt,
                SystemDate = c.CurrentDate
            }).FirstOrDefault();

            return(vm);
        }