Пример #1
0
        public string GetUserInfoText(RichiedentePraticaDTO richiedente)
        {
            var siglaRichiedente = string.Empty;
            if (!string.IsNullOrEmpty(richiedente?.SiglaRichiedente))
                siglaRichiedente = "--> " + richiedente.SiglaRichiedente + " ";

            return "<span><strong>{0} " + siglaRichiedente + "{1}</strong></span><br/>";
        }
Пример #2
0
        public IList<RichiedentePraticaDTO> GetAllRichiedenti(int idCondominio, int? idPratica)
        {
            try
            {
                var condominio = _daoFactory.GetCondominioDao().GetById(idCondominio, false);

                const string hql = "SELECT SOG.Persona FROM SoggettoCondominio SOG WHERE SOG.UnitaImmobiliare.GruppoStabileRiferimento.PalazzinaRiferimento.CondominioRiferimento = :condominio";
                var persone = _daoFactory.GetPersonaDao().GetByQuery(hql, new QueryParam("condominio", condominio));

                if (idPratica != null)
                {
                    var pratica = _daoFactory.GetPraticaDao().GetById(idPratica.Value, false);
                    foreach (var richiedente in pratica.Richiedenti)
                        persone.Add(richiedente.Richiedente);
                }

                // Referenti studio
                var personeReferenti = _daoFactory.GetReferenteDao().GetEffettiviByAzienda(condominio.Azienda.ID).Where(item => item.PersonaRiferimento != null).Select(item => item.PersonaRiferimento);
                foreach (var persona in personeReferenti)
                    persone.Add(persona);

                var soggetti = new List<RichiedentePraticaDTO>();
                foreach (var persona in persone)
                {
                    var soggetto = new RichiedentePraticaDTO
                    {
                        Id = persona.ID,
                        DisplayNominativo = persona.DisplayName,
                        IdCondominio = condominio.ID,
                        IdPersona = persona.ID,
                        Tipo = "Condomino"
                    };

                    if (persona.Referenti.Count > 0)
                        soggetto.SiglaRichiedente = persona.Referenti.First().Sigla;

                    soggetti.Add(soggetto);
                }

                ISet<RichiedentePraticaDTO> richiedenti = new HashSet<RichiedentePraticaDTO>(soggetti);

                return richiedenti.ToList();
            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Errore inaspettato nella lettura dei possibili richiedenti di pratica per condominio - {0} - condominio:{1}", ex, Utility.GetMethodDescription(), idCondominio);
                throw;
            }
        }
Пример #3
0
        public List<RichiedentePraticaDTO> GetIncaricatiByCondominio(CondominioDTO condominio)
        {
            try
            {
                ISet<RichiedentePraticaDTO> soggetti = new HashSet<RichiedentePraticaDTO>();

                // ================================================================================================
                //  Referenti
                // ================================================================================================
                try
                {
                    foreach (var referenteDTO in _referenteService.GetAllEffettivi())
                    {
                        try
                        {
                            var richiedente = new RichiedentePraticaDTO
                            {
                                Id = referenteDTO.ID,
                                DisplayNominativo = referenteDTO.NominativoPersona,
                                IdCondominio = condominio.ID,
                                IdPersona = referenteDTO.PersonaId,
                                Tipo = "Referente",
                                SiglaRichiedente = referenteDTO.Sigla
                            };
                            soggetti.Add(richiedente);
                        }
                        catch (Exception ex)
                        {
                            _log.ErrorFormat("Errore nella lettura dei soggetti attivi per condominio - SINGOLO REFERENTE - {0} - referente:{1} - condominio:{2} - azienda:{3}", ex, Utility.GetMethodDescription(), referenteDTO.ID, condominio.ID, Login.Instance.CurrentLogin().Azienda);
                            throw;
                        }
                    }
                }
                catch (Exception ex)
                {
                    _log.ErrorFormat("Errore nella lettura dei soggetti attivi per condominio - REFERENTI - {0} - condominio:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), condominio.ID, Login.Instance.CurrentLogin().Azienda);
                    throw;
                }

                return new List<RichiedentePraticaDTO>(soggetti.ToList());

            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Errore nella lettura dei soggetti attivi per condominio - {0} - condominio:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), condominio.ID, Login.Instance.CurrentLogin().Azienda);
                throw;
            }
        }
Пример #4
0
        public string AddRichiedentePratica(PraticaDTO pratica, RichiedentePraticaDTO richiedente)
        {
            var richiedenti = new List<PraticaRichiedenteDTO>
            {
                new PraticaRichiedenteDTO
                    {
                        IdPersona = richiedente.IdPersona,
                        DataRichiesta = DateTime.Today,
                        IdPratica = pratica.ID
                    }
            };

            var result = GetServiceClient().AddRichiedentePratica(richiedenti, GetUserInfo());
            CloseService();
            return result;
        }
        private void richiedenteLeave(object sender, EventArgs e)
        {
            if (_richiedenteSelected == null || string.IsNullOrEmpty(richiedente.Text))
            {
                richiedente.Text = null;
                _richiedenteSelected = null;
            }
            else
                richiedente.Text = _richiedenteSelected.DisplayNominativo;

            ricercaRichiedente.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters();
        }
        public void Reset()
        {
            _richiedenteSelected = null;
            OnSelectRichiedente(new DataSourceEventArgs<RichiedentePraticaDTO>(SelectedRichiedente));

            _richiedenteInitial = 0;
            ricercaRichiedente.Selected.Rows.Clear();
            ricercaRichiedente.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters();
            richiedente.Text = string.Empty;
        }
        public void SetRichiedenteInitial(int idRichiedente)
        {
            _richiedenteInitial = idRichiedente;

            foreach (UltraGridRow row in ricercaRichiedente.Rows)
            {
                if (row.IsDataRow && ((RichiedentePraticaDTO)row.ListObject).Id == _richiedenteInitial)
                {
                    row.Selected = true;
                    _richiedenteSelected = (RichiedentePraticaDTO)row.ListObject;
                    richiedente.Text = _richiedenteSelected.DisplayNominativo;
                    OnSelectRichiedente(new DataSourceEventArgs<RichiedentePraticaDTO>(SelectedRichiedente));
                    break;
                }
            }
        }
        private void ricercaRichiedenteClick(object sender, EventArgs e)
        {
            try
            {
                //Cast the sender into an UltraGrid
                var grid = sender as UltraGrid;

                //Get the last element that the mouse entered
                if (grid != null && grid.DisplayLayout != null && grid.DisplayLayout.UIElement != null && grid.DisplayLayout.UIElement.LastElementEntered != null)
                {
                    var lastElementEntered = grid.DisplayLayout.UIElement.LastElementEntered;

                    //See if there's a RowUIElement in the chain.
                    RowUIElement rowElement;
                    var element = lastElementEntered as RowUIElement;
                    if (element != null)
                        rowElement = element;
                    else
                    {
                        rowElement = (RowUIElement)lastElementEntered.GetAncestor(typeof(RowUIElement));
                    }

                    if (rowElement == null) return;

                    //Try to get a row from the element
                    var row = (UltraGridRow)rowElement.GetContext(typeof(UltraGridRow));

                    //If no row was returned, then the mouse is not over a row. 
                    if (row == null || !row.IsDataRow || !(row.ListObject is RichiedentePraticaDTO))
                        return;

                    _richiedenteSelected = (RichiedentePraticaDTO)row.ListObject;
                }
                richiedente.Text = _richiedenteSelected.DisplayNominativo;
                OnSelectRichiedente(new DataSourceEventArgs<RichiedentePraticaDTO>(_richiedenteSelected));
                ((DropDownEditorButton)richiedente.ButtonsRight["SceltaRichiedente"]).CloseUp();

            }
            catch (Exception ex)
            {
                _log.ErrorFormat("Errore nella ricerca del richiedente - {0} - azienda:{1}", ex, Utility.GetMethodDescription(), Login.Instance.CurrentLogin().Azienda);
            }
        }
        private void ricercaRichiedentePreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
                {
                    if (ricercaRichiedente.ActiveRow != null && ricercaRichiedente.ActiveRow.ListObject != null)
                    {
                        _richiedenteSelected = (RichiedentePraticaDTO)ricercaRichiedente.ActiveRow.ListObject;
                        OnSelectRichiedente(new DataSourceEventArgs<RichiedentePraticaDTO>(_richiedenteSelected));
                        richiedente.Text = ricercaRichiedente.ActiveRow.Cells["DisplayNominativo"].Value.ToString();
                        ((DropDownEditorButton)richiedente.ButtonsRight["SceltaRichiedente"]).CloseUp();
                    }
                }

                if (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)
                    richiedente.Text += e.KeyCode.ToString();
                else if (e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9)
                    richiedente.Text += e.KeyCode.ToString().Substring(1, 1);
                else if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9)
                    richiedente.Text += e.KeyCode.ToString().Substring(6, 1);
                else if (e.KeyCode == Keys.Back)
                {
                    if (richiedente.Text.Length > 0)
                        richiedente.Text = richiedente.Text.Substring(0, richiedente.Text.Length - 1);
                }
            }
            catch (Exception ex)
            {
                
                _log.Warn("Errore nel controllo del tasto premuto - " + Utility.GetMethodDescription() + " - keycode:" + e.KeyCode, ex);
            }
        }