public ActionResult EditCompanyDetails() { var company = _companyDetailsService.GetCompany(); var companyDetailsViewModel = new CompanyDetailsViewModel { Id = company.Id, Name = company.Name, Address1 = !String.IsNullOrEmpty(company.Address1) ? company.Address1 : String.Empty, Address2 = !String.IsNullOrEmpty(company.Address2) ? company.Address2 : String.Empty, Address3 = !String.IsNullOrEmpty(company.Address3) ? company.Address3 : String.Empty, Address4 = !String.IsNullOrEmpty(company.Address4) ? company.Address4 : String.Empty, Address5 = !String.IsNullOrEmpty(company.Address5) ? company.Address5 : String.Empty, Telephone = company.Telephone, Fax = company.Fax, Email = company.Email, Www = company.Www, TermsAndConditions = company.TermsAndConditions, QuoteSummaryText = company.QuoteSummaryText, OrderAcknowledgeText = company.OrderAcknowledgeText, RegNo = !String.IsNullOrEmpty(company.RegNo) ? company.RegNo : String.Empty, VatRegNo = !String.IsNullOrEmpty(company.VatRegNo) ? company.VatRegNo : String.Empty, CurrencyId = company.DefaultCurrency.Id, PaymentTermId = company.DefaultPaymentTerm.Id, BankDetailsId = company.DefaultBankDetails.Id, TaxCodeId = company.DefaultTaxCode.Id, CultureId = company.DefaultCultureCode, Currencies = _currencyService.GetCurrencies().ToSelectList(), PaymentTerms = _listItemService.GetAllByCategory(ListItemCategoryType.PaymentTerm).ToSelectList(), TaxCodes = _companyDetailsService.GetTaxCodes().Select(t => new { Id = t.Id, Name = t.TaxCodeName }).ToSelectList(), BankDetails = _companyDetailsService.GetBankDetails().Select(t => new { Id = t.Id, Name = t.ShortName }).ToSelectList(), Cultures = _companyDetailsService.GetSupportedCultures().Select(c => new { Id = c.Key, Name = c.Value }).ToSelectList() }; return(View("CompanyDetails", companyDetailsViewModel)); }
public ActionResult CreateIndividualOrder() { var viewModel = new OrderCreateViewModel { JobItemId = Guid.Empty, CurrencyId = _companyDetailsService.GetCompany().DefaultCurrency.Id, Currencies = _currencyService.GetCurrencies().ToSelectList(), Description = "placeholder", // This is needed because this value is required by another view that uses the same model. Quantity = 1 // Likewise. }; return(View(viewModel)); }
public frmCurrency() { InitializeComponent(); dgvCurrency.AutoGenerateColumns = false; this.CurrencyService = new CurrencyService(); this.dgvCurrency.DataSource = CurrencyService.GetCurrencies(); }
protected override async Task OnInitializedAsync() { //Id = Id ?? "1"; //int.TryParse(Id, out int Id); if (Id != null) // for Edit { LineItem = (await LineItemService.GetLineItemById(int.Parse(Id))); Mapper.Map(LineItem, LineItemEditModel); Description = LineItemEditModel.Description; } else // for Create { //PageHeader = "Create LineItem"; LineItem = new LineItem { //LineItems Id = 1, Date = DateTime.Now, Description = " ", //Status = (Status)Enum.Parse(typeof(Status), "Requested") }; } Categories = (await CategoryService.GetCategories()).ToList(); CategoryId = LineItem.CategoryId.ToString(); Currencies = (await CurrencyService.GetCurrencies()).ToList(); CurrencyId = LineItem.CurrencyId.ToString(); if (LineItem.Receipt.Length > 0) { var format = "image/png"; var imageDataUrl = $"data:{format};base64,{Convert.ToBase64String(LineItem.Receipt)}"; imageDataUrls.Add(imageDataUrl); } }
protected async override Task OnInitializedAsync() { if (Id != null) { Guid invoiceNumber = new Guid(Id); ViewTitle = "Edit Invoice"; Invoice = await InvoiceService.GetInvoice(invoiceNumber); } else { ViewTitle = "New Invoice"; Invoice = new Invoice { DeliveryDate = DateTime.Now, SettleDate = DateTime.Now, InvoiceDate = DateTime.Now, InvoiceVat = "", Client = "", Currency = "", ExchangeRate = "" }; } Vats = (await VatService.GetVats()).ToList(); Currencies = (await CurrencyService.GetCurrencies()).ToList(); ExchangeRates = (await ExchangeRateService.GetExchangeRates()).ToList(); Clients = (await ClientService.GetClients()).ToList(); Mapper.Map(Invoice, InvoiceViewModel); }
public async Task <IActionResult> GetCurrencies() { // Reponse var response = await _currencyService.GetCurrencies(); // Return return(Ok(response)); }
protected override async Task OnInitAsync() { Currencies = CurrencyService.GetCurrencies(); SourceCurrency = Currencies.First(); SelectedSourceCurrency = SourceCurrency.Code; TargetCurrency = Currencies.First(); SelectedTargetCurrency = TargetCurrency.Code; await CalculateRate(); }
public async Task <IHttpActionResult> Register(RegisterBindingModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var user = new ApplicationUser() { UserName = model.Email, Email = model.Email }; IdentityResult result = await UserManager.CreateAsync(user, model.Password); if (!result.Succeeded) { return(GetErrorResult(result)); } var accountservice = new AccountService(); var userId = Guid.Parse(accountservice.GetGuid(user.Email)); var walletService = new WalletService(userId); var wallet = new WalletCreate { WalletBalance = 50000 }; if (!walletService.CreateWallet(wallet)) { return(InternalServerError(new Exception("Error creating Wallet."))); } var currencyService = new CurrencyService(); var currencies = currencyService.GetCurrencies(); foreach (var currency in currencies) { var holdingService = new HoldingService(userId); var holding = new HoldingCreate() { CryptoHoldingBalance = 0, CurrencyId = currency.CurrencyId, WalletId = walletService.GetWalletId() }; if (!holdingService.CreateHolding(holding)) { return(InternalServerError(new Exception($"Error creating entry for Holding: {holding.CurrencyId}"))); } } return(Ok()); }
public ActionResult <Dictionary <string, Currency> > Get() { var currencies = CurrencyService.GetCurrencies(); if (currencies == null) { return(NotFound("404 Error (Not Found): List of Supported Currencies could not be retrieved.")); } return(currencies); }
public ActionResult Create(Guid jobItemId, Guid jobId) { var job = _jobService.GetJob(jobId); var company = _companyDetailsService.GetCompany(); var jobItem = _jobItemService.GetById(jobItemId); var workTypeListItemId = _listItemService.GetByType(ListItemType.WorkTypeInvestigation).Id; var investigationWorkItem = jobItem.HistoryItems.Where(i => i.WorkType.Id == workTypeListItemId).FirstOrDefault(); var viewmodel = new QuoteCreateViewModel() { JobItemId = jobItemId, JobId = jobId, OrderNo = job.OrderNo, AdviceNo = job.AdviceNo, Currencies = _currencyService.GetCurrencies().ToSelectList(), CurrencyId = company.DefaultCurrency.Id, Report = investigationWorkItem != null ? investigationWorkItem.Report : String.Empty }; return(View("Create", viewmodel)); }
protected override async Task OnInitializedAsync() { CreateEditMode = false; LineItemEditModel = new LineItemEditModel(); LineItems = (await LineItemService.GetLineItems()).ToList(); Categories = (await CategoryService.GetCategories()).ToList(); CategoryId = LineItem.CategoryId.ToString(); Currencies = (await CurrencyService.GetCurrencies()).ToList(); CurrencyId = LineItem.CurrencyId.ToString(); }
public void GetCurrencies() { try { _currencyService.GetCurrencies(); } catch (DomainValidationException dex) { _domainValidationException = dex; } }
public ActionResult Index() { var currencies = _currencyService.GetCurrencies().Select(c => new CurrencyViewModel { Id = c.Id, Name = c.Name, DisplayMessage = c.DisplayMessage }).ToList(); var listViewModel = new CurrencyListViewModel() { Currencies = currencies, CreateViewModel = new CurrencyViewModel() }; return(View(listViewModel)); }
public ActionResult <double> Get(string code1, string code2, int num) { if (code1.Length != 3) { return(BadRequest($"400 Error (Bad Request): Currency Code \"{code1}\" not valid.")); } if (code2.Length != 3) { return(BadRequest($"400 Error (Bad Request): Currency Code \"{code2}\" not valid.")); } if (num < 0 || num > 15) { return(BadRequest("400 Error (Bad Request): Precision must be from 0 to 15.")); } code1 = code1.ToUpper(); code2 = code2.ToUpper(); var currencies = CurrencyService.GetCurrencies(); if (currencies.ContainsKey(code1) && currencies.ContainsKey(code2)) { var currency1 = currencies[code1]; var currency2 = currencies[code2]; double exchange = CurrencyService.ExchangeRate(currency1, currency2); if (exchange == 0) { return(NotFound("404 Error (Not Found): Currency Conversion Rate could not be found.")); } exchange = Math.Round(exchange, num); return(exchange); } else if (currencies.ContainsKey(code1) && !currencies.ContainsKey(code2)) { return(NotFound($"404 Error (Not Found): Currency Code \"{code2}\" could not be found.")); } else if (!currencies.ContainsKey(code1) && currencies.ContainsKey(code2)) { return(NotFound($"404 Error (Not Found): Currency Code \"{code1}\" could not be found.")); } else { return(NotFound($"404 Error (Not Found): Currency Code \"{code1}\" & \"{code2}\" could not be found.")); } }
public ActionResult <Currency> Get(string code) { if (code.Length != 3) { return(BadRequest($"400 Error (Bad Request): Currency Code \"{code}\" not valid.")); } code = code.ToUpper(); var currencies = CurrencyService.GetCurrencies(); if (currencies.ContainsKey(code)) { var currency = currencies[code]; return(currency); } else { return(NotFound($"404 Error (Not Found): Currency Code \"{code}\" could not be found.")); } }
public IHttpActionResult Listar(string ids = "") { try { IAppCache cache = new CachingService(); var currencyService = new CurrencyService(); Func <List <Currency> > getCurrenciesFunc = () => currencyService.GetCurrencies(ids).ToList(); var cachedCurrencies = cache.GetOrAdd("currencies", getCurrenciesFunc); // return Ok(currencyService.GetCurrencies(ids)); return(Ok(cachedCurrencies)); } catch (Exception ex) { return(InternalServerError(ex)); } }
protected ImageConverter _imageConverter;// = new ImageConverter(); protected override async Task OnInitializedAsync() { var authenticationState = await((CustomAuthenticationStateProvider)AuthenticationStateProvider).GetAuthenticationStateAsync(); var AuthenticationStateUser = authenticationState.User; Name = AuthenticationStateUser.Claims.Where(x => x.Type.Equals("email")).FirstOrDefault().Value; if (Name == null) { Name = (await authenticationStateTask).User.Claims.Where(x => x.Type.Equals("email")).FirstOrDefault().Value; } if (!authenticationState.User.Identity.IsAuthenticated) { string returnUrl = WebUtility.UrlEncode($"/list"); NavigationManager.NavigateTo($"/login?returnUrl={returnUrl}"); } Categories = (await CategoryService.GetCategories()).ToList(); Currencies = (await CurrencyService.GetCurrencies()).ToList(); //Id = Id ?? "1"; int.TryParse(Id, out int claimId); if (claimId != 0)// for Edit { Claim = (await ClaimService.GetClaimById(int.Parse(Id))); Mapper.Map(Claim, ClaimEditModel); if (ClaimEditModel.RequesterComments != null) { RequesterComments = ClaimEditModel.RequesterComments; } if (ClaimEditModel.ApproverComments != null) { ApproverComments = ClaimEditModel.ApproverComments; } if (ClaimEditModel.FinanceComments != null) { FinanceComments = ClaimEditModel.FinanceComments; } if (Claim.LineItems.Count() > 0) { foreach (var LineItem in Claim.LineItems) { LineItemEditModel = new LineItemEditModel(); Mapper.Map(LineItem, LineItemEditModel); LineItemEditModels.Add(LineItemEditModel); if (LineItem.Receipt != null) { imageDataUrls.Clear(); var format = "image/png"; var imageDataUrl = $"data:{format};base64,{Convert.ToBase64String(LineItem.Receipt)}"; imageDataUrls.Add(imageDataUrl); LineItemImageModel Lim = new LineItemImageModel { Id = LineItem.Id, ImageDataUrls = imageDataUrls.ToList() }; LineItemImageModels.Add(Lim); } } } } else // for Create { ClaimEditModel = new ClaimEditModel { Requester = Name, SubmitDate = DateTime.Now, Status = (Status)Enum.Parse(typeof(Status), "Requested") }; if (LineItemEditModels.Count() > 0) { foreach (var lineItemEditModel in LineItemEditModels) { if (lineItemEditModel.Receipt != null) { imageDataUrls.Clear(); var format = "image/png"; var imageDataUrl = $"data:{format};base64,{Convert.ToBase64String(lineItemEditModel.Receipt)}"; imageDataUrls.Add(imageDataUrl); LineItemImageModel Lim = new LineItemImageModel { Id = lineItemEditModel.Id, ImageDataUrls = imageDataUrls.ToList() }; LineItemImageModels.Add(Lim); } } } } }
protected override async Task OnInitializedAsync() { CreateEditMode = false; CurrencyEditModel = new CurrencyEditModel(); Currencies = (await CurrencyService.GetCurrencies()).ToList(); }
public JsonResult GetCurrencies() { var Currencies = service.GetCurrencies(); return(Json(Currencies, JsonRequestBehavior.AllowGet)); }
public ListCurrenciesResponse GetCurrencies([FromBody] BaseRequest request) => _currencyService.GetCurrencies(request);