private static void actualizarDVH(int id, double nValor) { BOGrupos bo = new BOGrupos(); try { bo.UpdateBy("Verificacion", id, nValor); } catch (Exception ex) { throw ; } }
public static Boolean corregirIntegridad() { try { BOGrupos bo = new BOGrupos(); DataSet ds = bo.GetByN("Consistencia", ""); int y, j; if (ds.Tables[0].Rows.Count == 0) return true; // la tabla está vacía. Int32 nVerificacion = 0; Int32 nSuma = 0; string sCadena = ""; j = 0; foreach (DataRow dr in ds.Tables[0].Rows) { nVerificacion = 0; sCadena = ""; for (int i = 0; i <= ds.Tables[0].Columns.Count - 2; i++) { // Armo un string largo con todos los campos de la tabla. if (typeof(DateTime) == dr[i].GetType()) { sCadena = String.Concat(sCadena, Convert.ToDateTime(dr[i]).Ticks); } else { sCadena = String.Concat(sCadena, Convert.ToString(dr[i])); } } for (int i2 = 0; i2 <= sCadena.Length - 1; i2++) { // Obtengo el valor en int de cada caracter del string largo char sPos = Convert.ToChar(sCadena.Substring(i2, 1)); nVerificacion = nVerificacion + Convert.ToInt32(sPos); } bo.UpdateBy("Verificacion", dr[0], nVerificacion); y = Convert.ToInt32(ds.Tables[0].Rows[j]["Verificacion"]); nSuma = nSuma + nVerificacion; j = j + 1; } // Fin Recorro todas las filas de la tabla Int32 nIntVertical = BRDVVertical.consistenciaVertical("TransArte_Grupos"); if (!nIntVertical.Equals(nSuma)) { BRDVVertical.actualizarGrupos("TransArte_Grupos"); BRBitacora.registrarEvento("Rev. Consist. Vertical Tabla TransArte_Grupos:OK!", BeanException.Critico); } BRBitacora.registrarEvento("Rev. Consist. Horizontal Tabla TransArte_Grupos:OK!", BeanException.Critico); return true; } catch (Exception ex) { throw; } }
public static void modificarGrupo(int idGrupo, string descGrupo) { try { BOGrupos bo = new BOGrupos(); bo.UpdateBy("IdGrupo", idGrupo, descGrupo); Int32 nValor = calcularDVH(idGrupo); actualizarDVH(idGrupo, nValor); BRDVVertical.actualizarGrupos("TransArte_Grupos"); BRBitacora.registrarEvento("Grupo (ID): " + Convert.ToString(idGrupo) + " Modificado.", BeanException.Moderado); } catch (Exception ex) { throw ; } }