/// <summary> /// Estrae la lista di tutti i gestori /// </summary> /// <returns>Observable Collection</returns> public RegistryOwnersList GetGestioneList() { try { using (MySqlDataAdapter dbAdapter = new MySqlDataAdapter()) { dbAdapter.SelectCommand = new MySqlCommand(); dbAdapter.SelectCommand.Connection = new MySqlConnection(DAFconnection.GetConnectionType()); dbAdapter.SelectCommand.CommandType = CommandType.Text; dbAdapter.SelectCommand.CommandText = SQL.RegistryScripts.GetGestioneList; DataTable dataTable = new DataTable(); dbAdapter.Fill(dataTable); RegistryOwnersList ROL = new RegistryOwnersList(); foreach (DataRow dr in dataTable.Rows) { RegistryOwner RO = new RegistryOwner(); RO.Id_gestione = (int)dr.Field <uint>("id_gestione"); RO.Nome_Gestione = dr.Field <string>("nome_gestione"); RO.Tipologia = dr.Field <string>("tipologia"); ROL.Add(RO); } return(ROL); } } catch (MySqlException err) { throw new Exception("GetGestioneList " + err.Message); } catch (Exception err) { throw new Exception("GetGestioneList " + err.Message); } }
/// <summary> /// Aggiorna i dati di una persona /// </summary> /// <param name="owner">Il record da aggiornare</param> public void UpdateGestioneName(RegistryOwner owner) { try { using (MySqlCommand dbComm = new MySqlCommand()) { dbComm.Connection = new MySqlConnection(DAFconnection.GetConnectionType()); dbComm.CommandType = CommandType.Text; dbComm.CommandText = SQL.RegistryScripts.UpdateGestioneName; dbComm.Parameters.AddWithValue("nome", owner.Nome_Gestione); dbComm.Parameters.AddWithValue("tipologia", owner.Tipologia); dbComm.Parameters.AddWithValue("id", owner.Id_gestione); dbComm.Connection.Open(); dbComm.ExecuteNonQuery(); dbComm.Connection.Close(); } } 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; }