public void Edit(BatchVaccine batchVaccine) { var currentbatchVaccine = this.GetById(batchVaccine.Id); currentbatchVaccine.VaccineId = batchVaccine.VaccineId; currentbatchVaccine.StartDate = batchVaccine.StartDate; currentbatchVaccine.EndDate = batchVaccine.EndDate; Uow.BatchVaccines.Edit(currentbatchVaccine); Uow.Commit(); }
public BatchVaccine ToBatchVaccine() { var batchVaccine = new BatchVaccine { Id = Guid.NewGuid(), CreatedDate = DateTime.Now, BatchId = this.BatchId.GetValueOrDefault(), VaccineId = this.VaccineId.GetValueOrDefault(), StartDate = this.StartDate, EndDate = this.EndDate.Value, IsDeleted = false }; return batchVaccine; }
public void Create(BatchVaccine batchVaccine) { Uow.BatchVaccines.Add(batchVaccine); Uow.Commit(); }
public static CreateBatchVaccineModel FromClient(BatchVaccine batchVaccine) { var form = Mapper.Map<BatchVaccine, CreateBatchVaccineModel>(batchVaccine); return form; }
private void OnBatchVaccineCreated(BatchVaccine batchVaccine) { if (BatchVaccineCreated != null) { BatchVaccineCreated(this, batchVaccine); } }
private void FrmCreateEditBatchVaccine_Load(object sender, EventArgs e) { var formTitle = ""; txtRecommendedDate.Visible = false; lblRecommendedDate.Visible = false; using (var batchService = _serviceFactory.Create<IBatchService>()) { _batch = batchService.GetById(_stateController.CurrentSelectedBatch.Id); dtpStartDate.Value = _batch.DateOfBirth; dtpEndDate.Value = _batch.DateOfBirth.AddDays(_batch.GeneticLine.ProductionWeeks * 7); txtRecommendedDate.Text = ""; formTitle = string.Format("Lote {0} - Crear Vacunación", _batch.Number.ToString()); } using (var vaccineService = _serviceFactory.Create<IVaccineService>()) { var vaccines = vaccineService.GetAllActive().OrderBy(x => x.Name).ToList(); ddlVaccines.ValueMember = "Id"; ddlVaccines.DisplayMember = "Name"; Vaccine item = new Vaccine(); item.Name = "Seleccione una vacuna.."; item.Id = Guid.Empty; vaccines.Insert(0,item); ddlVaccines.DataSource = vaccines; //ddlVaccines.Items.Add(item); } if (_batchVaccineId != Guid.Empty) { //Editar using (var batchVaccineService = _serviceFactory.Create<IBatchVaccineService>()) { _batchVaccine = batchVaccineService.GetById(_batchVaccineId); if (_batchVaccine.Vaccine.RecommendedDay.HasValue) { txtRecommendedDate.Text = _batch.DateOfBirth.AddDays(_batchVaccine.Vaccine.RecommendedDay.Value).ToString(); txtRecommendedDate.ReadOnly = true; } else { txtRecommendedDate.Visible = false; lblRecommendedDate.Visible = false; } dtpStartDate.Value = _batchVaccine.StartDate; if (_batchVaccine.EndDate != null) dtpEndDate.Value = _batchVaccine.EndDate.Value; ddlVaccines.SelectedValue = _batchVaccine.VaccineId; formTitle = string.Format("Lote {0} - Editar Vacunación", _batch.Number.ToString()); } } this.Text = formTitle; }