コード例 #1
0
ファイル: AdminController.cs プロジェクト: km-mahbub/pedal
        public ActionResult DailyStoreTransactionSummary()
        {
            // var stores = _unitOfWork.Stores.GetAll();
            var customers    = _unitOfWork.UserManager.Users.ToList();
            var transections = _unitOfWork.CashMemos.GetDailyTransaction();
            var stores       = _unitOfWork.Stores.GetAll();

            var cashViewModel = new CashMemoViewModel
            {
                Stores       = stores,
                Customers    = customers,
                Transections = transections
            };


            return(View(cashViewModel));
        }
コード例 #2
0
        public ActionResult FindCycle(string value)
        {
            var rent       = _unitOfWork.Rents.GetRentByTrackId(value);
            var cycle      = _unitOfWork.Cycles.Get(rent.CycleId);
            var rentedHour = TrackIdGenerotor.CalculateHour(rent.RentedTime);

            var viewModel = new CashMemoViewModel
            {
                CustomerName        = _unitOfWork.UserManager.FindById(rent.CustomerId).UserName,
                CycleName           = _unitOfWork.Companies.Get(cycle.CompanyId).Name,
                RentedFromStoreName = _unitOfWork.Stores.Get(rent.RentedFromStoreId).Name,
                RentedHour          = rentedHour,
                TotalCost           = TrackIdGenerotor.CalculateCost(rentedHour, (int)cycle.CostPerHour)
            };

            return(Json(viewModel, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public ActionResult ReceiveCycle(CashMemoViewModel model)
        {
            if (ModelState.IsValid)
            {
                var rent = _unitOfWork.Rents.GetRentByTrackId(model.TrackId);

                var cycle = _unitOfWork.Cycles.Get(rent.CycleId);

                var store = _unitOfWork.Stores.GetStoreWithManager(User.Identity.GetUserId());

                var rentedHour = TrackIdGenerotor.CalculateHour(rent.RentedTime);

                CashMemo memo = new CashMemo
                {
                    RentedHour      = rentedHour,
                    TotalCost       = TrackIdGenerotor.CalculateCost(rentedHour, (int)cycle.CostPerHour),
                    ManagerId       = User.Identity.GetUserId(),
                    CustomerId      = rent.CustomerId,
                    RentId          = rent.RentId,
                    StoreId         = _unitOfWork.Stores.GetStoreWithManager(User.Identity.GetUserId()).StoreId,
                    CashReceiveTime = DateTime.Now,
                };

                _unitOfWork.CashMemos.Add(memo);
                cycle.CycleStatusType = CycleStatusType.Available;
                cycle.RentedHour     += rentedHour;
                cycle.StoreId         = store.StoreId;

                rent.IsReceived           = true;
                rent.ReturnTime           = DateTime.Now;
                rent.ToBeSubmittedStoreId = store.StoreId;

                store.TotalCycle += 1;

                _unitOfWork.Complete();

                return(RedirectToAction("Index", "Store"));
            }



            return(HttpNotFound());
        }
コード例 #4
0
ファイル: AdminController.cs プロジェクト: km-mahbub/pedal
        public ActionResult DailyTransactionAdmin(int id)
        {
            var stores    = _unitOfWork.Stores.GetAll();
            var customers = _unitOfWork.UserManager.Users.ToList();

            var transections =
                _unitOfWork.CashMemos.GetDailyTransectionByStore(id);


            var cycles = _unitOfWork.Cycles.GetAll();

            CashMemoViewModel myModel = new CashMemoViewModel
            {
                Stores       = stores,
                Customers    = customers,
                Transections = transections,
                Cycles       = cycles
            };


            return(View("DailyTransaction", myModel));
        }
コード例 #5
0
        public ActionResult DailyTransaction()
        {
            var stores    = _unitOfWork.Stores.GetAll();
            var customers = _unitOfWork.UserManager.Users.ToList();

            var transections =
                _unitOfWork.CashMemos.GetDailyTransectionByStore(_unitOfWork.Stores
                                                                 .GetStoreWithManager(User.Identity.GetUserId()).StoreId);


            var cycles = _unitOfWork.Cycles.GetAll();

            CashMemoViewModel myModel = new CashMemoViewModel
            {
                Stores       = stores,
                Customers    = customers,
                Transections = transections,
                Cycles       = cycles
            };


            return(View(myModel));
        }