public ActionResult NotGave(DeclineRequestViewModel model)
        {
            var request      = this.requestForAssetService.GetById(model.RequestId);
            var itemsMessage = "";

            foreach (var item in request.Assets)
            {
                itemsMessage += item.InventoryNumber + ", ";
            }

            //Add a new event that asset were not givent
            var aEvent = new Event
            {
                UserId             = request.FromId,
                Content            = "Your request for assets with inventory numbers " + itemsMessage + " was approved. But the asset cannot be gave ! " + model.Message,
                Date               = DateTime.Now,
                EventRelocationUrl = "/Orders/AssetOrder/GetRequestForFinishingOrFinished/" + model.RequestId
            };

            this.eventService.Add(aEvent);

            //Add from user to request' packing slip
            this.packingSlipService.SetFromUser(
                request.PackingSlipId.Value,
                this.User.Identity.GetUserId());


            //Set request is finished
            this.requestForAssetService.SetFinished(model.RequestId);

            return(Redirect("/Orders/AssetOrder/ViewApprovedRequests"));
        }
Esempio n. 2
0
        public ActionResult AssetIsNotRenovate(DeclineRequestViewModel model)
        {
            var request = this.requestForRenovationService.GetById(model.RequestId);

            //Verify if request is from user organisation
            if (!this.IsMegaAdmin())
            {
                if (request.From.Site.OrganisationId != this.userService.GetUserOrganisationId(this.User.Identity.GetUserId()))
                {
                    return(Redirect("/Home/NotAuthorized"));
                }
            }

            //Add event that asset is not renovated
            var aEvent = new Event
            {
                UserId             = request.FromId,
                Content            = "Asset with inventory number " + request.Asset.InventoryNumber + " was not renovated and now it is active. " + model.Message,
                Date               = DateTime.Now,
                EventRelocationUrl = "/AssetsActions/RenovationAsset/ReturnedAssets"
            };

            //Set asset is given and from in packing slip
            this.packingSlipService.SetGiven(request.AcceptancePackingSlipId.Value, DateTime.Now);
            this.packingSlipService.SetFromUser(request.AcceptancePackingSlipId.Value, this.User.Identity.GetUserId());

            //Set asset is returned and change status
            this.requestForRenovationService.SetReturned(model.RequestId);
            this.assetService.ChangeStatus(request.AssetId, "Broken");
            this.eventService.Add(aEvent);



            return(Redirect("/AssetsActions/RenovationAsset/GetAssetsForRenovating"));
        }
Esempio n. 3
0
        public ActionResult Decline(DeclineRequestViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var request = this.requestForRenovationService.GetById(model.RequestId);

            //Add event that request is not approved
            var aEvent = new Event
            {
                UserId             = request.FromId,
                Content            = "Your request for renovation the asset with inventory number " + request.Asset.InventoryNumber + " was not approved. " + model.Message,
                Date               = DateTime.Now,
                EventRelocationUrl = "/AssetsActions/RenovationAsset/ViewHistoryRequest/" + model.RequestId
            };

            this.eventService.Add(aEvent);

            //Set request is finished and it is seen by approver
            this.requestForRenovationService.SetFinished(model.RequestId);
            this.requestForRenovationService.SetIsSeenFromApprover(model.RequestId);

            return(Redirect("/AssetsActions/RenovationAsset/GetRequestsForApproving"));
        }
Esempio n. 4
0
        public ActionResult NotGave(DeclineRequestViewModel model)
        {
            var request      = this.requestToAcquireItemService.GetById(model.RequestId);
            var itemsMessage = "";

            foreach (var item in request.Items)
            {
                itemsMessage += item.Brand + " " + item.Model + ", ";
            }

            //Add event that items are not gave
            var aEvent = new Event
            {
                UserId             = request.FromId,
                Content            = "Your request for " + itemsMessage + " was approved. But the items cannot be gave ! " + model.Message,
                Date               = DateTime.Now,
                EventRelocationUrl = "/Orders/ItemOrder/GetRequestForFinishingOrFinished/" + model.RequestId
            };

            this.eventService.Add(aEvent);

            //Set from user to packing slip
            this.packingSlipService.SetFromUser(
                this.requestToAcquireItemService.GetById(model.RequestId).PackingSlipId.Value,
                this.User.Identity.GetUserId());

            //Set request is finished and items are not given
            this.requestToAcquireItemService.SetFinished(model.RequestId);
            this.requestToAcquireItemService.SetItemsNotGave(model.RequestId);

            return(Redirect("/Orders/ItemOrder/ViewApprovedRequests"));
        }
        public ActionResult Decline(DeclineRequestViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var request      = this.requestForAssetService.GetById(model.RequestId);
            var itemsMessage = "";

            foreach (var item in request.Assets)
            {
                itemsMessage += item.InventoryNumber + ", ";
            }

            //Add event tha request was not approved
            var aEvent = new Event
            {
                UserId             = request.FromId,
                Content            = "Your request for assets with inventory numbers " + itemsMessage + " was not approved. " + model.Message,
                Date               = DateTime.Now,
                EventRelocationUrl = "/Orders/AssetOrder/GetRequestForFinishingOrFinished/" + model.RequestId
            };

            this.eventService.Add(aEvent);

            //Set request is finished and not approved
            this.requestForAssetService.SetFinished(model.RequestId);
            this.requestForAssetService.SetNotApproved(model.RequestId);

            return(Redirect("/Orders/AssetOrder/GetAllRequestsForAproving"));
        }
Esempio n. 6
0
        public ActionResult Decline(DeclineRequestViewModel model)
        {
            var request = this.requestToProviderService.GetById(model.RequestId);

            //Verify if request is from user organisation
            if (!this.IsMegaAdmin())
            {
                if (request.From.Site.OrganisationId != this.userService.GetUserOrganisationId(this.User.Identity.GetUserId()))
                {
                    return(Redirect("/Home/NotAuthorized"));
                }
            }

            //Add event that request is not approved
            var aEvent = new KAssets.Models.Event
            {
                UserId             = request.FromId,
                Content            = "Your request to provider was not approved. " + model.Message,
                Date               = DateTime.Now,
                EventRelocationUrl = "/Orders/ProviderOrder/ViewHistoryRequest/" + model.RequestId
            };

            this.eventService.Add(aEvent);
            this.requestToProviderService.SetFinished(model.RequestId);

            return(Redirect("/Orders/ProviderOrder/GetRequestsForApproving"));
        }
Esempio n. 7
0
        public ActionResult Decline(DeclineRequestViewModel model)
        {
            var request      = this.requestToAcquireItemService.GetById(model.RequestId);
            var itemsMessage = "";

            foreach (var item in request.Items)
            {
                itemsMessage += item.Brand + " " + item.Model + ", ";
            }

            //Add event that request is not approved
            var aEvent = new Event
            {
                UserId             = request.FromId,
                Content            = "Your request for " + itemsMessage + " was not approved. " + model.Message,
                Date               = DateTime.Now,
                EventRelocationUrl = "/Orders/ItemOrder/GetRequestForFinishingOrFinished/" + model.RequestId
            };

            this.eventService.Add(aEvent);

            //Set request is finished and not approved
            this.requestToAcquireItemService.SetFinished(model.RequestId);
            this.requestToAcquireItemService.SetNotApproved(model.RequestId);

            return(Redirect("/Orders/ItemOrder/GetAllRequestsForAproving"));
        }
Esempio n. 8
0
        public ActionResult Decline(DeclineRequestViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // Set invoice is seen by approver
            this.invoiceService.SetSeenByApprover(model.RequestId);

            //Set invoice is finished
            this.invoiceService.SetFinished(model.RequestId);


            //Add a event that invoice is not approved
            this.eventService.Add(new Event
            {
                Content            = "Your invoice was not approved !",
                Date               = DateTime.Now,
                EventRelocationUrl = "/Invoices/Invoice/ViewHistory/" + model.RequestId,
                UserId             = this.invoiceService.GetById(model.RequestId).CompiledUserId
            });

            return(Redirect("/Invoices/Invoice/InvoicesForApproving"));
        }
Esempio n. 9
0
        public ActionResult DeclineRequest(DeclineRequestViewModel model)
        {
            this.loanRequestsService.DeclineLoanRequest(model.Id, this._userContext);
            var client = this._clientProfileService.GetClient(model.ClientId);

            this.mailService.SendMessage(EmailTemplateType.DeclineCreditRequest, client, model.Text);
            return(this.Json(true, JsonRequestBehavior.AllowGet));
        }
Esempio n. 10
0
        public ActionResult DeclineRequest(int id, int clientId)
        {
            //this.loanRequestsService.DeclineLoanRequest(id, this._userContext);
            var model = new DeclineRequestViewModel
            {
                Id       = id,
                ClientId = clientId
            };

            return(this.View("CreditRequests/DeclineRequest", model));
        }
Esempio n. 11
0
        public ActionResult AssetIsNotRenovate(int id)
        {
            var request = this.requestForRenovationService.GetById(id);

            //Verify if request is from user organisation
            if (!this.IsMegaAdmin())
            {
                if (request.From.Site.OrganisationId != this.userService.GetUserOrganisationId(this.User.Identity.GetUserId()))
                {
                    return(Redirect("/Home/NotAuthorized"));
                }
            }

            var viewModel = new DeclineRequestViewModel
            {
                RequestId = id
            };

            return(View(viewModel));
        }
Esempio n. 12
0
        public ActionResult Decline(int id)
        {
            var invoice = this.invoiceService.GetById(id);

            //Verify if asset is from user organisation
            if (!this.IsMegaAdmin())
            {
                if (invoice.CompiledUser.Site.OrganisationId != this.userService.GetUserOrganisationId(this.User.Identity.GetUserId()))
                {
                    return(Redirect("/Home/NotAuthorized"));
                }
            }

            var viewModel = new DeclineRequestViewModel
            {
                RequestId = id
            };

            return(View(viewModel));
        }
Esempio n. 13
0
        public ActionResult Decline(DeclineRequestViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var request = this.requestForScrappingService.GetById(model.RequestId);

            var aEvent = new Event
            {
                UserId             = request.FromId,
                Content            = "Your request for scrapping asset with inventory number " + request.Asset.InventoryNumber + " was not approved. " + model.Message,
                Date               = DateTime.Now,
                EventRelocationUrl = "/AssetsActions/ScrappingAsset/ViewHistoryRequest/" + model.RequestId
            };

            this.eventService.Add(aEvent);

            this.requestForScrappingService.SetFinished(model.RequestId);

            return(Redirect("/AssetsActions/ScrappingAsset/RequestsForApproving"));
        }