public Boolean AnularDB(ro_Asignacion_Implemento_x_Empleado_Info Info) { try { using (EntitiesRoles Conexion = new EntitiesRoles()) { ro_Asignacion_Implemento_x_Empleado Entity = Conexion.ro_Asignacion_Implemento_x_Empleado.SingleOrDefault(q => q.IdAsignacion_Impl == Info.IdAsignacion_Impl); Entity.Estado = "I"; Entity.IdUsuarioUltAnu = Info.IdUsuarioUltAnu; Entity.Fecha_UltAnu = Info.Fecha_UltAnu; Entity.MotivoAnulacion = Info.MotivoAnulacion; Conexion.SaveChanges(); } Data_det.EliminarDB(Info); return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); return(false); } }
private void gridViewAsignacion_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { Asignacion_Info = (ro_Asignacion_Implemento_x_Empleado_Info)gridViewAsignacion.GetFocusedRow(); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean AnularDB(ro_Asignacion_Implemento_x_Empleado_Info Info, ref string mensajeE) { try { return(Data.AnularDB(Info)); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "AnularDB", ex.Message), ex) { EntityType = typeof(ro_Asignacion_Implemento_x_Empleado_Bus) }; } }
private void Limpiar() { try { Asig_Imp_Info = new ro_Asignacion_Implemento_x_Empleado_Info(); this.Text = "Orden de servicio por activo fijo ***NUEVO REGISTRO***"; txtIdAsignación.Text = string.Empty; txtObservacion.Text = string.Empty; ucRo_Empleado1.InicializarEmpleado(); deFecha.EditValue = DateTime.Now; lista_detalle = new BindingList <ro_Asignacion_Implemento_x_Empleado_det_Info>(); gridControlAsignacion.DataSource = lista_detalle; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean EliminarDB(ro_Asignacion_Implemento_x_Empleado_Info info) { try { EntitiesRoles Conexion = new EntitiesRoles(); var Comando = Conexion.Database.ExecuteSqlCommand("delete from ro_Asignacion_Implemento_x_Empleado_det where IdEmpresa = " + info.IdEmpresa + " and IdAsignacion_Impl = " + info.IdAsignacion_Impl + ""); return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.InnerException.ToString()); } }
public Boolean ModificarDB(ro_Asignacion_Implemento_x_Empleado_Info Info) { try { using (EntitiesRoles Conexion = new EntitiesRoles()) { ro_Asignacion_Implemento_x_Empleado Entity = Conexion.ro_Asignacion_Implemento_x_Empleado.SingleOrDefault(q => q.IdAsignacion_Impl == Info.IdAsignacion_Impl); Entity.IdEmpresa = Info.IdEmpresa; Entity.IdAsignacion_Impl = Info.IdAsignacion_Impl; Entity.Fecha_Entrega = Info.Fecha_Entrega; Entity.IdEmpleado = Info.IdEmpleado; Entity.Observacion = Info.Observacion; Entity.Estado = Info.Estado; Entity.Tipo_Movimiento = Info.Tipo_Movimiento; Conexion.SaveChanges(); } Data_det.EliminarDB(Info); foreach (var item in Info.Lst_ro_Asignacion_Implemento_x_Empleado_det) { item.IdEmpresa = Info.IdEmpresa; item.IdAsignacion_Impl = Info.IdAsignacion_Impl; } Data_det.GuardarDB(Info.Lst_ro_Asignacion_Implemento_x_Empleado_det); return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); return(false); } }
public List <ro_Asignacion_Implemento_x_Empleado_Info> Get_ListAsignacion_Implemento_x_Empleado(int idEmpresa, DateTime FechaIni, DateTime FechaFin) { try { List <ro_Asignacion_Implemento_x_Empleado_Info> Lista = new List <ro_Asignacion_Implemento_x_Empleado_Info>(); using (EntitiesRoles Conexion = new EntitiesRoles()) { var query = (from q in Conexion.vwro_Asignacion_Implemento_x_Empleado where idEmpresa == q.IdEmpresa && FechaIni <= q.Fecha_Entrega && q.Fecha_Entrega <= FechaFin select q); foreach (var item in query) { ro_Asignacion_Implemento_x_Empleado_Info info = new ro_Asignacion_Implemento_x_Empleado_Info(); info.IdEmpleado = item.IdEmpresa; info.IdEmpleado = item.IdEmpleado; info.IdAsignacion_Impl = item.IdAsignacion_Impl; info.Fecha_Entrega = item.Fecha_Entrega; info.Observacion = item.Observacion; info.Fecha_Transac = item.Fecha_Transac; info.pe_nombreCompleto = item.pe_nombreCompleto; info.Tipo_Movimiento = item.Tipo_Movimiento; Lista.Add(info); } } return(Lista); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.InnerException.ToString()); } }
public Boolean ActualizarDB(ro_Asignacion_Implemento_x_Empleado_Info Info, ref string mensajeE) { try { if (Validar_Objeto(Info, ref mensajeE)) { res = Data.ModificarDB(Info); } else { res = false; } return(res); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "ActualizarDB", ex.Message), ex) { EntityType = typeof(ro_Asignacion_Implemento_x_Empleado_Bus) }; } }
private Boolean Validar_Objeto(ro_Asignacion_Implemento_x_Empleado_Info Info, ref string mensajeE) { try { res = true; if (Info.IdEmpleado == null || Info.IdEmpleado == 0) { mensajeE = "Seleccione un empleado "; res = false; } if (Info.Observacion == null || Info.Observacion == "") { mensajeE = "Ingrese una observación "; res = false; } if (Info.Fecha_Entrega == null) { mensajeE = "Seleccione la fecha "; res = false; } return(res); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Validar_Objeto", ex.Message), ex) { EntityType = typeof(ro_Asignacion_Implemento_x_Empleado_Bus) }; return(false); } }
public void Set_Info(ro_Asignacion_Implemento_x_Empleado_Info Info) { try { Asig_Imp_Info = Info; if (Info != null) { txtObservacion.Text = Info.Observacion; txtIdAsignación.Text = Info.IdAsignacion_Impl.ToString(); deFecha.EditValue = Info.Fecha_Entrega; ucRo_Empleado1.setEmpleado(Info.IdEmpleado); lista_detalle = new BindingList <ro_Asignacion_Implemento_x_Empleado_det_Info>(Asig_Imp_det_Bus.Get_Lista_Implemento_x_empleador_det(param.IdEmpresa, Info.IdAsignacion_Impl)); gridControlAsignacion.DataSource = lista_detalle; if (Info.Estado == "I") { lblAnulado.Visible = true; } if (Info.Tipo_Movimiento == "-") { rbt_Egreso.Checked = true; } else { rbt_ingreso.Checked = true; } } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }