public void guardar() { try { CONT_NIVEL_CUENTA m = new CONT_NIVEL_CUENTA { ID = 0, NM_NIVEL = 0, ID_EMPRESA = _datasistema.empresa.ID, NM_CANT_CARACTERES = int.Parse(UINM_CANT_CARACTERES.EditValue.ToString()) }; if (UIID.Text == "") { _datasistema.ContextoContabilidad.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues); //Validar if (manejadorData.consultarPorIdEmpresa(_datasistema.empresa.ID).Count() == 0) { m.NM_NIVEL = 1; } else { m.NM_NIVEL = manejadorData.consultarMaxNivelPorIdEmpresa(_datasistema.empresa.ID) + 1; } m = manejadorData.insertar(m); } else { m.ID = int.Parse(UIID.Text); manejadorData.modificar(m); } consultar(); MetodosForm.seleccionarFila(uigridview, "ID", m.ID); } catch (Exception e) { MetodosForm.mensajeErrorDefault(e.Message, _datasistema); } }
public void nuevo() { if (UIID.Text == "") { return; } CONT_CUENTA Cuenta = manejadorData.consultarPorId(int.Parse(UIID.Text)); if (Cuenta.FLG_DETALLE == 'S') { MetodosForm.mensajeErrorDefault("La cuenta es de detalle", _datasistema); return; } CONT_NIVEL_CUENTA Nivel = manejadorNivel.consultarPorId(int.Parse(UIID_NIVEL.EditValue.ToString())); if (manejadorNivel.consultarPorNivel(_datasistema.empresa.ID, Nivel.NM_NIVEL.Value).Count() == 0) { MetodosForm.mensajeErrorDefault("No existe el siguiente nivel", _datasistema); return; } Nivel = manejadorNivel.consultarSiguienteNivel(Nivel.NM_NIVEL.Value); UIID.Text = ""; UICD_CUENTA.Text = null; UIDS_CUENTA.Text = ""; UICD_TIPO_SALDO.EditValue = null; UIFLG_DETALLE.Checked = true; UICD_CUENTA_PADRE.Text = Cuenta.CD_CUENTA; Cuentapadre = Cuenta; //variable temporal UIID_NIVEL.EditValue = Nivel.ID; //UIID_RUBRO.EditValue = null; }
public void eliminar() { try { CONT_NIVEL_CUENTA m = new CONT_NIVEL_CUENTA { ID = int.Parse(UIID.Text) }; manejadorData.eliminar(m); consultar(); } catch (Exception e) { MetodosForm.mensajeErrorDefault(e.Message, _datasistema); } }