public async Task <IActionResult> Edit(string id, MotivoBaja motivoBaja) { try { if (!string.IsNullOrEmpty(id)) { var response = await apiServicio.EditarAsync(id, motivoBaja, new Uri(WebApp.BaseAddressRM), "api/MotivoBaja"); if (response.IsSuccess) { await GuardarLogService.SaveLogEntry(new LogEntryTranfer { ApplicationName = Convert.ToString(Aplicacion.WebAppRM), EntityID = string.Format("{0} : {1}", "Sistema", id), LogCategoryParametre = Convert.ToString(LogCategoryParameter.Edit), LogLevelShortName = Convert.ToString(LogLevelParameter.ADV), Message = "Se ha actualizado un registro sistema", UserName = "******" }); return(this.Redireccionar($"{Mensaje.Informacion}|{Mensaje.Satisfactorio}")); } ViewData["Error"] = response.Message; return(View(motivoBaja)); } return(this.Redireccionar($"{Mensaje.Error}|{Mensaje.RegistroNoExiste}")); } catch (Exception ex) { await GuardarLogService.SaveLogEntry(new LogEntryTranfer { ApplicationName = Convert.ToString(Aplicacion.WebAppRM), Message = "Editando un Motivo de Baja", ExceptionTrace = ex.Message, LogCategoryParametre = Convert.ToString(LogCategoryParameter.Edit), LogLevelShortName = Convert.ToString(LogLevelParameter.ERR), UserName = "******" }); return(this.Redireccionar($"{Mensaje.Error}|{Mensaje.ErrorEditar}")); } }
public List <MotivoBaja> LlenarComboMotivoBaja(MotivoBaja Datos) { try { Usuario_Datos UD = new Usuario_Datos(); return(UD.LlenarComboMotivoBaja(Datos)); } catch (Exception ex) { throw ex; } }
private void LlenarComboMotivoBaja() { try { MotivoBaja DatosAux = new MotivoBaja { Conexion = Comun.Conexion, IncluirSelect = true }; Usuario_Negocio UN = new Usuario_Negocio(); this.cmbMotivoBaja.DataSource = UN.LlenarComboMotivoBaja(DatosAux); this.cmbMotivoBaja.ValueMember = "IDMotivoBaja"; this.cmbMotivoBaja.DisplayMember = "Descripcion"; } catch (Exception ex) { throw ex; } }
private Usuario ObtenerDatos() { try { Usuario DatosAux = new Usuario(); MotivoBaja Baja = this.ObtenerMotivoSeleccionado(); DatosAux.IDEmpleado = this.Empleado.IDEmpleado; DatosAux.IDMotivoBaja = Baja.IDMotivoBaja; DatosAux.ComentariosBaja = this.txtComentarios.Text; DatosAux.Conexion = Comun.Conexion; DatosAux.IDUsuario = Comun.IDUsuario; return(DatosAux); } catch (Exception ex) { throw ex; } }
private MotivoBaja ObtenerMotivoSeleccionado() { try { MotivoBaja Motivo = new MotivoBaja(); if (this.cmbMotivoBaja.Items.Count > 0) { if (this.cmbMotivoBaja.SelectedIndex != -1) { Motivo = (MotivoBaja)this.cmbMotivoBaja.SelectedItem; } } return(Motivo); } catch (Exception ex) { throw ex; } }
private List <Error> ValidarDatos() { try { List <Error> Errores = new List <Error>(); int aux = 0; MotivoBaja AuxMB = this.ObtenerMotivoSeleccionado(); if (AuxMB.IDMotivoBaja == 0) { Errores.Add(new Error { Numero = (aux += 1), Descripcion = "Seleccione un motivo de baja.", ControlSender = this.cmbMotivoBaja }); } return(Errores); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Create(MotivoBaja motivoBaja) { try { var response = await apiServicio.InsertarAsync(motivoBaja, new Uri(WebApp.BaseAddressRM), "api/MotivoBaja/InsertarMotivoBaja"); if (response.IsSuccess) { await GuardarLogService.SaveLogEntry(new LogEntryTranfer { ApplicationName = Convert.ToString(Aplicacion.WebAppRM), ExceptionTrace = null, Message = "Se ha creado un Activo Fijo Motivo Baja", UserName = "******", LogCategoryParametre = Convert.ToString(LogCategoryParameter.Create), LogLevelShortName = Convert.ToString(LogLevelParameter.ADV), EntityID = string.Format("{0} {1}", "Motivo de Baja:", motivoBaja.IdMotivoBaja) }); return(this.Redireccionar($"{Mensaje.Informacion}|{Mensaje.Satisfactorio}")); } ViewData["Error"] = response.Message; return(View(motivoBaja)); } catch (Exception ex) { await GuardarLogService.SaveLogEntry(new LogEntryTranfer { ApplicationName = Convert.ToString(Aplicacion.WebAppRM), Message = "Creando Activo Fijo Motivo Baja", ExceptionTrace = ex.Message, LogCategoryParametre = Convert.ToString(LogCategoryParameter.Create), LogLevelShortName = Convert.ToString(LogLevelParameter.ERR), UserName = "******" }); return(this.Redireccionar($"{Mensaje.Error}|{Mensaje.ErrorCrear}")); } }
public List <MotivoBaja> LlenarComboMotivoBaja(MotivoBaja Datos) { try { List <MotivoBaja> Lista = new List <MotivoBaja>(); MotivoBaja Item; object[] Parametros = { Datos.IncluirSelect }; SqlDataReader Dr = SqlHelper.ExecuteReader(Datos.Conexion, "spCSLDB_get_ComboMotivosBaja", Parametros); while (Dr.Read()) { Item = new MotivoBaja(); Item.IDMotivoBaja = Dr.IsDBNull(Dr.GetOrdinal("IDMotivoBaja")) ? 0 : Dr.GetInt32(Dr.GetOrdinal("IDMotivoBaja")); Item.Descripcion = Dr.IsDBNull(Dr.GetOrdinal("Motivo")) ? string.Empty : Dr.GetString(Dr.GetOrdinal("Motivo")); Lista.Add(Item); } Dr.Close(); return(Lista); } catch (Exception ex) { throw ex; } }
public Boolean guardar(clsMotivoBaja motivobaja) { try { int id = getSiguiente(); motivobaja.idMotivoBaja = id; using (ActivoFijoEntities ent = new ActivoFijoEntities()) { MotivoBaja Sub = new MotivoBaja() { IdMotivoBaja = motivobaja.idMotivoBaja, Idestado = motivobaja.idEstado, descripcion = motivobaja.descripcion, }; ent.AddToMotivoBaja(Sub); ent.SaveChanges(); } return true; } catch (Exception) { return false; } }