///<summary>Inserts one Fee into the database. Provides option to use the existing priKey.</summary> internal static long Insert(Fee fee,bool useExistingPK) { if(!useExistingPK && PrefC.RandomKeys) { fee.FeeNum=ReplicationServers.GetKey("fee","FeeNum"); } string command="INSERT INTO fee ("; if(useExistingPK || PrefC.RandomKeys) { command+="FeeNum,"; } command+="Amount,OldCode,FeeSched,UseDefaultFee,UseDefaultCov,CodeNum) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(fee.FeeNum)+","; } command+= "'"+POut.Double(fee.Amount)+"'," +"'"+POut.String(fee.OldCode)+"'," + POut.Long (fee.FeeSched)+"," + POut.Bool (fee.UseDefaultFee)+"," + POut.Bool (fee.UseDefaultCov)+"," + POut.Long (fee.CodeNum)+")"; if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { fee.FeeNum=Db.NonQ(command,true); } return fee.FeeNum; }
///<summary>Inserts one Fee into the database. Returns the new priKey.</summary> internal static long Insert(Fee fee) { if(DataConnection.DBtype==DatabaseType.Oracle) { fee.FeeNum=DbHelper.GetNextOracleKey("fee","FeeNum"); int loopcount=0; while(loopcount<100){ try { return Insert(fee,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ fee.FeeNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(fee,false); } }
public int Create(Fee entity) { Dictionary<String, string> _parameter = new Dictionary<string, string>(); _parameter.Add("Students_Id", entity.Students_Id.ToString()); _parameter.Add("Courses_Id", entity.Courses_Id.ToString()); _parameter.Add("Month", entity.Month); _parameter.Add("Year", entity.Year); _parameter.Add("Amount", entity.Amount.ToString()); return _database.Create("sp_CreateFee", _parameter); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<Fee> TableToList(DataTable table){ List<Fee> retVal=new List<Fee>(); Fee fee; for(int i=0;i<table.Rows.Count;i++) { fee=new Fee(); fee.FeeNum = PIn.Long (table.Rows[i]["FeeNum"].ToString()); fee.Amount = PIn.Double(table.Rows[i]["Amount"].ToString()); fee.OldCode = PIn.String(table.Rows[i]["OldCode"].ToString()); fee.FeeSched = PIn.Long (table.Rows[i]["FeeSched"].ToString()); fee.UseDefaultFee= PIn.Bool (table.Rows[i]["UseDefaultFee"].ToString()); fee.UseDefaultCov= PIn.Bool (table.Rows[i]["UseDefaultCov"].ToString()); fee.CodeNum = PIn.Long (table.Rows[i]["CodeNum"].ToString()); retVal.Add(fee); } return retVal; }
/// <summary> /// Generates the bytes. /// </summary> /// <returns>The transaction bytes.</returns> internal override byte[] GenerateBytes() { var builder = new FlatBufferBuilder(1); // create vectors var signatureVector = TransferTransactionBuffer.CreateSignatureVector(builder, new byte[64]); var signerVector = TransferTransactionBuffer.CreateSignerVector(builder, GetSigner()); var feeVector = TransferTransactionBuffer.CreateFeeVector(builder, Fee.ToUInt8Array()); var deadlineVector = TransferTransactionBuffer.CreateDeadlineVector(builder, Deadline.Ticks.ToUInt8Array()); var recipientVector = TransferTransactionBuffer.CreateRecipientVector(builder, Address.Plain.FromBase32String()); ushort version = ushort.Parse(NetworkType.GetNetworkByte().ToString("X") + "0" + Version.ToString("X"), System.Globalization.NumberStyles.HexNumber); if (Message == null) { Message = EmptyMessage.Create(); } // create message vector var bytePayload = Message.GetPayload(); var payload = MessageBuffer.CreatePayloadVector(builder, bytePayload); MessageBuffer.StartMessageBuffer(builder); if (bytePayload != null) { MessageBuffer.AddType(builder, Message.GetMessageType()); } MessageBuffer.AddPayload(builder, payload); var message = MessageBuffer.EndMessageBuffer(builder); // create mosaics vector var mosaics = new Offset <MosaicBuffer> [Mosaics.Count]; for (var index = 0; index < Mosaics.Count; index++) { var mosaic = Mosaics[index]; var idPayload = MosaicBuffer.CreateIdVector(builder, mosaic.MosaicId.Id.ToUInt8Array()); var amountVector = MosaicBuffer.CreateAmountVector(builder, mosaic.Amount.ToUInt8Array()); MosaicBuffer.StartMosaicBuffer(builder); MosaicBuffer.AddId(builder, idPayload); MosaicBuffer.AddAmount(builder, amountVector); mosaics[index] = MosaicBuffer.EndMosaicBuffer(builder); } var mosaicsVector = TransferTransactionBuffer.CreateMosaicsVector(builder, mosaics); // add vectors TransferTransactionBuffer.StartTransferTransactionBuffer(builder); TransferTransactionBuffer.AddSize(builder, (uint)(/*fixed size*/ 148 + 16 * Mosaics.Count + Message.GetLength())); TransferTransactionBuffer.AddSignature(builder, signatureVector); TransferTransactionBuffer.AddSigner(builder, signerVector); TransferTransactionBuffer.AddVersion(builder, version); TransferTransactionBuffer.AddType(builder, TransactionTypes.Types.Transfer.GetValue()); TransferTransactionBuffer.AddFee(builder, feeVector); TransferTransactionBuffer.AddDeadline(builder, deadlineVector); TransferTransactionBuffer.AddRecipient(builder, recipientVector); TransferTransactionBuffer.AddNumMosaics(builder, (byte)Mosaics.Count); TransferTransactionBuffer.AddMessageSize(builder, (byte)Message.GetLength()); TransferTransactionBuffer.AddMessage(builder, message); TransferTransactionBuffer.AddMosaics(builder, mosaicsVector); // end build var codedTransfer = TransferTransactionBuffer.EndTransferTransactionBuffer(builder); builder.Finish(codedTransfer.Value); return(new TransferTransactionSchema().Serialize(builder.SizedByteArray())); }
public ActionResult Add(Fee model) { Repo.Save(model); return(View()); }
/// <summary> /// Returns true if UserTrade instances are equal /// </summary> /// <param name="other">Instance of UserTrade to be compared</param> /// <returns>Boolean</returns> public bool Equals(UserTrade other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Direction == other.Direction || Direction.Equals(other.Direction) ) && ( FeeCurrency == other.FeeCurrency || FeeCurrency.Equals(other.FeeCurrency) ) && ( OrderId == other.OrderId || OrderId != null && OrderId.Equals(other.OrderId) ) && ( Timestamp == other.Timestamp || Timestamp != null && Timestamp.Equals(other.Timestamp) ) && ( Price == other.Price || Price != null && Price.Equals(other.Price) ) && ( Iv == other.Iv || Iv != null && Iv.Equals(other.Iv) ) && ( TradeId == other.TradeId || TradeId != null && TradeId.Equals(other.TradeId) ) && ( Fee == other.Fee || Fee != null && Fee.Equals(other.Fee) ) && ( OrderType == other.OrderType || OrderType.Equals(other.OrderType) ) && ( TradeSeq == other.TradeSeq || TradeSeq != null && TradeSeq.Equals(other.TradeSeq) ) && ( SelfTrade == other.SelfTrade || SelfTrade != null && SelfTrade.Equals(other.SelfTrade) ) && ( State == other.State || State.Equals(other.State) ) && ( Label == other.Label || Label != null && Label.Equals(other.Label) ) && ( IndexPrice == other.IndexPrice || IndexPrice != null && IndexPrice.Equals(other.IndexPrice) ) && ( Amount == other.Amount || Amount != null && Amount.Equals(other.Amount) ) && ( InstrumentName == other.InstrumentName || InstrumentName != null && InstrumentName.Equals(other.InstrumentName) ) && ( TickDirection == other.TickDirection || TickDirection.Equals(other.TickDirection) ) && ( MatchingId == other.MatchingId || MatchingId != null && MatchingId.Equals(other.MatchingId) ) && ( Liquidity == other.Liquidity || Liquidity.Equals(other.Liquidity) )); }
public async Task CanGetFees() { Fee fee = await client.Fees(); Assert.IsNotNull(fee); }
private Dictionary<String, String> Mapper(Fee entity) { Dictionary<String, String> _parameters = new Dictionary<string, string>(); PropertyInfo[] properties = typeof(Fee).GetProperties(); foreach (PropertyInfo property in properties) { _parameters.Add(property.Name, Convert.ToString(property.GetValue(entity))); } return _parameters; }
bool IsFeeSame(Fee f1, Fee f2) { return f1.FeeType == f2.FeeType && f1.PayReceive == f2.PayReceive && Math.Abs(f1.Amount - f2.Amount) < Utilities.Epsilon; }
///<summary>Updates one Fee in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> public static void Update(Fee fee,Fee oldFee){ string command=""; if(fee.Amount != oldFee.Amount) { if(command!=""){ command+=",";} command+="Amount = '"+POut.Double(fee.Amount)+"'"; } if(fee.OldCode != oldFee.OldCode) { if(command!=""){ command+=",";} command+="OldCode = '"+POut.String(fee.OldCode)+"'"; } if(fee.FeeSched != oldFee.FeeSched) { if(command!=""){ command+=",";} command+="FeeSched = "+POut.Long(fee.FeeSched)+""; } if(fee.UseDefaultFee != oldFee.UseDefaultFee) { if(command!=""){ command+=",";} command+="UseDefaultFee = "+POut.Bool(fee.UseDefaultFee)+""; } if(fee.UseDefaultCov != oldFee.UseDefaultCov) { if(command!=""){ command+=",";} command+="UseDefaultCov = "+POut.Bool(fee.UseDefaultCov)+""; } if(fee.CodeNum != oldFee.CodeNum) { if(command!=""){ command+=",";} command+="CodeNum = "+POut.Long(fee.CodeNum)+""; } if(command==""){ return; } command="UPDATE fee SET "+command +" WHERE FeeNum = "+POut.Long(fee.FeeNum); Db.NonQ(command); }
public override string ToString() { StringBuilder __sb = new StringBuilder("Transaction("); bool __first = true; if (__isset.id) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Id: "); __sb.Append(Id); } if (Source != null && __isset.source) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Source: "); __sb.Append(Source); } if (Target != null && __isset.target) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Target: "); __sb.Append(Target); } if (Amount != null && __isset.amount) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Amount: "); __sb.Append(Amount == null ? "<null>" : Amount.ToString()); } if (Balance != null && __isset.balance) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Balance: "); __sb.Append(Balance == null ? "<null>" : Balance.ToString()); } if (__isset.currency) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Currency: "); __sb.Append(Currency); } if (Signature != null && __isset.signature) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Signature: "); __sb.Append(Signature); } if (SmartContract != null && __isset.smartContract) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("SmartContract: "); __sb.Append(SmartContract == null ? "<null>" : SmartContract.ToString()); } if (Fee != null && __isset.fee) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Fee: "); __sb.Append(Fee == null ? "<null>" : Fee.ToString()); } if (__isset.timeCreation) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("TimeCreation: "); __sb.Append(TimeCreation); } if (UserFields != null && __isset.userFields) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("UserFields: "); __sb.Append(UserFields); } if (__isset.type) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Type: "); __sb.Append(Type); } if (SmartInfo != null && __isset.smartInfo) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("SmartInfo: "); __sb.Append(SmartInfo == null ? "<null>" : SmartInfo.ToString()); } if (ExtraFee != null && __isset.extraFee) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ExtraFee: "); __sb.Append(ExtraFee); } if (__isset.poolNumber) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("PoolNumber: "); __sb.Append(PoolNumber); } if (UsedContracts != null && __isset.usedContracts) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("UsedContracts: "); __sb.Append(UsedContracts); } __sb.Append(")"); return(__sb.ToString()); }
public void Foo(Fee arg) {}
///<summary>Updates one Fee in the database.</summary> public static void Update(Fee fee){ string command="UPDATE fee SET " +"Amount = '"+POut.Double(fee.Amount)+"', " +"OldCode = '"+POut.String(fee.OldCode)+"', " +"FeeSched = "+POut.Long (fee.FeeSched)+", " +"UseDefaultFee= "+POut.Bool (fee.UseDefaultFee)+", " +"UseDefaultCov= "+POut.Bool (fee.UseDefaultCov)+", " +"CodeNum = "+POut.Long (fee.CodeNum)+" " +"WHERE FeeNum = "+POut.Long(fee.FeeNum); Db.NonQ(command); }
// ReSharper disable UnusedParameter.Local public SingleArgCtor(Fee arg) // ReSharper restore UnusedParameter.Local {}
public void Foo() { var f = new Fee(); }
private void gvFees_SelectionChanged(object sender, EventArgs e) { int selectedIndex = gvFees.CurrentRow.Index; if (selectedIndex >= 0) { string bID = gvFees.Rows[selectedIndex].Cells["FeeID"].Value.ToString(); List<Fee> fee = new List<Fee>(); fee = feeList.FindAll(x => x.FeeID.ToString() == bID); feeSelected = new Fee(); feeSelected = (Fee)fee[0]; } }
public void InsertFee(Fee Fee) { context.Fees.Add(Fee); }
public Iso8583Message ProcessMessage(Iso8583Message message, SourceNode sourceNode) { var field41 = message.Fields[41].Value.ToString(); var terminalID = field41.Substring(1, field41.Length - 1); string cardBIN = message.Fields[2].Value.ToString().Substring(0, 6); Console.WriteLine("Processing ..."); if (!terminalID.Equals(IsoMessageFieldDefinitions.TERMINAL_ID.ToString())) { Console.WriteLine("THIS IS A NOT-ON-US TRANSACTION"); } else { if (cardBIN.Equals(IsoMessageFieldDefinitions.INSTITUTION_BIN.ToString())) { Console.WriteLine("THIS IS AN ON-US TRANSACTION"); } else { Console.WriteLine("THIS IS A REMOTE-ON-US TRANSACTION"); } } if (message.MessageTypeIdentifier != 420) { message = AddOriginalDataElement(message); } // SourceNode sourceNode = new EntityLogic<SourceNode>().GetByID(sourceID); bool returnMsg; message = CheckMessageType(message, sourceNode, out returnMsg); if (returnMsg == true) { return(message); } Iso8583Message responseMessage; string expiryDate = message.Fields[14].Value.ToString(); DateTime cardExpiry = ParseDate(expiryDate); if (cardExpiry < DateTime.Now) { //expired card responseMessage = SetResponseMessage(message, "54"); new TransactionLogProcessing().LogTransaction(responseMessage); return(responseMessage); } Console.WriteLine("Getting TrxCode ..."); string transactionTypeCode = message.Fields[3].Value.ToString().Substring(0, 2); Console.WriteLine("Getting Amount ..."); double amount = ConvertIsoAmountToDouble(message.Fields[4].Value.ToString()); if (transactionTypeCode != "31" && amount <= 0) { responseMessage = SetResponseMessage(message, "13"); new TransactionLogProcessing().LogTransaction(responseMessage); return(responseMessage); } // GETTING ROUTE Console.WriteLine("Getting BIN ..."); // string cardBIN = message.Fields[2].Value.ToString().Substring(0, 6); Console.WriteLine("Getting Route ..."); Route route = new RouteLogic().GetRouteByBIN(cardBIN); if (route == null) { responseMessage = SetResponseMessage(message, "15"); new TransactionLogProcessing().LogTransaction(responseMessage); return(responseMessage); } if (route.SinkNode == null || route.SinkNode.Status == "In-active") { Console.WriteLine("Sink Node is null"); responseMessage = SetResponseMessage(message, "91"); new TransactionLogProcessing().LogTransaction(responseMessage); return(responseMessage); } //GETTING SCHEME Scheme scheme; try { Console.WriteLine("Getting Scheme ..."); scheme = SwitchData.GetSchemeByRoute(route, transactionTypeCode); } catch (Exception e) { responseMessage = SetResponseMessage(message, "06"); new TransactionLogProcessing().LogTransaction(responseMessage); return(responseMessage); } if (scheme == null) { responseMessage = SetResponseMessage(message, "58"); new TransactionLogProcessing().LogTransaction(responseMessage); //new TransactionLogLogic().LogMessage(responseMessage); return(responseMessage); } Console.WriteLine("Getting TrxType ..."); TransactionType transactionType = new TransactionTypeLogic().GetTransactionTypebyCode(transactionTypeCode); Console.WriteLine("Getting Channel ..."); string channelCode = message.Fields[41].Value.ToString().Substring(0, 1); Channel channel = new ChannelLogic().GetChannelByCode(channelCode); Fee fee = GetFee(transactionType, channel, scheme); if (fee == null) { responseMessage = SetResponseMessage(message, "58"); new TransactionLogProcessing().LogTransaction(responseMessage); return(responseMessage); } double?fees = CalculateFee(fee, amount); message = SetFee(message, fees); //BY NOW ALL CHECKS HAVE BEEN DONE , TIME TO SEND TO SINK NODE bool needReversal = false; Console.WriteLine("Routing To Destination ..."); responseMessage = RouteToDestination(message, route.SinkNode, out needReversal); return(responseMessage); }
public IList<Trade> Import(Market market, Feed feed, StringBuilder sb, FilterData filterData) { var infos = filterData.Data ?? TradeImportHelper.ReadData(FilterInfo, filterData, sb); var trades = new List<Trade>(); var dict = new Dictionary<TradeInfo, Trade>(); if (filterData.Progress != null) filterData.Progress.AnalysisInit(infos.Count, "Building Products"); int count = 0; foreach (var info in infos) { if (filterData.Progress != null && filterData.Progress.IsCanceled) return new List<Trade>(); count++; if (filterData.Progress != null) filterData.Progress.AnalysisProgress(count, ""); if (FilterInfo(info)) continue; if(filterData.Currencies !=null && filterData.Currencies.Count > 0 && !filterData.Currencies.Contains(info.Currency1)) continue; if (info.Otc == null || !(info.Otc is SwapInfo) || info.Otc.IsEmpty()) { sb.Append(TradeImportHelper.FormatErrorMessage("Swap info not found or not complete", info.HoldingID, info.TradeID, info.Instrument)); continue; } var prodCurrency = Env.Current.StaticData.GetCurrency(info.Currency1); string prodtype, aliasSource; if (info.SecurityType.Equals(SwapInfo.IRSwap)) { prodtype = prodCurrency.IsNonDeliverable ? "NDS" : "Swap"; aliasSource = SwapInfo.AliasSourceIrs; } else if (info.SecurityType.Equals(SwapInfo.CcySwap)) { prodtype = info.Instrument.Contains("MTM") ? "MTMCurrencySwap" : "CurrencySwap"; aliasSource = SwapInfo.AliasSourceCcy; } else { prodtype = "FRA"; aliasSource = SwapInfo.AliasSourceFra; } var alias = Env.Current.StaticData.GetAlias(new Alias { AliasType = "Template", EntityId = 0, Source = aliasSource, SourceReference = info.Instrument }); if (alias != null) { var swapInfo = info.Otc as SwapInfo; var template = Env.Current.StaticData.GetTemplate(Template.Shared, prodtype, alias.Name); if (template == null && prodtype == "Swap") { // some swap is booked as NDS prodtype = "NDS"; template = Env.Current.StaticData.GetTemplate(Template.Shared, prodtype, alias.Name); prodtype = "Swap/NDS"; } swapInfo.Generator = template; if (swapInfo.Generator == null) { sb.Append(TradeImportHelper.FormatErrorMessage("Generator template for " + prodtype + " " + alias.Name + " not found", info.HoldingID, info.TradeID, info.Instrument)); continue; } } else { sb.Append(TradeImportHelper.FormatErrorMessage("Alias for Generator not found", info.HoldingID, info.TradeID, info.Instrument)); continue; } if (filterData.Progress != null) filterData.Progress.AnalysisProgress(count, ""); var trade = new Trade(); if (FilterInfo(info)) continue; if (!TradeImportHelper.InitTrade(trade, info, filterData, sb)) continue; dict[info] = trade; } if (filterData.Progress != null) filterData.Progress.AnalysisDone(); if (filterData.Progress != null) filterData.Progress.AnalysisInit(infos.Count, "Building Products"); count = 0; foreach (var kvp in dict) { if (filterData.Progress != null && filterData.Progress.IsCanceled) return new List<Trade>(); count++; if (filterData.Progress != null && count%5==0) filterData.Progress.AnalysisProgress(count, ""); var info = kvp.Key; var trade = kvp.Value; var sinfo= info.Otc as SwapInfo; try { var copy = trade.Id > 0 ? (Trade)trade.Clone() : null; var tradeType = trade.TradeType; sinfo.Generator.Apply(trade, new SimpleDate(sinfo.TradeDate), market); trade.TradeType = tradeType; if (trade.Product == null) { sb.Append(TradeImportHelper.FormatErrorMessage("No product generated after applying Generator", info.HoldingID, info.TradeID, info.Instrument)); continue; } if (trade.Product == null) continue; if (copy != null) { TradeImportHelper.CopyTrade(copy, trade); trade.MirrorBookId = copy.MirrorBookId; trade.MirrorTradeId = copy.MirrorTradeId; } //if (sinfo.ClearingHouse != null) // info.ClearingHouse = sinfo.ClearingHouse; trade.SettlementDate = sinfo.SwapStartDate1; TradeImportHelper.SetParties(trade, info); if (info.SecurityType.Equals(SwapInfo.IRSwap)) { var swap = trade.Product as Swap; var payLeg = swap.PayLeg; var recLeg = swap.ReceiveLeg; Leg leg1 = payLeg, leg2 = recLeg; if (!payLeg.IsFixedRate && !recLeg.IsFixedRate) { // basis swap var r1 = payLeg.RateIndex; // leg1 index var r2 = recLeg.RateIndex; // leg2 index if (r1.Equals(r2)) { r1 = payLeg.RateIndexTenor.Count.ToString(); r2 = recLeg.RateIndexTenor.Count.ToString(); } var idx1 = sinfo.Generator.Name.IndexOf(r1); var idx2 = sinfo.Generator.Name.IndexOf(r2); if ((idx1 < idx2 && info.TradeAction.Equals("B")) || (idx1 > idx2 && (info.TradeAction.Equals("S")))) { swap.SwitchLegs(); } if (idx2 < idx1) { leg1 = recLeg; leg2 = payLeg; } InitLegs2(leg1, leg2, info); } else { if ((info.TradeAction.Equals("S") && !swap.PayLeg.IsFixedRate) || (info.TradeAction.Equals("B") && swap.PayLeg.IsFixedRate)) swap.SwitchLegs(); InitLegs(swap.PayLeg, swap.ReceiveLeg, info); } if (trade.CcpId != 0) { //Nothing to do let the EventScheduleHelper insert the StepIn } else { if (swap.PayLeg.StartDate < trade.GetTradingDay()) { swap.PayLeg.FirstFullCalculationPeriod = true; swap.PayLeg.FirstCalculationPeriodStart = sinfo.SwapStartDate1; swap.ReceiveLeg.FirstFullCalculationPeriod = true; swap.ReceiveLeg.FirstCalculationPeriodStart = sinfo.SwapStartDate1; swap.PayLeg.StartDate = trade.GetTradingDay(); swap.ReceiveLeg.StartDate = swap.PayLeg.StartDate; } } } else if (info.SecurityType.Equals(SwapInfo.CcySwap)) { var swap = trade.Product as CurrencySwap; var mtm = trade.Product as MTMCurrencySwap; Leg payLeg, recLeg, leg1, leg2; payLeg = swap != null ? swap.PayLeg : mtm.PayLeg; recLeg = swap != null ? swap.ReceiveLeg : mtm.ReceiveLeg; if (info.TradeAction.Equals("B") && recLeg.NotionalCurrency.Equals(info.Currency2) || (info.TradeAction.Equals("S") && recLeg.NotionalCurrency.Equals(info.Currency1))) { if (swap != null) swap.SwitchLegs(); else mtm.SwitchLegs(); } if (payLeg.NotionalCurrency.Equals(info.Currency1)) { leg1 = payLeg; leg2 = recLeg; } else { leg2 = payLeg; leg1 = recLeg; } InitLegs2(leg1, leg2, info); } else if (info.SecurityType.Equals(SwapInfo.Fras)) { var fra = trade.Product as FRA; InitFra(fra, info); } sinfo.Generator.Provider.FillTrade(trade, market); trade.SetProperty("TemplateName", sinfo.Generator.Name); trade.SetProperty(TradeImportHelper.GeneratorProp, info.Instrument); //Add UpFront Fee if (Math.Abs(sinfo.FeeAmount) > Utilities.Epsilon) { var fee = new Fee { Date = sinfo.FeeDate, FeeType = FeeType.Upfront, PartyId = trade.PartyId, Currency = sinfo.FeeCurrency, Amount = Math.Abs(sinfo.FeeAmount), PayReceive = sinfo.FeePayRecv.Equals("Pay") ? PayReceive.Pay : PayReceive.Receive // how about None?? }; if (trade.Fees == null) trade.Fees = new List<Fee>(); trade.Fees.Add(fee); } trades.Add(trade); } catch (Exception x) { Logger.Error("Import Swap/FRA/CurrencySwap/NDS", x); sb.Append(TradeImportHelper.FormatErrorMessage("Fill Trade " + x.Message + " " + x.StackTrace, info.HoldingID, info.TradeID, info.Instrument)); } } sb.Append("Imported " + trades.Count + " Swaps/Fras/CurrencySwap/NDS\n"); if (filterData.Progress != null) filterData.Progress.AnalysisDone(); return trades; }
private decimal GetFinalPaymentAmount(decimal standardPaymentAmount, Fee loanFee) { return(Decimal.Round((standardPaymentAmount + loanFee.CompletionFee), 2)); }
public int UpdateFee(Fee fees) { return _feeRepository.Update(fees); }
public HomeControllerTests() { _loanService = Substitute.For <ILoanService>(); _feeConfig = Substitute.For <Fee>(); _homeController = new HomeController(_loanService, _feeConfig); }
/// <summary> /// Generates the bytes. /// </summary> /// <returns>System.Byte[].</returns> internal override byte[] GenerateBytes() { var builder = new FlatBufferBuilder(1); var namespaceNameLength = (uint)Encoding.UTF8.GetBytes(NamespaceId.Name).Length; // create vectors var signatureVector = NamespaceCreationTransactionBuffer.CreateSignatureVector(builder, new byte[64]); var signerVector = NamespaceCreationTransactionBuffer.CreateSignerVector(builder, GetSigner()); var feeVector = NamespaceCreationTransactionBuffer.CreateFeeVector(builder, Fee.ToUInt8Array()); var deadlineVector = NamespaceCreationTransactionBuffer.CreateDeadlineVector(builder, Deadline.Ticks.ToUInt8Array()); var durationParentId = ParentId == null?Duration.ToUInt8Array() : ParentId.Id.ToUInt8Array(); var durationParentIdVector = NamespaceCreationTransactionBuffer.CreateDurationParentIdVector(builder, durationParentId); var namespaceIdVector = NamespaceCreationTransactionBuffer.CreateNamespaceIdVector(builder, IdGenerator.GenerateId(NamespaceType == 0x00 ? 0 : IdGenerator.GenerateId(0, ParentId.Name), NamespaceId.Name).ToUInt8Array()); var name = NamespaceCreationTransactionBuffer.CreateNamespaceNameVector(builder, Encoding.UTF8.GetBytes(NamespaceId.Name)); ushort version = ushort.Parse(NetworkType.GetNetworkByte().ToString("X") + "0" + Version.ToString("X"), System.Globalization.NumberStyles.HexNumber); // Add to buffer NamespaceCreationTransactionBuffer.StartNamespaceCreationTransactionBuffer(builder); NamespaceCreationTransactionBuffer.AddSize(builder, 138 + namespaceNameLength); NamespaceCreationTransactionBuffer.AddSignature(builder, signatureVector); NamespaceCreationTransactionBuffer.AddSigner(builder, signerVector); NamespaceCreationTransactionBuffer.AddVersion(builder, version); NamespaceCreationTransactionBuffer.AddType(builder, TransactionTypes.Types.RegisterNamespace.GetValue()); NamespaceCreationTransactionBuffer.AddFee(builder, feeVector); NamespaceCreationTransactionBuffer.AddDeadline(builder, deadlineVector); NamespaceCreationTransactionBuffer.AddNamespaceType(builder, NamespaceType.GetValue()); NamespaceCreationTransactionBuffer.AddDurationParentId(builder, durationParentIdVector); NamespaceCreationTransactionBuffer.AddNamespaceId(builder, namespaceIdVector); NamespaceCreationTransactionBuffer.AddNamespaceNameSize(builder, (byte)namespaceNameLength); NamespaceCreationTransactionBuffer.AddNamespaceName(builder, name); // Calculate size var codedNamespace = NamespaceCreationTransactionBuffer.EndNamespaceCreationTransactionBuffer(builder); builder.Finish(codedNamespace.Value); return(new NamespaceCreateionTransactionSchema().Serialize(builder.SizedByteArray())); }
private void Save() { FeeServiceClient feeService = new FeeServiceClient(); Boolean ret = false; string message = String.Empty; string dis = txtDiscount.Text.ToString(); float discount = (float.Parse(dis))/100f; Fee fee = new Fee() { NumPay = Int32.Parse(txtNumPay.Text), FeeDescription = txtDescription.Text, Amount = double.Parse(txtAmount.Text), SYImplemented = cmbSY.SelectedValue.ToString(), GradeLevel = cmbGradeLevel.SelectedValue.ToString(), DiscountFullPay = discount }; if (Op.Equals("new")) { if (ExistingFees.Exists(t => t.FeeDescription == fee.FeeDescription && t.GradeLevel == fee.GradeLevel && t.SYImplemented == fee.SYImplemented)) { MessageBox.Show(this, "Fee for the Grade Level already Exists", "Fee Exists"); } else ret = feeService.CreateFee(ref fee, ref message); Log("C", "Fees", fee); if (ret) MessageBox.Show(this, "Saved Successfully"); else MessageBox.Show(this, "Error Saving"); this.Close(); } else if (Op.Equals("edit")) { fee.FeeID = SelectedFee.FeeID; ret = feeService.UpdateFee(ref fee, ref message); Log("U", "Fees", fee); if (ret) MessageBox.Show(this, "Saved Successfully"); else MessageBox.Show(this, "Error Saving"); this.Close(); } }
private decimal GetInitialPaymentAmount(decimal standardPaymentAmount, Fee loanFee) { return(Decimal.Round((standardPaymentAmount + loanFee.ArrangementFee), 2)); }
public Iso8583Message ValidateMessage(Iso8583Message originalMessage, int sourceID) { Logger.Log("\n Enter Validator"); //get source Node. SourceNode sourceNode = new SourceNodeManager().GetByID(sourceID); DateTime transmissionDate = DateTime.UtcNow; //format TransactionDate string transactionDate = string.Format("{0}{1}", string.Format("{0:00}{1:00}", transmissionDate.Month, transmissionDate.Day), string.Format("{0:00}{1:00}{2:00}", transmissionDate.Hour, transmissionDate.Minute, transmissionDate.Second)); //set Original Data Element string originalDataElement = string.Format("{0}{1}{2}", originalMessage.MessageTypeIdentifier.ToString(), originalMessage.Fields[11].ToString(), transactionDate); //add original data element to original message originalMessage.Fields.Add(90, originalDataElement); //Do Message Log Logger.LogTransaction(originalMessage, sourceNode); // Check if it is reversal message and do the needful if (originalMessage.MessageTypeIdentifier == 421) { Logger.Log("\n This is a reversal"); bool conReversal; Iso8583Message reversalIsoMsg = GetReversalMessage(originalMessage, out conReversal); if (!conReversal) { Logger.LogTransaction(reversalIsoMsg); return(reversalIsoMsg); } originalMessage = reversalIsoMsg; Logger.LogTransaction(originalMessage, sourceNode); } string theCardPan = originalMessage.Fields[2].Value.ToString(); string tranasactionTypeCode = originalMessage.Fields[3].Value.ToString().Substring(0, 2); double amount = Convert.ToDouble(originalMessage.Fields[4].Value); string orgExpiry = originalMessage.Fields[14].Value.ToString(); string code = originalMessage.Fields[123].ToString().Substring(13, 2); Channel channel = new ChannelManager().GetByCode(code); Fee fee = null; // string cardPAN = theCardPan.Substring(0, 6); Route theRoute = new RouteManager().GetRouteByCardPan(theCardPan.Substring(0, 6)); TransactionType transactionType = new TransactionTypeManager().GetByCode(tranasactionTypeCode); Iso8583Message responseMessage; //check if card has expired DateTime cardExpiryDate = ParseExpiryDate(orgExpiry); if (cardExpiryDate < DateTime.Now) { responseMessage = SetReponseMessage(originalMessage, "54"); //Expired card Logger.LogTransaction(responseMessage, sourceNode); return(responseMessage); } if (amount <= 0 && tranasactionTypeCode != "31") { responseMessage = SetReponseMessage(originalMessage, "13"); //Invalid amount Logger.LogTransaction(responseMessage, sourceNode); return(responseMessage); } if (theRoute == null) { Logger.Log("Sink node is null."); responseMessage = SetReponseMessage(originalMessage, "15"); //No such issuer Logger.LogTransaction(responseMessage, sourceNode); return(responseMessage); } SinkNode sinkNode = theRoute.SinkNode; if (sinkNode == null) { Logger.Log("Sink node is null."); responseMessage = SetReponseMessage(originalMessage, "91"); //Issuer inoperative Logger.LogTransaction(responseMessage, sourceNode); return(responseMessage); } Logger.Log("Loading SourceNode Schemes"); var theSchemes = sourceNode.Schemes; Scheme scheme = null; try { scheme = theSchemes.Where(x => x.Route.CardPAN == theCardPan.Substring(0, 6)).SingleOrDefault(); } catch (Exception ex) { Logger.Log("Error: \n" + ex.Message); responseMessage = SetReponseMessage(originalMessage, "31"); // Lazy load error : Set correct response code later Logger.LogTransaction(responseMessage, sourceNode); return(responseMessage); } if (scheme == null) { responseMessage = SetReponseMessage(originalMessage, "92"); // Route not allowed : Set correct response code later Logger.LogTransaction(responseMessage, sourceNode); return(responseMessage); } // int panCount = sourceNode.Schemes.Count(x => x.Route == theRoute); Logger.Log("Scheme : " + scheme.Name + " Loaded"); Logger.Log("Getting fee:"); fee = GetFeeIfTransactionIsAllowed(transactionType, channel, scheme); if (fee == null) { responseMessage = SetReponseMessage(originalMessage, "58"); // Transaction type not allowed in this scheme Logger.LogTransaction(responseMessage, sourceNode, scheme); return(responseMessage); } else { originalMessage = SetFee(originalMessage, CalculateFee(fee, amount)); } bool needReversal = false; Iso8583Message msgFromFEP = ToFEP(originalMessage, sinkNode, out needReversal); Logger.LogTransaction(msgFromFEP, sourceNode, scheme, fee, needReversal); return(msgFromFEP); }
///<summary></summary> public static void Delete(Fee fee) { string command = "DELETE FROM fee WHERE FeeNum=" + fee.FeeNum; General.NonQ(command); }
public FeeViewModelGet(Fee fee) { FeeType = fee.FeeType; MiningFee = new FeeAmountViewModelGet(fee.MiningFee); RelayFee = new FeeAmountViewModelGet(fee.RelayFee); }
public async Task <IHttpActionResult> Post([FromBody] Fee req) { try { string errorMessage = "UnknowError"; string errorCode = ErrorCodeEnum.UnknownError.ToString(); #region token var header = Request.Headers; if (header.Authorization == null) { return(StatusCode(HttpStatusCode.Unauthorized)); } var token = header.Authorization.Parameter; Employee employee; if (string.IsNullOrWhiteSpace(token) || !TokenManager.ValidateToken(token, out employee)) { return(StatusCode(HttpStatusCode.Unauthorized)); } #endregion if (!Operator.IsAdmin(employee)) { return(Ok(new RequestErrorCode(false, ErrorCodeEnum.Error_NotHavePermision.ToString(), "Khong co quyen"))); } #region Validate if (!Validate(req, out errorCode, out errorMessage)) { return(Ok(new RequestErrorCode(false, errorCode, errorMessage))); } #endregion #region Tạo key var oldKey = Memory.Memory.GetMaxKey(req.GetName()); int newKey = oldKey + 1; // set key req.Id = newKey; #endregion #region Process req.CreatedAt = DateTime.Now; req.CreatedBy = employee.Id; req.IsDeleted = 0; UpdateEntitySql updateEntitySql = new UpdateEntitySql(); var lstCommand = new List <EntityCommand>(); lstCommand.Add(new EntityCommand { BaseEntity = new Entity.Entity(req), EntityAction = EntityAction.Insert }); bool isOkDone = updateEntitySql.UpdateDefault(lstCommand); if (!isOkDone) { return(Ok(new RequestErrorCode(false, errorCode, errorMessage))); } #endregion // update memory MemorySet.UpdateAndInsertEntity(req); var result = new RequestErrorCode(true); result.DataResult = req; return(Ok(result)); } catch (Exception ex) { Logger.Write(ex.ToString()); } return(BadRequest("Unknow")); }
public void AddFee(Fee fee) { DataContext.Fees.Add(fee); SetAuditFields(fee); DataContext.SaveChanges(); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + Direction.GetHashCode(); hashCode = hashCode * 59 + FeeCurrency.GetHashCode(); if (OrderId != null) { hashCode = hashCode * 59 + OrderId.GetHashCode(); } if (Timestamp != null) { hashCode = hashCode * 59 + Timestamp.GetHashCode(); } if (Price != null) { hashCode = hashCode * 59 + Price.GetHashCode(); } if (Iv != null) { hashCode = hashCode * 59 + Iv.GetHashCode(); } if (TradeId != null) { hashCode = hashCode * 59 + TradeId.GetHashCode(); } if (Fee != null) { hashCode = hashCode * 59 + Fee.GetHashCode(); } hashCode = hashCode * 59 + OrderType.GetHashCode(); if (TradeSeq != null) { hashCode = hashCode * 59 + TradeSeq.GetHashCode(); } if (SelfTrade != null) { hashCode = hashCode * 59 + SelfTrade.GetHashCode(); } hashCode = hashCode * 59 + State.GetHashCode(); if (Label != null) { hashCode = hashCode * 59 + Label.GetHashCode(); } if (IndexPrice != null) { hashCode = hashCode * 59 + IndexPrice.GetHashCode(); } if (Amount != null) { hashCode = hashCode * 59 + Amount.GetHashCode(); } if (InstrumentName != null) { hashCode = hashCode * 59 + InstrumentName.GetHashCode(); } hashCode = hashCode * 59 + TickDirection.GetHashCode(); if (MatchingId != null) { hashCode = hashCode * 59 + MatchingId.GetHashCode(); } hashCode = hashCode * 59 + Liquidity.GetHashCode(); return(hashCode); } }
protected override void Seed(G4.BizPermit.Dal.DB context) { //BUSINESS NATURE -- START BusinessNature bn1 = new BusinessNature(); bn1.BusinessNatureName = "Food Services"; bn1.Code = 1; bn1.Description = "Restaurants, etc."; bn1.UniqueId = Guid.NewGuid(); bn1.IsActive = true; BusinessNature bn2 = new BusinessNature(); bn2.BusinessNatureName = "Retail"; bn2.Code = 2; bn2.Description = "Supermarket, stores, etc."; bn2.UniqueId = Guid.NewGuid(); bn2.IsActive = true; BusinessNature bn3 = new BusinessNature(); bn3.BusinessNatureName = "Wholesale"; bn3.Code = 3; bn3.Description = "sales many"; bn3.UniqueId = Guid.NewGuid(); bn3.IsActive = true; BusinessNature bn4 = new BusinessNature(); bn4.BusinessNatureName = "Manufacturing"; bn4.Code = 4; bn4.Description = "manufactures goods"; bn4.UniqueId = Guid.NewGuid(); bn4.IsActive = true; BusinessNature bn5 = new BusinessNature(); bn5.BusinessNatureName = "Services"; bn5.Code = 5; bn5.Description = "provides service"; bn5.UniqueId = Guid.NewGuid(); bn5.IsActive = true; //BUSINESS NATURE -- END //BUSINESS LINE -- START BusinessLine bl1 = new BusinessLine(); bl1.Name = "Spa"; bl1.BusinessNature = bn5; bl1.Code = 1; bl1.Description = "parlor and massage"; bl1.UniqueId = Guid.NewGuid(); bl1.isActive = true; BusinessLine bl2 = new BusinessLine(); bl2.Name = "Barber"; bl2.BusinessNature = bn5; bl2.Code = 2; bl2.Description = "kwentong barbero"; bl2.UniqueId = Guid.NewGuid(); bl2.isActive = true; BusinessLine bl3 = new BusinessLine(); bl3.Name = "Supermarket"; bl3.BusinessNature = bn2; bl3.Code = 3; bl3.Description = "nagbebenta"; bl3.UniqueId = Guid.NewGuid(); bl3.isActive = true; BusinessLine bl4 = new BusinessLine(); bl4.Name = "Department Store"; bl4.BusinessNature = bn2; bl4.Code = 4; bl4.Description = "tingi tingi lang"; bl4.UniqueId = Guid.NewGuid(); bl4.isActive = true; BusinessLine bl5 = new BusinessLine(); bl5.Name = "Restaurant"; bl5.BusinessNature = bn1; bl5.Code = 5; bl5.Description = "kainan"; bl5.UniqueId = Guid.NewGuid(); bl5.isActive = true; //BUSINESS LINE -- END //BUSINESS DETAIL -- START BusinessDetail bd1 = new BusinessDetail(); bd1.BirthDate = DateTime.Now; bd1.Name = "biz1"; bd1.BusinessLine = bl1; bd1.Capital = (decimal)100.12; bd1.Gross = (decimal)234.23; bd1.isNew = true; bd1.lastPayDate = DateTime.ParseExact("2016-12-31", "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); bd1.UniqueId = Guid.NewGuid(); BusinessDetail bd2 = new BusinessDetail(); bd2.BirthDate = DateTime.Now; bd2.Name = "biz2"; bd2.BusinessLine = bl2; bd2.Capital = (decimal)200.12; bd2.Gross = (decimal)2134.23; bd2.isNew = true; bd2.lastPayDate = DateTime.ParseExact("2016-12-31", "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); bd2.UniqueId = Guid.NewGuid(); //BUSINESS DETAIL -- END //BUSINESS OWNER -- START BusinessOwner bo1 = new BusinessOwner(); bo1.FirstName = "Michael"; bo1.MiddleName = "T."; bo1.LastName = "Pollente"; bo1.MaritalStatus = "Single"; bo1.UniqueId = Guid.NewGuid(); bo1.Gender = "Male"; bo1.CorporateName = "Jollibee"; bo1.BirthDate = DateTime.ParseExact("1996-06-13", "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); bo1.ContactNo = "1234"; bo1.Designation = "Mr."; bo1.isActive = true; BusinessOwner bo2 = new BusinessOwner(); bo2.FirstName = "Jon"; bo2.MiddleName = "Lang"; bo2.LastName = "Jovi"; bo2.MaritalStatus = "Single"; bo2.UniqueId = Guid.NewGuid(); bo2.Gender = "Female"; bo2.CorporateName = "Mayaman Corp"; bo2.BirthDate = DateTime.ParseExact("2016-12-31", "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); bo2.ContactNo = "1234"; bo2.Designation = "Ms."; bo2.isActive = true; //BUSINESS OWNER -- END //BUSINESS TYPE -- START BusinessType bt1 = new BusinessType(); bt1.Name = "Sole Proprietorship"; bt1.Code = 1; bt1.Description = "mag-isa ka lang"; bt1.isActive = true; bt1.UniqueId = Guid.NewGuid(); BusinessType bt2 = new BusinessType(); bt2.Name = "Partnership"; bt2.Code = 2; bt2.Description = "dalawa na kayo"; bt2.isActive = true; bt2.UniqueId = Guid.NewGuid(); BusinessType bt3 = new BusinessType(); bt3.Name = "Corporation"; bt3.Code = 3; bt3.Description = "woah dami"; bt3.isActive = true; bt3.UniqueId = Guid.NewGuid(); //BUSINESS TYPE -- END //BANK -- START Bank bank1 = new Bank(); bank1.Name = "BPI"; bank1.CreatedBy = 1; bank1.CreatedDate = DateTime.Now; bank1.IsActive = true; bank1.UniqueId = Guid.NewGuid(); Bank bank2 = new Bank(); bank2.Name = "BDO"; bank2.CreatedBy = 1; bank2.CreatedDate = DateTime.Now; bank2.IsActive = true; bank2.UniqueId = Guid.NewGuid(); //BANK -- END //PROVINCE -- ADD Province prov1 = new Province(); prov1.UniqueId = Guid.NewGuid(); prov1.Name = "NCR"; prov1.Code = 133900000; prov1.Description = "Capital"; prov1.isActive = true; Province prov2 = new Province(); prov2.UniqueId = Guid.NewGuid(); prov2.Name = "Rizal"; prov2.Code = 045800000; prov2.Description = "probinsya"; prov2.isActive = true; //PROVINCE -- END //CITY -- START City city1 = new City(); city1.UniqueId = Guid.NewGuid(); city1.Name = "Antipolo City"; city1.Code = 045802000; city1.Description = "first class"; city1.isActive = true; city1.Province = prov2; City city2 = new City(); city2.UniqueId = Guid.NewGuid(); city2.Name = "Cainta"; city2.Code = 045805000; city2.Description = "municipality"; city2.isActive = true; city2.Province = prov2; City city3 = new City(); city3.UniqueId = Guid.NewGuid(); city3.Name = "Manila"; city3.Code = 133900000; city3.Description = "capital"; city3.isActive = true; city3.Province = prov1; City city4 = new City(); city4.UniqueId = Guid.NewGuid(); city4.Name = "Quezon City"; city4.Code = 137404000; city4.Description = "big"; city4.isActive = true; city4.Province = prov1; //CITY -- END //DISTRICT -- START District dist1 = new District(); dist1.City = city1; dist1.Code = 1001; dist1.Description = "1DAntipolo"; dist1.Name = "1st District, Antipolo"; dist1.UniqueId = Guid.NewGuid(); dist1.isActive = true; District dist2 = new District(); dist2.City = city1; dist2.Code = 1002; dist2.Description = "2DAntipolo"; dist2.Name = "2nd District, Antipolo"; dist2.UniqueId = Guid.NewGuid(); dist2.isActive = true; District dist3 = new District(); dist3.City = city3; dist3.Code = 2001; dist3.Description = "1DManila"; dist3.Name = "1st District, Manila"; dist3.UniqueId = Guid.NewGuid(); dist3.isActive = true; District dist4 = new District(); dist4.City = city3; dist4.Code = 2002; dist4.Description = "2DManila"; dist4.Name = "2nd District, Manila"; dist4.UniqueId = Guid.NewGuid(); dist4.isActive = true; //DISTRICT -- END //BARANGAY -- START Barangay bar1 = new Barangay(); bar1.Name = "San Jose"; bar1.District = dist1; bar1.Code = 1001; bar1.Description = "bar1"; bar1.isActive = true; bar1.UniqueId = Guid.NewGuid(); Barangay bar2 = new Barangay(); bar2.Name = "Bagong Nayon"; bar2.District = dist2; bar2.Code = 1002; bar2.Description = "bar2"; bar2.isActive = true; bar2.UniqueId = Guid.NewGuid(); Barangay bar3 = new Barangay(); bar3.Name = "Quiapo"; bar3.District = dist4; bar3.Code = 2001; bar3.Description = "bar3"; bar3.isActive = true; bar3.UniqueId = Guid.NewGuid(); Barangay bar4 = new Barangay(); bar4.Name = "Sampaloc"; bar4.District = dist3; bar4.Code = 1001; bar4.Description = "bar4"; bar4.isActive = true; bar4.UniqueId = Guid.NewGuid(); //BARANGAY -- END //STREET -- START Street st1 = new Street(); st1.Name = "St1"; st1.Description = "street"; st1.Barangay = bar1; st1.Code = 1001; st1.isActive = true; st1.UniqueId = Guid.NewGuid(); Street st2 = new Street(); st2.Name = "St2"; st2.Description = "street"; st2.Barangay = bar2; st2.Code = 2001; st2.isActive = true; st2.UniqueId = Guid.NewGuid(); //STREET -- END //QUARTER -- START Quarter qrt1 = new Quarter(); qrt1.Name = "1st Quarter"; qrt1.IsActive = true; qrt1.CreatedBy = 1; qrt1.CreatedDate = DateTime.Now; qrt1.firstQtr = true; qrt1.secondQtr = false; qrt1.thirdQtr = false; qrt1.fourthQtr = false; Quarter qrt2 = new Quarter(); qrt2.Name = "2nd Quarter"; qrt2.IsActive = true; qrt2.CreatedBy = 1; qrt2.CreatedDate = DateTime.Now; qrt2.firstQtr = false; qrt2.secondQtr = true; qrt2.thirdQtr = false; qrt2.fourthQtr = false; Quarter qrt3 = new Quarter(); qrt3.Name = "3rd Quarter"; qrt3.IsActive = true; qrt3.CreatedBy = 1; qrt3.CreatedDate = DateTime.Now; qrt3.firstQtr = false; qrt3.secondQtr = false; qrt3.thirdQtr = true; qrt3.fourthQtr = false; Quarter qrt4 = new Quarter(); qrt4.Name = "4th Quarter"; qrt4.IsActive = true; qrt4.CreatedBy = 1; qrt4.CreatedDate = DateTime.Now; qrt4.firstQtr = false; qrt4.secondQtr = false; qrt4.thirdQtr = false; qrt4.fourthQtr = true; //QUARTER -- END //CUTOFF -- START Cutoff cut1 = new Cutoff(); cut1.Name = "1st"; cut1.UniqueId = Guid.NewGuid(); cut1.IsActive = true; cut1.CreatedDate = DateTime.Now; cut1.CreatedBy = 1; cut1.CuttoffDate = DateTime.ParseExact("2017-03-31", "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); Cutoff cut2 = new Cutoff(); cut2.Name = "2nd"; cut2.UniqueId = Guid.NewGuid(); cut2.IsActive = true; cut2.CreatedDate = DateTime.Now; cut2.CreatedBy = 1; cut2.CuttoffDate = DateTime.ParseExact("2017-06-30", "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); Cutoff cut3 = new Cutoff(); cut3.Name = "3rd"; cut3.UniqueId = Guid.NewGuid(); cut3.IsActive = true; cut3.CreatedDate = DateTime.Now; cut3.CreatedBy = 1; cut3.CuttoffDate = DateTime.ParseExact("2017-09-30", "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); Cutoff cut4 = new Cutoff(); cut4.Name = "4th"; cut4.UniqueId = Guid.NewGuid(); cut4.IsActive = true; cut4.CreatedDate = DateTime.Now; cut4.CreatedBy = 1; cut4.CuttoffDate = DateTime.ParseExact("2017-12-31", "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture); //CUTOFF -- END //STATUS -- START Status stat1 = new Status(); stat1.Name = "New"; stat1.UniqueId = Guid.NewGuid(); stat1.CreatedDate = DateTime.Now; stat1.CreatedBy = 1; Status stat2 = new Status(); stat2.Name = "Renew"; stat2.UniqueId = Guid.NewGuid(); stat2.CreatedDate = DateTime.Now; stat2.CreatedBy = 1; Status stat3 = new Status(); stat3.Name = "Both"; stat3.UniqueId = Guid.NewGuid(); stat3.CreatedDate = DateTime.Now; stat3.CreatedBy = 1; //STATUS -- END //FEES -- START Fee fee1 = new Fee(); fee1.Name = "Business Tax New"; fee1.Rate = 1500; fee1.isQuarterly = true; fee1.isActive = true; fee1.withInterest = false; fee1.UniqueId = Guid.NewGuid(); fee1.CreatedBy = 1; fee1.CreatedDate = DateTime.Now; fee1.Status = stat1; Fee fee2 = new Fee(); fee2.Name = "Business Tax Renew"; fee2.Rate = 1000; fee2.isQuarterly = true; fee2.isActive = true; fee2.withInterest = false; fee2.UniqueId = Guid.NewGuid(); fee2.CreatedBy = 1; fee2.CreatedDate = DateTime.Now; fee2.Status = stat2; Fee fee3 = new Fee(); fee3.Name = "Mayor's Fee"; fee3.Rate = 500; fee3.isQuarterly = false; fee3.isActive = true; fee3.withInterest = false; fee3.UniqueId = Guid.NewGuid(); fee3.CreatedBy = 1; fee3.CreatedDate = DateTime.Now; fee3.Status = stat3; Fee fee4 = new Fee(); fee4.Name = "Garbage Fee"; fee4.Rate = 200; fee4.isQuarterly = false; fee4.isActive = true; fee4.withInterest = false; fee4.UniqueId = Guid.NewGuid(); fee4.CreatedBy = 1; fee4.CreatedDate = DateTime.Now; fee4.Status = stat3; Fee fee5 = new Fee(); fee5.Name = "Mechanical Fee"; fee5.Rate = 250; fee5.isQuarterly = false; fee5.isActive = true; fee5.withInterest = false; fee5.UniqueId = Guid.NewGuid(); fee5.CreatedBy = 1; fee5.CreatedDate = DateTime.Now; fee5.Status = stat3; Fee fee6 = new Fee(); fee6.Name = "Plumbing Fee"; fee6.Rate = 230; fee6.isQuarterly = false; fee6.isActive = true; fee6.withInterest = false; fee6.UniqueId = Guid.NewGuid(); fee6.CreatedBy = 1; fee6.CreatedDate = DateTime.Now; fee6.Status = stat3; Fee fee7 = new Fee(); fee7.Name = "Electrical Fee"; fee7.Rate = 400; fee7.isQuarterly = false; fee7.isActive = true; fee7.withInterest = false; fee7.UniqueId = Guid.NewGuid(); fee7.CreatedBy = 1; fee7.CreatedDate = DateTime.Now; fee7.Status = stat3; Fee fee8 = new Fee(); fee8.Name = "Sticker Fee"; fee8.Rate = 100; fee8.isQuarterly = false; fee8.isActive = true; fee8.withInterest = false; fee8.UniqueId = Guid.NewGuid(); fee8.CreatedBy = 1; fee8.CreatedDate = DateTime.Now; fee8.Status = stat3; //FEE -- END //REQUIREMENTS -- START Requirement req1 = new Requirement(); req1.Name = "Barangay Clearance"; req1.Status = stat1; req1.UniqueId = Guid.NewGuid(); req1.IsActive = true; req1.CreatedBy = 1; req1.CreatedDate = DateTime.Now; Requirement req2 = new Requirement(); req2.Name = "Authorization Letter of Owner and ID"; req2.Status = stat3; req2.UniqueId = Guid.NewGuid(); req2.IsActive = true; req2.CreatedBy = 1; req2.CreatedDate = DateTime.Now; Requirement req3 = new Requirement(); req3.Name = "Lease Contract / Tax Declaration"; req3.Status = stat3; req3.UniqueId = Guid.NewGuid(); req3.IsActive = true; req3.CreatedBy = 1; req3.CreatedDate = DateTime.Now; Requirement req4 = new Requirement(); req4.Name = "SSS (Certification / Clearance)"; req4.Status = stat3; req4.UniqueId = Guid.NewGuid(); req4.IsActive = true; req4.CreatedBy = 1; req4.CreatedDate = DateTime.Now; Requirement req5 = new Requirement(); req5.Name = "CTC (Community Tax Certificate)"; req5.Status = stat3; req5.UniqueId = Guid.NewGuid(); req5.IsActive = true; req5.CreatedBy = 1; req5.CreatedDate = DateTime.Now; Requirement req6 = new Requirement(); req6.Name = "Public Liability Insurance"; req6.Status = stat2; req6.UniqueId = Guid.NewGuid(); req6.IsActive = true; req6.CreatedBy = 1; req6.CreatedDate = DateTime.Now; Requirement req7 = new Requirement(); req7.Name = "SEC Registration"; req7.Status = stat2; req7.UniqueId = Guid.NewGuid(); req7.IsActive = true; req7.CreatedBy = 1; req7.CreatedDate = DateTime.Now; Requirement req8 = new Requirement(); req8.Name = "DTI"; req8.Status = stat2; req8.UniqueId = Guid.NewGuid(); req8.IsActive = true; req8.CreatedBy = 1; req8.CreatedDate = DateTime.Now; //REQUIREMENTS -- END BusinessRecord br = new BusinessRecord(); br.Barangay = bar1; br.BlockNo = 1; br.BuildingName = "adwa"; br.BusinessDetail = bd1; br.BusinessName = "Mayaman Corp."; br.BusinessOwner = bo2; br.BusinessType = bt3; br.City = city1; br.Province = prov1; br.District = dist1; br.StartDate = DateTime.Now; br.Street = st1; br.StreetNo = 1; br.UniqueId = Guid.NewGuid(); br.isActive = true; br.isAssessed = 0; br.isCollected = 0; br.isRetired = false; br.Address = "adwad"; br.ContactNo = "12313"; br.FaxNo = "2131"; br.FloorNo = 2; br.Requirements.Add(req1); br.Requirements.Add(req2); context.BusinessNatures.AddOrUpdate(bn1, bn2, bn3, bn4, bn5); context.BusinessLines.AddOrUpdate(bl1, bl2, bl3, bl4, bl5); context.BusinessDetails.AddOrUpdate(bd1, bd2); context.BusinessOwners.AddOrUpdate(bo1, bo2); context.BusinessTypes.AddOrUpdate(bt1, bt2, bt3); context.BankRecords.AddOrUpdate(bank1, bank2); context.Provinces.AddOrUpdate(prov1, prov2); context.Cities.AddOrUpdate(city1, city2, city3, city4); context.Districts.AddOrUpdate(dist1, dist2, dist3, dist4); context.Barangays.AddOrUpdate(bar1, bar2, bar3, bar4); context.Streets.AddOrUpdate(st1, st2); context.Quarters.AddOrUpdate(qrt1, qrt2, qrt3, qrt4); context.Cutoffs.AddOrUpdate(cut1, cut2, cut3, cut4); context.Statuses.AddOrUpdate(stat1, stat2, stat3); context.Fees.AddOrUpdate(fee1, fee2, fee3, fee4, fee5, fee6, fee7, fee8); context.Requirements.AddOrUpdate(req1, req2, req3, req4, req5, req6, req7, req8); context.BusinessRecords.AddOrUpdate(br); }
/// <summary> /// Generates the bytes. /// </summary> /// <returns>System.Byte[].</returns> internal override byte[] GenerateBytes() { var builder = new FlatBufferBuilder(1); // create vectors var signatureVector = MosaicSupplyChangeTransactionBuffer.CreateSignatureVector(builder, new byte[64]); var signerVector = MosaicSupplyChangeTransactionBuffer.CreateSignerVector(builder, GetSigner()); var feeVector = MosaicSupplyChangeTransactionBuffer.CreateFeeVector(builder, Fee.ToUInt8Array()); var deadlineVector = MosaicSupplyChangeTransactionBuffer.CreateDeadlineVector(builder, Deadline.Ticks.ToUInt8Array()); var mosaicIdVector = MosaicSupplyChangeTransactionBuffer.CreateMosaicIdVector(builder, MosaicId.Id.ToUInt8Array()); var deltaVector = MosaicSupplyChangeTransactionBuffer.CreateFeeVector(builder, Delta.ToUInt8Array()); ushort version = ushort.Parse(NetworkType.GetNetworkByte().ToString("X") + "0" + Version.ToString("X"), System.Globalization.NumberStyles.HexNumber); // add vectors to buffer MosaicSupplyChangeTransactionBuffer.StartMosaicSupplyChangeTransactionBuffer(builder); MosaicSupplyChangeTransactionBuffer.AddSize(builder, 137); MosaicSupplyChangeTransactionBuffer.AddSignature(builder, signatureVector); MosaicSupplyChangeTransactionBuffer.AddSigner(builder, signerVector); MosaicSupplyChangeTransactionBuffer.AddVersion(builder, version); MosaicSupplyChangeTransactionBuffer.AddType(builder, TransactionTypes.Types.MosaicSupplyChange.GetValue()); MosaicSupplyChangeTransactionBuffer.AddFee(builder, feeVector); MosaicSupplyChangeTransactionBuffer.AddDeadline(builder, deadlineVector); MosaicSupplyChangeTransactionBuffer.AddMosaicId(builder, mosaicIdVector); MosaicSupplyChangeTransactionBuffer.AddDirection(builder, SupplyType.GetValue()); MosaicSupplyChangeTransactionBuffer.AddDelta(builder, deltaVector); // end build var codedTransfer = TransferTransactionBuffer.EndTransferTransactionBuffer(builder); builder.Finish(codedTransfer.Value); return(new MosaicSupplyChangeTransactionSchema().Serialize(builder.SizedByteArray())); }
static async Task Main(string[] args) { Console.WriteLine("Hello World!"); var connectionString = "ConnectTo=tcp://admin:Airfi2018Airfi2018@http://52.151.85.8:1113; HeartBeatTimeout=500"; // var conn = EventStoreConnection.Create(new Uri("tcp://*****:*****@http://52.151.85.8:1113") // var conn = EventStoreConnection.Create(new Uri("tcp://*****:*****@52.151.85.8:1113") // // ); var conn = EventStoreConnection.Create( ConnectionSettings.Create().KeepReconnecting(), ClusterSettings.Create().DiscoverClusterViaGossipSeeds().SetGossipSeedEndPoints(new [] { new IPEndPoint(IPAddress.Parse("52.151.78.42"), 2113), new IPEndPoint(IPAddress.Parse("52.151.79.84"), 2113), new IPEndPoint(IPAddress.Parse("51.140.14.214"), 2113) }).SetGossipTimeout(TimeSpan.FromMilliseconds(500)).Build()); await conn.ConnectAsync(); // var accountId = $"Account-{Guid.NewGuid()}"; var accountId = "Account-4d4158cd-a6ac-49cf-a41e-d11f86ccbbf6"; // var accountId = "test1"; // await conn.DeleteStreamAsync("Transactions", ExpectedVersion.Any,true); var watch = new Stopwatch(); watch.Start(); var tasks = new List <Task>(); var rnd = new Random(); var props = new List <Dictionary <string, object> >(); // props.Add(new Dictionary<string, object>() {{"item1", "value1"}}); // props.Add(new Dictionary<string, object>() {{"item2", "value2"}}); var subfee1 = new TransactionService.External.ValueObjects.KeyValuePair("myKey", "MyValue"); var companyId = "b3e4bf26-c93b-41f6-adf1-27b85fa82c91"; var subfee2 = new Fee(companyId, "MyLabel", 50, "USD", "0.9", 0, 0); var subfees = new List <Fee>() { subfee2 }; var keyValueParis = new List <TransactionService.External.ValueObjects.KeyValuePair>() { subfee1 }; var item = new TransactionItem(100, "B2C Renewal", 1, keyValueParis, subfees); var transaction = new Transaction("T-00001", Guid.NewGuid().ToString(), "Transaction", "B2C Renewal", 100, 50, new DateTime(rnd.Next(2015, 2018), rnd.Next(1, 12), rnd.Next(1, 28)), 20, "GBR", "GBP", new List <TransactionItem>() { item }); var data = new Data() { Balance = 100, Id = Guid.NewGuid().ToString() }; var jsonBytes = Encoding.ASCII.GetBytes(JsonConvert.SerializeObject(new AccountCreditedEvent(transaction), new JsonSerializerSettings() { ContractResolver = new CamelCasePropertyNamesContractResolver() })); for (int j = 0; j < 100; j++) { for (int i = 0; i < 100; i++) { tasks.Add(Task.Run(async() => { var e = new EventData(Guid.NewGuid(), "accountCredited", true, jsonBytes, null); // var conn = EventStoreConnection.Create(new Uri("tcp://*****:*****@localhost:1113") // ); // await conn.ConnectAsync(); await conn.AppendToStreamAsync(accountId, ExpectedVersion.Any, e); })); } // while (tasks.Count != 0) // { //// Thread.Sleep(TimeSpan.FromSeconds(1)); // var ts = tasks.Take(50).ToList(); // ts.ForEach(t => t.Start()); // Task.WaitAll(ts.ToArray()); // // tasks.RemoveAll(t => ts.Contains(t)); // } Task.WaitAll(tasks.ToArray()); } watch.Stop(); Console.WriteLine(watch.Elapsed); Console.ReadLine(); }
///<summary></summary> public static void ImportFees(string fileName, long feeSchedNum, long clinicNum, long provNum) { List <Fee> listFees = Fees.GetListExact(feeSchedNum, clinicNum, provNum); string[] fields; int counter = 0; int lineCount = File.ReadAllLines(fileName).Length; //quick and dirty using (StreamReader sr = new StreamReader(fileName)) { string line = sr.ReadLine(); while (line != null) { fields = line.Split(new string[1] { "\t" }, StringSplitOptions.None); if (fields.Length < 2) // && fields[1]!=""){//we no longer skip blank fees { line = sr.ReadLine(); continue; } long codeNum = ProcedureCodes.GetCodeNum(fields[0]); if (codeNum == 0) { line = sr.ReadLine(); continue; } Fee fee = Fees.GetFee(codeNum, feeSchedNum, clinicNum, provNum, listFees); string feeOldStr = ""; DateTime datePrevious = DateTime.MinValue; if (fee != null) { feeOldStr = "Old Fee: " + fee.Amount.ToString("c") + ", "; datePrevious = fee.SecDateTEdit; } if (fields[1] == "") //an empty entry will delete an existing fee, but not insert a blank override { if (fee == null) //nothing to do //counter++; //line=sr.ReadLine(); //continue; { } else { //doesn't matter if the existing fee is an override or not. Fees.Delete(fee); SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, "Procedure: " + fields[0] + ", " + feeOldStr //+", Deleted Fee: "+fee.Amount.ToString("c")+", " + "Fee Schedule: " + FeeScheds.GetDescription(feeSchedNum) + ". " + "Fee deleted using the Import button in the Fee Tools window.", codeNum, DateTime.MinValue); SecurityLogs.MakeLogEntry(Permissions.LogFeeEdit, 0, "Fee deleted", fee.FeeNum, datePrevious); } } else //value found { if (fee == null) //no current fee { fee = new Fee(); fee.Amount = PIn.Double(fields[1]); fee.FeeSched = feeSchedNum; fee.CodeNum = codeNum; fee.ClinicNum = clinicNum; //Either 0 because you're importing on an HQ schedule or local clinic because the feesched is localizable. fee.ProvNum = provNum; Fees.Insert(fee); } else { fee.Amount = PIn.Double(fields[1]); Fees.Update(fee); } SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, "Procedure: " + fields[0] + ", " + feeOldStr + ", New Fee: " + fee.Amount.ToString("c") + ", " + "Fee Schedule: " + FeeScheds.GetDescription(feeSchedNum) + ". " + "Fee changed using the Import button in the Fee Tools window.", codeNum, DateTime.MinValue); SecurityLogs.MakeLogEntry(Permissions.LogFeeEdit, 0, "Fee changed", fee.FeeNum, datePrevious); } //FeeSchedEvent.Fire(ODEventType.FeeSched,new ProgressBarHelper("Importing fees...",)); double percent = (double)counter * 100d / (double)lineCount; counter++; FeeSchedEvent.Fire(ODEventType.FeeSched, new ProgressBarHelper( "Importing fees...", ((int)percent).ToString(), blockValue: (int)percent, progressStyle: ProgBarStyle.Continuous)); line = sr.ReadLine(); } } }
public AdjustFeePage() { InitializeComponent(); Fee = FeeDAO.Instance.GetAllFee(); }
//------- public static PawnLoan GetCurrentLoanFees(SiteId siteId, PawnLoan pawnLoan, out UnderwritePawnLoanVO underwritePawnLoanVO) { decimal currentValue; PawnLoan _PawnLoan = Utilities.CloneObject(pawnLoan); // call UnderWrite Pawn Loan var upw = new UnderwritePawnLoanUtility(GlobalDataAccessor.Instance.DesktopSession); upw.RunUWP(siteId); underwritePawnLoanVO = upw.PawnLoanVO; // CL_PWN_0013_MININTAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0013_MININTAMT", out currentValue); Fee fee = new Fee { FeeType = FeeTypes.MINIMUM_INTEREST, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0018_SETUPFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0018_SETUPFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.SETUP, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0022_CITYFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0022_CITYFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.CITY, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0026_FIREARMFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0026_FIREARMFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.FIREARM, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0040_PFIMAILFEE underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0040_PFIMAILFEE", out currentValue); fee = new Fee { FeeType = FeeTypes.MAILER_CHARGE, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0101_LOANFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0101_LOANFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.LOAN, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0103_ORIGINFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0103_ORIGINFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.ORIGIN, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0104_ADMINFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0104_ADMINFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.ADMINISTRATIVE, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0105_INITCHGFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0105_INITCHGFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.INITIAL, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0106_PROCFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0106_PROCFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.PROCESS, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0115_PPCITYFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0115_PPCITYFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.PREPAID_CITY, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0030_STRGFEE underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0030_STRGFEE", out currentValue); fee = new Fee { FeeType = FeeTypes.STORAGE, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0033_MAXSTRGFEE underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0033_MAXSTRGFEE", out currentValue); fee = new Fee { FeeType = FeeTypes.STORAGE_MAXIMUM, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0037_TICKETFEE underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0037_TICKETFEE", out currentValue); fee = new Fee { FeeType = FeeTypes.TICKET, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); // CL_PWN_0102_PREPFEEAMT underwritePawnLoanVO.feeDictionary.TryGetValue("CL_PWN_0102_PREPFEEAMT", out currentValue); fee = new Fee { FeeType = FeeTypes.PREPARATION, Value = currentValue }; UpdatePawnLoanFee(_PawnLoan, fee); BusinessRuleVO businessRule = GlobalDataAccessor.Instance.DesktopSession.PawnBusinessRuleVO["PWN_BR-054"]; var sComponentValue = string.Empty; if (sComponentValue.Equals("ROUNDED")) { businessRule.getComponentValue("CL_PWN_0021_APRCALCTODEC", ref sComponentValue); underwritePawnLoanVO.APR = Math.Round(underwritePawnLoanVO.APR, Convert.ToInt32(sComponentValue)); } else { businessRule.getComponentValue("CL_PWN_0025_APRCALCRNDFAC", ref sComponentValue); } return(_PawnLoan); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { if (IsSelectionMode) { SelectedADA = ProcTable.Rows[e.Row]["ADACode"].ToString(); DialogResult = DialogResult.OK; return; } //else not selecting a code if (!Security.IsAuthorized(Permissions.Setup, DateTime.MinValue, true)) { return; } string ada = ProcTable.Rows[e.Row]["ADACode"].ToString(); if (e.Col > 3) //if double clicked on a fee { Fee FeeCur = null; int feesched = 0; if (e.Col == 4) { FeeCur = Fees.GetFeeByOrder(ada, listFeeSched.SelectedIndex); feesched = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].DefNum; } if (e.Col == 5) { if (comboCompare1.SelectedIndex == 0) { return; } FeeCur = Fees.GetFeeByOrder(ada, comboCompare1.SelectedIndex - 1); feesched = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare1.SelectedIndex - 1].DefNum; } if (e.Col == 6) { if (comboCompare2.SelectedIndex == 0) { return; } FeeCur = Fees.GetFeeByOrder(ada, comboCompare2.SelectedIndex - 1); feesched = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare2.SelectedIndex - 1].DefNum; } FormFeeEdit FormFE = new FormFeeEdit(); if (FeeCur == null) { FeeCur = new Fee(); FeeCur.ADACode = ada; FeeCur.FeeSched = feesched; Fees.Insert(FeeCur); FormFE.IsNew = true; } FormFE.FeeCur = FeeCur; FormFE.ShowDialog(); if (FormFE.DialogResult == DialogResult.OK) { Fees.Refresh(); changed = true; FillGrid(); } } else //not on a fee: Edit code instead { FormProcCodeEdit FormPCE = new FormProcCodeEdit(ProcedureCodes.GetProcCode(ada)); FormPCE.IsNew = false; FormPCE.ShowDialog(); if (FormPCE.DialogResult == DialogResult.OK) { //ProcedureCodes.Refresh(); changed = true; //Fees.Refresh();//fees were already refreshed within procCodeEdit FillGrid(); } } }
public NewHdBtcTransactionRequest(string walletName, string password, IEnumerable <TransactionAddress> inputs, IEnumerable <TransactionAddress> outputs, Fee fee, long locktime) { foreach (var input in inputs) { Inputs.Add(new TransactionItem(input.Address, input.Value)); } foreach (var output in outputs) { Outputs.Add(new TransactionItem(output.Address, output.Value)); } WalletName = walletName; Password = password; Fee = new FeeRequest(fee.Value, fee.Address); Locktime = locktime; }
public void Post([FromRoute] int parkId, [FromBody] Fee fee) { fee.ParkId = parkId; _db.Fees.Add(fee); _db.SaveChanges(); }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("Transaction"); oprot.WriteStructBegin(struc); TField field = new TField(); if (__isset.id) { field.Name = "id"; field.Type = TType.I64; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteI64(Id); oprot.WriteFieldEnd(); } if (Source != null && __isset.source) { field.Name = "source"; field.Type = TType.String; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteBinary(Source); oprot.WriteFieldEnd(); } if (Target != null && __isset.target) { field.Name = "target"; field.Type = TType.String; field.ID = 3; oprot.WriteFieldBegin(field); oprot.WriteBinary(Target); oprot.WriteFieldEnd(); } if (Amount != null && __isset.amount) { field.Name = "amount"; field.Type = TType.Struct; field.ID = 4; oprot.WriteFieldBegin(field); Amount.Write(oprot); oprot.WriteFieldEnd(); } if (Balance != null && __isset.balance) { field.Name = "balance"; field.Type = TType.Struct; field.ID = 5; oprot.WriteFieldBegin(field); Balance.Write(oprot); oprot.WriteFieldEnd(); } if (__isset.currency) { field.Name = "currency"; field.Type = TType.Byte; field.ID = 6; oprot.WriteFieldBegin(field); oprot.WriteByte(Currency); oprot.WriteFieldEnd(); } if (Signature != null && __isset.signature) { field.Name = "signature"; field.Type = TType.String; field.ID = 7; oprot.WriteFieldBegin(field); oprot.WriteBinary(Signature); oprot.WriteFieldEnd(); } if (SmartContract != null && __isset.smartContract) { field.Name = "smartContract"; field.Type = TType.Struct; field.ID = 8; oprot.WriteFieldBegin(field); SmartContract.Write(oprot); oprot.WriteFieldEnd(); } if (Fee != null && __isset.fee) { field.Name = "fee"; field.Type = TType.Struct; field.ID = 9; oprot.WriteFieldBegin(field); Fee.Write(oprot); oprot.WriteFieldEnd(); } if (__isset.timeCreation) { field.Name = "timeCreation"; field.Type = TType.I64; field.ID = 10; oprot.WriteFieldBegin(field); oprot.WriteI64(TimeCreation); oprot.WriteFieldEnd(); } if (UserFields != null && __isset.userFields) { field.Name = "userFields"; field.Type = TType.String; field.ID = 11; oprot.WriteFieldBegin(field); oprot.WriteBinary(UserFields); oprot.WriteFieldEnd(); } if (__isset.type) { field.Name = "type"; field.Type = TType.I32; field.ID = 12; oprot.WriteFieldBegin(field); oprot.WriteI32((int)Type); oprot.WriteFieldEnd(); } if (SmartInfo != null && __isset.smartInfo) { field.Name = "smartInfo"; field.Type = TType.Struct; field.ID = 13; oprot.WriteFieldBegin(field); SmartInfo.Write(oprot); oprot.WriteFieldEnd(); } if (ExtraFee != null && __isset.extraFee) { field.Name = "extraFee"; field.Type = TType.List; field.ID = 14; oprot.WriteFieldBegin(field); { oprot.WriteListBegin(new TList(TType.Struct, ExtraFee.Count)); foreach (ExtraFee _iter22 in ExtraFee) { _iter22.Write(oprot); } oprot.WriteListEnd(); } oprot.WriteFieldEnd(); } if (__isset.poolNumber) { field.Name = "poolNumber"; field.Type = TType.I64; field.ID = 15; oprot.WriteFieldBegin(field); oprot.WriteI64(PoolNumber); oprot.WriteFieldEnd(); } if (UsedContracts != null && __isset.usedContracts) { field.Name = "usedContracts"; field.Type = TType.List; field.ID = 16; oprot.WriteFieldBegin(field); { oprot.WriteListBegin(new TList(TType.String, UsedContracts.Count)); foreach (byte[] _iter23 in UsedContracts) { oprot.WriteBinary(_iter23); } oprot.WriteListEnd(); } oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }
private async void Send() { try { _dialogViewer.PushPage(_dialogId, Pages.Sending); Error error; if (From != null && TokenContract != null) // tezos token sending { var tokenAddress = await TezosTokensSendViewModel.GetTokenAddressAsync( account : App.AtomexApp.Account, address : From, tokenContract : TokenContract, tokenId : TokenId, tokenType : TokenType); if (tokenAddress.Currency == "FA12") { var currencyName = App.AtomexApp.Account.Currencies .FirstOrDefault(c => c is Fa12Config fa12 && fa12.TokenContractAddress == TokenContract) ?.Name ?? "FA12"; var tokenAccount = App.AtomexApp.Account .GetTezosTokenAccount <Fa12Account>(currencyName, TokenContract, TokenId); error = await tokenAccount .SendAsync(new WalletAddress[] { tokenAddress }, To, Amount, Fee, FeePrice, UseDeafultFee); } else { var tokenAccount = App.AtomexApp.Account .GetTezosTokenAccount <Fa2Account>("FA2", TokenContract, TokenId); var decimals = tokenAddress.TokenBalance.Decimals; var amount = Amount * (decimal)Math.Pow(10, decimals); var fee = (int)Fee.ToMicroTez(); error = await tokenAccount.SendAsync( from : From, to : To, amount : amount, tokenContract : TokenContract, tokenId : (int)TokenId, fee : fee, useDefaultFee : UseDeafultFee); } } else { var account = App.AtomexApp.Account .GetCurrencyAccount <ILegacyCurrencyAccount>(Currency.Name); error = await account .SendAsync(To, Amount, Fee, FeePrice, UseDeafultFee); } if (error != null) { _dialogViewer.PushPage(_dialogId, Pages.Message, MessageViewModel.Error( text: error.Description, backAction: BackToConfirmation)); return; } _dialogViewer.PushPage(_dialogId, Pages.Message, MessageViewModel.Success( text: "Sending was successful", nextAction: () => { _dialogViewer.HideDialog(_dialogId); })); } catch (Exception e) { _dialogViewer.PushPage(_dialogId, Pages.Message, MessageViewModel.Error( text: "An error has occurred while sending transaction.", backAction: BackToConfirmation)); Log.Error(e, "Transaction send error."); } }
public int CreateFee(Fee fees) { return _feeRepository.Create(fees); }
public async Task <ActionResult <Fee> > PostFee(Fee fee) { var feeList = _feesManager.AddFee(fee); return(Ok(_mapper.Map <IEnumerable <FeeDTO> >(feeList))); }
private static void swapUpfrontFee(Dictionary<string, dynamic> importRow, Trade trade) { if (importRow.ContainsKey("Fee Amount") && Math.Abs(importRow["Fee Amount"]) > Utilities.Epsilon) { double feeAmount = importRow["Fee Amount"]; string feeCcy = importRow["Fee Currency"]; string feePayRec = importRow["Fee Pay/Rec"]; string feeDate = importRow["Fee Date"]; var fee = new Fee { Date = new SimpleDate(DateTime.ParseExact(feeDate, "dd-MMM-yy", null, DateTimeStyles.None)), FeeType = FeeType.Upfront, PartyId = trade.PartyId, Currency = feeCcy, Amount = Math.Abs(feeAmount), PayReceive = feePayRec.Equals("Pay") ? PayReceive.Pay : PayReceive.Receive }; if (trade.Fees == null) trade.Fees = new List<Fee>(); trade.Fees.Add(fee); } }
public override string ToString() { return("Child Contestant " + Name + " " + TalentCode + " Fee " + Fee.ToString("C")); }