private void LoadData(int?Id) { using (var e = new posb.Habitant { Id = this.Id }) { e.Get(); this.txtName.Text = e.Nombre; this.txtLastName.Text = e.Paterno; this.txtMotherLastName.Text = e.Materno; this.txtObservations.Text = e.observations; this.cbActive.Checked = e.Active.Value; this.cmbYear.Text = e.Year.ToString(); this.cmbMonth.SelectedIndex = e.Month.Value; this.txtTotal.Text = String.Format("{0:0.00}", e.Total); } }
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); } }