private void cmbHabitant_SelectedIndexChanged(object sender, EventArgs e) { if (this.cmbHabitant.SelectedIndex > 0) { using (var waterIntake = new posb.WaterIntake { IdHabitant = this.cmbHabitant.GetVal <int>() }) { var waterIntakeList = waterIntake.List(); if (waterIntakeList.Count.Equals(0)) { waterIntakeList = waterIntake.List(3); } this.cmbWaterIntake.Fill(waterIntakeList); } } else { this.cmbWaterIntake.Fill(new List <posb.WaterIntake>()); } this.FillGridView(); }
private void Save() { using (var e = new posb.WaterIntake { Id = this.Id, IdHabitant = this.IdHabitant, IdStreet = this.cmbStreet.GetVal <int>(), IdRent = this.cmbHabitant.GetVal <int>(), ExteriorNumber = this.txtExteriorNumber.Text, InteriorNumber = this.txtInteriorNumber.Text, Colony = this.txtColony.Text, Active = this.cbActive.Checked, Total = decimal.Parse(this.txtTotal.Text), Principal = this.cbPrincipal.Checked, Type = this.cmbType.Text }) { e.Save(); if (e.Total > 0) { if (this.Confirm("¿Deseas imprimir el recibo?")) { this.PrintWaterIntake(e.Id.Value); } } this.Result(true, "Success!!"); this.Close(); } }
private void FillWaterIntake(int IdHabitant) { using (var waterIntake = new posb.WaterIntake { IdHabitant = IdHabitant }) { var waterIntakeList = waterIntake.List(4); if (waterIntakeList.Count.Equals(0)) { waterIntakeList = waterIntake.List(3); } this.cmbWaterIntake.Fill(waterIntakeList); if (this.cmbWaterIntake.Items.Count.Equals(2)) { this.cmbWaterIntake.SelectedIndex = 1; } if (this.idWaterIntake.HasValue) { this.cmbWaterIntake.SelectedValue = this.idWaterIntake; this.idWaterIntake = null; } } using (var habitant = new posb.Habitant { Id = this.cmbHabitant.GetVal <int>() }) { habitant.Get(); this.StartYear = habitant.Year; this.StartMonth = habitant.Month; this.FillYears(this.StartYear); this.FillYearsEnd(this.StartYear); } }
private void LoadData(int?Id) { using (var e = new posb.WaterIntake { Id = this.Id }) { e.Get(); if (e.IdRent.HasValue) { this.cmbHabitant.SelectedValue = e.IdRent; } this.cmbStreet.SelectedValue = e.IdStreet; this.txtExteriorNumber.Text = e.ExteriorNumber; this.txtInteriorNumber.Text = e.InteriorNumber; this.txtColony.Text = e.Colony; this.txtTotal.Text = String.Format("{0:0.00}", e.Total); this.cbActive.Checked = e.Active.Value; this.cbPrincipal.Checked = e.Principal.Value; this.cmbType.Text = e.Type; } }