public static async Task <InterestItem> AddInterest(InterestItem e) { var client = GetClient(); var ret = await client.Child("Interests").PostAsync(e); ret.Object.Key = ret.Key; return(ret.Object); }
void GetNewInterestItem() { InterestItem[] items = FindObjectsOfType <InterestItem>(); if (items.Length > 0) { currentInterestItem = items[(int)(Random.value * items.Length)]; startedObservingTimestamp = Time.time; } }
/// <summary> /// Reads an <see cref="InterestItem"/> from the stream /// </summary> /// <returns>A populated <see cref="InterestItem"/></returns> public InterestItem ReadInterestItem() { InterestItem retval = new InterestItem(); retval.Group = (ReadByte() == 0x01); retval.ID = ReadByte(); retval.Name = ReadString(ReadUshort(), Encoding.ASCII); return(retval); }
/// <summary> /// Processes a list of known interests from the server -- SNAC(0F,05) /// </summary> /// <param name="dp">A <see cref="DataPacket"/> object with a buffer containing SNAC(0F,05)</param> /// <remarks> /// libfaim doesn't implement the interest list fetching, so this one's thanks to Mark Doliner's /// ([email protected]) documentation. /// </remarks> public static void ProcessInterestList(DataPacket dp) { dp.Data.ReadUshort(); // First two bytes: 0x0001 ushort num_items = dp.Data.ReadUshort(); InterestItem[] interests = new InterestItem[num_items]; for (int i = 0; i < num_items; i++) { interests[i] = dp.Data.ReadInterestItem(); } dp.ParentSession.OnInterestsReceived(interests); }
public static bool SaveInterestType(int loanId, InterestType type,decimal amount) { var loan = ObjectContext.LoanAccounts.FirstOrDefault(entity => entity.FinancialAccountId == loanId); if (loan.InterestTypeId == type.Id) return false; else { var olditem = ObjectContext.InterestItems.FirstOrDefault(entity => entity.LoanId == loanId && entity.IsActive == true); loan.InterestTypeId = type.Id; if (olditem != null) { olditem.IsActive = false; } InterestItem item = new InterestItem(); item.LoanAccount = loan; item.IsActive = true; item.Amount = amount; ObjectContext.InterestItems.AddObject(item); return true; } }
public static async Task RemoveInterest(InterestItem e) { var client = GetClient(); await client.Child("Interests").Child(e.Key).DeleteAsync(); }
/// <summary> /// Reads an <see cref="InterestItem"/> from the stream /// </summary> /// <returns>A populated <see cref="InterestItem"/></returns> public InterestItem ReadInterestItem() { InterestItem retval = new InterestItem(); retval.Group = (ReadByte() == 0x01); retval.ID = ReadByte(); retval.Name = ReadString(ReadUshort(), Encoding.ASCII); return retval; }
private InterestItem CreateInterestItem(LoanAccount loanAccount, decimal newInterest, DateTime today) { InterestItem newInterestItem = new InterestItem(); newInterestItem.LoanAccount = loanAccount; newInterestItem.Amount = newInterest; newInterestItem.IsActive = true; return newInterestItem; }
public async Task RemoveInterest(InterestItem item) { await FirebaseDbConnection.RemoveInterest(item); Interests.Remove(item); }