public static void ApplyClassCollection(CancelViewModel cancelViewModel)
        {
            if (cancelViewModel.CancelItems != null)
            {
                // Business rule
                foreach (var cancelItem in cancelViewModel.CancelItems)
                {
                    foreach (var item in cancelItem.CancelViewItems)
                    {
                        if (item.LockExpireDate < DateTime.Now && item.LockExpireDate != DateTime.MinValue)
                        {
                            item.ClassCollection = "canceltablelistduedate";
                        }
                        else
                        {
                            item.ClassCollection = "canceltablelist";
                        }

                        if (item.ExceptionItemMaxWeight != -1)
                        {
                            item.ExceptionClassCollection = item.ExceptionItemMaxWeight < 300
                                ? "exceptionIcon exceptionIcon0"
                                : "exceptionIcon exceptionIcon1";
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public ActionResult CancelReservation(int id)
        {
            if (id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Islem islem = db.Islem.Find(id);

            if (islem == null)
            {
                return(HttpNotFound());
            }
            var cari = db.Cari.Find(islem.Cari_ID);

            ViewBag.CariBilgisi = cari.Cari_AdSoyad;

            var arac = db.viewAracList.First(x => x.Arac_ID == islem.Arac_ID);

            ViewBag.AracBilgisi = arac.AracMarka_Adi + " " + arac.AracModel_Adi + " (" + arac.AracPlakaNo + ")";
            CancelViewModel model = new CancelViewModel
            {
                Islem_TahsilEdilen = islem.Islem_TahsilEdilen,
                Tahsilat_Aciklama  = "Rezervasyon iptal edilirken iade edildi.",
            };

            return(View(model));
        }
        public static CancelViewModel RetrieveCancelViewModel(CancelLoanListState cancelListState, List <int> userAccountIds, GridDateFilter dateFilter, int userAccountId, Guid companyId, int channelId, int divisionId, Guid branchId, string searchTerm = null)
        {
            if (cancelListState == null)
            {
                cancelListState = new CancelLoanListState();
            }

            if (userAccountIds == null)
            {
                userAccountIds = new List <int>();
            }

            string isOnLineUser = cancelListState.BorrowerStatusFilter == null ? null :
                                  cancelListState.BorrowerStatusFilter == BorrowerStatusType.Offline.GetStringValue() ? "0" : "1";

            CancelViewData cancelViewData = LoanServiceFacade.RetrieveCancelItemsView(userAccountId, userAccountIds,
                                                                                      cancelListState.CurrentPage,
                                                                                      cancelListState.SortColumn.GetStringValue(),
                                                                                      cancelListState.SortDirection,
                                                                                      cancelListState.BoundDate,
                                                                                      searchTerm,
                                                                                      isOnLineUser,
                                                                                      companyId,
                                                                                      channelId,
                                                                                      divisionId,
                                                                                      branchId
                                                                                      ) ??
                                            new CancelViewData {
                CancelViewItems = new List <CancelViewItem>(), TotalItems = 0, TotalPages = 0
            };

            for (int i = 0; i < cancelViewData.CancelViewItems.Count; i++)
            {
                for (int j = 0; j < cancelViewData.CancelViewItems[i].CancelViewItems.Count; j++)
                {
                    DataForShortProductDescription data =
                        LoanServiceFacade.RetrieveDataForShortProductDescription(cancelViewData.CancelViewItems[i].CancelViewItems[j].LoanId);

                    cancelViewData.CancelViewItems[i].CancelViewItems[j].ProgramName = LoanHelper.FormatShortProductDescription(cancelViewData.CancelViewItems[i].CancelViewItems[j].IsHarp,
                                                                                                                                EnumHelper.GetStringValue((AmortizationType)data.AmortizationType),
                                                                                                                                data.LoanTerm,
                                                                                                                                data.FixedRateTerm,
                                                                                                                                EnumHelper.GetStringValue((MortgageType)data.MortgageType));
                }
            }

            var cancelViewModel = new CancelViewModel
            {
                BorrowerStatusList = new List <BorrowerStatusType>(Enum.GetValues(typeof(BorrowerStatusType)).Cast <BorrowerStatusType>().Skip(1)),
                CancelItems        = cancelViewData.CancelViewItems,
                PageCount          = cancelViewData.TotalPages,
                TotalItems         = cancelViewData.TotalItems
            };

            CancelGridHelper.ApplyClassCollection(cancelViewModel);
            CancelGridHelper.ProcessPagingOptions(cancelListState, cancelViewModel);


            return(cancelViewModel);
        }
Ejemplo n.º 4
0
        public ActionResult DeleteContract(int?id, string nothing)
        {
            PackageViewModel serviceContract = null;
            var contract = client.GetAsync("ServiceContracts/" + id);

            contract.Wait();
            var yield = contract.Result;

            if (yield.IsSuccessStatusCode)
            {
                var content = yield.Content.ReadAsStringAsync();
                content.Wait();
                JObject vendorPackage = JObject.Parse(content.Result);
                serviceContract = new PackageViewModel()
                {
                    Id            = (int)vendorPackage["Id"],
                    VendorType    = (string)vendorPackage["VendorType"],
                    VendorId      = (int?)vendorPackage["VendorId"],
                    Description   = (string)vendorPackage["Description"],
                    Price         = (double?)vendorPackage["Price"],
                    ContractPrice = (double?)vendorPackage["ContractPrice"],
                    CoupleId      = (int?)vendorPackage["CoupleId"],
                    PricePhaseKey = (int?)vendorPackage["PricePhaseKey"]
                };
            }
            var response = client.DeleteAsync("ServiceContracts/" + id);

            response.Wait();
            var result = response.Result;

            if (result.IsSuccessStatusCode)
            {
                var vendor = GetOneRequest(serviceContract.VendorType, serviceContract.VendorId);
                var token  = new CancelViewModel()
                {
                    VendorType   = serviceContract.VendorType,
                    Price        = serviceContract.Price,
                    VendorId     = serviceContract.VendorId,
                    CancelPerson = vendor.Name,
                    CoupleId     = serviceContract.CoupleId
                };
                if (serviceContract.PricePhaseKey == 3)
                {
                    token.Price = serviceContract.ContractPrice;
                }
                string json    = JsonConvert.SerializeObject(token);
                var    content = new StringContent(json, Encoding.UTF8, "application/json");
                response = client.PostAsync("CancelTokens", content);
                response.Wait();
                result = response.Result;
                if (result.IsSuccessStatusCode)
                {
                    return(RedirectToAction("Details"));
                }
            }
            return(View(id));
        }
Ejemplo n.º 5
0
        public IActionResult Cancel([FromForm] CancelViewModel model)
        {
            if (ModelState.IsValid == false)
            {
                return(RedirectToAction("Index"));
            }

            _jobService.Cancel(model.Id);

            return(RedirectToAction("Index", new { id = model.Id }));
        }
        public async Task <IActionResult> CancellationConfirmation(CancelViewModel cancelViewModel)
        {
            var model = new BookingCancellationModel
            {
                ReaderTicket     = cancelViewModel.ReaderTicket,
                BookingReference = cancelViewModel.BookingReference,
                CancelledBy      = "visitor"
            };
            await _bookingService.CancelBookingAsync(model);

            return(View(cancelViewModel));
        }
        public static void ProcessPagingOptions(CancelLoanListState cancelListState, CancelViewModel cancelViewModel)
        {
            if (cancelViewModel.PageCount % 10 == 0)
            {
                cancelViewModel.PageGroups = (cancelViewModel.PageCount / 10);
            }
            else
            {
                cancelViewModel.PageGroups = (cancelViewModel.PageCount / 10) + 1;
            }

            cancelViewModel.PageGroups = ( int )cancelViewModel.PageGroups;
            if (cancelViewModel.PageCount % 10 != 0)
            {
                cancelViewModel.LastPageItems = cancelViewModel.PageCount % 10;
            }
            else
            {
                cancelViewModel.LastPageItems = 10;
            }

            cancelViewModel.CurrentPage = cancelListState.CurrentPage;

            if (cancelViewModel.CurrentPage % 10 != 0)
            {
                cancelViewModel.StartPage = ( int )(cancelViewModel.CurrentPage / 10) * 10 + 1;
                if ((( int )((cancelViewModel.CurrentPage) / 10) + 1) == cancelViewModel.PageGroups)
                {
                    cancelViewModel.EndPage      = ( int )(cancelViewModel.CurrentPage / 10) * 10 + cancelViewModel.LastPageItems;
                    cancelViewModel.LastPageDots = true;
                }
                else
                {
                    cancelViewModel.EndPage      = ( int )(cancelViewModel.CurrentPage / 10) * 10 + 10;
                    cancelViewModel.LastPageDots = false;
                }
            }
            else
            {
                cancelViewModel.StartPage = ( int )((cancelViewModel.CurrentPage - 1) / 10) * 10 + 1;
                if ((( int )((cancelViewModel.CurrentPage - 1) / 10) + 1) == cancelViewModel.PageGroups)
                {
                    cancelViewModel.EndPage      = ( int )(cancelViewModel.CurrentPage / 10) * 10;
                    cancelViewModel.LastPageDots = true;
                }
                else
                {
                    cancelViewModel.EndPage      = ( int )((cancelViewModel.CurrentPage - 1) / 10) * 10 + 10;
                    cancelViewModel.LastPageDots = false;
                }
            }
        }
        public void Execute()
        {
            CancelLoanListState cancelLoanListState = _httpContext.Session[SessionHelper.CancelListState] != null ?
                                                      (CancelLoanListState)_httpContext.Session[SessionHelper.CancelListState] :
                                                      new CancelLoanListState();

            if (!InputParameters.ContainsKey("BorroweStatusFilter"))
            {
                throw new ArgumentException("BorroweStatusFilter was expected!");
            }

            cancelLoanListState.BorrowerStatusFilter = InputParameters["BorroweStatusFilter"].ToString() == "0" ?
                                                       null : InputParameters["BorroweStatusFilter"].ToString();

            UserAccount user = _httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name ?
                               user = (UserAccount)_httpContext.Session[SessionHelper.UserData] :
                                      UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name);

            if (user == null)
            {
                throw new InvalidOperationException("User is null");
            }

            // on date filter change, reset page number
            cancelLoanListState.CurrentPage = 1;

            FilterViewModel userFilterViewModel = null;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
            }
            else
            {
                userFilterViewModel = new FilterViewModel();
            }

            CancelViewModel cancelLoanViewModel = CancelDataHelper.RetrieveCancelViewModel(cancelLoanListState,
                                                                                           _httpContext.Session[SessionHelper.UserAccountIds] != null
                                                        ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds]
                                            : new List <int> {
            },
                                                                                           cancelLoanListState.BoundDate, user.UserAccountId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, CommonHelper.GetSearchValue(_httpContext));

            _viewName  = "Queues/_cancel";
            _viewModel = cancelLoanViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.CancelViewModel] = cancelLoanViewModel.ToXml();
            _httpContext.Session[SessionHelper.CancelListState] = cancelLoanListState;
        }
Ejemplo n.º 9
0
        public async Task <ActionResult> Cancel([Bind(Include = "RequestId,Desc")] CancelViewModel requestVM)
        {
            if (ModelState.IsValid)
            {
                var request = await db.Requests.FindAsync(requestVM.RequestId);

                request.IsCanceled      = true;
                db.Entry(request).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            //   ViewBag.RequestTypeId = new SelectList(db.RequestTypes, "RequestTypeId", "Name", request.RequestTypeId);
            return(View(requestVM));
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> Cancel([FromBody] CancelViewModel vm, CancellationToken cancellationToken)
        {
            var ctx = await this._interaction.GetAuthorizationContextAsync(vm.ReturnUrl);

            if (ctx != null)
            {
                // if the user cancels, send a result back into IdentityServer as if they
                // denied the consent (even if this client does not require consent).
                // this will send back an access denied OIDC error response to the client.
                await this._interaction.GrantConsentAsync(ctx, ConsentResponse.Denied);

                // we can trust model.ReturnUrl since GetAuthorizationContextAsync returned non-null
                return(this.Ok());
            }

            // since we don't have a valid context, then we just go back to the home page
            return(this.BadRequest());
        }
Ejemplo n.º 11
0
        public ActionResult CancelReservation(CancelViewModel model, int id)
        {
            Islem islem = db.Islem.Find(id);

            if (ModelState.IsValid)
            {
                islem.Islem_TahsilEdilen += model.Islem_TahsilEdilen ?? 0;
                islem.Islem_KalanBorc    -= model.Islem_TahsilEdilen ?? 0;

                var truncated = $"{islem.Islem_ID} Id'li İşlem: {model.Tahsilat_Aciklama}";
                if (truncated.Length > 500)
                {
                    truncated = truncated.Substring(0, 500);
                }
                KasaIslem tahsilat = new KasaIslem
                {
                    KasaIslem_Aciklama   = truncated,
                    KasaIslem_CreateDate = DateTime.Now,
                    KasaIslem_Tarih      = DateTime.Now,
                    KasaIslem_Tutar      = model.Islem_TahsilEdilen,
                    OdemeTipi_ID         = (int)model.OdemeTipi_ID,
                    KasaIslem_Tipi       = (int)KasaIslemTipi.Gider
                };
                db.KasaIslem.Add(tahsilat);
                islem.Islem_Tipi = (int)IslemTipi.RezervasyonIptal;

                Arac a = db.Arac.Find(islem.Arac_ID);
                a.AracKiralamaDurumu = (int)AracDurumu.Bos;

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            var cari = db.Cari.Find(islem.Cari_ID);

            ViewBag.CariBilgisi = cari.Cari_AdSoyad;

            var arac = db.viewAracList.First(x => x.Arac_ID == islem.Arac_ID);

            ViewBag.AracBilgisi = arac.AracMarka_Adi + " " + arac.AracModel_Adi + " (" + arac.AracPlakaNo + ")";
            return(View(model));
        }
Ejemplo n.º 12
0
        private async Task <CancelViewModel> GetViewModelAsync(int opportunityId, int opportunityItemId)
        {
            var viewModel = new CancelViewModel();

            if (opportunityId == 0)
            {
                return(viewModel);
            }

            viewModel.OpportunityId     = opportunityId;
            viewModel.OpportunityItemId = opportunityItemId;

            var opportunityItemCount = await _opportunityService.GetSavedOpportunityItemCountAsync(opportunityId);

            if (opportunityItemCount == 0)
            {
                return(viewModel);
            }

            viewModel.CancelText = "Cancel this opportunity";

            return(viewModel);
        }
Ejemplo n.º 13
0
        public ActionResult GetCancelTokens()
        {
            var userId = User.Identity.GetUserId();
            var user   = db.Couples.Where(c => c.ApplicationId == userId).SingleOrDefault();
            List <CancelViewModel> tokens = new List <CancelViewModel>();
            var response = client.GetAsync("CancelTokens/");

            response.Wait();
            var result = response.Result;

            if (result.IsSuccessStatusCode)
            {
                var read = result.Content.ReadAsStringAsync();
                read.Wait();
                var    service = read.Result;
                JArray jObject = JArray.Parse(service);
                foreach (var item in jObject)
                {
                    var token = new CancelViewModel()
                    {
                        Id           = (int)item["Id"],
                        VendorType   = (string)item["VendorType"],
                        VendorId     = (int?)item["VendorId"],
                        Price        = (double?)item["Price"],
                        CancelPerson = (string)item["CancelPerson"],
                        CoupleId     = (int?)item["CoupleId"]
                    };
                    if (token.CoupleId == user.CoupleId)
                    {
                        tokens.Add(token);
                    }
                }
            }
            ViewBag.Count = tokens.Count;
            return(View(tokens));
        }
 public IActionResult CancelBooking(CancelViewModel cancelViewModel)
 {
     return(View(cancelViewModel));
 }
Ejemplo n.º 15
0
        public void Execute()
        {
            String searchValue = CommonHelper.GetSearchValue(_httpContext);

            CancelLoanListState cancelListState;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.CancelListState] != null))
            {
                cancelListState = ( CancelLoanListState )_httpContext.Session[SessionHelper.CancelListState];
            }
            else
            {
                cancelListState = new CancelLoanListState();
            }

            bool refresh = InputParameters != null && InputParameters.ContainsKey("Refresh") && InputParameters["Refresh"].ToString().Trim() == "true";

            // reset Page Number to 1st on Tab change
            if (!refresh)
            {
                cancelListState.CurrentPage = 1;
            }

            FilterViewModel userFilterViewModel;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
                userFilterViewModel.FilterContext = FilterContextEnum.Cancel;
            }
            else
            {
                // possible state retrieval?
                userFilterViewModel = new FilterViewModel {
                    FilterContext = FilterContextEnum.Cancel
                };
            }

            UserAccount user;

            if (_httpContext != null && _httpContext.Session[SessionHelper.UserData] != null)
            {
                user = ( UserAccount )_httpContext.Session[SessionHelper.UserData];
            }
            else
            {
                throw new InvalidOperationException("UserData is null");
            }



            CancelViewModel cancelViewModel = CancelDataHelper.RetrieveCancelViewModel(cancelListState,
                                                                                       _httpContext.Session[SessionHelper.UserAccountIds] != null
                                                                            ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds]
                                                                            : new List <int> {
            }, cancelListState.BoundDate, user.UserAccountId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, searchValue);

            _viewName  = "Queues/_cancel";
            _viewModel = cancelViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.CancelViewModel] = cancelViewModel.ToXml();
            _httpContext.Session[SessionHelper.CancelListState] = cancelListState;
            _httpContext.Session[SessionHelper.FilterViewModel] = userFilterViewModel.ToXml();
            _httpContext.Session[SessionHelper.CurrentTab]      = LoanCenterTab.Cancelled;
        }
        public void Execute()
        {
            CancelLoanListState cancelListState = null;

            if (_httpContext.Session[SessionHelper.CancelListState] != null)
            {
                cancelListState = ( CancelLoanListState )_httpContext.Session[SessionHelper.CancelListState];
            }
            else
            {
                cancelListState = new CancelLoanListState();
            }

            UserAccount user;

            if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name)
            {
                user = ( UserAccount )_httpContext.Session[SessionHelper.UserData];
            }
            else
            {
                user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name);
            }

            if (user == null)
            {
                throw new InvalidOperationException("User is null");
            }

            /* parameter processing */
            var newPageNumber = 0;

            if (!InputParameters.ContainsKey("Page"))
            {
                throw new ArgumentException("Page number was expected!");
            }
            else
            {
                newPageNumber = Convert.ToInt32(InputParameters["Page"]);
            }

            cancelListState.CurrentPage = newPageNumber;

            /* Command processing */
            FilterViewModel userFilterViewModel = null;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
            }
            else
            {
                userFilterViewModel = new FilterViewModel();
            }

            CancelViewModel cancelViewModel = CancelDataHelper.RetrieveCancelViewModel(cancelListState,
                                                                                       _httpContext.Session[SessionHelper.UserAccountIds] != null ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds] : new List <int> {
            },
                                                                                       cancelListState.BoundDate, user.UserAccountId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, CommonHelper.GetSearchValue(_httpContext));

            _viewName  = "Queues/_cancel";
            _viewModel = cancelViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.CancelViewModel] = cancelViewModel.ToXml();
            _httpContext.Session[SessionHelper.CancelListState] = cancelListState;
        }
Ejemplo n.º 17
0
        public void Execute()
        {
            CancelLoanListState cancelListState = null;

            if (_httpContext.Session[SessionHelper.CancelListState] != null)
            {
                cancelListState = ( CancelLoanListState )_httpContext.Session[SessionHelper.CancelListState];
            }
            else
            {
                cancelListState = new CancelLoanListState();
            }

            UserAccount user;

            if (_httpContext.Session[SessionHelper.UserData] != null && ((UserAccount)_httpContext.Session[SessionHelper.UserData]).Username == _httpContext.User.Identity.Name)
            {
                user = ( UserAccount )_httpContext.Session[SessionHelper.UserData];
            }
            else
            {
                user = UserAccountServiceFacade.GetUserByName(_httpContext.User.Identity.Name);
            }

            if (user == null)
            {
                throw new InvalidOperationException("User is null");
            }

            /* parameter processing */
            CancelAttribute newSortColumn;

            if (!InputParameters.ContainsKey("Column"))
            {
                throw new ArgumentException("Column value was expected!");
            }
            else
            {
                newSortColumn = ( CancelAttribute )Enum.Parse(typeof(CancelAttribute), InputParameters["Column"].ToString());
            }

            if (cancelListState.SortColumn == newSortColumn && cancelListState.SortDirection == "ASC")
            {
                cancelListState.SortDirection = "DESC";
            }
            else
            {
                cancelListState.SortDirection = "ASC";
            }

            cancelListState.SortColumn = newSortColumn;

            /* Command processing */
            FilterViewModel userFilterViewModel = null;

            if ((_httpContext != null) && (_httpContext.Session[SessionHelper.FilterViewModel] != null))
            {
                userFilterViewModel = new FilterViewModel().FromXml(_httpContext.Session[SessionHelper.FilterViewModel].ToString());
            }
            else
            {
                userFilterViewModel = new FilterViewModel();
            }

            CancelViewModel cancelViewModel = CancelDataHelper.RetrieveCancelViewModel(cancelListState,
                                                                                       _httpContext.Session[SessionHelper.UserAccountIds] != null
                                                                                        ? (List <int>)_httpContext.Session[SessionHelper.UserAccountIds]
                                                                            : new List <int> {
            }, cancelListState.BoundDate, user.UserAccountId, userFilterViewModel.CompanyId, userFilterViewModel.ChannelId, userFilterViewModel.DivisionId, userFilterViewModel.BranchId, CommonHelper.GetSearchValue(_httpContext));

            _viewName  = "Queues/_cancel";
            _viewModel = cancelViewModel;

            /* Persist new state */
            _httpContext.Session[SessionHelper.CancelViewModel] = cancelViewModel.ToXml();
            _httpContext.Session[SessionHelper.CancelListState] = cancelListState;
        }