public AnteprimaReportRipartoPersona(IList<ReportRipartizioneBilancioDTO> dataSource, CondominioDTO condominio, EsercizioDTO esercizio, IList<PersonaContattoDTO> personeRiparto, Dictionary<int, IList<IList<UnitaImmobiliareListaDTO>>> listaUnitaImmobiliare, BilancioConsuntivoReportParameters parameters, ImpostazioneReportDTO impostazioneReportDTO, string reportKey, string note)
        {
            InitializeComponent();
            _dataSource = dataSource;
            _condominio = condominio;
            _esercizio = esercizio;
            _parameters = parameters;
            _personeRiparto = personeRiparto;
            _impostazioneReportDTO = impostazioneReportDTO;
            _note = note;

            Text = $"Riparto {_impostazioneReportDTO.Descrizione}";

            try
            {
                _importoTotale = getBilancioService().GetTotale(dataSource.ToList());
                _importoPreventivo = getBilancioService().GetTotalePreventivo(dataSource.ToList());

                IReportProvider document = new RipartoAnnualePersona(dataSource, _condominio, _esercizio, personeRiparto, listaUnitaImmobiliare, _parameters, _impostazioneReportDTO, reportKey, _note);
                SetDataSource(document.GetReport(), _impostazioneReportDTO);
            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Errore nell'apertura della maschera di anteprima per riparto - {0} - condominio:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), _condominio?.ID.ToString(CultureInfo.InvariantCulture) ?? "<NULL>", Login.Instance.CurrentLogin().Azienda);
                throw;
            }
        }
Example #2
1
        public AnteprimaReportRiparto(IList<ReportRipartizioneBilancioDTO> dataSource, CondominioDTO condominio, EsercizioDTO esercizio, BilancioConsuntivoReportParameters parameters, ImpostazioneReportDTO impostazioneReportDTO)
        {
            InitializeComponent();
            _dataSource = dataSource;
            _condominio = condominio;
            _esercizio = esercizio;
            _parameters = parameters;
            _impostazioneReportDTO = impostazioneReportDTO;

            Text = $"Riparto {_impostazioneReportDTO.Descrizione}";

            try
            {
                _importoTotale = getBilancioService().GetTotale(dataSource.ToList());
                _importoPreventivo = getBilancioService().GetTotalePreventivo(dataSource.ToList());

                IReportProvider document;
                if(_impostazioneReportDTO.MultiPageOrdered)
                    document = new RipartoMerge(dataSource, _condominio, _esercizio, _parameters, _impostazioneReportDTO, _importoTotale, _importoPreventivo);
                else
                    document = new RipartoSubreport(dataSource, _condominio, _esercizio, _parameters, _impostazioneReportDTO, _importoTotale, _importoPreventivo);
                
                SetDataSource(document.GetReport(), _impostazioneReportDTO);
            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Errore nell'apertura della maschera di anteprima per riparto - {0} - condominio:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), _condominio?.ID.ToString(CultureInfo.InvariantCulture) ?? "<NULL>", Login.Instance.CurrentLogin().Azienda);
                Close();
            }
        }
        private static IList<SignatureHelpItem> Filter(IList<SignatureHelpItem> items, IEnumerable<string> parameterNames)
        {
            if (parameterNames == null)
            {
                return items.ToList();
            }

            var filteredList = items.Where(i => Include(i, parameterNames)).ToList();
            return filteredList.Count == 0 ? items.ToList() : filteredList;
        }
Example #4
1
        /// <summary>
        /// Accepts a collection of frames and returns the total score
        /// </summary>
        /// <param name="scores"></param>
        /// <returns></returns>
        public int CalculateTotalScore(IList<IFrame> scores)
        {

            ValidateFrames(scores.ToList());

            var totalScore = 0;

            scores.ToList().ForEach(sc => totalScore += sc.Score);

            return totalScore;
        }
Example #5
1
        public long Run(IList<int> numbers)
        {
            long total = 0;
            int amount = this.maximum;
            int k;

            var rest = numbers.ToList();

            for (k = 0; k < numbers.Count - 1; k++)
            {
                int move = this.Decide(amount, rest);
                total += (long)move * numbers[k];
                amount -= move;
                amount += this.reload;

                if (amount > this.maximum)
                    amount = this.maximum;

                rest = rest.Skip(1).ToList();
            }

            total += (long)amount * numbers[k];

            return total;
        }
        /// <summary>
        /// Get the ToolbarItem reference by it's name.
        /// </summary>
        /// <returns>The ToolbarItem object that references the UIBarButtonInfo.</returns>
        /// <param name="items">The list of Items.</param>
        /// <param name="title">The button title.</param>
        ToolbarItem GetToolbarItem(IList<ToolbarItem> items, string title)
        {
            if (string.IsNullOrEmpty(title) || items == null)
                return null;

            return items.ToList().FirstOrDefault(itemData => title.Equals(itemData.Text));
        }
Example #7
1
        /// <summary>
        /// When the activity is created
        /// </summary>
        /// <param name="bundle">Any data passed to the activity</param>
        protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

            //Allow this inbox to be retrieved by other classes
            //This allows the inbox to be updated when a new message arrives
			MainActivity.references.Put ("Inbox", this);

			SetContentView(Resource.Layout.messaging_inbox);

			taskListView = (ListView)FindViewById (Resource.Id.listView);
            
            //Get all the users that this user has had a conversation with
            users = MessageRepository.GetMessagedUsers().ToArray<string>();
            tasks = new List<Message>();

            //Get the most recent message from each user to display in the "main" messaging list
            foreach (string s in users)
            {
                tasks.Add(MessageRepository.GetMostRecentMessageFrom(s));
            }
            
            // create our adapter
            taskList = new MsgListAdapterInbox(this, users.ToList());

			//Hook up our adapter to our ListView
			taskListView.Adapter = taskList;
		}
        public Validation CreatePackage(ref Package package, IList<long> items)
        {
            var val = _validator.ValidateNewPackage(package, null);

            var trans = _factory.BuildTransaction("InsertPackage");
            try
            {
                //validate
                if (val.IsValid)
                {
                    _repo.Insert(ref package, ref trans);
                    long packageId = package.Id;
                    items.ToList().ForEach(i => _itemRepo.SetItemPackage(i, packageId, ref trans));
                }
                trans.Commit();
            }
            catch (Exception e)
            {
                trans.Rollback();
                val.AddError(string.Format("Unable to create package: {0}", e.Message));
            }
            finally
            {
                trans.Dispose();
            }
            return val;
        }
 public static SyncOptions OptionsForSyncUp(IList<string> fieldList, MergeModeOptions mergeMode)
 {
     var nativeMergeMode = JsonConvert.SerializeObject(mergeMode);
     var nativeSyncOptions = SDK.SmartSync.Model.SyncOptions.OptionsForSyncUp(fieldList.ToList(), JsonConvert.DeserializeObject<SDK.SmartSync.Model.SyncState.MergeModeOptions>(nativeMergeMode));
     var syncOptions = JsonConvert.SerializeObject(nativeSyncOptions);
     return JsonConvert.DeserializeObject<SyncOptions>(syncOptions);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ListController"/> class.
 /// </summary>
 /// <param name="list">
 /// The list. 
 /// </param>
 /// <param name="dialogTitle">
 /// The dialog title. 
 /// </param>
 public ListController(IList<string> list, string dialogTitle)
 {
     // Clone the list. That way, if the close button is used
     // the original list won't be affected.
     this.List = new BindingList<string>(list.ToList());
     this.Title = dialogTitle;
 }
        public void Execute(IList<IAggregateCommand> commands, int expectedVersion)
        {
            if (commands.Count == 0)
            {
                return;
            }

            // readModelBuilderBus will publish events to a bus that will build read models and then pass events off to
            // the real eventBus
            var readModelBuilderBus = new ReadModelBuildingEventBus(this.registration.ImmediateReadModels(this.scope), this.eventBus);

            // holds the events that were raised from the aggregate and will push them to the read model building bus
            var aggregateEvents = new UnitOfWorkEventBus(readModelBuilderBus);

            // subscribe to the changes in the aggregate and publish them to aggregateEvents
            var aggregateRepo = new AggregateRepository(registration.New, this.scope.GetRegisteredObject<IEventStore>(), scope.GetRegisteredObject<ISnapshotRepository>());
            var subscription = aggregateRepo.Changes.Subscribe(aggregateEvents.Publish);
            this.scope.Add(new UnitOfWorkDisposable(subscription));

            // add them in this order so that aggregateEvents >> readModelBuilderBus >> read model builder >> eventBus
            this.scope.Add(aggregateEvents);
            this.scope.Add(readModelBuilderBus);

            var cmd = new CommandExecutor(aggregateRepo);
            cmd.Execute(commands.ToList(), expectedVersion);

            // enqueue pending commands
            this.EnqueueCommands(this.scope.GetRegisteredObject<IPendingCommandRepository>(), commands);

            // enqueue read models to be built - for non-immediate read models
            var typeName = AggregateRootBase.GetAggregateTypeDescriptor(registration.AggregateType);
            this.EnqueueReadModels(this.scope.GetRegisteredObject<IReadModelQueueProducer>(), typeName, aggregateEvents.GetEvents().Select(x => x.Event).OfType<IAggregateEvent>().ToList());
        }
Example #12
1
        private void setupElems(IList<Profile.ElementComponent> elements)
        {
            if (elements == null) throw Error.ArgumentNull("elements");

            _elements = elements.ToList();      // make a *shallow* copy of the list of elements
            OrdinalPosition = null;
        }
        public void UpdateMarkers(IList<MediaMarker> markers, bool forceRefresh)
        {
            var markersHash = markers.ToDictionary(i => i.Id, i => i);

            List<MediaMarker> newMarkers;
            List<MediaMarker> removedMarkers;

            if (forceRefresh)
            {
                newMarkers = markers.ToList();
                removedMarkers = _previousMarkers.Values.ToList();
            }
            else
            {
                newMarkers = markers.Where(i => !_previousMarkers.ContainsKey(i.Id)).ToList();
                removedMarkers = _previousMarkers.Values.Where(i => !markersHash.ContainsKey(i.Id)).ToList();
            }

            if (removedMarkers.Any() && MarkersRemoved != null)
            {
                MarkersRemoved(removedMarkers);
            }

            if (newMarkers.Any() && NewMarkers != null)
            {
                NewMarkers(newMarkers);
            }

            _previousMarkers = markersHash;
        }
Example #14
0
		private ToolbarItem GetButtonInfo(IList<ToolbarItem> items, string name)
		{
			if (string.IsNullOrEmpty(name) || items == null)
				return null;

			return items.ToList().Where(itemData => name.Equals(itemData.Name)).FirstOrDefault();
		}
        public CompletedItemReviewer(IList<SuspiciousPhrase> basicSuspiciousPhrases)
        {
            if (basicSuspiciousPhrases == null)
                throw new ArgumentNullException(nameof(basicSuspiciousPhrases));

            _basicSuspiciousPhrases = basicSuspiciousPhrases.ToList();
        }
        public static float ApplyFilter(IList<float> buffered, int indexOfSource, int dropSize, int takeSize)
        {
            var list = buffered.ToList();
            list.Sort();

            return list.Skip(dropSize).Take(takeSize).Average();
        }
        public async Task<Route> CalcuteRouteAsync(IList<AddressSearch> addressSearches, RouteType routeType)
        {
            var routeStops = new List<RouteStop>();

            addressSearches.ToList().ForEach(x =>
            {
                var routeStop = Mapper.Map<AddressSearch, RouteStop>(x);
                var point = Mapper.Map<AddressSearch, Point>(x);
                routeStop.point = point;
                routeStops.Add(routeStop);
            });

            var options = _config.GetRouteOptions(routeType);

            using (var routeSoapClient = new RouteSoapClient())
            {
                var response = await routeSoapClient.getRouteAsync(routeStops.ToArray(), options, _token.Tokenvalue);

                if (response.Body.getRouteResult.routeTotals != null)
                {
                    var route = Mapper.Map<RouteTotals, Route>(response.Body.getRouteResult.routeTotals);                    
                    return route;
                }
            }
            return null;
        }
Example #18
0
 public ConsoleManager(IList<Command> allCommands, TextReader consoleReader, TextWriter consoleWriter)
 {
     _allCommands = allCommands;
     _consoleReader = consoleReader;
     _consoleWriter = consoleWriter;
     _commandParser = new CommandParser(_allCommands.ToList());
 }
Example #19
0
        public SolutionWriter(ProjectVersion projectVersion, IList<Project> projects, string filename)
        {
            this.projectVersion = projectVersion;
            this.projects = projects.ToList();
            this.projects.Sort((a, b) => {
                // Sort exes first since VS picks the first file in the solution to be the
                // "StartUp Project".
                int ae = (a.Module.Characteristics & Characteristics.Dll) == 0 ? 0 : 1;
                int be = (b.Module.Characteristics & Characteristics.Dll) == 0 ? 0 : 1;
                int c = ae.CompareTo(be);
                if (c != 0)
                    return c;
                return StringComparer.OrdinalIgnoreCase.Compare(a.Filename, b.Filename);
            });
            this.filename = filename;

            this.configs = new List<string>();
            this.configs.Add("Debug");
            this.configs.Add("Release");

            var hash = new HashSet<string>(projects.Select(a => a.Platform));
            this.platforms = new List<string>(hash.Count);
            this.platforms.Add("Any CPU");
            hash.Remove("AnyCPU");
            if (hash.Count > 0)
                this.platforms.Add("Mixed Platforms");
            foreach (var p in hash)
                this.platforms.Add(p);
        }
Example #20
0
		public PocoSettings(
			bool makePartial,
			string nameSpace,
			IList<string> nameSpaceComments,
			bool createDefaultConstructor, 
			bool createAllPropertiesConstructor, 
			bool createAllPropertiesSansPrimaryKeyConstructor,
			bool createCopyConstructor,
			bool createMethodEquals, 
			string createMethodEqualsRegex,
            string outputFolder, 
			string projectPath, 
			string xmlOutputFilename)
		{
			this.MakePartial = makePartial;
			this.NameSpace = nameSpace;
			this.NameSpaceComments = nameSpaceComments.ToList();
			this.CreateDefaultConstructor = createDefaultConstructor;
			this.CreateAllPropertiesConstructor = createAllPropertiesConstructor;
			this.CreateAllPropertiesSansPrimaryKeyConstructor = createAllPropertiesSansPrimaryKeyConstructor;
			this.CreateCopyConstructor = createCopyConstructor;

			this.CreateMethodEquals = createMethodEquals;
			this.CreateMethodEqualsRegex = createMethodEqualsRegex;

			this.OutputFolder = outputFolder;
			this.ProjectPath = projectPath;
			this.XmlOutputFilename = xmlOutputFilename;
		}
        public async void Add(IList<ITableEntity> notes)
        {
            var batchOperation = new TableBatchOperation();

            notes.ToList().ForEach(n => batchOperation.Insert(n));
            await _table.ExecuteBatchAsync(batchOperation);
        }
		/// <summary>
		/// Initializes a new instance of UITableView.
		/// </summary>
		/// <param name="data">Source Data.</param>
		/// <param name="cellHeight">cellHeight, use 0 for default.</param>
		/// <param name="fSize">Cell Font size.</param>
		/// <param name="cellSelectedBackgroundColor">Cell selected background color, Use Clear for default</param>
		/// <param name="cellSelectedTextColor">Cell selected text color, Use Clear for default</param>
		public DropDownTable(IList<string> data, nfloat cellHeight,
			nfloat fSize, UIColor cellSelectedBackgroundColor, UIColor cellSelectedTextColor,
			string selectedText = "") : base()
		{
			CellLayoutMarginsFollowReadableWidth = false;
			this.MultipleTouchEnabled = true;
			this._FontSize = fSize;
			this._CellHeight = cellHeight;
			this._CellSBackgroundColor = cellSelectedBackgroundColor;
			this._CellSTextColor = cellSelectedTextColor;

			Source = new DropDownSource (data, this._FontSize, this._CellHeight, this._CellSBackgroundColor, 
				this._CellSTextColor, selectedText);

			//ContentInset =  new UIEdgeInsets(0, -10, 0, 0);
			LayoutMargins = UIEdgeInsets.Zero;
			SeparatorInset = UIEdgeInsets.Zero;

			// select default row
			var idx = data.ToList().FindIndex(x => x == selectedText);
			System.Diagnostics.Debug.WriteLine (idx);
			if (idx >= 0) {
				this.SelectRow (Foundation.NSIndexPath.FromItemSection (idx, 0), false, UITableViewScrollPosition.Top);
			}

			(Source as DropDownSource).OnSelected += RowSelected;
		}
        public ActionResult Create(decimal valor, Pessoa pessoa, IList<Lancamento> lancamentos)
        {
            try
            {
                Caixa caixa = new Caixa()
                {
                    Valor = valor,
                    DataPagamento = DateTime.Now,
                    Pessoa = pessoa,
                    Lancamentos = new List<Lancamento>()
                };
                lancamentos.ToList().ForEach(x => caixa.Lancamentos.Add(new Lancamento()
                    {
                        LancamentoId = x.LancamentoId,
                        Valor = x.Valor,
                        DataVencimento = x.DataVencimento,
                        Pago = true
                    }));
                _caixaServicos.Salva(caixa);

                return Json(new
                {
                    Success = true
                }, "application/json", JsonRequestBehavior.AllowGet);
            }
            catch
            {
                return Json(new
                {
                    Success = false
                }, "application/json", JsonRequestBehavior.AllowGet);
            }
            return View();
        }
Example #24
0
 public void ListarEventos(IList<EventoDTO> eventos)
 {
     dgListaEventos.DataSource = eventos.ToList();
     dgListaEventos.Columns["Comentario"].Visible = false;
     dgListaEventos.Columns["Pruebas"].Visible = false;
     dgListaEventos.Columns["EstaHabilitado"].Visible = false;
 }
Example #25
0
 private static void GenerateChains(IList<int> chain, int n)
 {
     var count = chain.Count;
     if (count >= n) return;
     var last = chain.Last();
     var nextElems = _dict[last].Where(k => !chain.Contains(k)).ToList();
     if (nextElems.Any() && count < n)
     {
         foreach (var next in nextElems)
         {
             var deeper = chain.ToList();
             deeper.Add(next);
             GenerateChains(deeper, n);
         }
     }
     else if (IsPrime(last + 1) && count == n - 1)
     {
         _nrOfChains++;
         /*foreach (var elem in chain)
         {
             Console.Write(elem+" ");
         }
         Console.WriteLine(1);*/
     }
 }
Example #26
0
 public void Add(IList<HandlerTypeInfo> typeInfos)
 {
     if (!_set)
     {
         if (typeInfos.Count == 1)
         {
             _single = typeInfos[0];
         }
         else
         {
             _list = new List<HandlerTypeInfo>(typeInfos);
         }
         _set = true;
     }
     else
     {
         if (_single != null)
         {
             _list = typeInfos as List<HandlerTypeInfo> ?? typeInfos.ToList();
             _list.Insert(0, _single);
             _single = null;
         }
         else
         {
             _list.AddRange(typeInfos);
         }
     }
 }
        public ElementNavigator(IList<ElementDefinition> elements)
        {
            if (elements == null) throw Error.ArgumentNull("elements");

            Elements = elements.ToList();      // make a *shallow* copy of the list of elements
            OrdinalPosition = null;
        }
Example #28
0
        public SessionFactoryBuilder(IDatabasePlatform platform, string connStr, IList<Assembly> assemblies, bool updateSchema, string defaultSchema, ILinqToHqlGeneratorsRegistry linqRegistry, bool showSql, Action<global::NHibernate.Cfg.Configuration> exposedConfig)
        {
            var configurer = platform.AsNHibernateConfiguration(connStr) as IPersistenceConfigurer;

            global::NHibernate.Cfg.Configuration configuration = null;

            _sessionFactory = Fluently.Configure()
            .Database(configurer)
            .Mappings(m => assemblies.ToList().ForEach(asm=> m.FluentMappings.AddFromAssembly(asm)))

            .ExposeConfiguration(cfg =>
                                 {
                                     configuration = cfg;
                                     cfg.SetProperty(global::NHibernate.Cfg.Environment.CollectionTypeFactoryClass, typeof(List<>).AssemblyQualifiedName);
                                     cfg.SetProperty(global::NHibernate.Cfg.Environment.PrepareSql, false.ToString());
                                     cfg.SetProperty(global::NHibernate.Cfg.Environment.ShowSql, showSql.ToString());
                                     cfg.SetProperty(global::NHibernate.Cfg.Environment.TransactionStrategy, "NHibernate.Transaction.AdoNetTransactionFactory");
                                     if(!String.IsNullOrEmpty(defaultSchema))
                                         cfg.SetProperty(global::NHibernate.Cfg.Environment.DefaultSchema, defaultSchema);
                                     if (null != linqRegistry)
                                        cfg.SetProperty(global::NHibernate.Cfg.Environment.LinqToHqlGeneratorsRegistry, linqRegistry.GetType().AssemblyQualifiedName);
                                     if(exposedConfig != null)
                                        exposedConfig(cfg);

                                 })
            .BuildSessionFactory();
            if (updateSchema)
                UpdateSchema(configuration);
        }
Example #29
0
        public SeriesData(int seriesId, SeriesMetadata myMeta, IList<DataValue> dataValues, Variable variable, 
            List<Source> sources, List<Method> methods, List<QualityControlLevel> qualityControlLevels)
            : this()
        {
            myMetadata = myMeta;
            SeriesID = seriesId;
            HasConfirmedTimeStamp = true;
            TimeStampMessage = string.Empty;
            myVariable = variable;
            values = dataValues.ToList();
            ontology = new List<OntologyItem>();
            tags = new List<HydroTag>();
            if (null != sources)
            {
                mySources = sources;
            }

            if (null != methods)
            {
                myMethods = methods;
            }

            if (null != qualityControlLevels)
            {
                myQualityControlLevels = qualityControlLevels;
            }
        }
        public void AppendToStream(IIdentity id, long expectedVersion, IList<IEvent> newEvents)
        {
            var server = this.client.GetServer();
            var db = server.GetDatabase("EventStore");
            var query = Query<MongoEventDocument>.EQ(s => s.id, id);
            
            var events = db.GetCollection<MongoEventDocument>("Events",_commitSettings);

            //events.Insert<MongoEventDocument>(new MongoEventDocument
            //{
            //    events = newEvents.ToList<IEvent>(),
            //    id = id,
            //    version = 1
            //});

            var doc = events.FindOneAs<MongoEventDocument>(query);
            if (doc == null) events.Insert<MongoEventDocument>(new MongoEventDocument
            {
                events = newEvents.ToList<IEvent>(),
                id = id,
                version = 1
            });
            if (doc != null)
            {
                doc.events.AddRange(newEvents);
                doc.version += 1;
                events.Save(doc);
            }


        }