public async Task OnGetAsync(string returnUrl = null)
        {
            try
            {
                if (!string.IsNullOrEmpty(ErrorMessage))
                {
                    ModelState.AddModelError(string.Empty, ErrorMessage);
                }

                returnUrl ??= Url.Content("~/");

                // Clear the existing external cookie to ensure a clean login process
                await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);

                ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();

                if (!ViewData.ContainsKey("CompanyName"))
                {
                    ViewData.Add("CompanyName", await _nodeContext.CompanyName);
                }

                ReturnUrl = returnUrl;
            }
            catch (Exception e)
            {
                _nodeContext.ErrorLog(e);
                throw;
            }
        }
        public IEnumerable <Activity_proc_WorkFlow> ChildActivities(string parentActivityCode)
        {
            try
            {
                var _parentActivityCode = new SqlParameter()
                {
                    ParameterName = "@ParentActivityCode",
                    SqlDbType     = System.Data.SqlDbType.VarChar,
                    Direction     = System.Data.ParameterDirection.Input,
                    Size          = 50,
                    Value         = parentActivityCode
                };

                var _activityCode = new SqlParameter()
                {
                    ParameterName = "@ActivityCode",
                    SqlDbType     = System.Data.SqlDbType.VarChar,
                    Direction     = System.Data.ParameterDirection.Input,
                    Size          = 50,
                    Value         = ActivityCode
                };

                string sql = $"Activity.proc_WorkFlow @ParentActivityCode, @ActivityCode";

                var results = _context.Activity_WorkFlow.FromSqlRaw(sql, _parentActivityCode, _activityCode).ToList();

                return(results.OrderBy(t => t.ActivityCode).Select(t => t));
            }
            catch (Exception e)
            {
                _context.ErrorLog(e);
                return(null);
            }
        }
Example #3
0
 public async Task <string> UserName(string aspnetId)
 {
     try
     {
         return(await _context.GetUserName(aspnetId));
     }
     catch (Exception e)
     {
         _context.ErrorLog(e);
         return(string.Empty);
     }
 }
Example #4
0
        public async Task <bool> Rebuild()
        {
            try
            {
                int result = await _context.Database.ExecuteSqlRawAsync("Org.proc_Rebuild @p0", parameters : new[] { AccountCode });

                return(result != 0);
            }
            catch (Exception e)
            {
                _context.ErrorLog(e);
                return(false);
            }
        }
        public async Task <bool> Generate()
        {
            try
            {
                int result = await _context.Database.ExecuteSqlRawAsync("Cash.proc_GeneratePeriods");

                return(result != 0);
            }
            catch (Exception e)
            {
                _context.ErrorLog(e);
                return(false);
            }
        }
Example #6
0
        public async Task <bool> SetToPrinted(NodeEnum.DocType docType)
        {
            try
            {
                int result = await _context.Database.ExecuteSqlRawAsync("App.proc_DocDespool @p0", parameters : new[] { (short)docType });

                return(result != 0);
            }
            catch (Exception e)
            {
                _context.ErrorLog(e);
                return(false);
            }
        }
 public Task <string> GetTaxCashCode(NodeEnum.TaxType taxType)
 {
     return(Task.Run(() =>
     {
         try
         {
             return _context.Cash_tbTaxTypes.Where(t => t.TaxTypeCode == (short)taxType).Select(t => t.CashCode).ToString();
         }
         catch (Exception e)
         {
             _context.ErrorLog(e);
             return string.Empty;
         }
     }));
 }
Example #8
0
        public async Task <IActionResult> OnGetAsync(string accountCode)
        {
            try
            {
                Org_tbOrg = await NodeContext.Org_tbOrgs.FindAsync(accountCode);

                if (Org_tbOrg == null)
                {
                    return(NotFound());
                }
                else
                {
                    OrganisationTypes    = new SelectList(await NodeContext.Org_tbTypes.OrderBy(t => t.OrganisationTypeCode).Select(t => t.OrganisationType).ToListAsync());
                    OrganisationStatuses = new SelectList(await NodeContext.Org_tbStatuses.OrderBy(t => t.OrganisationStatusCode).Select(t => t.OrganisationStatus).ToListAsync());
                    TaxCodes             = new SelectList(await NodeContext.App_TaxCodes.OrderBy(t => t.TaxCode).Select(t => t.TaxDescription).ToListAsync());

                    TaxDescription = await NodeContext.App_TaxCodes.Where(t => t.TaxCode == Org_tbOrg.TaxCode).Select(t => t.TaxDescription).FirstOrDefaultAsync();

                    OrganisationType = await NodeContext.Org_tbTypes.Where(t => t.OrganisationTypeCode == Org_tbOrg.OrganisationTypeCode).Select(t => t.OrganisationType).FirstAsync();

                    OrganisationStatus = await NodeContext.Org_tbStatuses.Where(t => t.OrganisationStatusCode == Org_tbOrg.OrganisationStatusCode).Select(t => t.OrganisationStatus).FirstAsync();

                    await SetViewData();

                    return(Page());
                }
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnPostAsync(string cashAccountCode)
        {
            try
            {
                if (cashAccountCode == null)
                {
                    return(NotFound());
                }

                var cashAccount = await NodeContext.Org_tbAccounts.FindAsync(cashAccountCode);

                if (cashAccount != null)
                {
                    NodeContext.Org_tbAccounts.Remove(cashAccount);
                    await NodeContext.SaveChangesAsync();
                }

                RouteValueDictionary route = new();
                route.Add("AccountType", AccountType);

                return(RedirectToPage("./Index", route));
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
Example #10
0
        public async Task OnGetAsync(string invoiceType)
        {
            try
            {
                await SetViewData();

                InvoiceTypes = new SelectList(await NodeContext.Invoice_tbTypes.OrderBy(t => t.InvoiceTypeCode).Select(t => t.InvoiceType).ToListAsync());

                var invoices = from tb in NodeContext.Invoice_RegisterOverdue select tb;

                if (!string.IsNullOrEmpty(invoiceType))
                {
                    invoices = invoices.Where(i => i.InvoiceType == invoiceType);
                }

                Invoice_RegisterOverdue = await invoices.OrderBy(i => i.ExpectedOn).ToListAsync();

                TotalInvoiceValue = (double)await invoices.SumAsync(i => i.InvoiceValue + i.TaxValue);

                TotalPaidValue = (double)await invoices.SumAsync(i => i.UnpaidValue);
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnPostAsync(string id)
        {
            try
            {
                if (id == null)
                {
                    return(NotFound());
                }

                if (!ModelState.IsValid)
                {
                    return(Page());
                }

                NodeContext.Usr_tbUsers.Add(Usr_tbUser);
                await NodeContext.SaveChangesAsync();

                var user = await UserManager.FindByIdAsync(id);

                var code = await UserManager.GenerateEmailConfirmationTokenAsync(user);

                await UserManager.ConfirmEmailAsync(user, code);

                return(RedirectToPage("./Index"));
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
Example #12
0
        public async Task <IActionResult> OnPostAsync(string paymentCode)
        {
            try
            {
                if (paymentCode == null)
                {
                    return(NotFound());
                }

                CashAccounts cashAccounts = new(NodeContext);
                if (await cashAccounts.PostAsset(paymentCode))
                {
                    await NodeContext.SaveChangesAsync();

                    string cashAccountCode = await NodeContext.Cash_tbPayments.Where(t => t.PaymentCode == paymentCode).Select(t => t.CashAccountCode).FirstAsync();

                    RouteValueDictionary route = new();
                    route.Add("CashAccountCode", cashAccountCode);

                    return(RedirectToPage("./Index", route));
                }
                else
                {
                    throw new Exception("Post failed! Consult logs");
                }
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnPostAsync()
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Page());
                }

                Cash_tbCategory.CashTypeCode = await NodeContext.Cash_tbTypes.Where(t => t.CashType == CashType).Select(t => t.CashTypeCode).FirstAsync();

                Cash_tbCategory.CashModeCode = await NodeContext.Cash_tbModes.Where(m => m.CashMode == CashMode).Select(m => m.CashModeCode).FirstAsync();

                NodeContext.Cash_tbCategories.Add(Cash_tbCategory);
                await NodeContext.SaveChangesAsync();

                if (!string.IsNullOrEmpty(ReturnUrl))
                {
                    return(LocalRedirect($"{ReturnUrl}?categorycode={Cash_tbCategory.CategoryCode}"));
                }
                else
                {
                    RouteValueDictionary route = new();
                    route.Add("cashTypeCode", Cash_tbCategory.CashTypeCode);

                    return(RedirectToPage("./Index", route));
                }
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnGetAsync()
        {
            try
            {
                var orgTypeCode = (await NodeContext.Org_tbTypes.MaxAsync(t => t.OrganisationTypeCode)) + 1;

                Org_tbType = new()
                {
                    OrganisationTypeCode = (short)orgTypeCode,
                    CashModeCode         = (short)NodeEnum.CashMode.Income
                };

                var modes = NodeContext.Cash_tbModes.OrderBy(m => m.CashModeCode).Select(m => m.CashMode);
                CashModes = new SelectList(await modes.ToListAsync());
                CashMode  = await NodeContext.Cash_tbModes
                            .Where(t => t.CashModeCode == Org_tbType.CashModeCode)
                            .Select(t => t.CashMode).FirstAsync();
                await SetViewData();

                return(Page());
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
Example #15
0
        public async Task <IActionResult> OnPostAsync(string paymentCode)
        {
            try
            {
                if (paymentCode == null)
                {
                    return(NotFound());
                }

                Cash_PaymentsUnposted = await NodeContext.Cash_PaymentsUnposted.FindAsync(paymentCode);

                if (Cash_PaymentsUnposted != null)
                {
                    NodeContext.Cash_PaymentsUnposted.Remove(Cash_PaymentsUnposted);
                    await NodeContext.SaveChangesAsync();
                }

                RouteValueDictionary route = new();
                route.Add("CashAccountCode", Cash_PaymentsUnposted.CashAccountCode);

                return(RedirectToPage("./Index", route));
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnGetAsync(short?yearNumber)
        {
            try
            {
                if (yearNumber == null)
                {
                    return(NotFound());
                }

                App_Year = await NodeContext.App_Years.Where(y => y.YearNumber == yearNumber).FirstOrDefaultAsync();

                if (App_Year == null)
                {
                    return(NotFound());
                }

                App_YearPeriods = await NodeContext.App_YearPeriods
                                  .Where(p => p.YearNumber == yearNumber)
                                  .OrderBy(p => p.StartOn)
                                  .ToListAsync();

                await SetViewData();

                return(Page());
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnPostAsync(string paymentCode)
        {
            try
            {
                if (paymentCode == null)
                {
                    return(NotFound());
                }

                CashAccounts cashAccounts = new(NodeContext);
                if (await cashAccounts.PostTransfer(paymentCode))
                {
                    return(RedirectToPage("./Index"));
                }
                else
                {
                    throw new Exception($"Transfer failed for payment code {paymentCode}!");
                }
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnGetAsync()
        {
            try
            {
                await SetViewData();


                Profile profile  = new(NodeContext);
                var     userName = await profile.UserName(UserManager.GetUserId(User));

                Cash_tbCategory = new Cash_tbCategory()
                {
                    CategoryTypeCode = (short)NodeEnum.CategoryType.CashTotal,
                    DisplayOrder     = 0,
                    IsEnabled        = 1,
                    CashModeCode     = (short)NodeEnum.CashMode.Neutral,
                    CashTypeCode     = (short)NodeEnum.CashType.Trade,
                    InsertedBy       = userName,
                    InsertedOn       = DateTime.Now,
                    UpdatedBy        = userName,
                    UpdatedOn        = DateTime.Now
                };

                return(Page());
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
Example #19
0
        public async Task OnGetAsync()
        {
            try
            {
                var periodNames = from tb in NodeContext.App_Periods
                                  orderby tb.StartOn descending
                                  select tb.Description;

                PeriodNames       = new SelectList(await periodNames.ToListAsync());
                Cash_BalanceSheet = new List <BalanceSheets>();

                DateTime startOn = DateTime.Today;

                if (string.IsNullOrEmpty(PeriodName))
                {
                    FinancialPeriods periods = new(NodeContext);
                    startOn    = periods.ActiveStartOn;
                    PeriodName = await NodeContext.App_Periods.Where(t => t.StartOn == startOn).Select(t => t.Description).FirstOrDefaultAsync();
                }
                else
                {
                    startOn = await NodeContext.App_Periods.Where(t => t.Description == PeriodName).Select(t => t.StartOn).FirstOrDefaultAsync();
                    await GenerateBalanceSheet(startOn);
                }

                await SetViewData();
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnPostAsync()
        {
            try
            {
                Invoice_Entry.InvoiceTypeCode = await NodeContext.Invoice_tbTypes.Where(t => t.InvoiceType == InvoiceType).Select(t => t.InvoiceTypeCode).FirstAsync();

                if (!ModelState.IsValid || (Invoice_Entry.TotalValue + Invoice_Entry.InvoiceValue == 0))
                {
                    return(Page());
                }

                if (Invoice_Entry.TotalValue != 0 && Invoice_Entry.InvoiceValue != 0)
                {
                    Invoice_Entry.InvoiceValue = 0;
                }

                Invoice_Entry.AccountCode = await NodeContext.Org_tbOrgs.Where(o => o.AccountName == OrganisationName).Select(o => o.AccountCode).FirstAsync();

                Invoice_Entry.CashCode = await NodeContext.Cash_tbCodes.Where(c => c.CashDescription == CashDescription).Select(c => c.CashCode).FirstAsync();

                Invoice_Entry.TaxCode = await NodeContext.App_tbTaxCodes.Where(c => c.TaxDescription == TaxDescription).Select(c => c.TaxCode).FirstAsync();

                NodeContext.Invoice_tbEntries.Add(Invoice_Entry);
                await NodeContext.SaveChangesAsync();

                return(RedirectToPage("./Index"));
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
Example #21
0
        public async Task <IActionResult> OnGetAsync(string categoryCode)
        {
            try
            {
                if (string.IsNullOrEmpty(categoryCode) && string.IsNullOrEmpty(CategoryCode))
                {
                    return(NotFound());
                }
                else if (!string.IsNullOrEmpty(categoryCode))
                {
                    CategoryCode = categoryCode;
                }


                Cash_Category = await NodeContext.Cash_tbCategories
                                .Where(c => c.CategoryCode == CategoryCode && c.CategoryTypeCode == (short)NodeEnum.CategoryType.CashTotal).FirstOrDefaultAsync();

                if (Cash_Category == null)
                {
                    return(NotFound());
                }

                CategoryTypes = new SelectList(await NodeContext.Cash_tbCategoryTypes
                                               .Where(t => t.CategoryTypeCode < (short)NodeEnum.CategoryType.Expression)
                                               .Select(t => t.CategoryType).ToListAsync());

                CashTypes = new SelectList(await NodeContext.Cash_tbTypes
                                           .OrderBy(t => t.CashTypeCode)
                                           .Select(t => t.CashType).ToListAsync());

                var candidates = from tb in NodeContext.Cash_CategoryTotalCandidates
                                 where tb.CategoryCode != Cash_Category.CategoryCode
                                 select tb;

                if (!string.IsNullOrEmpty(CategoryType))
                {
                    candidates = candidates.Where(t => t.CategoryType == CategoryType);
                }

                if (!string.IsNullOrEmpty(CashType))
                {
                    candidates = candidates.Where(t => t.CashType == CashType);
                }

                candidates = from tb in candidates
                             orderby tb.CategoryType, tb.CashType, tb.CashMode
                select tb;

                Cash_Candidates = await candidates.ToListAsync();

                await SetViewData();

                return(Page());
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnGetAsync(string addressCode)
        {
            try
            {
                if (string.IsNullOrEmpty(addressCode))
                {
                    return(NotFound());
                }

                Org_tbAddress = await NodeContext.Org_tbAddresses.FirstOrDefaultAsync(t => t.AddressCode == addressCode);

                if (Org_tbAddress == null)
                {
                    return(NotFound());
                }

                var org = await NodeContext.Org_tbOrgs.FirstAsync(t => t.AccountCode == Org_tbAddress.AccountCode);

                AccountName    = org.AccountName;
                IsAdminAddress = org.AddressCode == addressCode;

                await SetViewData();

                return(Page());
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnPostAsync()
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Page());
                }

                CashAccounts cashAccount = new(NodeContext);

                var profile = new Profile(NodeContext);
                var user    = await UserManager.GetUserAsync(User);

                string userId = await profile.UserId(user.Id);

                if (await cashAccount.PostPayment(userId))
                {
                    return(RedirectToPage("./Index"));
                }
                else
                {
                    throw new Exception($"Payment post failed for user {userId}");
                }
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
Example #24
0
        public async Task <IActionResult> OnGetAsync(string accountCode)
        {
            try
            {
                if (string.IsNullOrEmpty(accountCode))
                {
                    return(NotFound());
                }

                Org_Account = await NodeContext.Org_AccountLookup.FirstOrDefaultAsync(t => t.AccountCode == accountCode);

                if (Org_Account == null)
                {
                    return(NotFound());
                }

                var invoices = from tb in NodeContext.Invoice_Register
                               where tb.AccountCode == accountCode
                               orderby tb.InvoicedOn descending
                               select tb;

                Org_Invoices = await invoices.ToListAsync();

                await SetViewData();

                return(Page());
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
Example #25
0
        public async Task <IActionResult> OnPostAsync(string addressCode)
        {
            try
            {
                if (addressCode == null)
                {
                    return(NotFound());
                }

                Org_tbAddress tbAddress = await NodeContext.Org_tbAddresses.FindAsync(addressCode);

                if (tbAddress != null)
                {
                    NodeContext.Org_tbAddresses.Remove(tbAddress);
                    await NodeContext.SaveChangesAsync();
                }

                RouteValueDictionary route = new();
                route.Add("accountCode", tbAddress.AccountCode);

                return(RedirectToPage("./Index", route));
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnPostAsync(string paymentCode)
        {
            try
            {
                if (paymentCode == null)
                {
                    return(NotFound());
                }

                Cash_Payment = await NodeContext.Cash_tbPayments.FindAsync(paymentCode);

                if (Cash_Payment != null)
                {
                    CashAccounts cashAccounts = new(NodeContext);
                    if (await cashAccounts.DeletePayment(Cash_Payment.PaymentCode))
                    {
                        return(RedirectToPage("./Index"));
                    }
                    else
                    {
                        return(Page());
                    }
                }
                else
                {
                    return(RedirectToPage("./Index"));
                }
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task <IActionResult> OnPostAsync(string categoryCode)
        {
            try
            {
                if (categoryCode == null)
                {
                    return(NotFound());
                }

                var totals = NodeContext.Cash_tbCategoryTotals.Where(t => t.ParentCode == categoryCode);

                foreach (var total in await totals.ToListAsync())
                {
                    NodeContext.Cash_tbCategoryTotals.Remove(total);
                }

                var tbCategory = await NodeContext.Cash_tbCategories.FindAsync(categoryCode);

                NodeContext.Cash_tbCategories.Remove(tbCategory);
                await NodeContext.SaveChangesAsync();

                RouteValueDictionary route = new();
                route.Add("cashTypeCode", tbCategory.CashTypeCode);

                return(RedirectToPage("./Index", route));
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
        public async Task OnGetAsync(string returnUrl, string organisationType)
        {
            try
            {
                await SetViewData();

                OrganisationTypes    = new SelectList(await NodeContext.Org_tbTypes.OrderBy(t => t.OrganisationTypeCode).Select(t => t.OrganisationType).ToListAsync());
                OrganisationStatuses = new SelectList(await NodeContext.Org_tbStatuses.OrderBy(t => t.OrganisationStatusCode).Select(t => t.OrganisationStatus).ToListAsync());
                TaxCodes             = new SelectList(await NodeContext.App_TaxCodes.OrderBy(t => t.TaxCode).Select(t => t.TaxCode).ToListAsync());

                Orgs orgs = new(NodeContext);

                string organisatonType = string.IsNullOrEmpty(organisationType) ? OrganisationTypes.First().ToString()
                                        : await NodeContext.Org_tbTypes.Where(t => t.OrganisationType == organisationType).Select(t => t.OrganisationType).FirstOrDefaultAsync();

                OrgEntry = new OrgData()
                {
                    AccountName        = string.Empty,
                    OrganisationType   = organisationType,
                    OrganisationStatus = NodeContext.Org_tbStatuses.Where(t => t.OrganisationStatusCode == (short)NodeEnum.OrgStatus.Active).Select(t => t.OrganisationStatus).First(),
                    TaxCode            = await orgs.DefaultTaxCode()
                };

                ReturnUrl = string.IsNullOrEmpty(returnUrl) ? "./Index" : returnUrl;
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
Example #29
0
        public async Task <IActionResult> OnGetAsync(short?yearNumber, short?monthNumber)
        {
            try
            {
                if (yearNumber == null || monthNumber == null)
                {
                    return(NotFound());
                }

                App_tbYearPeriod = await NodeContext.App_tbYearPeriods.Where(p => p.YearNumber == yearNumber && p.MonthNumber == monthNumber).FirstOrDefaultAsync();

                if (App_tbYearPeriod == null)
                {
                    return(NotFound());
                }

                var App_YearPeriod = await NodeContext.App_YearPeriods.Where(p => p.YearNumber == yearNumber && p.MonthNumber == monthNumber).FirstOrDefaultAsync();

                PeriodDescription = string.Concat(App_YearPeriod.Description, "-", App_YearPeriod.MonthName);

                CashStatuses = new SelectList(await NodeContext.Cash_tbStatuses.OrderBy(s => s.CashStatusCode).Select(s => s.CashStatus).ToListAsync());
                CashStatus   = await NodeContext.Cash_tbStatuses
                               .Where(s => s.CashStatusCode == App_tbYearPeriod.CashStatusCode)
                               .Select(s => s.CashStatus).FirstAsync();

                await SetViewData();

                return(Page());
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }
Example #30
0
        public async Task <IActionResult> OnPostAsync(string paymentCode)
        {
            try
            {
                if (paymentCode == null)
                {
                    return(NotFound());
                }

                Cash_TransfersUnposted = await NodeContext.Cash_TransfersUnposted.FindAsync(paymentCode);

                if (Cash_TransfersUnposted != null)
                {
                    NodeContext.Cash_TransfersUnposted.Remove(Cash_TransfersUnposted);
                    await NodeContext.SaveChangesAsync();
                }

                return(RedirectToPage("./Index"));
            }
            catch (Exception e)
            {
                NodeContext.ErrorLog(e);
                throw;
            }
        }