public CommRuleGeneric(IModel ModelPortfolio, IAccountType AccountType, string CommRuleName, FeeTypes FeeType, Fees.Calculations.CommCalc CommCalculation) : base(CommRuleName, FeeType, CommCalculation) { this.ModelPortfolio = ModelPortfolio; this.AccountType = AccountType; }
public CommRuleSpecific(OrderActionTypes actionType, bool applyToAllAccounts, IAccountType accountType, IModel modelPortfolio, IAccount account, IInstrument instrument, ISecCategory ruleSecCategory, IExchange exchange, string commRuleName, FeeTypes feeType, CommRuleOpenClose openClose, CommRuleBuySell buySell, Fees.Calculations.CommCalc commCalculation) : base(commRuleName, feeType, commCalculation) { this.actionType = actionType; this.ApplyToAllAccounts = applyToAllAccounts; this.AccountType = accountType; this.ModelPortfolio = modelPortfolio; this.Account = account; this.Instrument = instrument; this.RuleSecCategory = ruleSecCategory; this.Exchange = exchange; this.OpenClose = openClose; this.BuySell = buySell; }
public void Claims_CalculateAndUpdate_Allowed1Allowed2CompletedProcedures() { string suffix = "8"; Patient pat = PatientT.CreatePatient(suffix); long patNum = pat.PatNum; long feeSchedNum1 = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix); long feeSchedNum2 = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix + "b"); //Standard Fee long codeNum = ProcedureCodes.GetCodeNum("D2750"); Fee fee = Fees.GetFee(codeNum, 53, 0, 0); if (fee == null) { fee = new Fee(); fee.CodeNum = codeNum; fee.FeeSched = 53; fee.Amount = 1200; Fees.Insert(fee); } else { fee.Amount = 1200; Fees.Update(fee); } //PPO fees fee = new Fee(); fee.CodeNum = codeNum; fee.FeeSched = feeSchedNum1; fee.Amount = 600; Fees.Insert(fee); fee = new Fee(); fee.CodeNum = codeNum; fee.FeeSched = feeSchedNum2; fee.Amount = 800; Fees.Insert(fee); //Carrier Carrier carrier = CarrierT.CreateCarrier(suffix); long planNum1 = InsPlanT.CreateInsPlanPPO(carrier.CarrierNum, feeSchedNum1).PlanNum; long planNum2 = InsPlanT.CreateInsPlanPPO(carrier.CarrierNum, feeSchedNum2).PlanNum; InsSub sub1 = InsSubT.CreateInsSub(pat.PatNum, planNum1); long subNum1 = sub1.InsSubNum; InsSub sub2 = InsSubT.CreateInsSub(pat.PatNum, planNum2); long subNum2 = sub2.InsSubNum; BenefitT.CreateCategoryPercent(planNum1, EbenefitCategory.Crowns, 50); BenefitT.CreateCategoryPercent(planNum2, EbenefitCategory.Crowns, 50); BenefitT.CreateAnnualMax(planNum1, 1000); BenefitT.CreateAnnualMax(planNum2, 1000); PatPlanT.CreatePatPlan(1, patNum, subNum1); PatPlanT.CreatePatPlan(2, patNum, subNum2); Procedure proc = ProcedureT.CreateProcedure(pat, "D2750", ProcStat.TP, "8", Fees.GetAmount0(codeNum, 53)); //crown on 8 long procNum = proc.ProcNum; //Lists List <ClaimProc> claimProcs = ClaimProcs.Refresh(patNum); Family fam = Patients.GetFamily(patNum); List <InsSub> subList = InsSubs.RefreshForFam(fam); List <InsPlan> planList = InsPlans.RefreshForSubList(subList); List <PatPlan> patPlans = PatPlans.Refresh(patNum); List <Benefit> benefitList = Benefits.Refresh(patPlans, subList); List <Procedure> procList = Procedures.Refresh(patNum); //Set complete and attach to claim ProcedureT.SetComplete(proc, pat, planList, patPlans, claimProcs, benefitList, subList); claimProcs = ClaimProcs.Refresh(patNum); List <Procedure> procsForClaim = new List <Procedure>(); procsForClaim.Add(proc); Claim claim = ClaimT.CreateClaim("P", patPlans, planList, claimProcs, procList, pat, procsForClaim, benefitList, subList); //Validate Assert.AreEqual(500, claim.WriteOff); }
///<summary>Most of the logic for breaking an appointment. Pass in the brokenFee (the number the user enters in the brokenAppointment window), ///Optionally pass in if the brokenappointment procedure is being deleted. Returns the broken procedure that was created.</summary> public static Procedure BreakAppointment(Appointment appt, Patient pat, ProcedureCode procCode, double feeOverride, bool isDeleteBrokenProc = false) { //suppressHistory is true due to below logic creating a log with a specific HistAppointmentAction instead of the generic changed. DateTime datePrevious = appt.DateTStamp; bool suppressHistory = false; if (procCode != null) { suppressHistory = procCode.ProcCode == "D9986" || procCode.ProcCode == "D9987"; } Appointments.SetAptStatus(appt, ApptStatus.Broken, suppressHistory); //Appointments S-Class handles Signalods if (appt.AptStatus != ApptStatus.Complete) //seperate log entry for completed appointments. { SecurityLogs.MakeLogEntry(Permissions.AppointmentEdit, pat.PatNum, appt.ProcDescript + ", " + appt.AptDateTime.ToString() + ", Broken from the Appts module.", appt.AptNum, datePrevious); } else { SecurityLogs.MakeLogEntry(Permissions.AppointmentCompleteEdit, pat.PatNum, appt.ProcDescript + ", " + appt.AptDateTime.ToString() + ", Broken from the Appts module.", appt.AptNum, datePrevious); } List <Procedure> listProcedures = Procedures.GetProcsForSingle(appt.AptNum, false); //splits should only exist on procs if they are using tp pre-payments List <PaySplit> listSplitsForApptProcs = new List <PaySplit>(); bool isNonRefundable = false; double brokenProcAmount = 0; if (listProcedures.Count > 0) { listSplitsForApptProcs = PaySplits.GetPaySplitsFromProcs(listProcedures.Select(x => x.ProcNum).ToList()); } Procedure brokenProcedure = new Procedure(); #region Charting the proc if (procCode != null) { switch (procCode.ProcCode) { case "D9986": //Missed HistAppointments.CreateHistoryEntry(appt.AptNum, HistAppointmentAction.Missed); break; case "D9987": //Cancelled HistAppointments.CreateHistoryEntry(appt.AptNum, HistAppointmentAction.Cancelled); break; } brokenProcedure.PatNum = pat.PatNum; brokenProcedure.ProvNum = (procCode.ProvNumDefault > 0 ? procCode.ProvNumDefault : appt.ProvNum); brokenProcedure.CodeNum = procCode.CodeNum; brokenProcedure.ProcDate = DateTime.Today; brokenProcedure.DateEntryC = DateTime.Now; brokenProcedure.ProcStatus = ProcStat.C; brokenProcedure.ClinicNum = appt.ClinicNum; brokenProcedure.UserNum = Security.CurUser.UserNum; brokenProcedure.Note = Lans.g("AppointmentEdit", "Appt BROKEN for") + " " + appt.ProcDescript + " " + appt.AptDateTime.ToString(); brokenProcedure.PlaceService = (PlaceOfService)PrefC.GetInt(PrefName.DefaultProcedurePlaceService); //Default proc place of service for the Practice is used. List <InsSub> listInsSubs = InsSubs.RefreshForFam(Patients.GetFamily(pat.PatNum)); List <InsPlan> listInsPlans = InsPlans.RefreshForSubList(listInsSubs); List <PatPlan> listPatPlans = PatPlans.Refresh(pat.PatNum); InsPlan insPlanPrimary = null; InsSub insSubPrimary = null; if (listPatPlans.Count > 0) { insSubPrimary = InsSubs.GetSub(listPatPlans[0].InsSubNum, listInsSubs); insPlanPrimary = InsPlans.GetPlan(insSubPrimary.PlanNum, listInsPlans); } double procFee; long feeSch; if (insPlanPrimary == null || procCode.NoBillIns) { feeSch = FeeScheds.GetFeeSched(0, pat.FeeSched, brokenProcedure.ProvNum); } else //Only take into account the patient's insurance fee schedule if the D9986 procedure is not marked as NoBillIns { feeSch = FeeScheds.GetFeeSched(insPlanPrimary.FeeSched, pat.FeeSched, brokenProcedure.ProvNum); } procFee = Fees.GetAmount0(brokenProcedure.CodeNum, feeSch, brokenProcedure.ClinicNum, brokenProcedure.ProvNum); if (insPlanPrimary != null && insPlanPrimary.PlanType == "p" && !insPlanPrimary.IsMedical) //PPO { double provFee = Fees.GetAmount0(brokenProcedure.CodeNum, Providers.GetProv(brokenProcedure.ProvNum).FeeSched, brokenProcedure.ClinicNum, brokenProcedure.ProvNum); brokenProcedure.ProcFee = Math.Max(provFee, procFee); } else { brokenProcedure.ProcFee = procFee; } if (!PrefC.GetBool(PrefName.EasyHidePublicHealth)) { brokenProcedure.SiteNum = pat.SiteNum; } Procedures.Insert(brokenProcedure); Procedure procOld = brokenProcedure.Copy(); //Now make a claimproc if the patient has insurance. We do this now for consistency because a claimproc could get created in the future. List <Benefit> listBenefits = Benefits.Refresh(listPatPlans, listInsSubs); List <ClaimProc> listClaimProcsForProc = ClaimProcs.RefreshForProc(brokenProcedure.ProcNum); Procedures.ComputeEstimates(brokenProcedure, pat.PatNum, listClaimProcsForProc, false, listInsPlans, listPatPlans, listBenefits, pat.Age, listInsSubs); if (listSplitsForApptProcs.Count > 0 && PrefC.GetBool(PrefName.TpPrePayIsNonRefundable) && procCode.ProcCode == "D9986") { //if there are pre-payments, non-refundable pre-payments is turned on, and the broken appointment is a missed code then auto-fill //the window with the sum of the procs for the appointment. Transfer money below after broken procedure is confirmed by the user. //normally goes to the form to let the user speficy, this is the auto filled amount for the form. brokenProcedure.ProcFee = feeOverride; //listSplitsForApptProcs.Sum(x => x.SplitAmt); isNonRefundable = true; } if (isDeleteBrokenProc) { brokenProcedure.ProcStatus = ProcStat.D; } brokenProcedure.ProcFee = feeOverride; brokenProcAmount = feeOverride; Procedures.Update(brokenProcedure, procOld); } #endregion //Note this MUST come after FormProcBroken since clicking cancel in that window will delete the procedure. if (isNonRefundable && !isDeleteBrokenProc && listSplitsForApptProcs.Count > 0) { //transfer what the user specified in the broken appointment window. //transfer up to the amount specified by the user foreach (Procedure proc in listProcedures) { if (brokenProcAmount == 0) { break; } List <PaySplit> listSplitsForAppointmentProcedure = listSplitsForApptProcs.FindAll(x => x.ProcNum == proc.ProcNum); foreach (PaySplit split in listSplitsForAppointmentProcedure) { if (brokenProcAmount == 0) { break; } double amt = Math.Min(brokenProcAmount, split.SplitAmt); Payments.CreateTransferForTpProcs(proc, new List <PaySplit> { split }, brokenProcedure, amt); brokenProcAmount -= amt; } } } return(brokenProcedure); }
public void Fees_GetFee_ExactNotFound() { Fee createdFee = CreateSingleFee(MethodBase.GetCurrentMethod().Name, _defaultFeeAmt * _rand.NextDouble(), true, true); Assert.IsNull(Fees.GetFee(_listProcCodes.Last().CodeNum, createdFee.FeeSched, createdFee.ClinicNum, createdFee.ProvNum)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Borrowdate,Expirationdate,Returndate,Profileid,Sampleid")] Borrowings borrowings) { if (id != borrowings.Id) { return(NotFound()); } if (ModelState.IsValid) { try { //update borrowing so return date _context.Update(borrowings); await _context.SaveChangesAsync(); //add fee for borrowing TimeSpan span = (TimeSpan)(borrowings.Returndate - borrowings.Expirationdate); double days = span.TotalDays; if (days > 0) { var fee = new Fees(); fee.Borrowid = borrowings.Id; fee.Feetotal = (int)days * 5; var maxId = 0; if (_context.Fees.Count() == 0) { maxId = 0; } else { maxId = _context.Fees.Max(x => x.Id); } fee.Id = ++maxId; _context.Add(fee); await _context.SaveChangesAsync(); } //zgolemi go numberofsamples na book var borrowing = _context.Borrowings.Where(x => x.Id == borrowings.Id).FirstOrDefault(); var samplee = _context.Samples.Where(x => x.Id == borrowings.Sampleid).FirstOrDefault(); var book = _context.Books.Where(x => x.Id == samplee.Bookid).FirstOrDefault(); book.Numberofsamples++; _context.Update(book); await _context.SaveChangesAsync(); //smeni go statuso na sample vo true var sample = _context.Samples.Where(x => x.Id == borrowings.Sampleid).FirstOrDefault(); sample.Samplestatus = true; _context.Update(sample); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BorrowingsExists(borrowings.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Profileid"] = new SelectList(_context.Members, "Profileid", "Profileid", borrowings.Profileid); ViewData["Sampleid"] = new SelectList(_context.Samples, "Id", "Id", borrowings.Sampleid); ViewBag.UserId = _httpContextAccessor.HttpContext.Request.Cookies["id"]; ViewBag.UserName = _httpContextAccessor.HttpContext.Request.Cookies["username"]; ViewBag.UserRole = _httpContextAccessor.HttpContext.Request.Cookies["userrole"]; var list = _context.Borrowings.Join(_context.Samples, borrowing => borrowing.Sampleid, sample => sample.Id, (borrowing, sample) => new { Id = borrowing.Id, Borrowdate = borrowing.Borrowdate, Expirationdate = borrowing.Expirationdate, Returndate = borrowing.Returndate, Bookid = sample.Bookid, Profileid = borrowing.Profileid, Sampleid = borrowing.Sampleid }).Join(_context.Books, bs => bs.Bookid, book => book.Id, (bs, book) => new BorrowingGridModel { Id = bs.Id, Bookname = book.Bookname, Borrowdate = bs.Borrowdate, Expirationdate = bs.Expirationdate, Returndate = bs.Returndate, Bookid = bs.Bookid, Profileid = bs.Profileid, Sampleid = bs.Sampleid }); return(View(borrowings)); }
public void Procedures_GlobalUpdateFees() { string name = MethodBase.GetCurrentMethod().Name; Random rand = new Random(); //set up fees List <Clinic> listClinics = new List <Clinic>(); for (int i = 0; i < 3; i++) { listClinics.Add(ClinicT.CreateClinic(name + "_" + i)); } List <long> listFeeSchedNums = new List <long>(); for (int i = 0; i < 2; i++) { listFeeSchedNums.Add(FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, name + "_" + i, false)); } List <long> listProvNums = new List <long>(); for (int i = 0; i < 2; i++) { long feeSched = listFeeSchedNums[rand.Next(listFeeSchedNums.Count - 1)]; listProvNums.Add(ProviderT.CreateProvider(name + "_" + i, feeSchedNum: feeSched)); } List <ProcedureCode> listProcCodes = ProcedureCodes.GetAllCodes(); List <Fee> listFees = new List <Fee>(); foreach (ProcedureCode procCode in listProcCodes) { foreach (long feeSched in listFeeSchedNums) { foreach (Clinic clinic in listClinics) { foreach (long provNum in listProvNums) { listFees.Add(FeeT.GetNewFee(feeSched, procCode.CodeNum, 50 * rand.NextDouble(), clinic.ClinicNum, provNum)); } } } } //set up patients List <Patient> listPatients = new List <Patient>(); for (int i = 0; i < 3; i++) { listPatients.Add(PatientT.CreatePatient(name + "_" + i, listProvNums[rand.Next(listProvNums.Count - 1)], listClinics[rand.Next(listClinics.Count - 1)].ClinicNum)); } //TP some procedures List <Fee> listTPFees = new List <Fee>(); for (int i = 0; i < 100; i++) { ProcedureCode procCode = listProcCodes[rand.Next(listProcCodes.Count - 1)]; Patient patient = listPatients[rand.Next(listPatients.Count - 1)]; Fee fee = Fees.GetFee(procCode.CodeNum, Providers.GetProv(patient.PriProv).FeeSched, patient.ClinicNum, patient.PriProv); Procedure proc = ProcedureT.CreateProcedure(patient, procCode.ProcCode, ProcStat.TP, "", fee.Amount); listTPFees.Add(fee); } //change some of the fees List <Fee> listTPFeesChanged = listTPFees.OrderBy(x => rand.Next()).Take(50).ToList(); List <Fee> listNonTPFeesChanged = (listFees.Except(listTPFees)).OrderBy(x => rand.Next()).Take(50).ToList(); FeeCache cache = new FeeCache(listTPFeesChanged.Union(listNonTPFeesChanged).ToList()); cache.BeginTransaction(); foreach (Fee fee in listTPFeesChanged) { fee.Amount = 50 * rand.NextDouble(); cache.Update(fee); } foreach (Fee fee in listNonTPFeesChanged) { fee.Amount = 50 * rand.NextDouble(); cache.Update(fee); } cache.SaveToDb(); //Run the global update long updatedCount = 0; cache = new FeeCache(); for (int i = 0; i < listClinics.Count; i++) { updatedCount += Procedures.GlobalUpdateFees(cache.GetFeesForClinics(listClinics.Select(x => x.ClinicNum)), listClinics[i].ClinicNum, listClinics[i].Abbr); } //check the counts are the same List <Fee> listToCount = listTPFees.Where(x => listTPFeesChanged.Select(y => y.FeeNum).Contains(x.FeeNum)).ToList(); Assert.AreEqual(listToCount.Count, updatedCount); }
public ActionResult Upload(HttpPostedFileBase uploadfile) { if (ModelState.IsValid) { if (uploadfile != null && uploadfile.ContentLength > 0) { //ExcelDataReader works on binary excel file Stream stream = uploadfile.InputStream; //We need to written the Interface. IExcelDataReader reader = null; if (uploadfile.FileName.EndsWith(".xls")) { //reads the excel file with .xls extension reader = ExcelReaderFactory.CreateBinaryReader(stream); } else if (uploadfile.FileName.EndsWith(".xlsx")) { //reads excel file with .xlsx extension reader = ExcelReaderFactory.CreateOpenXmlReader(stream); } else { //Shows error if uploaded file is not Excel file ModelState.AddModelError("File", "This file format is not supported"); return(View()); } //treats the first row of excel file as Coluymn Names reader.IsFirstRowAsColumnNames = true; //Adding reader data to DataSet() DataSet result = reader.AsDataSet(); reader.Close(); if (result != null) { foreach (DataRow row in result.Tables[0].Rows) { Fees fee = new Fees(); foreach (DataColumn col in result.Tables[0].Columns) { if (col.ColumnName.ToUpper() == "FECHA") { fee.Date = DateTime.Parse(row[col.ColumnName].ToString()); } if (col.ColumnName.ToUpper() == "CUOTA") { fee.Amount = Double.Parse(row[col.ColumnName].ToString()); } if (col.ColumnName.ToUpper() == "CODIGOVENDEDORSAP") { Int32 salesperson = Int32.Parse(row[col.ColumnName].ToString()); var user = db.DeviceUser.Where(w => w.SalesPersonId == salesperson).ToList().FirstOrDefault(); fee.DeviceUserId = user.DeviceUserId; } } db.Fees.Add(fee); } try { db.SaveChanges(); }catch (Exception e) { ModelState.AddModelError("File", e.Message); } } //Sending result data to View return(View(result.Tables[0])); } } else { ModelState.AddModelError("File", "Please upload your file"); } return(View()); }
/* * * Frontend page: Fee Page * Title: Getting Fees by due date * Designed: Nadeeka * User story: * Developed: Nadeeka * Date created: 4/21/2016 * */ public List <Fees> GetFeesByDueDate(int loanId, DateTime dueDate, string type) { try { List <Fees> lstFee = new List <Fees>(); DataHandler dataHandler = new DataHandler(); List <object[]> paramertList = new List <object[]>(); paramertList.Add(new object[] { "@loan_id", loanId }); paramertList.Add(new object[] { "@bill_due_date", dueDate }); paramertList.Add(new object[] { "@type", type }); DataSet dataSet = dataHandler.GetDataSet("spGetFeesByDueDate", paramertList); if (dataSet != null && dataSet.Tables.Count != 0) { foreach (DataRow dataRow in dataSet.Tables[0].Rows) { Fees fee = new Fees(); fee.FeeId = int.Parse(dataRow["fee_id"].ToString()); fee.UnitId = dataRow["unit_id"].ToString(); fee.LoanId = int.Parse(dataRow["loan_id"].ToString()); fee.Type = dataRow["type"].ToString(); fee.Amount = Convert.ToDecimal(dataRow["amount"].ToString()); fee.Description = dataRow["description"].ToString(); fee.BillDueDate = Convert.ToDateTime(dataRow["bill_due_date"].ToString()); fee.FeeDueDate = Convert.ToDateTime(dataRow["due_date"].ToString()); if (type == "advanceFee") { string[] info = fee.Description.Split(','); if (info != null && info.Length > 0) { if (info[1] != "") { fee.IdentificationNumber = info[1]; } if (info.Length > 2 && info[2] != "") { fee.Year = Convert.ToInt32(info[2]); } if (info.Length > 3 && info[3] != "") { fee.Make = info[3]; } if (info.Length > 4 && info[4] != "") { fee.Model = info[4]; } if (info.Length > 5 && info[5] != "") { fee.AdvanceDate = Convert.ToDateTime(info[5]); } else { fee.AdvanceDate = Convert.ToDateTime(dataRow["due_date"].ToString()); } } } lstFee.Add(fee); } return(lstFee); } else { return(null); } } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> BuildSingle([Required, FromBody] BuildSingleTransactionRequest request) { if (request == null || request.OperationId.Equals(Guid.Empty)) { return(BadRequest(ErrorResponse.Create("Invalid parameter").AddModelError(nameof(request.OperationId), "Must be valid guid"))); } string xdrBase64; var broadcast = await _transactionService.GetTxBroadcastAsync(request.OperationId); if (broadcast != null) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } var build = await _transactionService.GetTxBuildAsync(request.OperationId); if (build != null) { xdrBase64 = build.XdrBase64; } else { string memo = null; if (!_balanceService.IsAddressValid(request.FromAddress, out var fromAddressHasExtension)) { return(BadRequest(ErrorResponse.Create($"{nameof(request.FromAddress)} is not a valid"))); } if (!_balanceService.IsAddressValid(request.ToAddress, out var toAddressHasExtension)) { return(BadRequest(ErrorResponse.Create($"{nameof(request.ToAddress)} is not a valid"))); } if (fromAddressHasExtension) { if (!_balanceService.IsDepositBaseAddress(request.FromAddress)) { return(BadRequest(ErrorResponse.Create($"{nameof(request.FromAddress)} is not a valid. Public address extension allowed for deposit base address only!"))); } if (!_balanceService.IsDepositBaseAddress(request.ToAddress) || toAddressHasExtension) { return(BadRequest(ErrorResponse.Create($"{nameof(request.ToAddress)} is not a valid. Only deposit base address allowed as destination, when sending from address with public address extension!"))); } memo = _balanceService.GetPublicAddressExtension(request.FromAddress); } var toBaseAddress = _balanceService.GetBaseAddress(request.ToAddress); if (toAddressHasExtension) { memo = _balanceService.GetPublicAddressExtension(request.ToAddress); } if (request.AssetId != _blockchainAssetsService.GetNativeAsset().Id) { return(BadRequest(ErrorResponse.Create($"{nameof(request.AssetId)} was not found"))); } long amount; try { amount = long.Parse(request.Amount); } catch (FormatException) { // too small (e.g. 0.1) return(BadRequest(StellarErrorResponse.Create($"Amount is too small. min=1, amount={request.Amount}", BlockchainErrorCode.AmountIsTooSmall))); } var fees = new Fees(); if (!fromAddressHasExtension) { fees = await _transactionService.GetFeesAsync(); } var fromAddressBalance = await _balanceService.GetAddressBalanceAsync(request.FromAddress, fees); long requiredBalance; if (request.IncludeFee) { requiredBalance = amount; amount -= fees.BaseFee; } else { requiredBalance = amount + fees.BaseFee; } var availableBalance = fromAddressBalance.Balance; if (requiredBalance > availableBalance) { return(BadRequest(StellarErrorResponse.Create($"Not enough balance to create transaction. required={requiredBalance}, available={availableBalance}", BlockchainErrorCode.NotEnoughBalance))); } xdrBase64 = await _transactionService.BuildTransactionAsync(request.OperationId, fromAddressBalance, toBaseAddress, memo, amount); } return(Ok(new BuildTransactionResponse { TransactionContext = xdrBase64 })); }
/// <summary> /// Returns true if BankingAccountDetail instances are equal /// </summary> /// <param name="other">Instance of BankingAccountDetail to be compared</param> /// <returns>Boolean</returns> public bool Equals(BankingAccountDetail other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Bsb == other.Bsb || Bsb != null && Bsb.Equals(other.Bsb) ) && ( AccountNumber == other.AccountNumber || AccountNumber != null && AccountNumber.Equals(other.AccountNumber) ) && ( BundleName == other.BundleName || BundleName != null && BundleName.Equals(other.BundleName) ) && ( SpecificAccountUType == other.SpecificAccountUType || SpecificAccountUType != null && SpecificAccountUType.Equals(other.SpecificAccountUType) ) && ( TermDeposit == other.TermDeposit || TermDeposit != null && TermDeposit.Equals(other.TermDeposit) ) && ( CreditCard == other.CreditCard || CreditCard != null && CreditCard.Equals(other.CreditCard) ) && ( Loan == other.Loan || Loan != null && Loan.Equals(other.Loan) ) && ( Features == other.Features || Features != null && Features.SequenceEqual(other.Features) ) && ( Fees == other.Fees || Fees != null && Fees.SequenceEqual(other.Fees) ) && ( DepositRates == other.DepositRates || DepositRates != null && DepositRates.SequenceEqual(other.DepositRates) ) && ( LendingRates == other.LendingRates || LendingRates != null && LendingRates.SequenceEqual(other.LendingRates) ) && ( Address == other.Address || Address != null && Address.Equals(other.Address) )); }
public void PopulateDropdown(string eventCode = null, int olympiadId = -1) { Events.Clear(); var context = DataEntitiesProvider.Provide(); Olympiad_Info currentOlympiad; if (olympiadId < 1) { currentOlympiad = context.Olympiad_Infoes.OrderByDescending(x => x.StartDate).First(); } else { currentOlympiad = context.Olympiad_Infoes.First(x => x.Id == olympiadId); } CurrentOlympiadId = currentOlympiad.Id; foreach (var e in currentOlympiad.Events.Where(x => !x.Code.StartsWith("ZZ")) .OrderBy(x => x.Code)) { Events.Add(new EventVm { Text = e.Code + " " + e.Mind_Sport, Value = e.Code }); } if (eventCode == null) { EventCode = (Events.Any()) ? Events.First().Value : null; } else { EventCode = eventCode; } Types.Clear(); Types.Add(new TypeVm() { Value = null, Text = "(normal)" }); Types.Add(new TypeVm() { Value = "Beginners'", Text = "Beginners'" }); Fees.Clear(); Fees.Add(new EntryFeeVm() { Value = null, Text = "(none)" }); foreach (var f in context.Fees.OrderBy(x => x.Code)) { Fees.Add(new EntryFeeVm() { Value = f.Code, Text = f.DropdownText }); } Locations.Clear(); Locations.Add(new LocationVm() { Value = null, Text = "(no location)" }); foreach (var l in currentOlympiad.Locations.OrderBy(x => x.Location1)) { Locations.Add(new LocationVm() { Value = l.Location1, Text = l.Location1 }); } Olympiads.Clear(); foreach (var o in context.Olympiad_Infoes.OrderByDescending(x => x.StartDate)) { Olympiads.Add(new OlympiadVm { Text = o.FullTitle(), Id = o.Id }); } }
public static void RefreshCache() { Fees.FillCache(); }
public static Switch.Data.Models.Schemes ConvertToEntityModel(this schemeViewModel oView, Channels channel, Fees Fees, Routes Routes, TransactionType TransType) { var Schemes = new Switch.Data.Models.Schemes(); Schemes.Channel = channel; Schemes.Description = oView.Description; Schemes.Fees = Fees; Schemes.Id = oView.Id; Schemes.Name = oView.Name; Schemes.Route = Routes; Schemes.TransType = TransType; Schemes.IsDeleted = oView.IsDeleted; return(Schemes); }
public decimal GetLayawayFees() { return(Fees.Where(fee => fee.FeeType == FeeTypes.SERVICE || fee.FeeType == FeeTypes.INTEREST).Sum(fee => fee.OriginalAmount)); }
public void GetFeesResultTest(Fees fees) { Assert.IsNotNull(fees); }
public bool InsertFeesDetails(Fees fees) { using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["AutoDealersConnection"].ToString())) { try { using (SqlCommand command = new SqlCommand("spInsertFeesDetails", con)) { command.CommandType = CommandType.StoredProcedure; if (fees.AdvanceId == "1") { command.Parameters.Add("@advance_id", SqlDbType.Bit).Value = true; } else { command.Parameters.Add("@advance_id", SqlDbType.Bit).Value = false; } command.Parameters.Add("@advance_fee_amount", SqlDbType.Decimal).Value = fees.AdvanceAmount; command.Parameters.Add("@advance_fee_calculate_type", SqlDbType.NVarChar).Value = fees.AdvanceFeeCalculateType; command.Parameters.Add("@advance_receipt", SqlDbType.Bit).Value = fees.AdvanceNeedReceipt; command.Parameters.Add("@advance_payment_due_method", SqlDbType.NVarChar).Value = fees.AdvanceDue; command.Parameters.Add("@advance_payment_due_date", SqlDbType.NVarChar).Value = fees.AdvanceDueDate; command.Parameters.Add("@advance_auto_remind_dealer_email", SqlDbType.NVarChar).Value = fees.AdvanceFeeDealerEmail; command.Parameters.Add("@advance_delaer_remind_period", SqlDbType.NVarChar).Value = fees.AdvanceFeeDealerEmailRemindPeriod; command.Parameters.Add("@advance_due_auto_remind_email", SqlDbType.NVarChar).Value = fees.AdvanceDueEmail; command.Parameters.Add("@advance_due_auto_remind_period", SqlDbType.NVarChar).Value = fees.AdvanceDueEmailRemindPeriod; if (fees.MonthlyLoanId == "1") { command.Parameters.Add("@monthly_loan_id", SqlDbType.Bit).Value = true; } else { command.Parameters.Add("@monthly_loan_id", SqlDbType.Bit).Value = false; } command.Parameters.Add("@monthly_loan_fee_amount", SqlDbType.Decimal).Value = fees.MonthlyLoanAmount; command.Parameters.Add("@monthly_loan_receipt", SqlDbType.Bit).Value = fees.MonthlyLoanNeedReceipt; command.Parameters.Add("@monthly_loan_payment_due_method", SqlDbType.NVarChar).Value = fees.MonthlyLoanDue; command.Parameters.Add("@monthly_loan_payment_due_date", SqlDbType.NVarChar).Value = fees.MonthlyLoanDueDate; command.Parameters.Add("@monthly_loan_auto_remind_dealer_email", SqlDbType.NVarChar).Value = fees.MonthlyLoanFeeDealerEmail; command.Parameters.Add("@monthly_loan_delaer_remind_period", SqlDbType.NVarChar).Value = fees.MonthlyLoanFeeDealerEmailRemindPeriod; command.Parameters.Add("@monthly_loan_due_auto_remind_email", SqlDbType.NVarChar).Value = fees.MonthlyLoanDueEmail; command.Parameters.Add("@monthly_loan_due_auto_remind_period", SqlDbType.NVarChar).Value = fees.MonthlyLoanDueEmailRemindPeriod; if (fees.LotInspectionId == "1") { command.Parameters.Add("@lot_inspection_id", SqlDbType.Bit).Value = true; } else { command.Parameters.Add("@lot_inspection_id", SqlDbType.Bit).Value = false; } command.Parameters.Add("@lot_inspection_amount", SqlDbType.Decimal).Value = fees.LotInspectionAmount; command.Parameters.Add("@lot_inspection_receipt", SqlDbType.Bit).Value = fees.LotInspectionNeedReceipt; command.Parameters.Add("@lot_payment_due_method", SqlDbType.NVarChar).Value = fees.LotInspectionDue; command.Parameters.Add("@lot_payment_due_date", SqlDbType.NVarChar).Value = fees.LotInspectionDueDate; command.Parameters.Add("@lot_inspection_auto_remind_dealer_email", SqlDbType.NVarChar).Value = fees.LotInspectionFeeDealerEmail; command.Parameters.Add("@lot_inspection_delaer_remind_period", SqlDbType.NVarChar).Value = fees.LotInspectionFeeDealerEmailRemindPeriod; command.Parameters.Add("@lot_inspection_due_auto_remind_email", SqlDbType.NVarChar).Value = fees.LotInspectionDueEmail; command.Parameters.Add("@lot_inspection_due_auto_remind_period", SqlDbType.NVarChar).Value = fees.LotInspectionDueEmailRemindPeriod; command.Parameters.Add("@loan_id", SqlDbType.Int).Value = fees.LoanId; SqlParameter returnParameter = command.Parameters.Add("@ReturnValue", SqlDbType.Bit); returnParameter.Direction = ParameterDirection.ReturnValue; con.Open(); command.ExecuteNonQuery(); if ((int)returnParameter.Value == 1) { return(true); } else { return(false); } } } catch (Exception ex) { throw ex; } } }
private async Task <bool> Validation() { if (string.IsNullOrEmpty(ReceiptNo)) { await base.View.DisplayAlert("Missing Detail", "Enter receipt number.", "Ok"); return(false); } string _collgeName = string.Empty; if (IsNonIUCollege) { if (string.IsNullOrEmpty(SelectedCollege)) { await base.View.DisplayAlert("Missing Detail", "Please select proper college.", "Ok"); return(false); } if (IsOtherCollege) { if (string.IsNullOrEmpty(OtherCollege)) { await base.View.DisplayAlert("Missing Detail", "Please enter proper college name.", "Ok"); return(false); } else { _collgeName = OtherCollege; } } else { _collgeName = SelectedCollege; } } else { _collgeName = "INDUS UNIVERSITY"; } if (string.IsNullOrEmpty(PrimaryContactNumber)) { await base.View.DisplayAlert("Missing Detail", "Please enter primary contact detail.", "Ok"); return(false); } string _primaryNumber = string.Empty; if (PrimaryContactNumber.Length < 10) { await base.View.DisplayAlert("Missing Detail", "Invalid primary contact.", "Ok"); return(false); } else { _primaryNumber = PrimaryContactNumber; } string _secondaryNumber = string.Empty; if (!string.IsNullOrEmpty(SecondaryContactNumber) && SecondaryContactNumber.Length < 10) { await base.View.DisplayAlert("Missing Detail", "Invalid secondary contact.", "Ok"); return(false); } else { _secondaryNumber = SecondaryContactNumber; } if (string.IsNullOrEmpty(EmailAddress)) { await base.View.DisplayAlert("Missing Detail", "Please enter e-mail detail.", "Ok"); return(false); } bool isEmail = Regex.IsMatch(EmailAddress, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase); string _email = string.Empty; if (!isEmail) { await base.View.DisplayAlert("Missing Detail", "Please enter valid e-mail detail.", "Ok"); return(false); } else { _email = EmailAddress; } string _category = string.Empty; string _subcategory = string.Empty; string _event = string.Empty; if (SelectedEvent == null) { await base.View.DisplayAlert("Missing Detail", "Select event to participate.", "Ok"); return(false); } else { _category = SelectedCategory.Name; _subcategory = SelectedSubGategory.Name; _event = SelectedEvent.Name; } if (NumberOfParticipants == 0) { await base.View.DisplayAlert("Missing Detail", "Enter member strength of group.", "Ok"); return(false); } string _participantName = string.Empty; if (string.IsNullOrEmpty(ParticipantName)) { await base.View.DisplayAlert("Missing Detail", "Enter participant's or group's name.", "Ok"); return(false); } else { _participantName = ParticipantName; } if (SelectedEvent != null && !string.IsNullOrEmpty(SelectedEvent.Name) && SelectedEvent.Name.ToString().ToUpper().Contains("PUBG")) { if (string.IsNullOrEmpty(PUBGID)) { await base.View.DisplayAlert("Missing Detail", "Enter PubG ID.", "Ok"); return(false); } } else { PUBGID = string.Empty; } StringBuilder sb = new StringBuilder(); sb.Append("Receipt Number: " + ReceiptNo); sb.Append("\n"); sb.Append("\n"); sb.Append("College Details "); sb.Append("\n"); sb.Append("Name: " + _collgeName); sb.Append("\n"); sb.Append("\n"); sb.Append("Contact Details "); sb.Append("\n"); sb.Append("Primary Number: " + PrimaryContactNumber); sb.Append("\n"); sb.Append("Secondary Number: " + SecondaryContactNumber); sb.Append("\n"); sb.Append("Email: " + EmailAddress); sb.Append("\n"); sb.Append("\n"); sb.Append("Event Detail "); sb.Append("\n"); sb.Append("Category: " + SelectedCategory.Name); sb.Append("\n"); sb.Append("Sub Catagory: " + SelectedSubGategory.Name); sb.Append("\n"); sb.Append("Event: " + SelectedEvent.Name); sb.Append("\n"); sb.Append("\n"); sb.Append("Participate's or group's name: "); sb.Append("\n"); sb.Append(ParticipantName); sb.Append("\n"); if (!string.IsNullOrEmpty(PUBGID)) { sb.Append("\n"); sb.Append("PUBG ID: " + PUBGID.ToString()); sb.Append("\n"); } sb.Append("\n"); sb.Append("Fees Charged: " + Fees.ToString()); sb.Append("\n"); if (await base.View.DisplayAlert("Confirm Registration", sb.ToString(), "Save", "Cancel")) { return(true); } else { return(false); } }
/// <summary>Creates the request number of fee schedules, clinics and providers, and creates fees for each combination and code num. /// Always includes the the standard fees for HQ (ClinicNum=0) and will always create an empty fee schedule.</summary> protected FeeTestArgs CreateManyFees(int numFeeScheds, int numClinics, int numProvs, string suffix) { FeeTestArgs retVal = new FeeTestArgs(); //Set up fee schedules for (int i = 0; i < numFeeScheds; i++) { retVal.ListFeeSchedNums.Add(FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix, false)); } //Set up clinics Prefs.UpdateBool(PrefName.EasyNoClinics, false); for (int i = 0; i < numClinics; i++) { retVal.ListClinics.Add(ClinicT.CreateClinic(suffix + i)); } //Set up providers for (int i = 0; i < numProvs; i++) { retVal.ListProvNums.Add(ProviderT.CreateProvider(suffix)); } //Create the fees List <Fee> listFees = new List <Fee>(); foreach (long codeNum in _listProcCodes.Select(x => x.CodeNum)) { foreach (long feeSchedNum in retVal.ListFeeSchedNums) { foreach (Clinic clinic in retVal.ListClinics) { foreach (long provNum in retVal.ListProvNums) { listFees.Add(new Fee() { FeeSched = feeSchedNum, ClinicNum = clinic.ClinicNum, ProvNum = provNum, CodeNum = codeNum, Amount = _defaultFeeAmt * _rand.NextDouble() }); } } } } Fees.InsertMany(listFees); if (retVal.ListFeeSchedNums.Count > 0 && retVal.ListClinics.Count > 0) { retVal.ListFees = Fees.GetByFeeSchedNumsClinicNums(retVal.ListFeeSchedNums, retVal.ListClinics.Select(x => x.ClinicNum).ToList()) .Select(x => (Fee)x).ToList(); } //Always include the standard fee schedule for HQ. retVal.ListFees = retVal.ListFees.Union(Fees.GetByFeeSchedNumsClinicNums( new List <long>() { _standardFeeSchedNum }, new List <long>() { 0 }) .Select(x => (Fee)x)).ToList(); //create an empty feeschedule for the Insert/Update/Delete tests retVal.EmptyFeeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, "Empty" + suffix, false); return(retVal); }