Ejemplo n.º 1
0
 public TipoSoldiList GetTipoSoldiList()
 {
     try
     {
         using (MySqlDataAdapter dbAdapter = new MySqlDataAdapter())
         {
             dbAdapter.SelectCommand             = new MySqlCommand();
             dbAdapter.SelectCommand.CommandType = CommandType.Text;
             dbAdapter.SelectCommand.CommandText = SQL.RegistryScripts.GetTipoSoldiList;
             dbAdapter.SelectCommand.Connection  = new MySqlConnection(DAFconnection.GetConnectionType());
             DataTable dt = new DataTable();
             dbAdapter.Fill(dt);
             TipoSoldiList TSL = new TipoSoldiList();
             foreach (DataRow dr in dt.Rows)
             {
                 TipoSoldi TS = new TipoSoldi((Models.Enumeratori.TipologiaSoldi)dr.Field <uint>("id_tipo_soldi"));
                 TSL.Add(TS);
             }
             return(TSL);
         }
     }
     catch (MySqlException err)
     {
         throw new Exception(err.Message);
     }
     catch (Exception err)
     {
         throw new Exception(err.Message);
     }
 }
 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 };
     }
 }
 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;
 }