public void Edit(BatchObservation batchObservation)
        {
            var currentbatchObservation = this.GetById(batchObservation.Id);

            currentbatchObservation.Content = batchObservation.Content;
            currentbatchObservation.ObservationDate = batchObservation.ObservationDate;

            Uow.BatchObservations.Edit(currentbatchObservation);
            Uow.Commit();
        }
 public void Create(BatchObservation batchObservation)
 {
     Uow.BatchObservations.Add(batchObservation);
     Uow.Commit();
 }
 public BatchObservation ToBatchObservation()
 {
     var batchObservation = new BatchObservation
     {
         Id = Guid.NewGuid(),
         CreatedDate = DateTime.Now,
         Content = this.Content,
         ObservationDate = this.ObservationDate.GetValueOrDefault(),
         BatchId = this.BatchId.GetValueOrDefault(),
         IsDeleted = false
     };
     return batchObservation;
 }
 public static CreateBatchObservationModel FromClient(BatchObservation batchObservation)
 {
     var form = Mapper.Map<BatchObservation, CreateBatchObservationModel>(batchObservation);
     return form;
 }
 private void OnBatchObservationCreated(BatchObservation batchObservation)
 {
     if (BatchObservationCreated != null)
     {
         BatchObservationCreated(this, batchObservation);
     }
 }
        private void FrmCreateBatchObservation_Load(object sender, EventArgs e)
        {
            var formTitle = "";

            using (var batchService = _serviceFactory.Create<IBatchService>())
            {
                _batch = batchService.GetById(_stateController.CurrentSelectedBatch.Id);
                SetWeekAndDay(_batch.DateOfBirth,DateTime.Now);
                dtpObservationDate.Value = DateTime.Now;
                formTitle = string.Format("Lote {0} - Crear Observación", _batch.Number.ToString());
            }

            if (_observationId != Guid.Empty)
            {
                using (var batchObservationService = _serviceFactory.Create<IBatchObservationService>())
                {
                    _batchObservation = batchObservationService.GetById(_observationId);
                    SetWeekAndDay(_batch.DateOfBirth, _batchObservation.ObservationDate);
                    txtObservation.Text = _batchObservation.Content;
                    dtpObservationDate.Value = _batchObservation.ObservationDate;
                    formTitle = string.Format("Lote {0} - Editar Observación", _batch.Number.ToString());
                }
            }

            this.Text = formTitle;
            txtDay.Enabled = false;
            txtWeek.Enabled = false;
        }