private void CargarEntidad(Guid tallerId) { if (tallerId == Guid.Empty) { _tallerMovil = new TalleresMovile(); _tallerMovil.Id = Guid.NewGuid(); SetDatePickers(null, null); return; } else { _tallerMovil = Uow.TalleresMoviles.Obtener(t => t.Id == tallerId, t => t.TalleresMotivosMoviles); //_tallerMovil = Uow.TalleresMoviles.Listado(t=>t.TalleresMotivosMoviles).Where(t => t.Id == tallerId).FirstOrDefault(); SetDatePickers(_tallerMovil.FechaDesde, null); DdlMovil.SelectedValue = _tallerMovil.MovilId; DdlTipo.SelectedValue = _tallerMovil.TallerId; this.Desde = _tallerMovil.FechaDesde; this.Hasta = _tallerMovil.FechaHasta; this.Observaciones = _tallerMovil.Observaciones; foreach (TalleresMotivosMovile row in _tallerMovil.TalleresMotivosMoviles) { for (int i = 0; i < ChkListBox.Items.Count; i++) { MotivosTallere motivoTaller = (MotivosTallere)ChkListBox.Items[i]; if (motivoTaller.Id == row.MotivoTallerId) { ChkListBox.SetItemChecked(i, true); } } } } }
private void BtnAgregar_Click(object sender, EventArgs e) { var esValido = this.ValidarForm(); if (!esValido) return; if (Motivo != "") { var tipoTaller =new MotivosTallere(); tipoTaller.Id = Guid.NewGuid(); tipoTaller.Motivo = Motivo; tipoTaller.Activo = true; // tipoTaller.OperadorAltaId = Context.OperadorActual.Id; //tipoTaller.SucursalAltaId = Context.SucursalActual.Id; //tipoTaller.FechaAlta = _clock.Now; Uow.MotivosTalleres.Agregar(tipoTaller); Uow.Commit(); RefrescarListado(); Motivo = ""; } }
private void DeleteMotivoTaller(MotivosTallere motivoTaller) { motivoTaller.Activo = false; //tipoTaller.FechaModificacion = _clock.Now; // tipoTaller.OperadorModificacionId = Context.OperadorActual.Id; //tipoTaller.SucursalModificacionId = Context.SucursalActual.Id; Uow.MotivosTalleres.Modificar(motivoTaller); Uow.Commit(); RefrescarListado(); }