public List <man_tipo_horas_facturacion_Info> get_list(int IdEmpresa, bool mostrar_anuladas) { try { List <man_tipo_horas_facturacion_Info> Lista = new List <man_tipo_horas_facturacion_Info>(); using (EntitiesMantenimiento Context = new EntitiesMantenimiento()) { IQueryable <man_tipo_horas_facturacion> lst; if (mostrar_anuladas) { lst = from q in Context.man_tipo_horas_facturacion where q.IdEmpresa == IdEmpresa select q; } else { lst = from q in Context.man_tipo_horas_facturacion where q.IdEmpresa == IdEmpresa && q.estado == true select q; } foreach (var item in lst) { man_tipo_horas_facturacion_Info info = new man_tipo_horas_facturacion_Info(); info.IdEmpresa = item.IdEmpresa; info.IdTipo = item.IdTipo; info.IdProducto = item.IdProducto; info.ti_codigo = item.ti_codigo; info.ti_observacion = item.ti_observacion; info.estado = item.estado; Lista.Add(info); } } return(Lista); } catch (Exception ex) { string mensaje = ""; 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }
private void gridView_tipo_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { man_tipo_horas_facturacion_Info row = (man_tipo_horas_facturacion_Info)gridView_tipo.GetRow(e.RowHandle); if (row == null) { return; } if (e.Column == col_IdProducto) { row.estado = true; } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void gridView_tipo_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { man_tipo_horas_facturacion_Info row = (man_tipo_horas_facturacion_Info)gridView_tipo.GetRow(e.FocusedRowHandle); if (row == null) { col_IdProducto.OptionsColumn.AllowEdit = true; return; } if (row.IdTipo == 0) { col_IdProducto.OptionsColumn.AllowEdit = true; } else { col_IdProducto.OptionsColumn.AllowEdit = false; } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }