public List <ro_Asignacion_Implemento_x_Empleado_det_Info> Get_Lista_Implemento_x_empleador_det(int idEmpresa, decimal IdAsignacion_Impl) { try { List <ro_Asignacion_Implemento_x_Empleado_det_Info> Lista = new List <ro_Asignacion_Implemento_x_Empleado_det_Info>(); using (EntitiesRoles Conexion = new EntitiesRoles()) { var query = (from q in Conexion.ro_Asignacion_Implemento_x_Empleado_det where q.IdEmpresa == idEmpresa && q.IdAsignacion_Impl == IdAsignacion_Impl select q); foreach (var item in query) { ro_Asignacion_Implemento_x_Empleado_det_Info info = new ro_Asignacion_Implemento_x_Empleado_det_Info(); info.IdEmpresa = item.IdEmpresa; info.IdAsignacion_Impl = item.IdAsignacion_Impl; info.IdProducto = item.IdProducto; info.Fecha_Caducidad = item.Fecha_Caducidad; info.Vida_Util = item.Vida_Util; info.Detalle = item.Detalle; info.Estado_implemnto = item.Estado_implemnto; info.Cantidad = item.Cantidad; 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()); } }
private void gridViewAsignacion_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { ro_Asignacion_Implemento_x_Empleado_det_Info row = new ro_Asignacion_Implemento_x_Empleado_det_Info(); row = (ro_Asignacion_Implemento_x_Empleado_det_Info)gridViewAsignacion.GetFocusedRow(); int cont = 0; if (row != null) { if (row.IdProducto != 0) { cont = lista_detalle.Where(q => q.IdProducto == row.IdProducto).Count(); } } if (cont > 1) { item = lista_detalle.FirstOrDefault(q => q.IdProducto == row.IdProducto); MessageBox.Show("El implemento : " + item.IdProducto + " ya se encuentra en el Detalle. Se procederá a Eliminar", "Sistemas"); gridViewAsignacion.DeleteSelectedRows(); } if (e.Column.Name == "colVida_Util") { int Dias = row.Vida_Util; DateTime fecha_ = Convert.ToDateTime(deFecha.EditValue); fecha_ = fecha_.AddDays(Dias); gridViewAsignacion.SetFocusedRowCellValue(Col_fecha_fin_vida_util, fecha_); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }