Ejemplo n.º 1
0
 public void UpdateLocation(RegistryLocation registryLocation)
 {
     try
     {
         using (MySqlCommand dbComm = new MySqlCommand())
         {
             dbComm.CommandType = CommandType.Text;
             dbComm.CommandText = SQL.RegistryScripts.UpdateLocation;
             dbComm.Parameters.AddWithValue("desc", registryLocation.Desc_Conto);
             dbComm.Parameters.AddWithValue("note", registryLocation.Note);
             dbComm.Parameters.AddWithValue("id", registryLocation.Id_Conto);
             dbComm.Connection = new MySqlConnection(DAFconnection.GetConnectionType());
             dbComm.Connection.Open();
             dbComm.ExecuteNonQuery();
             dbComm.Connection.Close();
         }
     }
     catch (MySqlException err)
     {
         throw new Exception(err.Message);
     }
     catch (Exception err)
     {
         throw new Exception(err.Message);
     }
 }
Ejemplo n.º 2
0
 public RegistryLocationList GetRegistryLocationList()
 {
     try
     {
         using (MySqlDataAdapter dbAdaptar = new MySqlDataAdapter())
         {
             dbAdaptar.SelectCommand             = new MySqlCommand();
             dbAdaptar.SelectCommand.Connection  = new MySqlConnection(DAFconnection.GetConnectionType());
             dbAdaptar.SelectCommand.CommandType = CommandType.Text;
             dbAdaptar.SelectCommand.CommandText = SQL.RegistryScripts.GetRegistryLocationList;
             DataTable dt = new DataTable();
             dbAdaptar.Fill(dt);
             RegistryLocationList RLL = new RegistryLocationList();
             foreach (DataRow dr in dt.Rows)
             {
                 RegistryLocation RL = new RegistryLocation();
                 RL.Id_Conto   = (int)dr.Field <uint>("id_conto");
                 RL.Desc_Conto = dr.Field <string>("desc_conto");
                 RL.Note       = dr.Field <string>("note");
                 RLL.Add(RL);
             }
             return(RLL);
         }
     }
     catch (MySqlException err)
     {
         throw new Exception(err.Message);
     }
     catch (Exception err)
     {
         throw new Exception(err.Message);
     }
 }
 public void CloseDialogWithResult(Window window, DialogResult result, RegistryLocation location, RegistryOwner owner, TipoSoldi soldi)
 {
     CloseDialogWithResult(window, result);
     this.Location = location;
     this.Owner    = owner;
     this.Soldi    = soldi;
 }
 public Dialog3CombosViewModel(string message, RegistryLocationList locationList, RegistryOwnersList ownerList, TipoSoldiList tipoSoldis,
                               RegistryLocation location = null, RegistryOwner owner = null, TipoSoldi soldi = null)
     : base(message)
 {
     RegistryLocations = locationList;
     RegistryOwners    = ownerList;
     TipoSoldis        = tipoSoldis;
     NoCommand         = new CommandHandler(OnNoClicked);
     CancelCommand     = new CommandHandler(OnCancelClicked);
     YesCommand        = new CommandHandler(OnYesClicked);
     if (location == null || owner == null || soldi == null)
     {
         Id_Location = 0;
         Id_Owner    = 0;
         Id_Soldi    = 0;
     }
     else
     {
         Id_Location = location.Id_Conto;
         Id_Owner    = owner.Id_gestione;
         Id_Soldi    = soldi.Id_Tipo_Soldi;
         Location    = new RegistryLocation()
         {
             Id_Conto = location.Id_Conto, Desc_Conto = location.Desc_Conto
         };
         Owner = new RegistryOwner()
         {
             Id_gestione = owner.Id_gestione, Nome_Gestione = owner.Nome_Gestione
         };
         Soldi = new TipoSoldi((Models.Enum.TipologiaSoldi)soldi.Id_Tipo_Soldi); // { Id_Tipo_Soldi = soldi.Id_Tipo_Soldi, Desc_Tipo_Soldi = soldi.Desc_Tipo_Soldi };
     }
 }
Ejemplo n.º 5
0
        public RegisteredByAttribute(RegistryLocation location, string path, string name)
        {
            this.path = path;
            this.name = name;

            switch (location)
            {
                case RegistryLocation.ClassesRoot:
                    root = Registry.ClassesRoot;
                    break;
                case RegistryLocation.CurrentConfig:
                    root = Registry.CurrentConfig;
                    break;
                case RegistryLocation.CurrentUser:
                    root = Registry.CurrentUser;
                    break;
                case RegistryLocation.DynData:
                    root = Registry.DynData;
                    break;
                case RegistryLocation.LocalMachine:
                    root = Registry.LocalMachine;
                    break;
                case RegistryLocation.PerformanceData:
                    root = Registry.PerformanceData;
                    break;
                case RegistryLocation.Users:
                    root = Registry.Users;
                    break;
            }
        }
Ejemplo n.º 6
0
 public override string ToString()
 {
     if (RegistryLocation == StartupItemLocation.Folder)
     {
         return(RegistryLocation.ToString());
     }
     return(string.Format("{0}:{1}", RegistryLocation, StartupType));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Given a registry location containing a property name and value, create the ToolsetPropertyDefinition that maps to it
        /// </summary>
        /// <param name="toolsetWrapper">Wrapper for the key that we're getting values from</param>
        /// <param name="propertyName">The name of the property whose value we wish to generate a ToolsetPropertyDefinition for.</param>
        /// <returns>A ToolsetPropertyDefinition instance corresponding to the property name requested.</returns>
        private static ToolsetPropertyDefinition CreatePropertyFromRegistry(RegistryKeyWrapper toolsetWrapper, string propertyName)
        {
            string propertyValue = null;

            if (propertyName != null && propertyName.Length == 0)
            {
                InvalidToolsetDefinitionException.Throw("PropertyNameInRegistryHasZeroLength", toolsetWrapper.Name);
            }

            try
            {
                propertyValue = GetValue(toolsetWrapper, propertyName);
            }
            catch (RegistryException ex)
            {
                InvalidToolsetDefinitionException.Throw(ex, "RegistryReadError", ex.Source, ex.Message);
            }

            // For the purposes of error location, use the registry path instead of a file name
            IElementLocation location = new RegistryLocation(toolsetWrapper.Name + "@" + propertyName);

            return(new ToolsetPropertyDefinition(propertyName, propertyValue, location));
        }
Ejemplo n.º 8
0
 public RegisteredByAttribute(RegistryLocation location, string path)
     : this(location, path, String.Empty)
 {
 }