private void updateDVh(IAudit model) { try { generateDVh(model); Type type = model.GetType(); string tableName = getTableName(type); AuditDvh dvh = findDV(tableName, model.id.ToString()); if (dvh == null) { dvh = new AuditDvh(tableName, model.id.ToString(), model.dv); db.DVHs.Add(dvh); } else { dvh.dv = model.dv; db.Entry(dvh).State = EntityState.Modified; } db.SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex); } }
private AuditDvh findDV(string tableName, string id) { try { AuditDvh result = db.DVHs.Where(x => x.tableName == tableName && x.id == id).FirstOrDefault(); return(result); } catch (Exception err) { } return(null); }
public bool validateDVv(string tableName, string dvv) { bool result = true; dvv = Cryptog.EncriptarMD5(dvv); AuditDvh currentDv = findDV(tableName, "DVV"); if (currentDv != null) { result = dvv == currentDv.dv; } else { result = false; } return(result); }
public bool validateDVh(IAudit model) { bool result = true; Type type = model.GetType(); string tableName = getTableName(type); model.dv = generateDVh(model); AuditDvh currentDv = findDV(tableName, model.id.ToString()); if (currentDv != null) { result = model.dv == currentDv.dv; } else { result = false; } return(result); }
private void updateDVv(string tableName, string dvv) { try { dvv = Cryptog.EncriptarMD5(dvv); AuditDvh dv = findDV(tableName, "DVV"); if (dv == null) { dv = new AuditDvh(tableName, "DVV", dvv); db.DVHs.Add(dv); } else { dv.dv = dvv; db.Entry(dv).State = EntityState.Modified; } db.SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex); } }