public static void Main(string[] args)
        {
            var entry1 = new ParameterEntry();

            entry1.Add("name", "EVENT_PARAM_SCTP_SHUTDOWN_RESULT");
            entry1.Add("usevalid", "Yes");
            entry1.Add("description", "The results of a SCTP Shutdown");
            entry1.Add("numberofbytes", 1);
            entry1.Add("type", "ENUM");

            var entry2 = new ParameterEntry();

            entry2.Add("name", "EVENT_PARAM_ENBS1APID");
            entry2.Add("numberofbytes", 3);
            entry2.Add("usevalid", "Yes");
            entry2.Add("description", "eNB S1 AP ID");
            entry2.Add("resolution", 1);
            entry2.Add("type", "UINT");

            var types = new ParameterTypes();

            types.Add(entry1);
            types.Add(entry2);

            Console.WriteLine(types["EVENT_PARAM_ENBS1APID"]["name"]);
            Console.WriteLine(types["EVENT_PARAM_ENBS1APID"]["numberofbytes"]);
            Console.WriteLine(types["EVENT_PARAM_ENBS1APID"]["usevalid"]);
            Console.WriteLine(types["EVENT_PARAM_ENBS1APID"]["description"]);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds deposit details to database
        /// </summary>
        /// <param name="depositDetails">
        /// All details stored as class object
        /// </param>
        public void AddDepositDetails(Deposit deposit)
        {
            moneyManagerContext.Deposit.Add(deposit);
            //get list of all parameters that have amount less than balane
            //order by balance with lowest first
            var parameterList = moneyManagerContext.Parameters
                                .Where(parameter => parameter.ParameterBalance < parameter.ParameterAmount)
                                .OrderBy(parameter => parameter.ParameterBalance)
                                .ToList();
            var balance = deposit.DepositAmount;

            //add amount to balance from deposit and save changes
            foreach (var parameter in parameterList)
            {
                var amountToBeAdded      = parameter.ParameterAmount - parameter.ParameterBalance;
                var amountThatCanBeAdded = balance <= amountToBeAdded ? balance : amountToBeAdded;
                if (amountToBeAdded > (0.25 * parameter.ParameterAmount))
                {
                    ParameterEntry parameterEntry = new ParameterEntry()
                    {
                        ParameterId        = parameter.ParameterId,
                        DepositId          = deposit.DepositId,
                        AddedBalance       = amountThatCanBeAdded,
                        IsSavingsParameter = false
                    };
                    moneyManagerContext.ParameterEntry.Add(parameterEntry);
                    parameter.ParameterBalance = parameter.ParameterBalance + amountThatCanBeAdded;
                    balance = balance - amountThatCanBeAdded;
                    moneyManagerContext.Entry(parameter).State = EntityState.Modified;
                }
            }
            var savingsParameterList = moneyManagerContext.SavingsParameters.ToList();

            foreach (var savingsParameter in savingsParameterList)
            {
                ParameterEntry parameterEntry = new ParameterEntry()
                {
                    SavingsParameterId = savingsParameter.SavingsParameterId,
                    DepositId          = deposit.DepositId,
                    AddedBalance       = balance / savingsParameterList.Count,
                    IsSavingsParameter = true
                };
                moneyManagerContext.ParameterEntry.Add(parameterEntry);
                savingsParameter.SavingsParameterBalance          = savingsParameter.SavingsParameterBalance + (balance / savingsParameterList.Count);
                moneyManagerContext.Entry(savingsParameter).State = EntityState.Modified;
            }

            moneyManagerContext.SaveChanges();
        }
Exemplo n.º 3
0
        public void SetParameter(string key, string value)
        {
            var entry   = new ParameterEntry(key, value);
            var updated = false;
            var entries = _ParameterEntries
                          .Select((p) =>
            {
                if (p.Key != key || updated)
                {
                    return(p);
                }
                updated = true;
                return(entry);
            });

            // Force calculation of updated flag
            entries = entries.ToArray();
            if (!updated)
            {
                entries = entries.Concat(new[] { entry });
            }
            _ParameterEntries      = entries.ToArray();
            ParameterEntriesLookup = null;
        }
Exemplo n.º 4
0
		public void AddParameterToDefaultsList( GpuProgramParameterType type, string name )
		{
			ParameterEntry p = new ParameterEntry();
			p.ParameterType = type;
			p.ParameterName = name;
			paramTypeList.Add( p );
		}
 private ParameterEntry CreateParameterEntry(ParameterDescription parameter, Compiler.CodeModel.SymbolTable table)
 {
     var generated = new ParameterEntry((ParameterDescriptionEntry)parameter.CodeElement, table);
     foreach(var child in parameter.Children) generated.Add(child);
     return generated;
 }
Exemplo n.º 6
0
 private ParameterEntry CreateParameterEntry(ParameterDescriptionEntry parameter, Compiler.CodeModel.SymbolTable table)
 {
     var generated = new ParameterEntry(parameter, table);
     if (parameter.DataConditions != null) {
     foreach (var child in parameter.DataConditions) generated.Add(new DataCondition(child));
     }
     return generated;
 }
Exemplo n.º 7
0
        public static IParameterEntryViewModel ToViewModel(this ParameterEntry entity)
        {
            var dto = entity.Map <ParameterEntry, IParameterEntryViewModel>();

            return(dto);
        }