public List<Tarifa> LoadTarifa() { try { using (MySqlConnection cn = new MySqlConnection((clsCon = new Connection(this.user)).Parameters())) { lisTrf = new List<Tarifa>(); cn.Open(); sql = "select * from asada.view_tarifas"; cmd = new MySqlCommand(sql, cn); reader = cmd.ExecuteReader(); while (reader.Read()) { trf = new Tarifa(); trf.Code = reader.GetString(0); trf.FixAmount = float.Parse(reader.GetString(1)); trf.MetAmount = float.Parse(reader.GetString(2)); trf.RateHidrant = float.Parse(reader.GetString(3)); trf.TypeAppString = reader.GetString(4); lisTrf.Add(trf); } reader.Close(); return lisTrf; } } catch (Exception) { throw; } }
private Prevista GetInfo() { prv = new Prevista(); trf = new Tarifa(); prv.Code = txtCode.Text.Trim(); prv.CodeRate = cbxRate.SelectedIndex.ToString(); prv.Sector = cbxSector.SelectedValue.ToString(); prv.Identification = cbxAbonado.SelectedValue.ToString(); int n = cbxRate.SelectedIndex; if (n == 0) { trf.TypeApplication = true; prv.IsActive = true; } else { trf.TypeApplication = false; prv.IsActive = false; } prv.Ubication = txtAddress.Text; return prv; }