void UpdateFermo()
    {
        // quando prendo avanti
        if (Input.GetKey(KeyCode.W))
        {
            statoCorrente = Stato.Movimento;
            moveTo        = this.transform.position + this.transform.forward;
        }
        // quando prendo avanti
        if (Input.GetKey(KeyCode.S))
        {
            statoCorrente = Stato.Movimento;
            moveTo        = this.transform.position - this.transform.forward;
        }

        if (Input.GetKey(KeyCode.A))
        {
            isRotating = true;
            rotateTo   = Quaternion.Euler(0, -90, 0) * this.transform.rotation;
        }
        if (Input.GetKey(KeyCode.D))
        {
            isRotating = true;
            rotateTo   = Quaternion.Euler(0, 90, 0) * this.transform.rotation;
        }
    }
Exemple #2
0
 private FacadeStato()
 {
     _ou    = UnitàOperativa.GetInstance();
     _mc    = MemoriaControllo.GetInstance();
     _ram   = MemoriaCentrale.GetInstance();
     _stato = Stato.GetInstance();
 }
Exemple #3
0
        public void SetEmail(DatabaseContext db, string email, Stato stato = Stato.ATTIVO)
        {
            PERSONA_EMAIL model = this.Email.SingleOrDefault(m => m.TIPO == (int)TipoEmail.Registrazione);

            //this.Email.Remove(model);
            if (model == null)
            {
                if (!string.IsNullOrWhiteSpace(email))
                {
                    model                  = new PERSONA_EMAIL();
                    model.ID_PERSONA       = this.Persona.ID;
                    model.DATA_INSERIMENTO = DateTime.Now;
                    model.TIPO             = (int)TipoEmail.Registrazione;
                    model.STATO            = (int)stato;
                    model.EMAIL            = email;
                    db.PERSONA_EMAIL.Add(model);
                    this.Email.Add(model);
                }
            }
            else if (model.EMAIL != email)
            {
                if (string.IsNullOrWhiteSpace(email))
                {
                    db.Entry(model).State = EntityState.Deleted;
                    this.Email.Remove(model);
                }
                else
                {
                    model.EMAIL           = email;
                    db.Entry(model).State = EntityState.Modified;
                }
            }
            db.SaveChanges();
        }
Exemple #4
0
 /* COSTRUTTORE */
 public Task(DateTime dataDiScadenza, string descrizione, Stato importanza, int id)
 {
     DataScadenza = dataDiScadenza;
     Descrizione  = descrizione;
     Id           = id;
     Importanza   = importanza;
 }
Exemple #5
0
        /*
         * Verrà chiesto all'utente di inserire l'importanza dei task che si vuole visualizzare
         * Verrà poi richiamato un metodo che stamperà solo i task richiesti dall'utente,
         * quindi filtrati per importanza
         */
        internal static void FiltraTask()
        {
            Console.WriteLine("Inserisci i task da visualizzare (Basso, Medio, Alto)");
            Stato stato = (Stato)Enum.Parse(typeof(Stato), Console.ReadLine());

            GeneralTools.DisplayHeader();
            Console.WriteLine(_gestioneAgenda.FiltraTask(stato));
        }
 public AbbonamentoModel(ABBONAMENTO model)
 {
     this.Id             = model.ID;
     this.Nome           = model.NOME;
     this.BonusPerUtente = model.BONUS_PERUTENTE;
     this.Durata         = model.DURATA;
     this.Stato          = (Stato)model.STATO;
 }
Exemple #7
0
        /*
         * Questo metodo prende come parametri di input, tutti i dati necessari per invocare
         * il costruttore e istanziare un nuovo oggetto di tipo Task correttamente
         */
        internal Task AggiungiTask(DateTime dataScadenza, string descrizione, Stato importanza)
        {
            Task task = new Task(dataScadenza, descrizione, importanza, ++_id);

            _tasks.Add(task.Id, task);

            return(task);
        }
Exemple #8
0
 public static void GetSrv(List <CTipoCfgSrv> TestSrvs, List <Dati> ListaDati)
 {
     foreach (var test in TestSrvs)
     {
         System.ServiceProcess.ServiceControllerStatus Stato;
         string DisplayName;
         if (Servizi.DoesServiceExist(test.Nome, out DisplayName, out Stato))
         {
             AggiungiServ(DisplayName, test.Nome, Stato.ToString(), test.Tipo, ListaDati);
         }
     }
 }
        private void LoadProprieta(PERSONA_RICERCA model)
        {
            List <FINDSOTTOCATEGORIE_Result> categorie = (HttpContext.Current.Application["categorie"] as List <FINDSOTTOCATEGORIE_Result>);
            FINDSOTTOCATEGORIE_Result        categoria = categorie.SingleOrDefault(item => item.ID == model.RICERCA.ID_CATEGORIA);

            this.Id              = model.ID;
            this.Categoria       = categoria.NOME;
            this.Testo           = model.RICERCA.NOME;
            this.DataInserimento = model.RICERCA.DATA_INSERIMENTO;
            this.DataModifica    = (DateTime)model.RICERCA.DATA_MODIFICA;
            this.Stato           = (Stato)model.RICERCA.STATO;
        }
Exemple #10
0
        private const string _fileName = @"elenco.txt"; //file che verrà creato per il salvataggio dei dati

        /*
         * Questo metodo gestisce l'input e l'output per la creazione di un nuovo task
         * per ogni dato richiesto verrà richiamata la corrispettiva funzione che ne
         * restituirà il valore corretto, che come parametro di input avrà una stringa
         * con la quale si chiederà all'utente di inserire i dati.
         * Successivamente viene invocato un altro metodo che si occuperà di passare i
         * dati ottenuti dall'utente utili per istanziare un nuovo oggetto.
         */
        internal static void AggiungiTask()
        {
            Console.WriteLine("\nNuovo Task");
            Console.WriteLine("----------\n");
            DateTime dataScadenza = GeneralTools.GetDate("Inseriti data di scadenza (es. 08/08/2021): ");
            string   descrizione  = GeneralTools.GetText("Inserisci la descrizione del task: ");
            Stato    importanza   = GeneralTools.GetStato("Seleziona importanza (Basso, Medio, Alto)");

            Task task = _gestioneAgenda.AggiungiTask(dataScadenza, descrizione, importanza);

            Console.WriteLine("Aggiunto");
        }
Exemple #11
0
        /*
         * Prende come input un tipo Enum, attraverso un ciclo, controlla nel Dictionary se
         * il task ciclato ha come Stato di importanza lo stato che abbiamo preso in input, e
         * se è vero verrà aggiunto alla stringa da restituire, se è falso lo salta e non lo
         * aggiunge. Per il tipo di stampa viene utilizzata la proprietà della classe Task
         * 'Dettagli'
         */
        internal string FiltraTask(Stato stato)
        {
            string line = null;

            foreach (Task task in _tasks.Values)
            {
                if (task.Importanza == stato)
                {
                    line += task.Detaggli + '\n';
                }
            }
            return(line);
        }
Exemple #12
0
        /*
         * Funzione che prende in input una stringa che verrà poi stampata a schermo, verrà chiesto
         * all'utente di inserire un testo (Basso/Medio/Alto), verrà convertito e il valore
         * restituito sarà di tipo Enum
         */

        public static Stato GetStato(string label)
        {
            //Se inserisco una stringa diversa da quella richiesta, lancia un'eccezione...
            //prima prova con try e catch
            try
            {
                Console.WriteLine(label);
                Stato stato = (Stato)Enum.Parse(typeof(Stato), Console.ReadLine());
                return(stato);
            }
            catch (Exception)
            {
                Console.WriteLine("Scelta non valida");
                return(GetStato(label));
            }
        }
Exemple #13
0
        public static Stato GetInstance()
        {
            if (_stato != null)
            {
                return(_stato);
            }
            lock (Object)
            {
                if (_stato == null)
                {
                    _stato = new Stato();
                }
            }

            return(_stato);
        }
Exemple #14
0
        public override string ToString()
        {
            string text = "";

            text = text +
                   "ID: " + Identificativo.ToString() + "\n" +
                   "Marca: " + Marca + "\n" +
                   "Stato: " + Stato.ToString() + "\n" +
                   "Disponibilita: " + Disponibiita + "\n" +
                   "Longitudine: " + Longitudine.ToString() + "\n" +
                   "Latitudine: " + Latitudine.ToString() + "\n" +
                   "CostoMinuto: " + CostoMinuto.ToString() + "\n" +
                   "CostoOra: " + costoOra.ToString() + "\n" +
                   "CostoGiorno: " + costoGiorno.ToString() + "\n" +
                   "Posti: " + posti.ToString() + "\n";;

            return(text);
        }
Exemple #15
0
        private void AggiornaCommesseCollegate()
        {
            SqlConnection connessione  = new SqlConnection(Properties.Resources.StringaConnessione);
            SqlConnection connessione1 = new SqlConnection(Properties.Resources.StringaConnessione);
            SqlDataReader dati;
            int           IdCommessa, NrLastreNecessarie, NrLastreOrdinate, NrLastreAssegnate, Stato, ImpegnoTotale;
            bool          Parziale;

            connessione.Open();
            string     query   = "SELECT Commesse.IDCommessa,CodCommessa,TipoCommessa,NrLastreRichieste,NrPezziOrdinati,QtaImpegnata,Stato,ImpegnataMatPrima,EvasoParziale FROM Commesse INNER JOIN ImpegnateOrdinato ON Commesse.IDCommessa = ImpegnateOrdinato.IdCommessa WHERE TipoCommessa = 1 AND IdOrdFornDett = " + IdDettaglio.ToString();
            SqlCommand comando = new SqlCommand(query, connessione);

            dati = comando.ExecuteReader();
            while (dati.Read())
            {
                IdCommessa         = Convert.ToInt32(dati.GetValue(0));
                NrLastreNecessarie = Convert.ToInt32(dati.GetValue(3));
                NrLastreOrdinate   = Convert.ToInt32(dati.GetValue(4));
                NrLastreAssegnate  = Convert.ToInt32(dati.GetValue(5));
                Stato         = Convert.ToInt32(dati.GetValue(6));
                ImpegnoTotale = Convert.ToInt32(dati.GetValue(7));
                Parziale      = Convert.ToBoolean(dati.GetValue(8));

                ImpegnoTotale = ImpegnoTotale + NrLastreAssegnate;
                if (ImpegnoTotale >= NrLastreNecessarie)
                {
                    Stato    = 2;
                    Parziale = false;
                }
                connessione1.Open();
                string     query2   = "UPDATE Commesse SET ImpegnataMatPrima = " + ImpegnoTotale.ToString() + " , Stato = " + Stato.ToString() + " , EvasoParziale = '" + Parziale.ToString() + "' WHERE IDCommessa = " + IdCommessa.ToString();
                SqlCommand comando2 = new SqlCommand(query2, connessione1);
                try
                {
                    comando2.ExecuteNonQuery();
                }
                catch (Exception e)
                { }
                textBox1.Text = textBox1.Text + "Aggiornata commessa nr. " + IdCommessa.ToString() + " !\r\n";
                connessione1.Close();
            }
            dati.Close();
            connessione.Close();
        }
        public static void EsercizioTipo()
        {
            #region value type vs references type
            //value type

            //bool
            bool x = true;
            bool y = false;
            bool z = !x;
            Console.WriteLine("Valore z: {0}", z);

            //Numerici
            int i      = 0;
            int j      = 34;
            int numero = 1 * (2 + 3) * 4;

            float   f    = 1f / 3F;
            double  doub = 1d / 3d;
            decimal dec  = 1m / 3m;
            Console.WriteLine("Float: " + f);     //meno cifre decimali
            Console.WriteLine("Double: " + doub); //medio
            Console.WriteLine("Decimal: " + dec); //più cifre di tutti

            Console.WriteLine($"Range float: " + float.MinValue + " - " + float.MaxValue);
            Console.WriteLine($"Range double: " + double.MinValue + " - " + double.MaxValue);
            Console.WriteLine($"Range decimal: " + decimal.MinValue + " - " + decimal.MaxValue);

            //DateTime
            DateTime now   = DateTime.Now;
            DateTime today = DateTime.Today;
            DateTime date  = new DateTime(2020, 12, 25);
            Console.WriteLine("Data ora: " + now);
            Console.WriteLine("Data oggi: " + today);
            Console.WriteLine("Data natale: " + date);

            DateTime tomorrow = now.AddDays(1);
            DateTime In5Hours = now.AddHours(5);
            Console.WriteLine("Tomorrow: " + tomorrow + ", 5 ore: " + In5Hours);

            //enum, definito all'inizio
            Stato myStato = Stato.New;

            if (myStato == Stato.New) // o == 0, stessa cosa
            {
                Console.WriteLine("MyStato contiene New");
            }



            //references type

            //string
            string nome = " Maria Chiara Colla ";
            Console.WriteLine("Nome Completo: " + nome + ",");
            int lunghezza = nome.Length;
            Console.WriteLine("Lunghezza nome completo: " + lunghezza);
            string trimString = nome.Trim();
            Console.WriteLine("Nome completo senza spazi: " + trimString + ",");
            string subString = nome.Substring(0, 13); //da dove inizia e dove finisce
            Console.WriteLine("Solo nome: " + subString);

            //classi (nuova cartella: Classi)
            Console.Clear(); // resetta la console

            Console.WriteLine("_________ CLASSI _________");

            Persona persona = new Persona();
            try
            {
                persona.CodiceFiscale = "RSSMRC";
                persona.Nome          = "Marco";
                persona.Cognome       = "Rossi";
                persona.DataNascita   = new DateTime(1958, 07, 20);
            }catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            Persona persona2 = new Persona()
            {
                Nome          = "Alessia",
                Cognome       = "Bianchi",
                CodiceFiscale = "BNCLSS59G57J123M"
            };

            Console.WriteLine(persona.FullName("Signor"));
            Console.WriteLine(persona2.FullName("Signora"));

            Impiegato impiegato = new Impiegato()
            {
                Nome          = "Luca",
                Cognome       = "Gialli",
                CodiceFiscale = "GLLLCU12N45L456C",
                NumeroFigli   = 1,
                DataNascita   = new DateTime(1987, 11, 15)
            };
            Console.WriteLine(impiegato.FullName(""));

            Persona impiegato2 = new Impiegato()  //prende l'implementazione di impiegato
            {
                Nome          = "Anna",
                Cognome       = "Neri",
                CodiceFiscale = "NRENNA09V67N186X",
                DataNascita   = new DateTime(1989, 09, 02),
                NumeroFigli   = 3
            };

            Console.WriteLine(impiegato2.FullName(""));

            Manager m = new Manager();


            //interfacce
            persona.LogInfo("Il log funziona");
            impiegato.LogInfo("log ok");  //funziona comunque, lo eredita dalla classe padre
            impiegato2.LogInfo("log ok"); //funziona anche qui, stesso motivo

            //classe computer e interfaccia ilogging
            Computer myComputer = new Computer()
            {
                Modello = "DELL XPS 9570"
            };

            myComputer.LogInfo("Funziona anche per la classe computer");

            //array dell'interfaccia
            ILogging[] loggingItems = { myComputer, persona };
            foreach (var elem in loggingItems)
            {
                elem.LogInfo("Prova");
            }

            //eccezioni
            Persona persona1 = new Persona();
            try
            {
                persona1.CodiceFiscale = "RSSMRC";
                persona1.Nome          = "Marco";
                persona1.Cognome       = "Rossi";
                persona1.DataNascita   = new DateTime(1958, 07, 20);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            try
            {
                int a      = 5;
                int b      = 0;
                int result = a / b;
                Console.WriteLine(result);
            }
            catch (DivideByZeroException d)
            {
                Console.WriteLine("Divide by Zero Exception: " + d.Message);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }



            #endregion
        }
Exemple #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try {
                if (!IsPostBack)
                {
                    this.InitializeLabel();
                    //***************************************************************
                    //GIORDANO IACOZZILLI
                    //17/07/2013
                    //Gestione dell'icona della copia del docuemnto/fascicolo in deposito.
                    //***************************************************************
                    try
                    {
                        if (this.FlagCopyInArchive == "1")
                        {
                            this.phNeutro.Visible      = true;
                            this.cimgbttIsCopy.ToolTip = "Copia del fascicolo in archivio corrente";
                        }
                    }
                    catch
                    {
                        //Questo è per Veltri.
                    }
                    //***************************************************************
                    //FINE
                    //***************************************************************
                    Fascicolo fascicolo = UIManager.ProjectManager.getProjectInSession();
                    if (fascicolo != null && !string.IsNullOrEmpty(fascicolo.systemID))
                    {
                        this.viewLabel(true);
                        this.projectLblIdGenerato.Text     = fascicolo.systemID;
                        this.projectLblCodiceGenerato.Text = fascicolo.codice;
                        switch (fascicolo.stato)
                        {
                        case "A":
                        {
                            this.projectLblStatoGenerato.Text     = Utils.Languages.GetLabelFromCode("prjectStatoRegistroAperto", UIManager.UserManager.GetUserLanguage());
                            this.projectLblStatoGenerato.CssClass = "open";
                            break;
                        }

                        case "C":
                        {
                            this.projectLblStatoGenerato.Text     = Utils.Languages.GetLabelFromCode("prjectStatoRegistroChiuso", UIManager.UserManager.GetUserLanguage());
                            this.projectLblStatoGenerato.CssClass = "close";
                            break;
                        }

                        default:
                        {
                            this.projectLblStatoGenerato.Text     = Utils.Languages.GetLabelFromCode("prjectStatoRegistroGiallo", UIManager.UserManager.GetUserLanguage());
                            this.projectLblStatoGenerato.CssClass = "giallo";
                            break;
                        }
                        }

                        Registro registro = UIManager.RegistryManager.getRegistroBySistemId(fascicolo.idRegistroNodoTit);
                        if (registro == null)
                        {
                            registro = UIManager.RegistryManager.getRegistroBySistemId(fascicolo.idRegistro);
                        }

                        if (registro != null)
                        {
                            this.projectLblRegistroGenerato.Text = registro.codRegistro;
                        }

                        OrgTitolario titolario = UIManager.ClassificationSchemeManager.getTitolario(fascicolo.idTitolario);
                        string       language  = UIManager.UserManager.GetUserLanguage();
                        if (titolario != null)
                        {
                            switch (titolario.Stato)
                            {
                            case OrgStatiTitolarioEnum.Attivo:
                                this.projectLblTitolarioGenerato.ToolTip = Utils.Languages.GetLabelFromCode("ProjectLblTitolarioAttivo", language).Replace("@@", titolario.DescrizioneLite);
                                this.projectLblTitolarioGenerato.Text    = ellipsis(projectLblTitolarioGenerato.ToolTip, 20);
                                break;

                            default:
                                this.projectLblTitolarioGenerato.ToolTip = UIManager.ClassificationSchemeManager.getTitolario(fascicolo.idTitolario).Descrizione;
                                this.projectLblTitolarioGenerato.Text    = ellipsis(projectLblTitolarioGenerato.ToolTip, 20);
                                break;
                            }
                        }

                        Fascicolo _tempfascicolo = UIManager.ProjectManager.getClassificazioneById(fascicolo.idClassificazione);
                        this.projectLblClassificaGenerato.ToolTip = _tempfascicolo.codice + " - " + _tempfascicolo.descrizione;
                        this.projectLblClassificaGenerato.Text    = ellipsis(projectLblClassificaGenerato.ToolTip, 50);
                        this.projectImgConservazione.Enabled      = true;
                        this.projectImgStampaEtichette.Enabled    = true;

                        if (fascicolo.folderSelezionato == null)
                        {
                            fascicolo.folderSelezionato = UIManager.GridManager.GetFolderByIdFasc(UIManager.UserManager.GetInfoUser(), fascicolo);
                        }
                        UIManager.ProjectManager.setProjectInSession(fascicolo);

                        if (fascicolo.template != null && !string.IsNullOrEmpty(fascicolo.template.SYSTEM_ID.ToString()) && fascicolo.template.SYSTEM_ID != 0)
                        {
                            this.ProjectLitTypeDocumentHead.Visible  = true;
                            this.ProjectLitTypeDocumentValue.Visible = true;
                            this.ProjectLitTypeDocumentValue.Text    = fascicolo.template.DESCRIZIONE.Length < 25 ? fascicolo.template.DESCRIZIONE: fascicolo.template.DESCRIZIONE.Substring(0, 25) + " ...";
                            this.ProjectLitTypeDocumentValue.ToolTip = fascicolo.template.DESCRIZIONE;
                        }
                        else
                        {
                            this.ProjectLitTypeDocumentHead.Visible  = false;
                            this.ProjectLitTypeDocumentValue.Visible = false;
                        }
                    }
                    else
                    {
                        this.viewLabel(false);
                    }

                    this.LoadKeys();
                    this.VisibiltyRoleFunctions();
                }
                else
                {
                    if (!string.IsNullOrEmpty(this.HiddenFaseDiagramma.Value))
                    {
                        this.SelectedPhaseId           = this.HiddenFaseDiagramma.Value;
                        this.HiddenFaseDiagramma.Value = string.Empty;
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ajaxModalPopupPhases", "ajaxModalPopupPhases();", true);
                    }

                    if (!string.IsNullOrEmpty(this.Phases.ReturnValue))
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "setReturnValue", "SetRetValue('Phases','');", true);

                        // Verifico se esistono ruoli mancanti
                        //this.MissingRolesList = DiagrammiManager.ChangeStateGetMissingRoles(UIManager.ProjectManager.getProjectInSession().systemID, this.Phases.ReturnValue);
                        this.SelectedState = DiagrammiManager.GetStatoById(this.Phases.ReturnValue);
                        if (this.SelectedState != null && this.SelectedState.STATO_FINALE)
                        {
                            this.projectLblStatoGenerato.Text     = Utils.Languages.GetLabelFromCode("prjectStatoRegistroChiuso", UIManager.UserManager.GetUserLanguage());
                            this.projectLblStatoGenerato.CssClass = "close";
                        }
                        else
                        {
                            this.projectLblStatoGenerato.Text     = Utils.Languages.GetLabelFromCode("prjectStatoRegistroAperto", UIManager.UserManager.GetUserLanguage());
                            this.projectLblStatoGenerato.CssClass = "open";
                        }


                        if (this.MissingRolesList != null && this.MissingRolesList.Count > 0)
                        {
                            // Esistono ruoli mancanti
                            this.SelectedState = DiagrammiManager.GetStatoById(this.Phases.ReturnValue);
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ajaxModalPopupMissingRoles", "ajaxModalPopupMissingRoles();", true);
                        }
                        else
                        {
                            // Non esistono ruoli mancanti
                            // E' possibile inviare le trasmissioni salvate
                            DiagrammiManager.ChangeStateSendTransmissions(this.Phases.ReturnValue);
                        }
                        this.UpHeaderProject.Update();
                    }
                }
            }
            catch (System.Exception ex)
            {
                UIManager.AdministrationManager.DiagnosticError(ex);
                return;
            }
        }