public static bool Grabar(ContactoReclamo oContacto) { string sql = "ContactoReclamo_AM"; Database db = DatabaseFactory.CreateDatabase("DAT_V01"); DbCommand dbCommand = db.GetStoredProcCommand(sql); DbParameterCollection dbParametros = null; try { db.AddInParameter(dbCommand, "@cuil", DbType.String, oContacto.Cuil); db.AddInParameter(dbCommand, "@Telediscado", DbType.String, oContacto.Telediscado); db.AddInParameter(dbCommand, "@Telefono", DbType.String, oContacto.Telefono); db.AddInParameter(dbCommand, "@Celular", DbType.Boolean, oContacto.Celular); db.AddInParameter(dbCommand, "@Mail", DbType.String, oContacto.Mail); db.AddInParameter(dbCommand, "@Usuario", DbType.String, oContacto.UnaAuditoria.Usuario); db.AddInParameter(dbCommand, "@IP", DbType.String, oContacto.UnaAuditoria.IP); dbParametros = dbCommand.Parameters; db.ExecuteNonQuery(dbCommand); return(true); } catch (Exception ex) { log.Error(string.Format("{0}->{1}-> Error:{2}->{3}", DateTime.Now, System.Reflection.MethodBase.GetCurrentMethod(), ex.Source, ex.Message)); throw new Exception("Error en ContactoReclamoDAO.Grabar", ex); } finally { db = null; dbCommand.Dispose(); } }
public ResultadoUnico <string> ContactoGrabar(ContactoReclamo oContacto) { try { ResultadoUnico <string> oResultadoUnico = new ResultadoUnico <string>(); oResultadoUnico.DatoUnico = oContacto.ValidateRuleSetOutString(); //oResultado.DatoUnico = false; if (!string.IsNullOrEmpty(oResultadoUnico.DatoUnico)) { ContactoReclamoDAO.Grabar(oContacto); } return(oResultadoUnico); } catch (Exception err) { throw err; } }
public static ContactoReclamo Traer(string cuil) { string sql = "[ContactoReclamo_TxCuil]"; Database db = DatabaseFactory.CreateDatabase("DAT_V01"); DbCommand dbCommand = db.GetStoredProcCommand(sql); DbParameterCollection dbParametros = null; try { ContactoReclamo oContacto = new ContactoReclamo(); db.AddInParameter(dbCommand, "@cuil", DbType.String, cuil); dbParametros = dbCommand.Parameters; using (NullableDataReader ds = new NullableDataReader(db.ExecuteReader(dbCommand))) { while (ds.Read()) { Auditoria unAuditoria = new Auditoria(ds["Usuario"].ToString(), ds["Usuario"].ToString(), DateTime.Parse(ds["FecUltModificacion"].ToString())); oContacto.Cuil = ds["cuil"].ToString(); oContacto.Telediscado = ds["Telediscado"].ToString(); oContacto.Telefono = ds["Telefono"].ToString(); oContacto.Celular = bool.Parse(ds["Celular"].ToString()); oContacto.Mail = ds["Mail"].ToString(); } } return(oContacto); } catch (Exception ex) { log.Error(string.Format("{0}->{1}-> Error:{2}->{3}", DateTime.Now, System.Reflection.MethodBase.GetCurrentMethod(), ex.Source, ex.Message)); throw new Exception("Error en ContactoReclamoDAO.Traer", ex); } finally { db = null; dbCommand.Dispose(); } }