Beispiel #1
0
        /// <summary>
        /// Login al sistema documentale
        /// </summary>
        /// <param name="utente"></param>
        /// <param name="loginResult"></param>
        /// <returns></returns>
        public bool LoginUser(DocsPaVO.utente.UserLogin userLogin, out DocsPaVO.utente.Utente utente, out DocsPaVO.utente.UserLogin.LoginResult loginResult)
        {
            bool retValue = false;

            utente      = null;
            loginResult = UserLogin.LoginResult.UNKNOWN_USER;

            try
            {
                string userName     = TypeUtente.NormalizeUserName(userLogin.UserName);
                string userPassword = string.Empty;
                // Modifica 21-12-2012, recupero ticket documentum se login tramite token.
                //if (DocsPaServices.DocsPaQueryHelper.isUtenteDominioOrLdap(userLogin))
                if (userLogin.SSOLogin)
                {
                    // L'utente è agganciato in amministrazione ad un dominio,
                    // pertanto viene richiamato il servizio documentum per la generazione del ticket di autenticazione
                    userPassword = DctmTokenFactoryHelper.Generate(userName);
                }
                else
                {
                    userPassword = userLogin.Password;
                }

                RepositoryIdentity identity = DctmServices.DctmRepositoryIdentityHelper.GetIdentity(
                    DctmConfigurations.GetRepositoryName(),
                    userName,
                    userPassword,
                    userLogin.Dominio);

                string token = DctmServices.DctmRepositoryIdentityHelper.CreateAuthenticationToken(identity);

                // Verifica validità credenziali
                if (this.VerifyCredentials(userName, token, out loginResult))
                {
                    utente      = new Utente();
                    utente.dst  = token;
                    loginResult = DocsPaVO.utente.UserLogin.LoginResult.OK;
                }

                //per LDAP oppure per SHIBBOLETH
                if (userLogin.SSOLogin)
                {
                    utente.dst = UserManager.ImpersonateSuperUser();
                }
                //FINE per LDAP oppure per SHIBBOLETH


                retValue = (loginResult == DocsPaVO.utente.UserLogin.LoginResult.OK);
            }
            catch (Exception ex)
            {
                retValue    = false;
                utente      = null;
                loginResult = UserLogin.LoginResult.UNKNOWN_USER;

                logger.Debug(string.Format("Errore in Documentum.Login:\n{0}", ex.ToString()));
            }

            return(retValue);
        }
Beispiel #2
0
 public MyUserIdentity(FormsAuthenticationTicket ticket)
 {
     this.ticket = ticket;
     CurrentUser = JsonConvert.DeserializeObject <Utente>(ticket.UserData);
 }
Beispiel #3
0
        public void Logon(Utente user, bool persistCookie)
        {
            user.LastLogon = DateTime.UtcNow;
            _userRepo.SaveOrUpdate(user);

            HttpContext.Current.User = user;
            System.Threading.Thread.CurrentPrincipal = user;

            CurrentUser = user;

            _formsAuth.SetAuthCookie(user.Email, persistCookie);

            _auditing.SessionStartAudit("");
        }
Beispiel #4
0
        public Lega CreaMercato(Lega lega)
        {
            SqlConnection conn = null;

            try
            {
                //JACOPO
                //conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Jacopo\Source\Repos\progettoIngegneriaDelSoftware\MyFantalega\ServerLega\App_Data\DBMyFantalegaJacopo.mdf;Integrated Security=True");
                //LORENZO
                conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Lorenzo\Source\Repos\progettoIngegneriaDelSoftware\MyFantalega\ServerLega\App_Data\DBMyFantalegaLori.mdf;Integrated Security=True");
                //ALAN
                //conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Alan\Documents\universita\terzo anno\secondo semestre\progetto\MyFantalega\ServerLega\App_Data\DBMyFantalega.mdf;Integrated Security=True");
                conn.Open();
                Random  random = new Random();
                int     id     = random.Next(0, 1000);
                Mercato m      = new Mercato();
                m.IdMercato = id;
                //aggiungiamo squadre per l'esposizione del progetto
                //ATTENZIONE: AGGIUNGERE A MANO AL DB NELLA TABELLA UTENTE 3 Utenti con username rispettivamente userMock1, userMock2, userMock3
                m.addSquadra(lega.SquadraAdmin);

                Utente  a1     = new Utente();
                Squadra s1     = new Squadra();
                int     codice = random.Next(0, 9999);
                s1.Nome   = "SquadraMock" + codice;
                s1.Utente = a1;
                String     userMock     = "UserMock" + codice;
                SqlCommand insertUtente = new SqlCommand("INSERT INTO Utente (username, [e-mail] ) VALUES ( '" + userMock + "', '*****@*****.**')", conn);
                insertUtente.ExecuteNonQuery();
                SqlCommand insert = new SqlCommand("INSERT INTO Squadra(nome, creditiResidui, lega, utente) VALUES('" + s1.Nome + "' ," + lega.CreditiInizialiSquadra + ", '" + lega.NomeLega + "' , '" + userMock + "')", conn);
                insert.ExecuteNonQuery();
                m.addSquadra(s1);
                lega.AggiungiSquadra(s1);


                Utente  a2 = new Utente();
                Squadra s2 = new Squadra();
                codice       = random.Next(0, 9999);
                s2.Nome      = "SquadraMock" + codice;
                s2.Utente    = a2;
                userMock     = "UserMock" + codice;
                insertUtente = new SqlCommand("INSERT INTO Utente (username, [e-mail] ) VALUES ( '" + userMock + "', '*****@*****.**')", conn);
                insertUtente.ExecuteNonQuery();
                insert = new SqlCommand("INSERT INTO Squadra(nome, creditiResidui, lega, utente) VALUES('" + s2.Nome + "' ," + lega.CreditiInizialiSquadra + ", '" + lega.NomeLega + "' , '" + userMock + "')", conn);
                insert.ExecuteNonQuery();
                m.addSquadra(s2);
                lega.AggiungiSquadra(s2);


                Utente  a3 = new Utente();
                Squadra s3 = new Squadra();
                codice       = random.Next(0, 9999);
                s3.Nome      = "SquadraMock" + codice;
                s3.Utente    = a3;
                userMock     = "UserMock" + codice;
                insertUtente = new SqlCommand("INSERT INTO Utente (username, [e-mail] ) VALUES ( '" + userMock + "', '*****@*****.**')", conn);
                insertUtente.ExecuteNonQuery();
                insert = new SqlCommand("INSERT INTO Squadra(nome, creditiResidui, lega, utente) VALUES('" + s3.Nome + "' ," + lega.CreditiInizialiSquadra + ", '" + lega.NomeLega + "' , '" + userMock + "')", conn);
                insert.ExecuteNonQuery();
                m.addSquadra(s3);
                lega.AggiungiSquadra(s3);


                /*
                 * m.addSquadra( new Squadra("Foizasteam", lega, new Utente()));
                 * m.addSquadra( new Squadra("TagliesterUnited", lega, new Utente()));
                 * m.addSquadra( new Squadra("TaglionsporKulubu", lega, new Utente()));
                 * m.addSquadra( new Squadra("Stefanese1997", lega, new Utente()));
                 * m.addSquadra( new Squadra("DeportivoAperitivo", lega, new Utente()));
                 * m.addSquadra( new Squadra("CRFantasia7", lega, new Utente()));
                 * m.addSquadra( new Squadra("MercedesAMG", lega, new Utente()));
                 * m.addSquadra( new Squadra("SanGallo", lega, new Utente()));
                 */
                lega.MercatoAttivo = m;
                return(lega);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                lega.MercatoAttivo = null;
                return(lega);
            }
            finally
            {
                conn.Close();
            }
        }
        static void Main(string[] args)
        {
            string nome, cognome, data, comune, sex;

            Console.WriteLine("Programma di Calcolo del Codice Fiscale per Stato Italiano." +
                              "\nRivisto e approvato da un vero funzionario anagrafico!\n" +
                              "NB Non copre i casi di omocodia.\n");

            #region inputUser
            Console.WriteLine("Ciao, inserisci per favore il tuo nome, senza l'uso di accenti:");
            do
            {
                nome = Console.ReadLine();
                if (nome == "" || !(nome.All(c => Char.IsLetter(c) || c == ' ' || c == '\'')))
                {
                    Console.WriteLine("Dati non validabili. Riprova.");
                }
            } while (nome == "" || !(nome.All(c => Char.IsLetter(c) || c == ' ' || c == '\'')));
            nome = nome.Replace(" ", "").Replace("'", "");
            Console.WriteLine("Ciao, inserisci per favore il tuo cognome, senza l'uso di accenti:");
            do
            {
                cognome = Console.ReadLine();
                if (cognome == "" || !(cognome.All(c => Char.IsLetter(c) || c == ' ' || c == '\'')))
                {
                    Console.WriteLine("Dati non validabili. Riprova.");
                }
            } while (cognome == "" || !(cognome.All(c => Char.IsLetter(c) || c == ' ' || c == '\'')));
            cognome = cognome.Replace(" ", "").Replace("'", "");
            Console.WriteLine("Ciao, inserisci per favore la tua data di nascita in questo formato: dd/mm/yyyy:");
            CultureInfo itIT = new CultureInfo("it-IT");
            DateTime    date = new DateTime();
            do
            {
                data = Console.ReadLine();
                if (!(DateTime.TryParseExact(data, "dd/MM/yyyy", itIT, DateTimeStyles.None, out date)))
                {
                    Console.WriteLine("Dati non validabili. Riprova.");
                }
            } while (!(DateTime.TryParseExact(data, "dd/MM/yyyy", itIT, DateTimeStyles.None, out date)));
            Console.WriteLine("Ciao, inserisci per favore il tuo comune o la nazione di nascita:");
            do
            {
                comune = Console.ReadLine().ToUpper();
                if (comune == "" || !(comune.All(c => Char.IsLetter(c) || c == ' ' || c == '\'' || c == '-')))
                {
                    Console.WriteLine("Dati non validabili. Riprova.");
                }
            } while (comune == "" || !(comune.All(c => Char.IsLetter(c) || c == ' ' || c == '\'' || c == '-')));
            comune = comune.Replace("'", "").Replace("-", "");
            Console.WriteLine("Ciao, inserisci per favore il tuo gender, scrivendo M or F:");
            do
            {
                sex = Console.ReadLine().ToUpper();
                if (sex == "" || (sex != "M" && sex != "F"))
                {
                    Console.WriteLine("Dati non validabili. Riprova.");
                }
            } while (sex == "" || (sex != "M" && sex != "F"));
            #endregion

            Utente u = new Utente(nome, cognome, date, comune, sex);
            u.Print();
            CalcoloCF.Calcolo(u);

            Console.Read();
        }
Beispiel #6
0
        /// <summary>
        /// Metodo per il salvataggio dei dati di una ricevuta di eccezione o di annullamento
        /// </summary>
        /// <param name="senderRecordInfo">Informazioni sul protocollo mittente</param>
        /// <param name="receiverRecordInfo">Informazioni sul protocollo destinatario</param>
        /// <param name="reason">Ragione di annullamento o dettaglio dell'eccezione</param>
        /// <param name="receiverUrl">Url del destinatario</param>
        /// <param name="droppedProof">Flag utilizzato per indicare se si tratta di una ricevuta di annullamento</param>
        /// <param name="receiverCode">Codice del destinatario</param>
        public static void SaveProofData(RecordInfo senderRecordInfo, RecordInfo receiverRecordInfo, string reason, string receiverUrl, bool droppedProof, String receiverCode)
        {
            using (DocsPaDB.Query_DocsPAWS.InteroperabilitaSemplificata interopDb = new DocsPaDB.Query_DocsPAWS.InteroperabilitaSemplificata())
            {
                bool retVal = interopDb.SaveDocumentDroppedOrExceptionProofData(senderRecordInfo, receiverRecordInfo, reason, receiverUrl, droppedProof, receiverCode);

                SimplifiedInteroperabilityLogAndRegistryManager.InsertItemInLog(String.Empty, !retVal,
                                                                                String.Format("Salvataggio delle informazioni sulla ricevuta di {0} relativa al protocollo {1} creato in data {2}, {3}",
                                                                                              droppedProof ? "annullamento" : "eccezione",
                                                                                              senderRecordInfo.RecordNumber, senderRecordInfo.RecordDate,
                                                                                              retVal ? "riuscito correttamente" : "non riuscito"));

                logger.DebugFormat("Salvataggio delle informazioni sulla ricevuta di {0}, per l'interoperabilità semplificata, relativa al protocollo {1} creato in data {2}, {3}",
                                   droppedProof ? "annullamento" : "eccezione",
                                   senderRecordInfo.RecordNumber, senderRecordInfo.RecordDate,
                                   retVal ? "riuscito correttamente" : "non riuscito");

                // Recupero dell'id del documento cui si riferisce l'eccezione
                String idProfile = String.Empty;
                using (DocsPaDB.Query_DocsPAWS.Documenti docDb = new DocsPaDB.Query_DocsPAWS.Documenti())
                {
                    idProfile = docDb.GetIdProfileFromProtoInfo(senderRecordInfo.RecordDate, senderRecordInfo.RecordNumber, senderRecordInfo.AOOCode, senderRecordInfo.AdministrationCode);
                }

                // Se è una eccezione, viene inserita una riga nel registro delle ricevute
                if (!droppedProof)
                {
                    SaveExceptionInRegistry(
                        String.Empty,
                        InteroperabilitaSemplificataManager.GetUrl(OrganigrammaManager.GetIDAmm(senderRecordInfo.AdministrationCode)),
                        DateTime.Now,
                        idProfile,
                        receiverCode,
                        reason);


                    String userId = BusinessLogic.Documenti.DocManager.GetDocumentAttribute(
                        senderRecordInfo.RecordDate,
                        senderRecordInfo.RecordNumber,
                        senderRecordInfo.AOOCode,
                        senderRecordInfo.AdministrationCode,
                        DocsPaDB.Query_DocsPAWS.Documenti.DocumentAttribute.UserId);

                    //Recupero il ruolo che ha effettuato l'ultima spedizione IS, dallo storico delle spedizioni.
                    ArrayList listHistorySendDoc = SpedizioneManager.GetElementiStoricoSpedizione(idProfile);
                    if (listHistorySendDoc != null && listHistorySendDoc.Count > 0)
                    {
                        Object lastSendIs = (from record in listHistorySendDoc.ToArray()
                                             where ((ElStoricoSpedizioni)record).Mail_mittente.Equals("N.A.")
                                             select record).ToList().OrderBy(z => ((ElStoricoSpedizioni)z).Id).LastOrDefault();

                        Ruolo  role = UserManager.getRuoloByIdGruppo(((ElStoricoSpedizioni)lastSendIs).IdGroupSender);
                        Utente user = UserManager.getUtente(userId);
                        // LOG per documento
                        string desc = "Notifica di eccezione: " + reason.Replace("’", "'") + "<br/>Destinatario spedizione: " + receiverCode;
                        BusinessLogic.UserLog.UserLog.WriteLog(user.userId, user.idPeople, role.idGruppo,
                                                               user.idAmministrazione, "EXCEPTION_SEND_SIMPLIFIED_INTEROPERABILITY",
                                                               idProfile, desc, DocsPaVO.Logger.CodAzione.Esito.OK, null, "1");
                    }
                }
            }
        }
Beispiel #7
0
        protected void PopulatePolicyPeriod()
        {
            if (!string.IsNullOrEmpty(this.Policy.tipoPeriodo))
            {
                if (this.Policy.tipoPeriodo.Equals(this.type1.Value))
                {
                    this.type1.Checked = true;
                }
                if (this.Policy.tipoPeriodo.Equals(this.type2.Value))
                {
                    this.type2.Checked = true;
                }
                if (this.Policy.tipoPeriodo.Equals(this.type3.Value))
                {
                    this.type3.Checked = true;
                }
                if (this.Policy.tipoPeriodo.Equals(this.type4.Value))
                {
                    this.type4.Checked = true;
                }
            }

            this.txtNumGiorni.Text    = this.Policy.periodoGiornalieroNGiorni;
            this.txtOreGiorni.Text    = this.Policy.periodoGiornalieroOre;
            this.txtMinutiGiorni.Text = this.Policy.periodoGiornalieroMinuti;

            this.txtOreSettimana.Text    = this.Policy.periodoSettimanaleOre;
            this.txtMinutiSettimana.Text = this.Policy.periodoSettimanaleMinuti;

            if (this.Policy.periodoSettimanaleLunedi)
            {
                this.chK_lunedi.Selected = true;
            }
            if (this.Policy.periodoSettimanaleMartedi)
            {
                this.chK_martedi.Selected = true;
            }
            if (this.Policy.periodoSettimanaleMercoledi)
            {
                this.chK_mercoledi.Selected = true;
            }
            if (this.Policy.periodoSettimanaleGiovedi)
            {
                this.chK_giovedi.Selected = true;
            }
            if (this.Policy.periodoSettimanaleVenerdi)
            {
                this.chK_venerdi.Selected = true;
            }
            if (this.Policy.periodoSettimanaleSabato)
            {
                this.chK_sabato.Selected = true;
            }
            if (this.Policy.periodoSettimanaleDomenica)
            {
                this.chK_domenica.Selected = true;
            }

            this.txt_day.Text       = this.Policy.periodoMensileGiorni;
            this.txtOreMesi.Text    = this.Policy.periodoMensileOre;
            this.txtMinutiMese.Text = this.Policy.periodoMensileMinuti;

            if (!string.IsNullOrEmpty(this.Policy.idRuolo))
            {
                Corrispondente tempCorr = UserManager.getCorrispondenteBySystemIDDisabled(this.Page, this.Policy.idRuolo);
                if (tempCorr != null)
                {
                    this.txtCodRuolo.Text  = tempCorr.codiceRubrica;
                    this.txtDescRuolo.Text = tempCorr.descrizione;
                    this.id_corr.Value     = tempCorr.systemId;
                    Utente[] roleUsers = _wsInstance.getUserInRoleByIdCorrGlobali(tempCorr.systemId);
                    if (roleUsers != null && roleUsers.Length > 0)
                    {
                        this.ddl_role_users.Enabled = true;
                        this.ddl_role_users.Items.Clear();
                        for (int i = 0; i < roleUsers.Length; i++)
                        {
                            ddl_role_users.Items.Add(roleUsers[i].descrizione);
                            ddl_role_users.Items[i].Value = (roleUsers[i].systemId).ToString();
                        }
                    }
                    else
                    {
                        this.ddl_role_users.Enabled = false;
                    }
                }
                else
                {
                    this.txtCodRuolo.Text       = string.Empty;
                    this.txtDescRuolo.Text      = string.Empty;
                    this.id_corr.Value          = string.Empty;
                    this.ddl_role_users.Enabled = false;
                    this.ddl_role_users.Items.Clear();
                }
            }

            if (!string.IsNullOrEmpty(this.Policy.idUtenteRuolo))
            {
                //Corrispondente tempCorr = UserManager.getCorrispondenteBySystemIDDisabled(this.Page, this.Policy.idUtenteRuolo);
                Utente tempCorr = UserManager.GetUtenteByIdPeople(this.Policy.idUtenteRuolo);

                if (tempCorr != null)
                {
                    this.ddl_role_users.SelectedValue = this.Policy.idUtenteRuolo;
                }
                else
                {
                    this.ddl_role_users.Enabled = false;
                    this.ddl_role_users.Items.Clear();
                }
            }
            else
            {
                this.ddl_role_users.Enabled = false;
                this.ddl_role_users.Items.Clear();
            }

            if (this.Policy.consolidazione)
            {
                this.chk_consolidamento.Checked = true;
            }

            this.txtAvvisoMesi.Text = this.Policy.avvisoMesi;
            // MEV CS 1.5
            this.txtAvvisoMesiLegg.Text = this.Policy.avvisoMesiLegg;
            // fine MEV CS 1.5

            if (this.Policy.periodoAttivo)
            {
                this.chk_attiva.Checked = true;
            }
            this.chk_invio_automatico.Checked = this.Policy.statoInviato;

            //MEV CS 1.5 F02_01 conversione automatica documenti
            if (this.chk_invio_automatico.Checked)
            {
                this.chk_conversione_automatica.Enabled = true;
                //this.chk_conversione_automatica.Checked = false;
            }
            else
            {
                this.chk_conversione_automatica.Enabled = false;
                this.chk_conversione_automatica.Checked = false;
            }
            this.chk_conversione_automatica.Checked = this.Policy.statoConversione;
            //fine MEV CS 1.5 F02_01 conversione automatica documenti

            this.txt_a_ore.Text  = this.Policy.periodoAnnualeOre;
            this.txt_a_mese.Text = this.Policy.periodoAnnualeMese;
            this.txt_a_day.Text  = this.Policy.periodoAnnualeGiorno;
            this.txt_a_mm.Text   = this.Policy.periodoAnnualeMinuti;
            if (this.ddl_tipoCons.Items.FindByValue(this.Policy.tipoConservazione) != null)
            {
                this.ddl_tipoCons.SelectedValue = this.Policy.tipoConservazione;
            }

            if (this.ddl_tipoCons.SelectedValue == "CONSERVAZIONE_CONSOLIDATA")
            {
                this.chk_consolidamento.Checked = true;
                this.chk_consolidamento.Enabled = false;
            }
            if (this.ddl_tipoCons.SelectedValue == "CONSERVAZIONE_NON_CONSOLIDATA")
            {
                this.chk_consolidamento.Checked = false;
                this.chk_consolidamento.Enabled = false;
            }
            if (this.ddl_tipoCons.SelectedValue == "ESIBIZIONE")
            {
                this.chk_consolidamento.Checked = false;
                this.chk_consolidamento.Enabled = false;
            }
            if (this.ddl_tipoCons.SelectedValue == "CONSERVAZIONE_INTERNA")
            {
                this.chk_consolidamento.Checked = false;
                this.chk_consolidamento.Enabled = true;
            }
        }
        private async Task check()
        {
            var    utente = LoginData.getUser();
            Utente user   = new Utente();

            foreach (var i in utente)
            {
                if (i.attivo)
                {
                    user.id             = i.id;
                    user.attivo         = i.attivo;
                    user.username       = i.username;
                    user.password       = i.password;
                    user.token          = i.token;
                    user.organizzazione = i.organizzazione;
                    user.eliminato      = "false";
                    user.splash_logo    = i.splash_logo;
                    user.circle_logo    = i.circle_logo;
                }
            }
            if (string.IsNullOrEmpty(user.username))
            {
                user.id             = utente[0].id;
                user.attivo         = true;
                user.username       = utente[0].username;
                user.password       = utente[0].password;
                user.token          = utente[0].token;
                user.organizzazione = utente[0].organizzazione;
                user.splash_logo    = utente[0].splash_logo;
                user.circle_logo    = utente[0].circle_logo;
                user.eliminato      = "false";
            }
            REST <Utente, Final> rest = new REST <Utente, Final>();

            if (CrossConnectivity.Current.IsConnected)
            {
                var response = await rest.PostJson(URL.Login, user);

                if (response != null)
                {
                    if (response.status)
                    {
                        if (response.final[0].attivo == false)
                        {
                            await App.Current.MainPage.DisplayAlert("Login", "Utenza non attiva", "OK");

                            LoginData.dropUser(new TbLogin(user.username, user.password, user.token, user.organizzazione, user.circle_logo, user.splash_logo, true));
                            UtenzaData.DropUser(new TbUtente(response.final[0]));
                            App.Current.MainPage = new Login();
                        }
                        else
                        {
                            //await App.Current.MainPage.DisplayAlert("Login", "Login Effettuata con successo", "OK");
                            response.final[0].organizzazione = user.organizzazione;
                            foreach (var i in utente)
                            {
                                i.attivo = false;
                                LoginData.updateUser(i);
                            }
                            TbLogin us = new TbLogin(user.username, user.password, user.token, user.organizzazione, user.circle_logo, user.splash_logo, user.attivo);
                            us.id     = user.id;
                            us.attivo = true;
                            LoginData.updateUser(us);
                            UtenzaData.UpdateUser(new TbUtente(response.final[0]));
                        }
                    }
                    else
                    {
                        LoginData.dropUser(new TbLogin(user.username, user.password, user.token, user.organizzazione, user.circle_logo, user.splash_logo, true));
                        UtenzaData.DropUser(new TbUtente(response.final[0]));
                        App.Current.MainPage = new NavigationPage(new Login());
                    }
                }
                else
                {
                    await DisplayAlert("Attenzione", "Il servizio è momentaneamente non disponibile, riprova più tardi",
                                       "OK");
                    await check();
                }
            }
        }
Beispiel #9
0
 public RegisterPinPage(Utente user)
 {
     InitializeComponent();
     utente = user;
 }
Beispiel #10
0
        private static void CreaVendita(MyFeData myFeData)
        {
            //var aprile = new DateTime(2016, 4, 1);
            //if (myFeData.InseritaIlDateTime.Date >= aprile) return;

            using (UnitOfWork uow = new UnitOfWork())
            {
                Utente     utente     = uow.FindObject <Utente>(new BinaryOperator("AdUsername", "Internet"));
                Postazione postazione = uow.FindObject <Postazione>(new BinaryOperator("CodiceUnivoco", 1));

                if (utente == null)
                {
                    throw new Exception("Manca utente INTERNET");
                }

                if (postazione == null)
                {
                    throw new Exception("Manca postazione INTERNET, CodiceUnivoco==1");
                }

                var obj = uow.FindObject <Card>(new BinaryOperator("Codice", myFeData.CodiceTessera));
                if (obj != null)
                {
                    throw new Exception("VENDITA: Esiste già card con codice: " + myFeData.CodiceTessera);
                }

                TransazioneWeb trans = new TransazioneWeb(uow);
                trans.PuntoVendita       = myFeData.PuntoVendita;
                trans.Cliente            = myFeData.Cliente;
                trans.EmailCliente       = myFeData.EmailCliente;
                trans.IDCliente          = myFeData.IDCliente;
                trans.Transazione        = myFeData.Transazione;
                trans.InseritaIl         = myFeData.InseritaIl;
                trans.TitolareCarta      = myFeData.TitolareCarta;
                trans.EmailTitolare      = myFeData.EmailTitolare;
                trans.Inizio             = myFeData.Inizio;
                trans.Fine               = myFeData.Fine;
                trans.Giorni             = myFeData.Giorni;
                trans.Prodotto           = myFeData.Prodotto;
                trans.CodiceOperazione   = myFeData.CodiceOperazione;
                trans.CodiceTessera      = myFeData.CodiceTessera;
                trans.TipoOperazione     = myFeData.TipoOperazione;
                trans.Quantita           = myFeData.Quantita;
                trans.InseritaIlDateTime = myFeData.InseritaIlDateTime;
                trans.InizioDateTime     = myFeData.InizioDateTime;
                trans.FineDateTime       = myFeData.FineDateTime;
                trans.Save();

                Card card = new Card(uow);
                card.Codice             = myFeData.CodiceTessera;
                card.AssegnataIl        = myFeData.InseritaIlDateTime;
                card.AssegnataStruttura = postazione.Struttura;
                card.AssegnataUtente    = utente;
                card.Status             = EnumStatoCard.Emessa;
                card.Email            = myFeData.EmailTitolare;
                card.Cliente          = myFeData.Cliente;
                card.TitolareCarta    = myFeData.TitolareCarta;
                card.CodiceOperazione = myFeData.CodiceOperazione;
                card.Transazione      = myFeData.Transazione;
                card.VendutaOnline    = true;
                card.EmessoBiglietto  = false;

                switch (myFeData.Giorni)
                {
                case "2":
                    card.TipologiaCard = EnumTipologiaCard.Card2Giorni;
                    break;

                case "3":
                    card.TipologiaCard = EnumTipologiaCard.Card3Giorni;
                    break;

                case "6":
                    card.TipologiaCard = EnumTipologiaCard.Card6Giorni;
                    break;
                }
                card.Save();

                Vendita vendita = new Vendita(uow);

                vendita.Incasso         = EnumIncasso.Internet;
                vendita.CodiceLeggibile = Vendita.NuovoCodiceVendita();
                vendita.CodicePrevent   = "";

                vendita.DataContabile = myFeData.InseritaIlDateTime.Date;
                vendita.DataOraStampa = myFeData.InseritaIlDateTime;

                vendita.Descrizione = myFeData.TitolareCarta;

                vendita.Utente        = utente;
                vendita.Postazione    = postazione;
                vendita.Struttura     = postazione.Struttura;
                vendita.TotalePersone = 1;
                vendita.TotaleImporto = card.Importo;
                vendita.Save();

                Percorso per = uow.FindObject <Percorso>(new BinaryOperator("Descrizione", "MyFE"));

                Variante v1 = per.GetVarianteMyFe("Com", "C", card.TipologiaCard);
                Variante v2 = per.GetVarianteMyFe("Pin", "C", card.TipologiaCard);

                if (v1 == null || v2 == null)
                //if (v1 == null)
                {
                    throw new Exception("Manca tariffa");
                    //XtraMessageBox.Show("Tariffa per le card mancante", "ERRORE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //return false;
                }

                decimal totale = v1.Prezzo + (v2 != null ? v2.Prezzo : 0);

                List <Ingresso> ingressi = new List <Ingresso>();
                ingressi.AddRange(per.Ingressi);

                RigaVenditaVariante rvv1 = new RigaVenditaVariante(uow);
                rvv1.PrezzoTotale   = v1.Prezzo;
                rvv1.PrezzoUnitario = v1.Prezzo;
                rvv1.Profilo        = 0;
                rvv1.Quantita       = 1;
                rvv1.Variante       = v1;
                rvv1.Vendita        = vendita;
                rvv1.Card           = card;
                rvv1.Save();

                if (v2 != null)
                {
                    RigaVenditaVariante rvv2 = new RigaVenditaVariante(uow);
                    rvv2.PrezzoTotale   = v2.Prezzo;
                    rvv2.PrezzoUnitario = v2.Prezzo;
                    rvv2.Profilo        = 0;
                    rvv2.Quantita       = 1;
                    rvv2.Variante       = v2;
                    rvv2.Vendita        = vendita;
                    rvv2.Card           = card;
                    rvv2.Save();
                }

                DateTime inizioVal = myFeData.InizioDateTime.Date;
                DateTime fineVal   = inizioVal.AddDays(card.Giorni() - 1);

                Stampa stampa = new Stampa(uow);
                stampa.Vendita        = vendita;
                stampa.InizioValidita = inizioVal;
                stampa.FineValidita   = fineVal;
                stampa.Quantita       = 1;
                stampa.ImportoTotale  = totale;
                stampa.StatoStampa    = 0;
                stampa.TipoStampa     = EnumTipoStampa.CardInternet;
                stampa.Card           = card;
                stampa.Save();
                stampa.GeneraBarCode(postazione, ingressi);

                card.Status = EnumStatoCard.Emessa;
                card.Stampa = stampa;
                card.Save();

                Stampa doppia = uow.FindObject <Stampa>(new BinaryOperator("BarCode", stampa.BarCode));
                if (doppia != null)
                {
                    stampa.GeneraBarCode(postazione, ingressi);

                    doppia = uow.FindObject <Stampa>(new BinaryOperator("BarCode", stampa.BarCode));
                    if (doppia != null)
                    {
                        stampa.GeneraBarCode(postazione, ingressi);

                        doppia = uow.FindObject <Stampa>(new BinaryOperator("BarCode", stampa.BarCode));
                        if (doppia != null)
                        {
                            stampa.GeneraBarCode(postazione, ingressi);
                        }
                    }
                }

                stampa.Save();

                foreach (Ingresso ingresso in per.Ingressi)
                {
                    RigaStampaIngresso rigaingresso = new RigaStampaIngresso(uow);
                    rigaingresso.Ingresso      = uow.GetObjectByKey <Ingresso>(ingresso.Oid);
                    rigaingresso.Stampa        = stampa;
                    rigaingresso.TotalePersone = 1;
                    rigaingresso.Save();
                }

                uow.CommitChanges();
            }
        }
Beispiel #11
0
 public static void Assign(Utente utente)
 {
     //assign to utente
     _currentTicketNumber++;
 }
Beispiel #12
0
 public RegistrazioneModelView()
 {
     this.utenteRegistrazione = new Utente();
 }
        //Si suppone che object o sia una impostazione trasferimento

        public override void Salva(object o, PersistEvent param)
        {
            ImpostazioneTrasferimento.ImpostazioneTrasferimento toPut = (ImpostazioneTrasferimento.ImpostazioneTrasferimento)param.ToPersist;
            XmlDocument xdocument = new XmlDocument();

            try
            {
                xdocument.Load(Filename);
                //Dato che sono stato chiamato e il file esiste, si suppone che ci sia da fare un inserimento consono
                //Mi ri-permetto di andare liscio (a spade)
                XmlNode impostazioniMainNode = xdocument.DocumentElement;
                if (param.Action.Equals("aggiungi"))
                {
                    //Caso di aggiunta si veda sotto nel catch per commenti dettagliati
                    XmlElement xImpostazione = xdocument.CreateElement("impostazione");
                    xImpostazione.SetAttribute("utente", Utente.GetNomeUtente());
                    XmlElement cartellaSorgente = xdocument.CreateElement("cartella-sorgente");
                    cartellaSorgente.InnerText = toPut.CartellaSorgente.Path;
                    XmlElement cartellaDestinazione = xdocument.CreateElement("cartella-destinazione");
                    cartellaDestinazione.InnerText = toPut.CartellaDestinazione;
                    XmlElement verso = xdocument.CreateElement("verso");
                    verso.InnerText = toPut.Verso;
                    xImpostazione.AppendChild(cartellaSorgente);
                    xImpostazione.AppendChild(cartellaDestinazione);
                    xImpostazione.AppendChild(verso);
                    impostazioniMainNode.AppendChild(xImpostazione);
                }
                else if (param.Action.Equals("rimuovi"))
                {
                    //Caso di rimozione
                    //Itero, trovo l'impostazione che fa al caso mio e la rimuovo da impostazioni main node
                    //E tutti amici come prima
                    foreach (XmlNode impostazioneNode in impostazioniMainNode.ChildNodes)
                    {
                        if (impostazioneNode.Attributes.GetNamedItem("utente").Value.Equals(Utente.GetNomeUtente()))
                        {
                            //Controllo il contenuto
                            bool found = true;
                            foreach (XmlNode valueImpostazione in impostazioneNode.ChildNodes)
                            {
                                if (!valueImpostazione.Name.Equals("verso"))
                                {
                                    found = found && (
                                        ((valueImpostazione.Name.Equals("cartella-sorgente") &&
                                          valueImpostazione.InnerText.Equals(toPut.CartellaSorgente.Path))) ||
                                        (valueImpostazione.Name.Equals("cartella-destinazione") &&
                                         valueImpostazione.InnerText.Equals(toPut.CartellaDestinazione)));
                                }
                            }
                            if (found)
                            {
                                impostazioniMainNode.RemoveChild(impostazioneNode);
                            }
                        }
                    }
                }
                XmlWriterSettings settings = new XmlWriterSettings
                {
                    Indent = true
                };
                //Scrivo il file
                XmlWriter writer = XmlWriter.Create(Filename, settings);
                xdocument.Save(writer);
                //Ricordarsi la close sennò si hanno vari problemi
                writer.Close();
            }
            catch
            {
                //Il documento esiste, aggiungo andando liscio(a spade)
                xdocument = new XmlDocument();
                //Creo il tag contenitore
                XmlElement impostazioni = xdocument.CreateElement("impostazioni");
                //Creo il tag per la mia impostazione
                XmlElement impostazione = xdocument.CreateElement("impostazione");
                //Imposto l'attributo utente in modo consono
                impostazione.SetAttribute("utente", Utente.GetNomeUtente());

                //Creo gli i figli che compongono il tag impostazione e gli do il valore che devo inserire
                XmlElement cartellaSorgente = xdocument.CreateElement("cartella-sorgente");
                cartellaSorgente.InnerText = toPut.CartellaSorgente.Path;
                XmlElement cartellaDestinazione = xdocument.CreateElement("cartella-destinazione");
                cartellaDestinazione.InnerText = toPut.CartellaDestinazione;
                XmlElement verso = xdocument.CreateElement("verso");
                verso.InnerText = toPut.Verso;

                //Creo l'albero XML da aggiungere al DOM appena verra creato
                impostazione.AppendChild(cartellaSorgente);
                impostazione.AppendChild(cartellaDestinazione);
                impostazione.AppendChild(verso);
                impostazioni.AppendChild(impostazione);
                XmlDeclaration xmlDeclaration = xdocument.CreateXmlDeclaration("1.0", "UTF-8", null);
                //Creo la document root
                XmlElement root = xdocument.DocumentElement;
                xdocument.InsertBefore(xmlDeclaration, root);
                //Aggiungo impostazioni al dom
                xdocument.AppendChild(impostazioni);

                //Scrivo il file
                XmlWriterSettings settings = new XmlWriterSettings
                {
                    Indent = true
                };
                //Aggiungo il writer
                XmlWriter writer = XmlWriter.Create(Filename, settings);
                //TODO Aggiungere lo schema
                xdocument.Save(writer);
                writer.Close();
            }
        }
Beispiel #14
0
 public void Add(Utente utente)
 {
     _dbContext.UtenteCollection.InsertOne(utente);
 }
        public void Visit(FileWrapper file)
        {
            FileInfo source      = new FileInfo(file.Path);
            String   fileDstPath = String.Join("\\", _pathDestinazione, source.Name);

            //Trovo l'autore del file
            string author = File.GetAccessControl(file.Path).GetOwner(typeof(System.Security.Principal.NTAccount)).ToString();

            //Prova va spostato sotto

            if (!author.Equals(string.Join("\\", Utente.GetNomeHost(), Utente.GetNomeUtente())))
            {
                if (!_blacklistController.IsBlackListed(author))
                {
                    bool riconosciuto = _viewHome.ChiediScelta(author);
                    if (riconosciuto)
                    {
                        //Se esiste Confronto gli hash se sono diversi sincronizzo
                        if (File.Exists(fileDstPath))
                        {
                            var    sourceStream = new FileStream(file.Path, FileMode.Open, FileAccess.Read);
                            String srcSum       = GetChecksumBuffered(sourceStream);
                            var    dstStream    = new FileStream(fileDstPath, FileMode.Open, FileAccess.Read);
                            String dstSum       = GetChecksumBuffered(dstStream);

                            //Se gli hash non sono uguali
                            if (!srcSum.Equals(dstSum))
                            {
                                File.Copy(file.Path, fileDstPath);
                                ActionCompletedEvent args = new ActionCompletedEvent
                                {
                                    ToEntry = EntryFactory.CreateEntry(this, "file copiato", sorgente: file.Path, destinazione: fileDstPath)
                                };
                                ToLog?.Invoke(this, args);
                            }
                        }
                        //Copio diretto
                        else
                        {
                            File.Copy(file.Path, fileDstPath);
                            ActionCompletedEvent args = new ActionCompletedEvent
                            {
                                ToEntry = EntryFactory.CreateEntry(this, "file copiato", sorgente: file.Path, destinazione: fileDstPath)
                            };
                            ToLog?.Invoke(this, args);
                        }
                    }
                    else
                    {
                        _blacklistController.AggiungiUtente(author);
                        //Elimino il file
                        File.Delete(file.Path);
                        ActionCompletedEvent args = new ActionCompletedEvent
                        {
                            ToEntry = EntryFactory.CreateEntry(this, "file eliminato", sorgente: file.Path)
                        };
                        ToLog?.Invoke(this, args);
                    }
                }
            }
            //Il file è del proprietario non c'è bisogno di chiamare la blacklist
            else
            {
                if (File.Exists(fileDstPath))
                {
                    var    sourceStream = new FileStream(file.Path, FileMode.Open, FileAccess.Read);
                    String srcSum       = GetChecksumBuffered(sourceStream);
                    var    dstStream    = new FileStream(fileDstPath, FileMode.Open, FileAccess.Read);
                    String dstSum       = GetChecksumBuffered(dstStream);

                    //Se gli hash non sono uguali
                    if (!srcSum.Equals(dstSum))
                    {
                        ActionCompletedEvent args = new ActionCompletedEvent
                        {
                            ToEntry = EntryFactory.CreateEntry(this, "file copiato", sorgente: file.Path, destinazione: fileDstPath)
                        };
                        ToLog?.Invoke(this, args);
                        File.Copy(file.Path, fileDstPath);
                    }
                }
                //Copio diretto
                else
                {
                    ActionCompletedEvent args = new ActionCompletedEvent
                    {
                        ToEntry = EntryFactory.CreateEntry(this, "file copiato", sorgente: file.Path, destinazione: fileDstPath)
                    };
                    ToLog?.Invoke(this, args);
                    File.Copy(file.Path, fileDstPath);
                }
            }
        }
Beispiel #16
0
 public override string ToString()
 {
     return("" + base.DataOra + "\t" + "Impostazione\t" + Operazione + "\t" + Utente.GetNomeUtente() + "\t" + Sorgente + "\t" + Destinatario);
 }
Beispiel #17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="utente"></param>
 /// <returns></returns>
 public Utente Insert(Utente utente)
 {
     return(this.GetService().Insert(new InsertRequest(this.GetCredentials(), utente)).InsertResult);
 }
Beispiel #18
0
        public List <Lega> GetLeghe(Utente utente)
        {
            IGestioneUtenteController gestioneUtenteController = new GestioneUtenteController();

            return(gestioneUtenteController.GetLeghe(utente));
        }
Beispiel #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="utente"></param>
 /// <returns></returns>
 public Utente Update(Utente utente)
 {
     return(this.GetService().Update(new UpdateRequest(this.GetCredentials(), utente)).UpdateResult);
 }
Beispiel #20
0
        private void buttonLogin_Click(object sender, RoutedEventArgs e)
        {
            // effettua il login al sistema
            try
            {
                Utente ute = new Utente();
                ute.Login = txtUtente.Text;
                ute.Psw   = txtPassword.Password;
                bool esito = cUtenti.EseguiLogIn(ref ute);
                if (!esito)
                {
                    loginOk = false;
                    // TO DO inserire messaggio in gestione messaggi
                    MessageBox.Show("Le credenziali non corrispondono con quelle presenti nel sistema.\r\nL'accesso al sistema Revisoft è negato.", "Accesso negato", MessageBoxButton.OK, MessageBoxImage.Stop);
                    return;
                }
                else
                {
                    switch (ute.RuoId)
                    {
                    case 0:
                        // se il ruolo = nessun ruolo l'utente non può accedere perchè il team leader deve ancora definire il suo ruolo all'interno del team
                        // TO DO inserire messaggio in gestione messaggi
                        loginOk = false;
                        MessageBox.Show("Il Team Leader non ha ancora associato a questa utenza un ruolo all'interno del team, il ruolo è necessario per l'impostazione del lavoro.\r\nL'accesso al sistema Revisoft è negato.", "Accesso negato", MessageBoxButton.OK, MessageBoxImage.Stop);
                        break;

                    case 1:
                        // Administrator
                        loginOk      = true;
                        App.AppTipo  = App.ModalitaApp.Administrator;
                        App.AppRuolo = App.RuoloDesc.Administrator;
                        break;

                    case 2:
                        // Team Leader
                        loginOk      = true;
                        App.AppTipo  = App.ModalitaApp.Team;
                        App.AppRuolo = App.RuoloDesc.TeamLeader;
                        break;

                    case 3:
                        //Reviewer
                        loginOk      = true;
                        App.AppTipo  = App.ModalitaApp.Team;
                        App.AppRuolo = App.RuoloDesc.Reviewer;
                        break;

                    case 4:
                        //esecutore
                        loginOk      = true;
                        App.AppTipo  = App.ModalitaApp.Team;
                        App.AppRuolo = App.RuoloDesc.Esecutore;
                        break;

                    case 5:
                        // standalone
                        loginOk      = true;
                        App.AppTipo  = App.ModalitaApp.StandAlone;
                        App.AppRuolo = App.RuoloDesc.StandAlone;
                        break;

                    case 6:
                        // revisore autonomo standalone
                        loginOk      = true;
                        App.AppTipo  = App.ModalitaApp.StandAlone;
                        App.AppRuolo = App.RuoloDesc.StandAlone;
                        break;
                    }
                    App.AppUtente = ute;
                }
                base.Close();
            }
            catch (Exception ex)
            {
                cBusinessObjects.logger.Error(ex, "wLogin.buttonLogin_Click exception");
                App.GestioneLog(ex.Message);
            }
        }
        public async Task <IActionResult> OnPostAsync(String nome, String DataNasc, String NIF, String masc, String fem, string returnUrl = null)
        {
            returnUrl ??= Url.Content("~/");
            ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
            if (ModelState.IsValid)
            {
                var user = new IdentityUser {
                    UserName = Input.Email, Email = Input.Email
                };
                var result = await _userManager.CreateAsync(user, Input.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password.");

                    Utente ute = new Utente
                    {
                        Nome     = nome,
                        DataNasc = DateTime.Parse(DataNasc),
                        NIF      = NIF,
                        Sexo     = masc != null ? masc : fem,
                        lig      = user.Id
                    };


                    await _userManager.AddToRoleAsync(user, "Utente");

                    _context.Add(ute);
                    await _context.SaveChangesAsync();

                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
                    var callbackUrl = Url.Page(
                        "/Account/ConfirmEmail",
                        pageHandler: null,
                        values: new { area = "Identity", userId = user.Id, code = code, returnUrl = returnUrl },
                        protocol: Request.Scheme);

                    await _emailSender.SendEmailAsync(Input.Email, "Confirm your email",
                                                      $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(callbackUrl)}'>clicking here</a>.");

                    if (_userManager.Options.SignIn.RequireConfirmedAccount)
                    {
                        return(RedirectToPage("RegisterConfirmation", new { email = Input.Email, returnUrl = returnUrl }));
                    }
                    else
                    {
                        await _signInManager.SignInAsync(user, isPersistent : false);

                        return(LocalRedirect(returnUrl));
                    }
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }

            // If we got this far, something failed, redisplay form
            return(Page());
        }
Beispiel #22
0
 public void SetUp()
 {
     Factory.InitializeBugTracking(null, "password");
     Db    = Factory.LoadBugTracking(null, "password");
     User1 = new Utente()
     {
         Name      = "Stefano",
         Surname   = "Castello",
         Dob       = new DateTime(93, 12, 12),
         CodFisc   = "CSTSFN93D12D969U",
         Age       = 24,
         LogIn     = "******",
         Indirizzo = new Address()
         {
             Civico = 9, Interno = 2, Via = "viale Villa Chiesa"
         }
     };
     User2 = new Utente()
     {
         Name      = "Giorgio",
         Surname   = "Castello",
         Dob       = new DateTime(60, 07, 20),
         CodFisc   = "CSTGRG60L20D969A",
         Age       = 57,
         LogIn     = "******",
         Indirizzo = new Address()
         {
             Civico = 9, Interno = 2, Via = "viale Villa Chiesa"
         }
     };
     Prod1 = new Prodotto()
     {
         CommName = "Schermo",
         Id       = 10,
         Req      = new List <Prodotto>(),
         NotComp  = new List <Prodotto>()
     };
     Prod3 = new Prodotto()
     {
         CommName = "Android",
         Id       = 12,
         Req      = new List <Prodotto>(),
         NotComp  = new List <Prodotto>()
     };
     Prod2 = new Prodotto()
     {
         CommName = "iPhone",
         Id       = 11,
         Req      = new List <Prodotto> {
             Prod1
         },
         NotComp = new List <Prodotto> {
             Prod3
         }
     };
     Prod3.NotComp.Add(Prod2);
     Report1 = new Segnalazione()
     {
         Author       = User1,
         CreationDate = DateTime.Today,
         Descr        = "Sistema Orrendo!",
         SigProd      = Prod3,
         State        = "Aperta",
         Text         = "Nulla da aggingere !",
         Comments     = new List <Commento>()
     };
     Comment1 = new Commento()
     {
         Author       = User2,
         CreationDate = DateTime.Today,
         Text         = "Vero Meglio Apple!"
     };
 }
Beispiel #23
0
        internal Boolean InsertUtente(Utente obj)
        {
            sqlop = new SqlOperations();
            sqlop.databaseConnection = ConfigurationManager.ConnectionStrings["cs"].ToString();

            DbParameter[] dbp = new DbParameter[8];

            dbp[0] = new SqlParameter();
            dbp[0].ParameterName = "Nome";
            dbp[0].DbType = DbType.String;
            dbp[0].Direction = ParameterDirection.Input;
            dbp[0].Value = obj.Nome;

            dbp[1] = new SqlParameter();
            dbp[1].ParameterName = "Cognome";
            dbp[1].DbType = DbType.String;
            dbp[1].Direction = ParameterDirection.Input;
            dbp[1].Value = obj.Cognome;

            dbp[2] = new SqlParameter();
            dbp[2].ParameterName = "Email";
            dbp[2].DbType = DbType.String;
            dbp[2].Direction = ParameterDirection.Input;
            dbp[2].Value = obj.Email;

            dbp[3] = new SqlParameter();
            dbp[3].ParameterName = "UserID";
            dbp[3].DbType = DbType.String;
            dbp[3].Direction = ParameterDirection.Input;
            dbp[3].Value = obj.UserID;

            dbp[4] = new SqlParameter();
            dbp[4].ParameterName = "IDProfilo";
            dbp[4].DbType = DbType.Int32;
            dbp[4].Direction = ParameterDirection.Input;
            dbp[4].Value = obj.IDProfilo;

            dbp[5] = new SqlParameter();
            dbp[5].ParameterName = "Attivo";
            dbp[5].DbType = DbType.Boolean;
            dbp[5].Direction = ParameterDirection.Input;
            dbp[5].Value = obj.Attivo;

            dbp[6] = new SqlParameter();
            dbp[6].ParameterName = "IDUtente";
            dbp[6].DbType = DbType.Int32;
            dbp[6].Direction = ParameterDirection.Output;
            dbp[6].Value = obj.IDUtente;

            dbp[7] = new SqlParameter();
            dbp[7].ParameterName = "Esiste";
            dbp[7].DbType = DbType.Boolean;
            dbp[7].Direction = ParameterDirection.Output;

            SqlCommandObject sco = new SqlCommandObject();
            sco.SPName = "Utenti.SP_Utenti_Insert";
            sco.SPParams = dbp;

            DataTable dt;
            List<ExpandoObject> outputList = new List<ExpandoObject>();

            string proc = sqlop.ExecuteProcedure(sco, out dt, out outputList);
            IEnumerable<dynamic> esiste = outputList.Cast<dynamic>().Where(x => x.Nome.Contains("@Esiste"));

            return Convert.ToBoolean(esiste.First().Value);
        }
Beispiel #24
0
 public void SetUtente(string userEmail)
 {
     Utente = _utenteRepository.QueryOver()
         .Where(el => el.Email == userEmail)
         .Cacheable()
         .SingleOrDefault();
 }
Beispiel #25
0
        internal string UpdateUtente(Utente obj)
        {
            sqlop = new SqlOperations();
            sqlop.databaseConnection = ConfigurationManager.ConnectionStrings["cs"].ToString();

            DbParameter[] dbp = new DbParameter[6];

            dbp[0] = new SqlParameter();
            dbp[0].ParameterName = "IDUtente";
            dbp[0].DbType = DbType.Int32;
            dbp[0].Direction = ParameterDirection.Input;
            dbp[0].Value = obj.IDUtente;

            dbp[1] = new SqlParameter();
            dbp[1].ParameterName = "Nome";
            dbp[1].DbType = DbType.String;
            dbp[1].Direction = ParameterDirection.Input;
            dbp[1].Value = obj.Nome;

            dbp[2] = new SqlParameter();
            dbp[2].ParameterName = "Cognome";
            dbp[2].DbType = DbType.String;
            dbp[2].Direction = ParameterDirection.Input;
            dbp[2].Value = obj.Cognome;

            dbp[3] = new SqlParameter();
            dbp[3].ParameterName = "Email";
            dbp[3].DbType = DbType.String;
            dbp[3].Direction = ParameterDirection.Input;
            dbp[3].Value = obj.Email;

            dbp[4] = new SqlParameter();
            dbp[4].ParameterName = "UserID";
            dbp[4].DbType = DbType.String;
            dbp[4].Direction = ParameterDirection.Input;
            dbp[4].Value = obj.UserID;

            dbp[5] = new SqlParameter();
            dbp[5].ParameterName = "IDProfilo";
            dbp[5].DbType = DbType.Int32;
            dbp[5].Direction = ParameterDirection.Input;
            dbp[5].Value = obj.IDProfilo;

            SqlCommandObject sco = new SqlCommandObject();
            sco.SPName = "Utenti.SP_Utenti_Update";
            sco.SPParams = dbp;

            DataTable dt;
            string proc = sqlop.ExecuteProcedure(sco, out dt);

            if (proc != string.Empty)
                return proc;

            return "";
        }
Beispiel #26
0
 public JsonDataBase(string dBFilePath, Utente login)
 {
     dataBaseFilePath = dBFilePath;
     CredenzialiLogin = login;
     PasswordDataBase = JsonDatabaseHelper.GetData(dataBaseFilePath);
 }
Beispiel #27
0
        public static void EseguiCreaModificaCancella()
        {
            //Istanzio il manager dei libri
            Console.WriteLine();
            Console.WriteLine("ESECUZIONE DEL WORKFLOW UTENTI...");
            Console.WriteLine();
            UtenteManager manager = new UtenteManager();

            //Visualizzazione contenuto database
            Console.WriteLine("Lettura del database...");

            var UtentiInArchivio = manager.Carica();

            Console.WriteLine($"Trovati {UtentiInArchivio.Count} utenti in archivio");
            foreach (var currentUtente in UtentiInArchivio)
            {
                Console.WriteLine($"Lettura: {currentUtente.Username} (ID:{currentUtente.Id})");
            }
            Console.WriteLine("");

            //Creazione di un nuovo libro => "C" di CRUD
            Console.WriteLine("Creazione di un Utente...");
            Random randomGenerator = new Random();
            var    nuovoUtente     = new Utente
            {
                Username       = "******",
                Nome           = "Mario",
                Cognome        = "Rossi",
                Timestamp      = DateTime.Now,
                UtenteCreatore = "mario.rossi",
            };

            manager.Crea(nuovoUtente);
            Console.WriteLine("L'utente dovrebbe essere stato creato su disco!");
            Console.WriteLine();

            //Leggiamo i libri dal disco => "R" di CRUD
            Console.WriteLine("Lettura del database...");
            UtentiInArchivio = manager.Carica();
            Console.WriteLine($"Trovati {UtentiInArchivio.Count} utenti in archivio");
            foreach (var currentUtenti in UtentiInArchivio)
            {
                Console.WriteLine($"Lettura: {currentUtenti.Username} (ID:{currentUtenti.Id})");
            }
            Console.WriteLine("");

            //Modifico genere esistente e scrivo sui disco
            Console.WriteLine("Modifica di un utente esistente...");
            nuovoUtente.Username = "******";
            nuovoUtente.Cognome  = "Verdi";
            manager.Aggiorna(nuovoUtente);
            Console.WriteLine("l'usename e Cognome cambiati dovrebbero essere sul disco!");
            Console.WriteLine();

            //Leggiamo i libri dal disco => "R" di CRUD
            Console.WriteLine("Lettura del database...");
            UtentiInArchivio = manager.Carica();
            Console.WriteLine($"Trovati {UtentiInArchivio.Count} Utenti in archivio");
            foreach (var currentUtente in UtentiInArchivio)
            {
                Console.WriteLine($"Lettura: {currentUtente.Username} (ID:{currentUtente.Id})");
            }
            Console.WriteLine("");


            //Cancellazione del genere => "D" di CRUD
            Console.WriteLine("Cancellazione di un libro esistente...");
            manager.Cancella(nuovoUtente);
            Console.WriteLine("Il libro dovrebbe essere stato cancellato dal disco!");
            Console.WriteLine();

            //Leggiamo i libri dal disco => "R" di CRUD
            Console.WriteLine("Lettura del database...");
            UtentiInArchivio = manager.Carica();
            Console.WriteLine($"Trovati {UtentiInArchivio.Count} libri in archivio");
            foreach (var currentUtente in UtentiInArchivio)
            {
                Console.WriteLine($"Lettura: {currentUtente.Username} (ID:{currentUtente.Id})");
            }
            Console.WriteLine("");
        }
Beispiel #28
0
        private static Receita CreateReceitaIfDoesNotExist(ServicoDomicilioDbContext db, Medico medico, Utente utente)
        {
            DateTime Date    = DateTime.Now;
            Receita  receita = db.Receita.SingleOrDefault(b => b.Nreceita == nreceita);

            if (receita == null)
            {
                nreceita++;
                db.Receita.Add(new Receita {
                    MedicoId = medico.MedicoId, UtenteId = utente.UtenteId, Date = Date, Nreceita = nreceita
                });
                db.SaveChanges();
            }

            return(receita);
        }
Beispiel #29
0
        /// <summary>
        /// Ricerca fascicoli
        /// </summary>
        /// <param name="filterItem"></param>
        /// <param name="pagingContext"></param>
        /// <returns></returns>
        public static Fascicolo[] SearchFascicoli(FascicoliFilterItem filterItem, PagingContext pagingContext)
        {
            FiltroRicerca[] filters = filterItem.ToFiltriRicerca();

            int pageCount;
            int recordCount;


            Utente     user       = UserManager.getUtente();
            InfoUtente infoUtente = UserManager.getInfoUtente();

            Registro registro = null;

            foreach (Registro item in UserManager.getRuolo().registri)
            {
                if (item.systemId.Equals(filterItem.IDRegistro))
                {
                    registro = item;
                    break;
                }
            }

            FascicolazioneClassificazione classificazione = null;

            if (filterItem.CodiceNodoTitolario != string.Empty)
            {
                ClassificaHandler classificaHandler = new ClassificaHandler();
                classificazione = classificaHandler.GetClassificazione(filterItem.CodiceNodoTitolario, registro);
            }

            DocsPaWebService ws = new DocsPaWebService();

            // Lista dei system id dei fascicoli. Non utilizzata
            SearchResultInfo[] idProjects = null;

            Fascicolo[] retValue = ws.FascicolazioneGetListaFascicoliPaging(
                infoUtente,
                classificazione,
                registro,
                filters,
                false,
                false,
                false,
                pagingContext.PageNumber,
                pagingContext.PageSize,
                false,
                null,
                out pageCount,
                out recordCount,
                out idProjects);


            pagingContext.PageCount   = pageCount;
            pagingContext.RecordCount = recordCount;

            if (retValue == null)
            {
                retValue = new Fascicolo[0];
            }

            return(retValue);
        }
Beispiel #30
0
        /// <summary>
        /// Metodo per la costruzione del corpo della mail
        /// </summary>
        /// <param name="codice"></param>
        /// <param name="utente"></param>
        /// <param name="param">Parametri relativi all'alert</param>
        /// <returns></returns>
        private string getBodyMail(string codice, InfoUtente utente, string param)
        {
            string testo      = string.Empty;
            string dataInizio = string.Empty;

            //recupero i parametri relativi all'alert
            //string parametri = this.getParametriAlert(utente.idAmministrazione, codice);

            //dati utente CS da inserire nel messaggio
            Utente user = BusinessLogic.Utenti.UserManager.getUtenteById(utente.idPeople);
            string nome = user.nome + " " + user.cognome;

            //amministrazione
            string amministrazione = BusinessLogic.Amministrazione.AmministraManager.AmmGetInfoAmmCorrente(utente.idAmministrazione).Descrizione;

            //costruzione corpo del messaggio
            testo = "Si segnala che l'utente " + nome;
            switch (codice)
            {
            case "LEGGIBILITA_ANTICIPATA":
                testo = testo + ", in data " + DateTime.Now.ToString("dd/MM/yyyy") +
                        ", ha eseguito un'operazione di verifica di leggibilità sull'istanza di conservazione numero " + param +
                        " dell'Amministrazione " + amministrazione + " anticipatamente rispetto ai termini di scadenza previsti.";
                break;

            case "LEGGIBILITA_PERC":
                testo = testo + ", in data " + DateTime.Now.ToString("dd/MM/yyyy") + " ha eseguito un'operazione di " +
                        "verifica di leggibilità sull'istanza di conservazione numero " + param + " dell'Amministrazione "
                        + amministrazione + " selezionando un campione da verificare di dimensioni maggiori rispetto a quelle consentite.";
                break;

            case "LEGGIBILITA_SINGOLO":
                if (!string.IsNullOrEmpty(param))
                {
                    dataInizio = param.Split('§')[2];
                }
                testo = testo + ", nel periodo dal " + dataInizio + " al " + DateTime.Now.ToString("dd/MM/yyyy") +
                        ", ha superato la frequenza consentita per l'utilizzo della funzione di verifica " +
                        "leggibilità di un singolo documento dell'Amministrazione " + amministrazione + ".";
                break;

            case "DOWNLOAD":
                if (!string.IsNullOrEmpty(param))
                {
                    dataInizio = param.Split('§')[2];
                }
                testo = testo + ", nel periodo dal " + dataInizio + " al " + DateTime.Now.ToString("dd/MM/yyyy") +
                        ", ha superato la frequenza consentita per l'utilizzo della funzione di download delle " +
                        "istanze di conservazione dell'Amministrazione " + amministrazione + ".";
                break;

            case "SFOGLIA":
                if (!string.IsNullOrEmpty(param))
                {
                    dataInizio = param.Split('§')[2];
                }
                testo = testo + ", nel periodo dal " + dataInizio + " al " + DateTime.Now.ToString("dd/MM/yyyy") +
                        ", ha superato la frequenza consentita per l'utilizzo della funzione di consultazione " +
                        "delle istanze di conservazione dell'Amministrazione " + amministrazione + ".";
                break;
            }

            return(testo);
        }
Beispiel #31
0
        public Lega CreaLega(String nome, int numeroPartecipanti, String nomeSquadra, Utente utente)
        {
            IGestioneUtenteController gestioneUtenteController = new GestioneUtenteController();

            return(gestioneUtenteController.CreaLega(nome, numeroPartecipanti, nomeSquadra, utente));
        }
Beispiel #32
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="utente"></param>
 private static void ValidateForDelete(Utente utente)
 {
     Utils.Validator.CheckProperty <int>(utente, "Id", true, 0);
     Utils.Validator.CheckProperty <DateTime>(utente, "DataCreazione", true, 50);
     Utils.Validator.CheckProperty <DateTime>(utente, "DataUltimaModifica", true, 50);
 }
Beispiel #33
0
        public Boolean cambiaPassword(String vecchiaPass, String nuovaPass, String domanda, String risposta, Utente utente)
        {
            IGestioneUtenteController gestioneUtenteController = new GestioneUtenteController();

            return(gestioneUtenteController.CambiaPassword(vecchiaPass, nuovaPass, domanda, risposta, utente));
        }
Beispiel #34
0
        public void SaveOrdine(OrdinePresenter ordinePresenter)
        {
            var utente = new Utente
            {
                Nome = ordinePresenter.Nome,
                Cognome = ordinePresenter.Cognome,
                Indirizzo = ordinePresenter.Indirizzo,
                Telefono = ordinePresenter.Telefono
            };

            this.db
                .Utenti
                .Add(utente);

            this.db
                .SaveChanges();

            var ordine = new Ordine
            {
                Data = DateTime.Now,
                ProdottoId = ordinePresenter.ProdottoId,
                UtenteId = utente.Id
            };

            this.db
                .Ordini
                .Add(ordine);

            this.db
                .SaveChanges();
        }
Beispiel #35
0
        public static SortedList <string, Utente> readClienti()
        {
            SortedList <string, Utente> listClienti = new SortedList <string, Utente>();

            try
            {
                m_dbConnection.Open();
                string sql = "SELECT idcliente,clienti.nome as nomeCl,cognome,sesso,codiceFiscale,"
                             + "dataNascita,luogoNascita,email,telefono,indirizzo,province.cod as provC,province.nome as provN,"
                             + "province.regione as provR,stato,scadAbb,scadVisita,stato_cliente"
                             + " FROM clienti inner join province on province.cod = provincia";
                SQLiteCommand    command = new SQLiteCommand(sql, m_dbConnection);
                SQLiteDataReader rdr     = command.ExecuteReader();
                while (rdr.Read())
                {
                    try
                    {
                        Utente user = new Utente();
                        user.Identifier           = rdr["idcliente"].ToString();
                        user.Nome                 = rdr["nomeCl"].ToString();
                        user.Cognome              = rdr["cognome"].ToString();
                        user.Sesso                = rdr["sesso"].ToString();
                        user.CodiceFiscale        = rdr["codiceFiscale"].ToString();
                        user.DataDiNascita        = Convert.ToDateTime(rdr["dataNascita"].ToString());
                        user.LuogoNascita         = rdr["luogoNascita"].ToString();
                        user.Email                = rdr["email"].ToString();
                        user.Telefono             = rdr["telefono"].ToString();
                        user.Indirizzo            = rdr["indirizzo"].ToString();
                        user.Provincia            = new Provincia(rdr["provC"].ToString(), rdr["provN"].ToString(), rdr["provR"].ToString());
                        user.Stato                = rdr["stato"].ToString();
                        user.ScadenzaAbb          = Convert.ToDateTime(rdr["scadAbb"].ToString());
                        user.ScadenzaVisitaMedica = Convert.ToDateTime(rdr["scadVisita"].ToString());
                        try
                        {
                            user.Status = Convert.ToInt32(rdr["stato_cliente"].ToString());
                        }
                        catch (Exception ex)
                        {
                            if (Convert.ToBoolean(rdr["stato_cliente"].ToString()))
                            {
                                user.Status = 1;
                            }
                            else
                            {
                                user.Status = 0;
                            }
                        }
                        listClienti.Add(user.Identifier, user);
                    }catch (Exception ex) {
                        Helper.Logger("class=DBSqlLite readCliente " + ex.Message);
                    }
                }

                if (rdr != null)
                {
                    rdr.Close();
                }

                foreach (string id in listClienti.Keys)
                {
                    try
                    {
                        sql = "SELECT presenze.dataingresso as dataIn,presenze.oraIn as oraIn,presenze.oraOut as oraOut,presenze.idpresenze as idPres" +
                              " FROM presenze INNER JOIN clienti on clienti.idcliente = presenze.idutente" +
                              " WHERE idcliente = " + id;
                        command = new SQLiteCommand(sql, m_dbConnection);
                        rdr     = command.ExecuteReader();

                        while (rdr.Read())
                        {
                            Utente   user = listClienti[id];
                            Presenza pres = new Presenza();
                            pres.Data        = Convert.ToDateTime(rdr["dataIn"].ToString());
                            pres.OraIngresso = TimeSpan.Parse(rdr["oraIn"].ToString());
                            pres.OraUscita   = TimeSpan.Parse(rdr["oraOut"].ToString());
                            pres.IdPresenza  = Convert.ToInt32(rdr["idPres"].ToString());
                            user.ListPresenze.Add(pres.Data, pres);
                        }
                    }
                    catch (Exception ex)
                    {
                        Helper.Logger("class=DBSqlLite readClienti.readPresenze ->" + ex.Message);
                    }
                    finally
                    {
                        if (rdr != null)
                        {
                            rdr.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Helper.Logger("class=DBSqlLite readClienti ->" + ex.Message);
            }
            finally
            {
                m_dbConnection.Close();
            }
            return(listClienti);
        }