internal static BETipoDocumentoContable GetTipoDocumentoContableSerie(int idTipoDocumentoContableSerie) { try { BETipoDocumentoContable oTipoDoc = new BETipoDocumentoContable(); using (DataClassEpiNetDataContext db = new DataClassEpiNetDataContext()) { oTipoDoc = (from om in db.TBL_EPI_TIPODOCUMENTOCONTABLESERIES where om.EPI_BIT_ACTIVO == true && om.EPI_INT_IDTIPODOCUMENTOCONTABLESERIES == idTipoDocumentoContableSerie select new BETipoDocumentoContable { EPI_INT_IDTIPODOCUMENTOCONTABLESERIES = om.EPI_INT_IDTIPODOCUMENTOCONTABLESERIES, EPI_INT_IDTIPODOCUMENTOCONTABLE = om.EPI_INT_IDTIPODOCUMENTOCONTABLE ?? 0, EPI_VCH_SERIE = om.EPI_VCH_SERIE, EPI_INT_CORRELATIVO = (om.EPI_INT_CORRELATIVO ?? 0) + 1 }).FirstOrDefault(); } return(oTipoDoc); } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message.ToString() + " (COMUNICAR A SISTEMAS)", "ERROR"); return(null); } }
private void searchLookUpTipoDocumento_EditValueChanged(object sender, EventArgs e) { SearchLookUpEdit currentEditor = (sender as SearchLookUpEdit); int iCurrentIndex = currentEditor.Properties.GetIndexByKeyValue(currentEditor.EditValue); BETipoDocumentoContable findedRecord = (currentEditor.Properties.DataSource as BindingSource).List[iCurrentIndex] as BETipoDocumentoContable; int idTipoDocSerie = Convert.ToInt32(findedRecord.EPI_INT_IDTIPODOCUMENTOCONTABLESERIES); BETipoDocumentoContable oSerie = BLTipoDocumentoContable.GetTipoDocumentoContableSerie(idTipoDocSerie); if (oSerie != null) { txtSerie.Text = oSerie.EPI_VCH_SERIE; txtCorrelativo.Text = oSerie.EPI_INT_CORRELATIVO.ToString().PadLeft(7, '0'); } }